mPlane nodeJS implementation
npm install mplane
#Usage example In this example we set a capability for a probe.
var mplane = require'mplane';var MY_IP="192.168.0.1";// Initialize available primitives from a registry// Can be any valid URL or local filemplaneElementinitialize_registry"ict-mplane.eu/registry/demo";// Create a new Capability objectvar probeCapability = ;// Set time constraintsprobeCapabilityset_when"now ... future / 1s";// Add parameters with constraintsprobeCapabilityadd_parametertype:"destination.ip4"constraints: "192.168.0.0/16"add_parametertype:"source.ip4"constraints:MY_IP;// ResultsprobeCapabilityadd_result_column"delay.twoway";// Some metadataprobeCapabilityset_metadata_value"System_type""Just a TEST"set_metadata_value"System_version""0.1a"set_metadata_value"System_ID""Pinger"update_token;// A label to identify the capabilityprobeCapabilityset_label"This_is_a_pinger";
#Interaction with the RI The mPlane Reference Implementation, written in python, can be find here. In order to correctly interact with any component using the RI messages formats, two method have been exposed in the library, to decode messages generated by the RI and to send messages to a RI component.
##from_dict This is a global method exposed in the mplane library. It sould be used to import any raw message received from an mPlane RI component. It will generate an mplane object of the type contained in the message. In the following example the data received as a body of an HTTP communication is imported in an mPlane object.
var result = mplanefrom_dictbody;
This method, defined for any mPlane information element, should be used before sending data to a RI component. The following example, shows how the pinger capability defined in the above probe example be transformed in a standard mPlane message.
/* serialize the capability in an mPlane RI message*/var RIprobeCapability = probeCapabilityto_dict;/* Shows the serialized capability*/console.logRIprobeCapability;
This is the output of the above example
The base mPlane library implements the mPlane Information Model elements that can be used to build messages to be carried on top of any protocol of choice (SSH, HTTP,...). A nodejs HTTPS API has been implemented for basic usage (create and read elements) and can be find here.
A reasoner written for DEMO purpouses is available here
A probe implementing ping, traceroute and HTTP download delay is available here
#Documentation Please refer to the API reference mPlane nodejs API
You can find release notes here
#LICENSE This software is released under the BSD license.