Octopus Simulator

October 21, 2020 · View on GitHub

Build Status

Octopus simulator consists of the simulators for testing Octopus adaptor.

Quick-start

To bring up all Octopus simulator, please apply the installer YAML file under deploy/e2e.

$ kubectl apply -f https://raw.githubusercontent.com/cnrancher/octopus-simulator/master/deploy/e2e/all_in_one.yaml

Simulators

Bluetooth Simulator

Bluetooth simulator is mocking a heart rate sensor, there are three GATT Services in this simulated peripheral:

The endianness of all property is LittleEndian.

  • Device Information Service, UUID 00010000-0001-1000-8000-00805F9B34FB.

    CharacteristicTypePropertyUUIDValue
    System IDstringread2A234EBA552F
    Model Numberstringread2A24Rancher Octopus Bluetooth Device 0.0.1
    Serial Numberstringread2A25CB4040E1234567
    Firmware Revisionstringread2A260.8.0
    Hardware Revisionreadstring2A270.5.7
    Software Revisionreadstring2A280.1.0
    Manufacturer Namereadstring2A29Rancher Octopus Fake Device
  • Battery Service, UUID 00020000-0001-1000-8000-00805F9B34FB.

    CharacteristicTypePropertyUUIDValue
    Battery Levelint8read2A19100 - declines per 2 minutes
  • Heart Rate Service, UUID 00030000-0001-1000-8000-00805F9B34FB.

    CharacteristicTypePropertyUUIDValue
    Heart Rate Measurementfloat64notify,indicate,read2A37control_point ± 20
    Body Sensor Locationint8read2A381 - chest
    Heart Rate Control Pointfloat64write2A3980
    Heart Rate New Alertbooleannotify,indicate2A460 - green if rate in control_point ± 20, 1 - red

Modbus Simulator

Modbus simulator is mocking a thermometer, the numerical accuracy is two decimal places, and the measurement is Kelvin absolute temperature and relative humidity.

The endianness of all property is BigEndian.

NameRegisterTypeTypePropertyAddressQuantityValue
SwitchCoilRegisterbooleanread/write11Triggers to mock, the default is true.
TemperatureHoldingRegisterfloat32read02Represents the realtime absolute temperature, unit is in kevin, its range is between 273.15 and 378.15.
HumidityHoldingRegisterfloat32read22Represents the humidity, unit is in %, its range is between 10 and 100.
High Temperature ThresholdHoldingRegisterint32read/write42Represents the threshold of absolute temperature, unit is in kevin, the default value is 324.
High Temperature AlarmCoilRegisterbooleanread01Indicates high temperature alarm. When the temperature exceeds the threshold, the high temperature alarm is true.
BatteryHoldingRegisterint8read61Represents the battery, uint is in %, the default value is 100.
ManufacturerHoldingRegisterstringread714Indicates the manufacturer.

MQTT Simulator

MQTT simulator is mocking kitchen door, kitchen light, living room light and bedroom light.

  • Kitchen door Pub/Sub information

    # -- sub
    cattle.io/octopus/home/status/kitchen/door/state -> open
    cattle.io/octopus/home/status/kitchen/door/width -> 1.2
    cattle.io/octopus/home/status/kitchen/door/height -> 1.8
    cattle.io/octopus/home/status/kitchen/door/production_material -> wood
    
  • Kitchen light Pub/Sub information

    # -- sub
    cattle.io/octopus/home/status/kitchen/light/switch -> false
    cattle.io/octopus/home/get/kitchen/light/gear -> low
    cattle.io/octopus/home/status/kitchen/light/parameter_power -> 3.0
    cattle.io/octopus/home/status/kitchen/light/parameter_luminance -> 245
    cattle.io/octopus/home/status/kitchen/light/manufacturer -> Rancher Octopus Fake Device
    cattle.io/octopus/home/status/kitchen/light/production_date -> 2020-07-08T13:24:00.00Z
    cattle.io/octopus/home/status/kitchen/light/service_life -> P10Y0M0D
    
    # -- pub
    # select from `true, false`
    cattle.io/octopus/home/set/kitchen/light/switch <- true
    # select from `[low, mid, high]`, change to `parameter_luminance`
    cattle.io/octopus/home/control/kitchen/light/gear <- low
    
  • Living room light Pub/Sub information

    # -- sub
    cattle.io/octopus/home/livingroom/light/switch -> false
    cattle.io/octopus/home/livingroom/light/gear -> low
    cattle.io/octopus/home/livingroom/light/parameter -> [{"name":"power","value":"70.0w"},{"name":"luminance","value":"4900lm"}]
    cattle.io/octopus/home/livingroom/light/production -> {"manufacturer":"Rancher Octopus Fake Device","date":"2020-07-09T13:00:00.00Z","serviceLife":"P10Y0M0D"}
    
    # -- pub
    # select from `true, false`
    cattle.io/octopus/home/livingroom/light/switch/set <- true
    # select from `[low, mid, high]`, change to `parameter[1].value`
    cattle.io/octopus/home/livingroom/light/gear/set <- low
    
  • Bedroom light Pub/Sub information

    # -- sub
    cattle.io/octopus/home/bedroom/light -> {"switch":false,"action":{"gear":"low"},"parameter":{"power":24.3,"luminance":1800},"production":{"manufacturer":"Rancher Octopus Fake Device","date":"2020-07-20T13:24:00.00Z","serviceLife":"P10Y0M0D"}}
    
    # -- pub
    # select from `true, false`
    cattle.io/octopus/home/bedroom/light/set <- {"switch":true}
    # select from `[low, mid, high]`, change to `parameter.luminance`
    cattle.io/octopus/home/bedroom/light/set <- {"action":{"gear":"low"}}
    

OPC-UA Simulator

OPC-UA simulator is open62541/open62541:1.0.

NameTypePropertyNodeIDValue
the answerInt32read/writens=1;s=the.answer42.
example bytestringByteStringread/writens=1;s=myByteString0x74657374313233(string is test123\0test123)
Boolean - 0Booleanreadns=1;i=43001random change
Int16 - 100Int16readns=1;i=43101random change
Uint16 - 200Uint16readns=1;i=43201random change
Int32 - 300Int32readns=1;i=43301random change
Uint32 - 400Uint32readns=1;i=43401random change
Int64 - 500Int64readns=1;i=43501random change
Uint64 - 600Uint64readns=1;i=43601random change
Float - 700Floatreadns=1;i=43701random change
Double - 800Doublereadns=1;i=43801random change
String - 900Stringreadns=1;i=43901random change
ByteString - 1100ByteStringreadns=1;i=44101random change

License

Copyright (c) 2020 Rancher Labs, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at LICENSE file for details.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.