From 0f102be98671abc253e2e73aba15073458c1e444 Mon Sep 17 00:00:00 2001 From: IWASE Yusuke Date: Thu, 16 Mar 2017 13:44:02 +0900 Subject: scenario_test: pep8 and pylint improvements Signed-off-by: IWASE Yusuke --- test/scenario_test/bgp_zebra_test.py | 52 +++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 18 deletions(-) (limited to 'test/scenario_test/bgp_zebra_test.py') diff --git a/test/scenario_test/bgp_zebra_test.py b/test/scenario_test/bgp_zebra_test.py index 24b1477f..8857f801 100644 --- a/test/scenario_test/bgp_zebra_test.py +++ b/test/scenario_test/bgp_zebra_test.py @@ -13,17 +13,25 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest -from fabric.api import local -from lib import base -from lib.gobgp import * -from lib.quagga import * +from __future__ import absolute_import + import sys -import os import time +import unittest + +from fabric.api import local import nose + from noseplugin import OptionParser, parser_option -from itertools import chain + +from lib import base +from lib.base import ( + Bridge, + BGP_FSM_ESTABLISHED, +) +from lib.gobgp import GoBGPContainer +from lib.quagga import QuaggaBGPContainer + class GoBGPTestBase(unittest.TestCase): @@ -65,17 +73,20 @@ class GoBGPTestBase(unittest.TestCase): cls.gobgps = {'ipv4': g1_v4, 'ipv6': g1_v6} cls.quaggas = {'ipv4': q1_v4, 'ipv6': q1_v6} cls.others = {'ipv4': [o1_v4, o2_v4], 'ipv6': [o1_v6, o2_v6]} - cls.bridges = {'br01_v4' : br01_v4, - 'br02_v4' : br02_v4, - 'br03_v4' : br03_v4, - 'br01_v6' : br01_v6, - 'br02_v6' : br02_v6, - 'br03_v6' : br03_v6} + cls.bridges = { + 'br01_v4': br01_v4, + 'br02_v4': br02_v4, + 'br03_v4': br03_v4, + 'br01_v6': br01_v6, + 'br02_v6': br02_v6, + 'br03_v6': br03_v6, + } """ No.1 start up ipv4 containers and check state each neighbor is established in ipv4 environment """ + def test_01_check_neighbor_established(self): g1 = self.gobgps['ipv4'] q1 = self.quaggas['ipv4'] @@ -99,6 +110,7 @@ class GoBGPTestBase(unittest.TestCase): No.2 check whether the ping is reachable in container that have previously beyond the gobpg in ipv4 environment """ + def test_02_check_reachablily_beyond_gobgp_from_quagga(self): g1 = self.gobgps['ipv4'] q1 = self.quaggas['ipv4'] @@ -108,9 +120,9 @@ class GoBGPTestBase(unittest.TestCase): for info in g1.ip_addrs: if 'br01_v4' in info[2]: next_hop = info[1].split('/')[0] - self.assertFalse(next_hop == None) + self.assertFalse(next_hop is None) o1.add_static_route(self.bridges['br02_v4'].subnet, next_hop) - addr = [e[1] for e in o1.ip_addrs if 'br01_v4' in e[2] ] + addr = [e[1] for e in o1.ip_addrs if 'br01_v4' in e[2]] self.assertTrue(len(addr) == 1) q1.get_reachablily(addr[0]) @@ -118,6 +130,7 @@ class GoBGPTestBase(unittest.TestCase): No.3 check whether the ping is reachable in container that have previously beyond the quagga in ipv4 environment """ + def test_03_check_reachablily_beyond_quagga_from_gobgp(self): g1 = self.gobgps['ipv4'] q1 = self.quaggas['ipv4'] @@ -125,7 +138,7 @@ class GoBGPTestBase(unittest.TestCase): next_hop = q1.ip_addrs[2][1].split('/')[0] o2.add_static_route(self.bridges['br02_v4'].subnet, next_hop) - addr = [e[1] for e in o2.ip_addrs if 'br03_v4' in e[2] ] + addr = [e[1] for e in o2.ip_addrs if 'br03_v4' in e[2]] self.assertTrue(len(addr) == 1) g1.get_reachablily(addr[0]) @@ -133,6 +146,7 @@ class GoBGPTestBase(unittest.TestCase): No.4 start up ipv4 containers and check state each neighbor is established in ipv6 environment """ + def test_04_check_neighbor_established_v6(self): g1 = self.gobgps['ipv6'] q1 = self.quaggas['ipv6'] @@ -156,6 +170,7 @@ class GoBGPTestBase(unittest.TestCase): No.5 check whether the ping is reachable in container that have previously beyond the gobpg in ipv6 environment """ + def test_05_check_reachablily_beyond_gobgp_from_quagga(self): g1 = self.gobgps['ipv6'] q1 = self.quaggas['ipv6'] @@ -164,7 +179,7 @@ class GoBGPTestBase(unittest.TestCase): next_hop = g1.ip_addrs[1][1].split('/')[0] g1.set_ipv6_forward() o1.add_static_route(self.bridges['br02_v6'].subnet, next_hop) - addr = [e[1] for e in o1.ip_addrs if 'br01_v6' in e[2] ] + addr = [e[1] for e in o1.ip_addrs if 'br01_v6' in e[2]] self.assertTrue(len(addr) == 1) q1.get_reachablily(addr[0]) @@ -172,6 +187,7 @@ class GoBGPTestBase(unittest.TestCase): No.6 check whether the ping is reachable in container that have previously beyond the quagga in ipv6 environment """ + def test_06_check_reachablily_beyond_quagga_from_gobgp(self): g1 = self.gobgps['ipv6'] q1 = self.quaggas['ipv6'] @@ -180,7 +196,7 @@ class GoBGPTestBase(unittest.TestCase): next_hop = q1.ip_addrs[2][1].split('/')[0] q1.set_ipv6_forward() o2.add_static_route(self.bridges['br02_v6'].subnet, next_hop) - addr = [e[1] for e in o2.ip_addrs if 'br03_v6' in e[2] ] + addr = [e[1] for e in o2.ip_addrs if 'br03_v6' in e[2]] self.assertTrue(len(addr) == 1) g1.get_reachablily(addr[0]) -- cgit v1.2.3