Difference between revisions of "M2M Bridge"

From AMTech WikiDocs
Jump to: navigation, search
(Implementation notes)
(Edge Configuration)
Line 26: Line 26:
 
             "tenant" : "xxxxxxx",   
 
             "tenant" : "xxxxxxx",   
 
             <span style="color:red">//m2mBridge userId password</span>   
 
             <span style="color:red">//m2mBridge userId password</span>   
             "password" :"xxxxxxxx",
+
             "password" :"xxxxxxxx"
            <span style="color:red">//topic to get crud (observationresourcecrud) and command observations</span> (See [[Sensor's network#Crud observation|CRUD observations]] [[Activities#Send command|Send command]] )
+
            "crudCommandUrl" :"/xx/xx/"
+
        },
+
        <span style="color:red">//access control information add to send observations</span>
+
        "guestSecurity":{
+
            <span style="color:red">//add guest tenants to observations send from bridge</span>
+
            "guesttenants":["progressnext2016"],   
+
            <span style="color:red">//add guest users to observations send from bridge</span>
+
            "guestusers":[]      
+
        },
+
        <span style="color:red">//network failed configuration</span>
+
        "networkFailed" :{
+
            <span style="color:red">//re-connection delay after an instance of plug in failed </span>
+
            "reconnectWait" : 60000      
+
        },
+
        <span style="color:red">//bridge startup configuration</span>
+
        "pluginLoad" :{        
+
            <span style="color:red">//send observations error when errors occurred at bridge layer</span>
+
            "sendM2mBridgeError" : true
+
        },
+
        <span style="color:red">//network failed configuration</span>
+
        "logger" :{
+
            <span style="color:red">//network failed configuration</span>
+
            "colorize" : true, //colorize log console messages
+
            <span style="color:red">//network failed configuration</span>
+
            "level": "debug" //log level
+
 
         },
 
         },
 +
        <span style="color:red">//Id to uniquely identify a M2MBridge instance, in absence of this property a unique identifier gets created</span>
 +
        "bridgeId":"m2mBridgeProgressNext",     
 +
        <span style="color:red">//wkt location to set m2mBridge location</span>
 +
        "location": "{\"wkt\":\"POINT(-99.17125583 19.40501031)\",\"sContext\":\"geo\"}",     
 
         <span style="color:red">//Address use to geo locate m2mBridge instance</span>
 
         <span style="color:red">//Address use to geo locate m2mBridge instance</span>
 
         "address" :{  
 
         "address" :{  
Line 61: Line 39:
 
             "number":"3960"
 
             "number":"3960"
 
         },
 
         },
        <span style="color:red">//Id to uniquely identify a M2MBridge instance, in absence of this property a unique identifier gets created</span>
 
        "bridgeId":"m2mBridgeProgressNext",     
 
        <span style="color:red">//auto discover configuration</span>
 
        "autoDiscover":{
 
            <span style="color:red">//create things type instances at startup time</span>
 
            "execute" : false,                       
 
            <span style="color:red">//Jsonld instances of the thing to be created </span>
 
            "instances":{
 
            <span style="color:red">//SNMPDeveice jsonld instance</span>
 
          "SNMPDevice":[
 
                {
 
                    "setOIDs": "[{\"oid\":\".1.3.6.1.2.1.1.6.0\", \"type\":\"OctetString\", \"value\":\"Irvine California\"}]",
 
                    "_lastmodified": 1450988442414,
 
                    "guestusers": [],
 
                    "@type": "/amtech/linkeddata/types/composite/entity/SNMPDevice",
 
                    "_resourcestatus": "valid",
 
                    "_name": "snmpClientM2mBridge",
 
                    "getOIDs": "[{\"name\":\"memoryTotal\", \"oid\":\".1.3.6.1.4.1.2021.4.5.0\"},  {\"name\":\"memoryAvailable\", \"oid\":\".1.3.6.1.4.1.2021.4.6.0\"}]",
 
                    "ipaddress": "localhost",
 
                    "communityString": "private",
 
                    "emaillist": "",
 
                    "instanceobservationconfig": "{}",
 
                    "creationDate": "2015-12-24T20:20:42.407Z",
 
                    "readFrequency": "PT10M",
 
                    "guesttenants": [
 
                        "follower_m2mcreator@@amtech.mx"
 
                    ],
 
                    "description": "An SNMPDevice instance acting as SNMP manager/client proxying snmp commands (get/set/trups) to manager a ubuntu box hosting m2mbridge",
 
                    "phonelist": "",
 
                    "@id": "/amtech/things/entities/snmpClientM2mBridge",
 
                    "snmpVersion": "2c",
 
                    "_user": "m2mcreator@amtech.mx"
 
                }
 
            ], …
 
        }
 
 
     }
 
     }
  

Revision as of 19:46, 7 April 2016

Functionality

  • Configurable edge intelligence
  • Bridges standard and proprietary protocols to AMTech IoT DAP.
  • Device-to-device or device-to-cloud communications.
    • MQTT, LLRP, CoAP, STOMP, SmartM2M, LWM2M, PLC, Zigbee and others
  • Allow remote and centralized control of IoT devices and gateways.
    • SNMP/MIB/TRAP, Reader Management and other
  • Configurable auto-discover
  • Implements common functionality and orchestrates the execution of the protocols
  • Network failure detection and recovery
  • Get centralized configuration information at startup and real time modifications
  • Access control policies to manage observation production and consumption

Example.jpg

Edge Configuration

  • Edge/Device(s) site configuration bridgeConfig.json
   {
   //text to label bridge instance
   "description": "AMTech M2M Bridge", 
       "dap":{
           //amtech IoT DAP ur
           "dapUrl": "https://dap.amtech.mx",     
           //userid for the m2mBridge instance 
           "userId": "xxxxxxx@amtech.mx",
           // tenant where bridge been configured       
           "tenant" : "xxxxxxx",  
           //m2mBridge userId password  
           "password" :"xxxxxxxx"
       },
        //Id to uniquely identify a M2MBridge instance, in absence of this property a unique identifier gets created
       "bridgeId":"m2mBridgeProgressNext",       
        //wkt location to set m2mBridge location
       "location": "{\"wkt\":\"POINT(-99.17125583 19.40501031)\",\"sContext\":\"geo\"}",       
       //Address use to geo locate m2mBridge instance
       "address" :{				 
           "country" : "usa",
           "city": "Las Vegas",
           "road": "Las Vegas Boulevard South",
           "number":"3960"
       },
   }

Cloud Configuration

  • Create an amtechM2mBridge thing type instace (See "/amtech/linkeddata/types/composite/entity/amtechM2mBridge")
  • Create an actor with the polices required by the activity(s) (See Actors)
    • Add the things type polices the bridge needs access to
    • Police must have user check; enabling instance access control by m2mBridge instance
    • Include in the polices the thing types the bridge instantiates
  • Register a follower (See Roles)
    • Assign to follower actor "m2mBridge" access
    • Uniquely identify each m2mBridge
  • Activity observation configuration (See Observation production configuration)
//topic to get crud and command observations                             
"dap":{
       "crudCommandUrl" :"/xx/xx/"			
   }
  • Things instance creation
  • Monitoring M2MBridge status
    • Create an SNMPDevice instance given access to the M2MBridge user (See "/amtech/linkeddata/types/composite/entity/SNMPDevice")
      • Create a reasoner to monitor disk, cpu and memory usage as needed by IoT solution

Implementation notes

  • M2MBridge is an open source nodes stack developed by the AMTEch team; it discovers, loads nodes modules implementing "M2MBridge plugin interface" and creates thing types instances (See Thing types) tacking into account the observation production configuration (See Observation production configuration) and M2MBridge credentials (See Actors and Edge Configuration).
    • It leverages AMTech IoT DAP (See Integration Guideline)
      • Gets observation production configuration (See Observation production configuration API)
      • Gets thing types instances (See Observation instances API)
      • Creates a web socket to receive asynchronous commands and thing instances changes (crud operations) (See CRUD and Commands API)
        • Dispatch command observations to plugin instance leveraging thing type instance @id (See Thing types)
        • Restart instance when supported properties change by calling stop and star plugin interface
      • Creates configuration information for Thing type leveraging configuration information and client side M2MBridge placeholders (See Observation production configuration and Placeholders)
      • Load plugin nodes modules required by configuration
      • Creates an instance of plugin for each type from observation production configuration leveraging thing type instance @id (See Thing types)
        • JavaScript object is extended with the properties values from the thing instance (See plugin example )
        • Properties and methods are injected like common logg for m2mBridge plugins, methods to send observations with and without transformation, methods for restarting, observation production configuration and others (See for details)
        • If instance does not exist at the server side execute auto discover process from bridgeConfig.json can be configured (See Edge Configuration)
      • Creates a centralized observation dispatcher with persistence to ensure:
        • Observations delivery.
        • The order that observations occurred .

How to implement a new plugin

   function SNMPDevice() {
   }
   SNMPDevice.prototype.start = function ( complete) {
       try {
           complete(null);
       } catch (e) {
           complete(e);
       }
   };
   SNMPDevice.prototype.stop = function (complete) {
       try {
           complete(null);
       } catch (e) {
           complete(e);
       }
   };
   SNMPDevice.prototype.command = function (observation, complete) {
       try {
           complete(null);
       } catch (e) {
           complete(e);
       }
   };
   module.exports.SNMPDevice = SNMPDevice;

How to install it

Existing plugins

LLRPReader

BLEPeripheralsScanner

BLEbeaconsScanner

SNMPDevice

MQTTBroker

COAP