Skip to content

IoT Devices

patrikSohlman edited this page Nov 4, 2020 · 40 revisions

Table of Contents

Dell Edge Gateway 3000 Series

Intro

The first thing you need to do is to install the snap image with microServiceBus.node preconfigured.

Installation Guide

First you need to make sure that your computer allows network sharing, under properties of your network. Add the connection to the gateway. Then log in to the gateway using:

ssh admin@[Device IP Address] # Default password 'admin' How to do initial setup from base image Ubuntu Core:

  1. Enable GSM network (if applicable)

    Enable the GSM network for 3G/4G use with the following commands: (Change apn "m2m.tele2.com" to appropiate carrier settings)

    # Enable GSM network:
    nmcli con add type gsm ifname cdc-wdm0 con-name GSMMSB apn m2m.tele2.com
    nmcli con up GSMMSB
    
    # Check status by running:
    network-manager.nmcli -s con show GSMMSB
    
  2. Install snap image

    Now you are ready to install the microServiceBus snap. Run the following: Append the '--beta ' before "install" below if you're running a non-production site and want some early updates of microservicebus-node module)

    snap install microservicebus-node --devmode; 
    snap connect microservicebus-node:modem-manager modem-manager:service; 
    snap connect microservicebus-node:network-observe :network-observe; 
    snap connect microservicebus-node:serial-port caracalla:ttys4; 
    snap connect microservicebus-node:serial-port caracalla:ttys5; 
    snap connect microservicebus-node:serial-port caracalla:ttyxrusb0; 
    snap connect microservicebus-node:serial-port caracalla:ttyxrusb1; 
    snap connect microservicebus-node:gpio caracalla:gpa-sku-gpio0; 
    snap connect microservicebus-node:gpio caracalla:gpa-sku-gpio1; 
    snap connect microservicebus-node:gpio caracalla:gpa-sku-gpio2; 
    snap connect microservicebus-node:gpio caracalla:gpa-sku-gpio3; 
    snap connect microservicebus-node:gpio caracalla:gpa-sku-gpio4; 
    snap connect microservicebus-node:gpio caracalla:gpa-sku-gpio5; 
    snap connect microservicebus-node:gpio caracalla:gpa-sku-gpio6; 
    snap connect microservicebus-node:gpio caracalla:gpa-sku-gpio7; 
    snap connect microservicebus-node:socket-plug microservicebus-dam:socket-slot

Optional docker plug:

snap connect microservicebus-node:docker docker:docker-daemon
  1. Check snap status

    Now you can run following command to check the status of the microServiceBus service:

    systemctl status -l snap.microservicebus-node.microservicebus-node

    or, to tail the latest logs:

    sudo journalctl -u snap.microservicebus-node.microservicebus-node -n100 -f
  2. Manual sign-in (only applicable in rare cases)

    If no automatic sign-in is being done via IMEI you can manually enroll the device in an organisation by providing a code.

    sudo -n microservicebus-node.init -c CODEHERE -n NODENAME -env customer1.microservicebus.com 
    # where -env is only needed if private/self hosting is being used

    After successful init/login and snap microservicebus-node needs to be restarted.

    snap restart microservicebus-node

    Watch for the output:

    mSB: Successfully created node: NODENAME
    mSB: Signing in...
    mSB: Sign in complete...
    

    to determine when the node is done initializing.

    Now we can safetly exit from the mSB node by pressing CTRL+C once. And let application close down (sometimes you may need to press 'Enter' to see original *nix prompt.

    And we're now all set to start the service again.

    # Restart the snap
    snap restart microservicebus-node
    
  1. Change admin password

    Change the admin password on the node to something secure. At least 10 characters with upper and lower case letters and special symbols. Change the password on the node with:

    passwd

    Then add the password under node preferences on the node page on microservicebus.com. (note that only the owner of the orginacatizion on microservicebus.com can save the password)

  2. Synchronize time

    snap install ntpcontrol --edge
    snap connect ntpcontrol:timeserver-control
    sudo reboot
    

    The default max time between sync occations is 2048 seconds (~ approx 30 minutes).

  3. Check serial ports (both 1 and 2) settings and adapt to the desired setting

    Check setting
    sudo dcc.cctk --serial1
    
    Change setting to 232 or 485
    sudo dcc.cctk --serial1=rs485
    sudo dcc.cctk --serial1=rs232
    
  4. Disable USB ports (DELL) (Optional)

    sudo dcc.cctk --usbport00=disable
    sudo dcc.cctk --usbport01=disable
    

    You can check the USB status using

    sudo dcc.cctk --usbport01
    

    If the USB ports are disabled, also you will not be able to boot from them.

    $sudo dcc.cctk bootorder
    
  5. Install microserviecbus-dam

    The DAM service is used to dynamically control user access to gateways. In short it polls device access information from mSB Device API (/api/nodes/{id}/access) and creates/removes user accounts on the device. These individual user/admin accounts are being used mainly by SSH.

    For more information about msb-dam

    snap install microservicebus-dam --beta --devmode; snap connect microservicebus-dam:account-control; snap connect microservicebus-dam:hardware-observe

Installing and using developer tools

Ubuntu Core provides a read-only file system; that doesn't let you install deb packages. Installing the "classic" snap creates a classic Ubuntu environment for you to use on the device.

snap install classic --edge --devmode

Ubuntu Core commands

Useful commands to use in Ubuntu Core, for more efficient debuging:

# Start new snap shell
sudo su - 

sudo snap run --shell microservicebus-node

# Start tail of syslog with specific search criteria
# Change last word (mSB:) to whatever suits you
sudo tail -f /var/log/syslog | grep --line-buffered mSB:
# or
sudo journalctl -u snap.microservicebus-node.microservicebus-node -n100 -f

# List everything related to mSB between time slots:
sudo journalctl --since "2018-01-28 01:00" --until "2018-01-28 01:59" -u snap.microservicebus-node.microservicebus-node --no-pager >/home/admin/journal.log

# List everything form the log related to a PID:
sudo grep '\[PID\]' /var/log/syslog*

#Change the serial port protocol to rs485
sudo dcc.cctk --serial1=rs485

#Add a static ip connection
nmcli con add type ethernet con-name ethernet ifname eth0 ip4 10.0.0.3/24

# List information about the device, ex. how to get the IMEI number
sudo mmcli -m 0

# Sniff serial port data
## Connect the TX port (pin 3 on Dell) on the RS port to the RX on the other serial port (pin 2), and run the following command:
od -x < [Secondary RS port]