Chetan Gaonker | b8619e5 | 2016-04-12 18:03:05 -0700 | [diff] [blame] | 1 | import unittest |
| 2 | import time |
| 3 | import os |
| 4 | import json |
| 5 | from nose.tools import * |
| 6 | from onosclidriver import OnosCliDriver |
| 7 | from OnosCtrl import OnosCtrl |
| 8 | from scapy.all import * |
| 9 | |
| 10 | log.setLevel('INFO') |
| 11 | |
| 12 | class routes_exchange(unittest.TestCase): |
| 13 | |
| 14 | @classmethod |
| 15 | def setUpClass(cls): |
| 16 | cls.cli = OnosCliDriver(connect = True) |
| 17 | |
| 18 | @classmethod |
| 19 | def tearDownClass(cls): |
| 20 | cls.cli.disconnect() |
| 21 | |
| 22 | def test_route_cli(self): |
| 23 | routes = json.loads(self.cli.routes(jsonFormat = True)) |
| 24 | log.info('Routes: %s' %routes) |
| 25 | |
| 26 | def test_devices_cli(self): |
| 27 | devices = json.loads(self.cli.devices(jsonFormat = True)) |
| 28 | available_devices = filter(lambda d: d['available'], devices) |
| 29 | device_ids = [ d['id'] for d in devices ] |
| 30 | log.info('Available Devices: %s' %devices) |
| 31 | log.info('Device IDS: %s' %device_ids) |
| 32 | |
| 33 | def test_flows_cli(self): |
| 34 | flows = json.loads(self.cli.flows(jsonFormat = True)) |
| 35 | flows = filter(lambda f: f['flows'], flows) |
| 36 | log.info('Flows: %s' %flows) |