blob: 731cf3232320dd50fa1e8d2c3691155f29438b75 [file] [log] [blame]
Chetan Gaonkercfcce782016-05-10 10:10:42 -07001#
2# Copyright 2016-present Ciena Corporation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
Chetan Gaonkerb8619e52016-04-12 18:03:05 -070016import unittest
17import time
18import os
19import json
20from nose.tools import *
21from onosclidriver import OnosCliDriver
22from OnosCtrl import OnosCtrl
23from scapy.all import *
24
25log.setLevel('INFO')
26
27class routes_exchange(unittest.TestCase):
28
29 @classmethod
30 def setUpClass(cls):
31 cls.cli = OnosCliDriver(connect = True)
32
33 @classmethod
34 def tearDownClass(cls):
35 cls.cli.disconnect()
36
37 def test_route_cli(self):
38 routes = json.loads(self.cli.routes(jsonFormat = True))
39 log.info('Routes: %s' %routes)
40
41 def test_devices_cli(self):
42 devices = json.loads(self.cli.devices(jsonFormat = True))
43 available_devices = filter(lambda d: d['available'], devices)
44 device_ids = [ d['id'] for d in devices ]
45 log.info('Available Devices: %s' %devices)
46 log.info('Device IDS: %s' %device_ids)
47
48 def test_flows_cli(self):
49 flows = json.loads(self.cli.flows(jsonFormat = True))
50 flows = filter(lambda f: f['flows'], flows)
51 log.info('Flows: %s' %flows)