A generic SNMP device service. Included is a sample for a network switch device driver. Additionally, a Patlite profile is included in the profiles director.
This device service facilitates via the configuration, accessing the TrendNet TEG-082WS 10 port switch.
You can send and receive event readings from the network switch. Currently this device service is tailored specifically to the TrendNET TEG-082WS switch but refactoring could take place to abstract the device type and provde a myrida of device profiles. You would need to interrogate the network switch and then determine the appropriate device profile. This particular device service uses the SNMP (Simple Network Management Protocol).
SNMP communication with the switch permits the device service to create events based on the Network Switch data. For further information on the Simple Network Management Protocol SNMP Wiki
Currently, the NATS Messaging capability (NATS MessageBus) is opt-in at build time. This means that the published Docker image and Snaps do not include the NATS messaging capability.
The following make commands will build the local binary or local Docker image with NATS messaging capability included.
make build-nats
make docker-nats
The locally built Docker image can then be used in place of the published Docker image in your compose file.
See Compose Builder nat-bus
option to generate compose file for NATS and local dev images.
Async callbacks not supported SNMP Traps are currently not implemented but will be completed at a future date. Network Switch Type abstraction
This component is packaged as docker image and snap.
For docker, please refer to the Dockerfile and Docker Compose Builder scripts.
For the snap, refer to the snap directory.
device-snmp-go requires Go language. Download the current release if you don't have it already.
Have access to the EdgeX Foundry
project github site.
This service requires the EdgeX-Go platform and several of its services to be up and running if you want to test the device service full integration. However, you can run this service as a standalone with the following minium services up and running either a) natively (.exe) or b) as Docker image containers.
Detailed instructions on how to use the various Edgex-Foundry service(s) are linked below.
Service | README |
---|---|
core-data | core/core-data/README.md |
core-command | core/core-command/README.md |
core-metadata | core/core-metadata/README.md |
If you choose to run the required services or all services as Docker containers you will need to use the Delhi version 0.7.1 of the Edgex-Go Services.
Download from GitHub the EdgeXFoundry developer-scripts
project. I download all of my EdgeX Foundry repositories into a parent 'edgexfoundry' directory. The following docker commands assume you have that parent directory in place.
To download the required Delhi versions of the Edgex-Go services perform the following from the console.
cd .../edgexfoundry/developer-scripts/compose-files/
docker-compose up -d
Now to stop all of the services you and do the following:
cd .../edgexfoundry/developer-scripts/compose-files/
docker-compose down
Now to stop all of the services and remove the docker volumes do the following:
cd .../edgexfoundry/developer-scripts/compose-files/
docker-compose down -v
You would want to remove the docker image volumes for anything you persisted. The volumes contain all the data you have published to your edgex-go-mongo as an example.
As a general practice I routinely remove my docker volumes. For more information on docker commands see ref Docker Commands
Note: docker-compose.yml is going to be the latest release version of the edgex-foundry project.
For future versions please use the docker-compose-delhi-0.7.1.yml file
For device service get calls we will use our configured static IP address for our network card. You can find this by executing the following: osx. Note you will need to ensure you select your working machine's ethernet static and not any other devices you have on your local network. I have included the SNMP MIB table OID entry(s) so you can see what OID's the device service is using.
arp -a
cheese.attlocal.net (192.168.1.69) [ethernet] ...
...
This is the IP address you will substitute for localhost in the following commands.
Verify the deployment by navigating to your server address in your preferred browser or Postman
REST test harness.
Or you can use the curl command from your console if your on linux or OSX. If you choose to use Postman just use the address less the curl command.
$ curl http://localhost:59993/api/v2/ping
The current state of the Network Switch reboot
$ curl http://localhost:59993/api/v2/trendnet01/Reboot
The switch uptime since last reboot in TimeTicks
$ curl http://localhost:59993/api/v2/trendnet01/Uptime
The switch firmware version
$ curl http://localhost:59993/api/v2/trendnet01/Firmware
The switch MAC Address
$ curl http://localhost:59993/api/v2/trendnet01/MacAddress
The switch IPV4 Address
$ curl http://localhost:59993/api/v2/trendnet01/IPV4Address
The switch Subnet Mask
$ curl http://localhost:59993/api/v2/trendnet01/IPV4SubnetMask
The switch IPV4 Gateway Address
$ curl http://localhost:59993/api/v2/trendnet01/IPV4GatewayAddress
For the set commands we presently just have one. I have included the SNMP MIB OID table entry(s) so you can see what OID's the device service is using.
Restarts the switch
Parameter | Value | Description |
---|---|---|
RebootControlState | 1 | Restarts the switch |
RebootControlState | 2 | Factory reset and restarts switch |
RebootControlState | 3 | Factory reset, restarts switch with no IP Address |
$ curl -H 'Content-Type: application/json' -X PUT -d '{"RebootControlState":"1"}' http://localhost:59993/api/v2/Reboot
This service is driven by a configuration.yaml
YAML-based file that resides
in the directory the application is executed from. See cmd/res/configuration.yaml for default configuration.
Website: Dillinger.io "A great README.md file editor"