Adding ONOS cli test cases using the new onos cli driver framework
diff --git a/src/test/onosCli/__init__.py b/src/test/onosCli/__init__.py
new file mode 100644
index 0000000..93253fd
--- /dev/null
+++ b/src/test/onosCli/__init__.py
@@ -0,0 +1,9 @@
+import os,sys
+##add the python path to lookup the utils
+working_dir = os.path.dirname(os.path.realpath(sys.argv[-1]))
+utils_dir = os.path.join(working_dir, '../utils')
+fsm_dir = os.path.join(working_dir, '../fsm')
+cli_dir = os.path.join(working_dir, '../cli')
+__path__.append(utils_dir)
+__path__.append(fsm_dir)
+__path__.append(cli_dir)
diff --git a/src/test/onosCli/onosCliTest.py b/src/test/onosCli/onosCliTest.py
new file mode 100644
index 0000000..039a9b9
--- /dev/null
+++ b/src/test/onosCli/onosCliTest.py
@@ -0,0 +1,36 @@
+import unittest
+import time
+import os
+import json
+from nose.tools import *
+from onosclidriver import OnosCliDriver
+from OnosCtrl import OnosCtrl
+from scapy.all import *
+
+log.setLevel('INFO')
+
+class routes_exchange(unittest.TestCase):
+
+ @classmethod
+ def setUpClass(cls):
+ cls.cli = OnosCliDriver(connect = True)
+
+ @classmethod
+ def tearDownClass(cls):
+ cls.cli.disconnect()
+
+ def test_route_cli(self):
+ routes = json.loads(self.cli.routes(jsonFormat = True))
+ log.info('Routes: %s' %routes)
+
+ def test_devices_cli(self):
+ devices = json.loads(self.cli.devices(jsonFormat = True))
+ available_devices = filter(lambda d: d['available'], devices)
+ device_ids = [ d['id'] for d in devices ]
+ log.info('Available Devices: %s' %devices)
+ log.info('Device IDS: %s' %device_ids)
+
+ def test_flows_cli(self):
+ flows = json.loads(self.cli.flows(jsonFormat = True))
+ flows = filter(lambda f: f['flows'], flows)
+ log.info('Flows: %s' %flows)