Skip to content

Commit

Permalink
topotato: refactor test_bgp_as_wide_bgp_identifier.py
Browse files Browse the repository at this point in the history
Signed-off-by: Nathan Mangar <[email protected]>
  • Loading branch information
Nathan Mangar authored and eqvinox committed Nov 1, 2022
1 parent bf3cc70 commit 76e1e7b
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions test_bgp_as_wide_bgp_identifier.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from topotato import *
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2022 Nathan Mangar


"""
rfc6286: Autonomous-System-Wide Unique BGP Identifier for BGP-4
Expand All @@ -7,9 +9,16 @@
affected and should work.
"""

__topotests_file__ = "bgp_as_wide_bgp_identifier/test_bgp_as_wide_bgp_identifier.py"
__topotests_gitrev__ = "4953ca977f3a5de8109ee6353ad07f816ca1774c"

# pylint: disable=wildcard-import, unused-wildcard-import

from topotato import *


@topology_fixture()
def allproto_topo(topo):
def topology(topo):
"""
[ r1 ]
|
Expand Down Expand Up @@ -70,32 +79,20 @@ class Configs(FRRConfigs):
"""


@config_fixture(Configs)
def configs(config, allproto_topo):
return config


@instance_fixture()
def testenv(configs):
return FRRNetworkInstance(configs.topology, configs).prepare()


class test_bgp_as_wide_bgp_identifier(TestBase):
instancefn = testenv

class TestBGPAsWideBGPIdentifier(TestBase, AutoFixture, topo=topology, configs=Configs):
@topotatofunc
def bgp_converge(self, topo, r1, r2, r3):
def bgp_converge(self, _, r1):
expected = {"192.168.255.1": {"bgpState": "Established"}}
yield from AssertVtysh.make(
r1,
"bgpd",
f"show ip bgp neighbor 192.168.255.1 json",
"show ip bgp neighbor 192.168.255.1 json",
maxwait=2.0,
compare=expected,
)

@topotatofunc
def bgp_failed(self, topo, r1, r2, r3):
def bgp_failed(self, _, r3):
expected = {
"192.168.255.1": {
"lastNotificationReason": "OPEN Message Error/Bad BGP Identifier"
Expand All @@ -104,7 +101,7 @@ def bgp_failed(self, topo, r1, r2, r3):
yield from AssertVtysh.make(
r3,
"bgpd",
f"show ip bgp neighbor 192.168.255.1 json",
"show ip bgp neighbor 192.168.255.1 json",
maxwait=2.0,
compare=expected,
)

0 comments on commit 76e1e7b

Please sign in to comment.