User Tools

Site Tools


Writing /app/www/public/data/meta/development/snmp/rapid.meta failed
development:snmp:rapid

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
development:snmp:rapid [2018/10/19 16:27] ashevyakovdevelopment:snmp:rapid [2021/06/25 10:09] (current) – created - external edit 127.0.0.1
Line 1: Line 1:
 +====== Rapid Public Service Deployment ======
  
 +Author: Andrey Shevyakov
 +
 +Description:
 +A quick guide on how to implement an **SnmpManager** Grails service with which a client GUI can interact (regardless of the selected GUI framework). 
 +
 +Steps:
 +  - Create a Grails service implementing the **DomainInteractor** trait that will provide the following CRUD methods:
 +    * **getDomainInstance()**
 +    * **getDomainInstanceBulk()**
 +    * **newDomainInstance()**
 +    * **newDomainInstanceBulk()**
 +    * **updateDomainInstance()**
 +    * **updateDomainInstanceBulk()**
 +    * **deleteDomainInstance()**
 +    * **deleteDomainInstanceBulk()**
 +  - In the service constructor, specify the following parameters (**DomainInteraction** trait):
 +    * **domainRefParam** - key referring to the domain name (same as **Class.simpleName**) in the received map (params) - example: "domainName"
 +    * **domainEntriesRefParam** - key referring to the entries collection in the received map (params) - example: "entriesToProcess"
 +    * **domainIdRefParam** - key referring to the ID of a single domain entry to be affected in the received map (params) - example: "idToProcess"
 +    * **domainIdsRefParam** - key referring to the IDs of the domain entries to be affected in the received map (params) - example: "idsToProcess"
 +    * **allowedDomains** - names of the domains that are allowed for processing by the service - example: ["Carrier", "DasHub"]
 +  - Create a Grails controller extending the **SecureController**
 +  - In the controller, implement a service accepting the client-sent JSON payload (**must** contain the keys specified in the **Step 2** for the valid CRUD processing) and calling the relevant service method and returning the processing results to the client in the JSON format.
 +
 +JSON-Request Example - Update CRUD:
 +<code>
 +var data = JSON.stringify({
 +    'serviceAction' : 'updateDomainInstanceBulk',
 +    'serviceDomain' : 'ResponsibilityType',
 +    'serviceEntries' : [
 +        {'id' : 30, 'name' : 'I was updated'},
 +        {'id' : 27, 'name' : 'I was updated too'}
 +    ]
 +});
 +</code>
 +
 +JSON-Response Example - Update CRUD:
 +<code>
 +{
 +   "results": [
 +      {
 +         "id": 20,
 +         "ResponsibilityType": {
 +            "id": 20,
 +            "name": "I was updated",
 +            "class": "com.errigal.snmpmanager.knowledge.ResponsibilityType"
 +         },
 +         "success": true
 +      },
 +      {
 +         "id": 22,
 +         "ResponsibilityType": {
 +            "id": 22,
 +            "name": "I was updated too",
 +            "class": "com.errigal.snmpmanager.knowledge.ResponsibilityType"
 +         },
 +         "success": true
 +      }
 +   ],
 +   "success": true
 +}
 +</code>
 +
 +Diagrams:
 +
 +{{:development:snmp:domain_interactor_data_flow.png?1200|}}
 +\\
 +\\
 +\\
 +\\
 +\\
 +{{:development:snmp:domain_helper_data_flow.png?1200|}}