1.Introduction #

PseudoThing is KnowThings’s pre-release prototype bringing our fancy math algorithms to IoT. We are working on making virtual devices that you can use to build your software before physical devices are ready, test your software at scale, and predict the interactions of real devices before field testing.

2.Known Platforms #

Theoretically, PseudoThing should work on any platform with Java 8. We’ve currently tested:

  • Linux
  • Mac
  • Raspbian
  • Windows 7 and Windows 10

3.Prerequisites #

Oracle or Open JDK 8. We suggest using Oracle JDK.

4.Install #

Ensure that JDK is installed on the system and path is set to java executable. Unzip the PseudoThing.zip into a directory and you are done.

5.Use #

PseudoThing creates a simulation using a 3 step process.

  1. Capture
  2. Model
  3. Playback

5.1.Step 1 -- Capture #

Generate a PCAP file with the transactions that you want (we use Wireshark).

Filter out non device traffic using this code:

(ip.addr== xx  tcp.port==xx)

In most use cases, you have a server and a device. Only one of these things is instantiating a communication, the other is listening for a communication. Use the IP address and TCP port of the thing that is listening, whether it is a server or a device is irrelevant.

If you are using Wireshark, make sure you save your capture as a PCAP file as that is the only format we support. If you get a pcapng file,  you can Save As .pcap file format and it should work.

5.2.Step 2 -- Model #

The fun part! Here you will create your first AVD (adaptive virtual device) Create your PseudoThing by running this command:

Unix, Linux or Mac:

modelAVD.sh

Windows Operating Systems:

modelAVD.bat

Run the command inside the bin directory inside the PseudoThing directory. If you want to run it anywhere else, set the classpath according to the PseudoThing jar file and set the path per environment variable as needed.

Arguments

modelAVD supports the following arguments:

   -h, --help
          Displays this help text.
   -f <PCAP file>, --pcapFile=<PCAP file>
          Specifies the path of the pcap file to create a model from.
   -a <AVD Name>, --avdName=<AVD Name>
          Name of the model, referred as adaptive virtual device (AVD). 
          [OPTIONAL]
   -i <Server IP Address>, --ip=<Server IP Address>
          IP Address of system under test (SUT)
   -p <Server Port>, --port=<Server Port>
          Port number of the system under test (SUT)

Windows Examples

./modelAVD.bat -f C:\Users\MyIoT\PseudoThing\bin\exampleLocal.pcap -a MyFirstAVD -i 192.168.0.0 -p 3000

./modelAVD.bat --pcapFile=exampleLocal.pcap --avdName=MyFirstAVD --ip=172.16.0.0 --port=3000

 

Mac and Linux Examples

./modelAVD.sh --pcapFile=/home/myIoT/PseudoThing/bin/exampleLocal.pcap --avdName=llAVD2 --ip=000.000.000.000 --port=3000

./modelAVD.sh -f /home/myIoT/PseudoThing/bin/exampleLocal.pcap -a lsAVD1 -i 000.000.000.000 -p 3000

You’ll get the following message if everything was successful:

Adaptive Virtual Device created: MyFirstAVD

5.3.Step 3 -- Playback #

Once you have your PseudoThing AVD model, you can play it back and have it stand in for the device you recorded.

On Mac, Linux, and Linux Operating Systems use:

runAVD.sh

On Windows Operating Systems:

runAVD.bat

It also must be run from the bin directory of your PseudoThing directory.

runAVD.sh takes the following parameters:

runAVD.sh <AVD name> <Server IP Address> <Server Port>

Arguments

runAVD supports the following arguments:

   -h, --help
          Displays this help text.
   -a <AVD Name>, --avdName=<AVD Name>
          Name of the AVD to playback
   -i <Server IP Address>, --ip=<Server IP Address>
          IP Address of system under test (SUT)
   -p <Server Port>, --port=<Server Port>
          Port number of the SUT to which this AVD would connect
   -r, --responder
          Run this AVD as Responder. SUT IP and Port are NOT REQUIRED for 
          this mode.
   -s <Responder Port>, --respPort=<Responder Port>
          Port number at which the AVD responder would run, and "serve" 
          the responses from. Only USED if running as responder, but is 
          OPTIONAL. If not provided, the DEFAULT port used is 8111

Windows Examples

C:\Users\MyIoT\PseudoThing\bin>runAVD.bat -a MyTestAVD -i 172.16.0.0 -p 3000 

C:\Users\MyIoT\PseudoThing\bin>runAVD.bat --avdName=MyTestAVD --ip=172.16.0.0 --port=3000

 

Mac and Linux Examples

runAVD.sh -a MyTestAVD -i 172.16.0.0 -p 3000

runAVD.sh --avdName=MyTestAVD --ip=172.16.0.0 --port=3000

6.Run AVD as a Requestor Client Device #

A requestor device is a device that initiates contact with the software. It is awake and keeps a port open while it is requesting information and getting a response back.

To run the AVD as a requester/client device:

runAVD.sh -a <AVD name> -i <Server IP Address> -p <Server Port> runAVD.sh --avdName=<AVD name> --ip=<Server IP Address> --port=<Server Port>

7.Run AVD as a Responder Client Device #

A responder client device is a device that respondes to a request from software. It is alseep and awakens when it is pinged.

 

Windows Example
runAVD.bat -a <AVD name> -r -s <Responder Port>

runAVD.bat -a MyTestAVD -r -s 30001

runAVD.bat --avdName=<AVD name> --responder --respPort=<Responder Port>

runAVD.bat --avdName=MyTestAVD --responder --respPort=30001

 

Linux or Mac Example

runAVD.sh -a <AVD name> -r -s <Responder Port>

./runAVD.sh -a MyTestAVD -r -s 30001

runAVD.sh --avdName=<AVD name> --responder --respPort=<Responder
Port>