blob: 46d5effd32f9b2d640f37ef6b99b5846ceecd931 [file] [log] [blame]
Matteo Scandolo48d3d2d2017-08-08 13:05:27 -07001
2# Copyright 2017-present Open Networking Foundation
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
16
A R Karthick76a497a2017-04-12 10:59:39 -070017#
Chetan Gaonkercfcce782016-05-10 10:10:42 -070018# Copyright 2016-present Ciena Corporation
19#
20# Licensed under the Apache License, Version 2.0 (the "License");
21# you may not use this file except in compliance with the License.
22# You may obtain a copy of the License at
A R Karthick76a497a2017-04-12 10:59:39 -070023#
Chetan Gaonkercfcce782016-05-10 10:10:42 -070024# http://www.apache.org/licenses/LICENSE-2.0
A R Karthick76a497a2017-04-12 10:59:39 -070025#
Chetan Gaonkercfcce782016-05-10 10:10:42 -070026# Unless required by applicable law or agreed to in writing, software
27# distributed under the License is distributed on an "AS IS" BASIS,
28# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29# See the License for the specific language governing permissions and
30# limitations under the License.
31#
Chetan Gaonkerb8619e52016-04-12 18:03:05 -070032import unittest
33import time
34import os
35import json
36from nose.tools import *
37from onosclidriver import OnosCliDriver
38from OnosCtrl import OnosCtrl
A R Karthick76a497a2017-04-12 10:59:39 -070039from CordTestUtils import log_test as log
Chetan Gaonkerb8619e52016-04-12 18:03:05 -070040
41log.setLevel('INFO')
42
43class routes_exchange(unittest.TestCase):
44
45 @classmethod
46 def setUpClass(cls):
47 cls.cli = OnosCliDriver(connect = True)
48
49 @classmethod
50 def tearDownClass(cls):
51 cls.cli.disconnect()
52
53 def test_route_cli(self):
54 routes = json.loads(self.cli.routes(jsonFormat = True))
55 log.info('Routes: %s' %routes)
56
57 def test_devices_cli(self):
58 devices = json.loads(self.cli.devices(jsonFormat = True))
59 available_devices = filter(lambda d: d['available'], devices)
60 device_ids = [ d['id'] for d in devices ]
61 log.info('Available Devices: %s' %devices)
62 log.info('Device IDS: %s' %device_ids)
63
64 def test_flows_cli(self):
65 flows = json.loads(self.cli.flows(jsonFormat = True))
66 flows = filter(lambda f: f['flows'], flows)
67 log.info('Flows: %s' %flows)