This guide describes how to:
- Create and manage an Ubuntu VM within which iotivity can be built and run
- Download, build, and run IoTivity sample clients and servers
- Run The OCF CTT certification suite against IoTivity
The environment outlined in this guide is focused on running the CTT and IoTivity on the same machine, the specifics of which are:
- Computer running windows
- Ubuntu 16.04 as a VM on VirtualBox
This guide assumes that you have basic familiarity with setting up a VM and with Windows and Ubuntu
Install IoTivity
Download and install the latest version of Virtual Box
Download Ubuntu .iso
Download your preffered version of an Ubuntu desktop .iso file targeted for amd/i386, for example ubuntu-16.04.3-desktop-amd64.iso
. (This guide was validated against v16.04)
Create an Ubuntu VM
Specify at least 2048 MB RAM, and a fixed size drive of at least 20 GB
The first time you start the VM, you will be promted for the startup disk. Click the folder icon on the bottom right of the dialog, and select the Ubuntu .iso file that you downloaded earlier, then hit ** Start**
At the next prompt, hit the Install Ubuntu and finish the configuration as you desire
Configure Ubuntu for IoTivity
Run the following commands in an Ubuntu terminal
sudo apt-get install build-essential git scons libtool autoconf valgrind doxygen wget unzip
sudo apt-get install libboost-dev libboost-program-options-dev libboost-thread-dev uuid-dev libexpat1-dev libglib2.0-dev libsqlite3-dev libcurl4-gnutls-dev
Clone the IoTivity repo
# Master
git clone https://gerrit.iotivity.org/gerrit/iotivity
# Release branch
git clone -b 1.3-rel https://gerrit.iotivity.org/gerrit/iotivity
Build IoTivity
Change direcoty to the iotivity
directory created by the clone, then run one of the scons
based builds below.
If it is the first build, you will be prompted to clone additional depndencies. Copy and paste and run the the git commands listed,then run the scons command again (repeat until all required dependencies have been cloned).
# Release Build
scons
# debug build
scons RELEASE=0
# Loogging build
scons LOGGING=1 LOG_LEVEL=DEBUG
NOTE: If you would just like to run some IoTivity examples, and not the CTT, a Windows machine is not required, and you can skip directly to the Running IoTivity Security Examples section below
Dowloawd and run the CTT installer
The CTT test tool is a windows based app.
The the official CTT release downloads can be found here
If you require a Pre Release test version, contact Mitch Ketrick at cpm@openconnectivity.org
Within Windows, extract the contents of the downloaded zip file into a folder, and run the setup.exe
installer
Configure Ubuntu for CTT visibility
Disbale the Ubuntu firewall
# Check to see if the firewall is enabled
sudo ufw status
# If the response is `Status: active`, turn it off like so
sudo ufw disable
Configure the VM for host only networking
- From the menu bar in the Ubuntu VM window:
Machine -> Settings
- Select the
Network
tab - Make sure that
Attached To
is set toHost Only Network
- Note: If at some point you require internet access within Ubuntu (for example for additional code downloads), you will need to change
Attached To
back toNAT
Configure the CTT to communicate on the Ubuntu VMs network interface
- From the CTT Window bar menu select
Options -> Network Interface
- Click on
VirtualBox Host-Only Network
, then select the corresponding IP address, and hit OK
For this guide, we will be testing the Iotivity Security Provision server
Clean out DB files from past runs
If this is not the first test run of the random pin security server, you will need to delete DB files generated by from previous runs
# from: iotivity/out/linux/x86_64/release/resource/csdk/security/provisioning/sample
rm oic_svr_db_server_randompin.dat device_properties.dat
if the CTT reports the message
Pease initiate device to revert to "Ready for OTM" state
, this means that old .dat files are around, and should be deleted as shown above
Start the IoTivity Server
# from: iotivity/out/linux/x86_64/release/resource/csdk/security/provisioning/sample
./sampleserver_randompin
Configure CTT to Test the IoTivity Server
From the CTT window bar menu select File -> Select DUT
, and you should see the IoTivity server
OCS Server Devices
OCS Devices
device-uid
Select the IoTivity server's device ID, and click Next
If you don't see the IoTivity Server listed check the following
- sampleserver_randompin is running
- Ubuntu VM network is set to
Host Only Network
(as described above)- The Ubuntu firewall is disabled (as described above)
- The CTT network interface has been set to the Ubuntu VM (as described above)
Select the desired PICs config file and click Next
Note: for the current CTT under development, use
PICS_server_OCF10.json
Accept all of the defaults on the next dialog by hitting Next
Run CTT Security Tests
CT 1.7.4.2
is known to pass. Unselect all tests except this one, and hit the green play button >
in the upper left of the CTT test app.
Currently the test
CT 1.7.4.2
is located in theSecurity CR35/36/48
test group
You may be promted for a pin, if so, sampleserver_randompin will have generated one, and printed it to the Ubnutu terminal. Enter the PIN into the CTT and hit Set Value
If everything is configured correctly, this test should run to completion and pass. You will know that the test passed from this line shown near the bottom of the CTT log
14:50:43 PASS Test case result: PASSED
if the CTT reports the message
Pease initiate device to revert to "Ready for OTM" state
, this means that old sampleserver_randompin DB files are around, and should be deleted as shown above
In your ubuntu install, change directory to
iotivity/out/linux/x86_64/release/resource/csdk/security/provisioning/sample
# In terminal window 1
./sampleserver_justworks
# In terminal window 2
./provisioningclient
if you have run these samples and you want to start fresh, you will need to remove and reinstall several database files
# from: iotivity/out/linux/x86_64/release/resource/csdk/security/provisioning/sample
rm device_properties.dat oic_svr_db_server_justworks.dat oic_svr_db_client.dat
# from: iotivity (this will install fresh DB files)
scons
In the client terminal, you will be presented with a list of actions that can be taken. As an example, try the following:
Identify the Server
In the client terminal, enter 10: Discover All Un/Owned Devices on Network
In the resonse you should see the server is now identified as being unowned:
Discovering All Un/Owned Devices on Network..
> Discovered Owned Devices
Device List is Empty..
> Discovered Unowned Devices
[1] 12345678-1234-1234-1234-123456789012 ocf.1.1.0
Regstier/Own the Server
In the client terminal, enter 20: Register/Own All Discovered Unowned Devices
In the response you should see that the server was successfully registgered
09:04.809 INFO: provisioningclient: Ownership Transfer SUCCEEDED - ctx: Provision Manager Client Application Context
> Registered Discovered Unowned Devices
Verify that the server was registered
In the client terminal, enter 10 again: Discover All Un/Owned Devices on Network
In the response you should see the server is now identified as being owned:
Discovering All Un/Owned Devices on Network..
> Discovered Owned Devices
[1] 12345678-1234-1234-1234-123456789012 ocf.1.1.0
> Discovered Unowned Devices
Device List is Empty..
TBD