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 , --pcapFile=
Specifies the path of the pcap file to create a model from.
-a , --avdName=
Name of the model, referred as adaptive virtual device (AVD).
[OPTIONAL]
-i , --ip=
IP Address of system under test (SUT)
-p , --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

Arguments

runAVD supports the following arguments:

-h, --help Displays this help text. -a , --avdName= Name of the AVD to playback -i , --ip= IP Address of system under test (SUT) -p , --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 , --respPort= 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 -i -p runAVD.sh --avdName= --ip= --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 -r -s

runAVD.bat -a MyTestAVD -r -s 30001

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

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

Linux or Mac Example

runAVD.sh -a -r -s

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

runAVD.sh --avdName= --responder --respPort=