User Tools

Site Tools


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

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:

  1. Create a Grails service implementing the DomainInteractor trait that will provide the following CRUD methods:
    • getDomainInstance()
    • getDomainInstanceBulk()
    • newDomainInstance()
    • newDomainInstanceBulk()
    • updateDomainInstance()
    • updateDomainInstanceBulk()
    • deleteDomainInstance()
    • deleteDomainInstanceBulk()
  2. 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”]
  3. Create a Grails controller extending the SecureController
  4. 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:

var data = JSON.stringify({
    'serviceAction' : 'updateDomainInstanceBulk',
    'serviceDomain' : 'ResponsibilityType',
    'serviceEntries' : [
        {'id' : 30, 'name' : 'I was updated'},
        {'id' : 27, 'name' : 'I was updated too'}
    ]
});

JSON-Response Example - Update CRUD:

{
   "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
}

Diagrams:






development/snmp/rapid.txt · Last modified: 2021/06/25 10:09 (external edit)