blob: 4fa20f73cfddba0c91b6845453b4a3b0ef54b840 [file] [log] [blame]
A R Karthick76a497a2017-04-12 10:59:39 -07001#
Chetan Gaonkercfcce782016-05-10 10:10:42 -07002# 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
A R Karthick76a497a2017-04-12 10:59:39 -07007#
Chetan Gaonkercfcce782016-05-10 10:10:42 -07008# http://www.apache.org/licenses/LICENSE-2.0
A R Karthick76a497a2017-04-12 10:59:39 -07009#
Chetan Gaonkercfcce782016-05-10 10:10:42 -070010# 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
A R Karthick76a497a2017-04-12 10:59:39 -070023from CordTestUtils import log_test as log
Chetan Gaonkerb8619e52016-04-12 18:03:05 -070024
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)