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/bgp_zebra_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/bgp_zebra_test.py')
-rw-r--r-- | test/scenario_test/bgp_zebra_test.py | 52 |
1 files changed, 34 insertions, 18 deletions
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]) |