diff options
author | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2017-03-16 13:44:02 +0900 |
---|---|---|
committer | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2017-03-16 16:14:20 +0900 |
commit | 0f102be98671abc253e2e73aba15073458c1e444 (patch) | |
tree | 606b1cd73a6b242b0a1f92f7f02d36694e11a1b0 /test/scenario_test/route_server_as2_test.py | |
parent | 03ba90ac0dd6ecea6c1e2b24956bcc73962d1ef7 (diff) |
scenario_test: pep8 and pylint improvements
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Diffstat (limited to 'test/scenario_test/route_server_as2_test.py')
-rw-r--r-- | test/scenario_test/route_server_as2_test.py | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/test/scenario_test/route_server_as2_test.py b/test/scenario_test/route_server_as2_test.py index b391aa46..2c79a5fe 100644 --- a/test/scenario_test/route_server_as2_test.py +++ b/test/scenario_test/route_server_as2_test.py @@ -13,17 +13,25 @@ # See the License for the specific language governing permissions and # limitations under the License. +from __future__ import absolute_import + import unittest -from fabric.api import local -from lib import base -from lib.gobgp import * -from lib.exabgp import * import sys -import os import time + +from fabric.api import local import nose + from noseplugin import OptionParser, parser_option +from lib import base +from lib.base import ( + BGP_FSM_IDLE, + BGP_FSM_ESTABLISHED, +) +from lib.gobgp import GoBGPContainer +from lib.exabgp import ExaBGPContainer + class GoBGPTestBase(unittest.TestCase): @@ -39,18 +47,15 @@ class GoBGPTestBase(unittest.TestCase): ctn_image_name=gobgp_ctn_image_name, log_level=parser_option.gobgp_log_level) - rs_clients = [ExaBGPContainer(name='q{0}'.format(i+1), asn=65001+i, - router_id='192.168.0.{0}'.format(i+2)) - for i in range(4)] + rs_clients = [ + ExaBGPContainer(name='q{0}'.format(i + 1), asn=(65001 + i), + router_id='192.168.0.{0}'.format(i + 2)) + for i in range(4)] ctns = [g1] + rs_clients - q1 = rs_clients[0] - q2 = rs_clients[1] - q3 = rs_clients[2] - q4 = rs_clients[3] # advertise a route from route-server-clients for idx, rs_client in enumerate(rs_clients): - route = '10.0.{0}.0/24'.format(idx+1) + route = '10.0.{0}.0/24'.format(idx + 1) rs_client.add_route(route) if idx < 2: route = '10.0.10.0/24' @@ -68,8 +73,7 @@ class GoBGPTestBase(unittest.TestCase): rs_client.add_peer(g1, as2=as2) cls.gobgp = g1 - cls.quaggas = { x.name: x for x in rs_clients } - + cls.quaggas = {x.name: x for x in rs_clients} # test each neighbor state is turned establish def test_01_neighbor_established(self): @@ -87,7 +91,7 @@ class GoBGPTestBase(unittest.TestCase): self.assertEqual(state, BGP_FSM_ESTABLISHED) local_rib = self.gobgp.get_local_rib(rs_client) local_rib = [p['prefix'] for p in local_rib] - if len(local_rib) < len(self.quaggas)-1: + if len(local_rib) < (len(self.quaggas) - 1): time.sleep(self.wait_per_retry) continue @@ -97,7 +101,7 @@ class GoBGPTestBase(unittest.TestCase): if done: continue # should not reach here - self.assertTrue(False) + raise AssertionError def test_03_stop_q2_and_check_neighbor_status(self): q2 = self.quaggas['q2'] |