Skip to content

Commit

Permalink
topotato: fix a bunch of formatting oddness
Browse files Browse the repository at this point in the history
Signed-off-by: David Lamparter <[email protected]>
  • Loading branch information
eqvinox committed Dec 13, 2022
1 parent 32a102c commit 34a250e
Show file tree
Hide file tree
Showing 12 changed files with 81 additions and 64 deletions.
12 changes: 7 additions & 5 deletions test_bgp_aggregate_address_origin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2022 Nathan Mangar

"""
Expand Down Expand Up @@ -38,12 +40,12 @@ class Configs(FRRConfigs):
#% block main
#% if router.name == 'r1'
interface lo
ip address {{ routers.r1.lo_ip4[0] }}
ip address {{ routers.r1.lo_ip4[0] }}
!
#% endif
#% for iface in router.ifaces
interface {{ iface.ifname }}
ip address {{ iface.ip4[0] }}
ip address {{ iface.ip4[0] }}
!
#% endfor
ip forwarding
Expand All @@ -52,7 +54,7 @@ class Configs(FRRConfigs):
"""

bgpd = """
#% block main
#% block main
#% if router.name == 'r2'
router bgp 65001
no bgp ebgp-requires-policy
Expand All @@ -71,8 +73,8 @@ class Configs(FRRConfigs):
exit-address-family
!
#% endif
#% endblock
"""
#% endblock
"""


class BGPAggregateAddressOrigin(TestBase, AutoFixture, topo=topology, configs=Configs):
Expand Down
11 changes: 6 additions & 5 deletions test_bgp_aggregate_address_route_map.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2022 Nathan Mangar

Expand Down Expand Up @@ -43,12 +44,12 @@ class Configs(FRRConfigs):
#% block main
#% if router.name == 'r1'
interface lo
ip address {{ routers.r1.lo_ip4[0] }}
ip address {{ routers.r1.lo_ip4[0] }}
!
#% endif
#% for iface in router.ifaces
interface {{ iface.ifname }}
ip address {{ iface.ip4[0] }}
ip address {{ iface.ip4[0] }}
!
#% endfor
ip forwarding
Expand All @@ -57,7 +58,7 @@ class Configs(FRRConfigs):
"""

bgpd = """
#% block main
#% block main
#% if router.name == 'r2'
router bgp 65001
no bgp ebgp-requires-policy
Expand All @@ -79,8 +80,8 @@ class Configs(FRRConfigs):
set metric 123
!
#% endif
#% endblock
"""
#% endblock
"""


class BGPAggregateAddressRouteMap(
Expand Down
6 changes: 3 additions & 3 deletions test_bgp_as_wide_bgp_identifier.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2022 Nathan Mangar


"""
rfc6286: Autonomous-System-Wide Unique BGP Identifier for BGP-4
Test if 'Bad BGP Identifier' notification is sent only to
Expand Down Expand Up @@ -41,7 +41,7 @@ class Configs(FRRConfigs):
#% block main
#% for iface in router.ifaces
interface {{ iface.ifname }}
ip address {{ iface.ip4[0] }}
ip address {{ iface.ip4[0] }}
!
#% endfor
ip forwarding
Expand Down Expand Up @@ -76,7 +76,7 @@ class Configs(FRRConfigs):
!
#% endif
#% endblock
"""
"""


class TestBGPAsWideBGPIdentifier(TestBase, AutoFixture, topo=topology, configs=Configs):
Expand Down
31 changes: 16 additions & 15 deletions test_bgp_comm-list_delete.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2022 Noah Krishnamoorty

Expand Down Expand Up @@ -35,7 +36,7 @@ class Configs(FRRConfigs):
#% block main
#% if router.name == 'r1'
interface lo
ip address {{ router.lo_ip4[0] }}
ip address {{ router.lo_ip4[0] }}
!
#% endif
#% for iface in router.ifaces
Expand All @@ -53,29 +54,29 @@ class Configs(FRRConfigs):
#% block main
#% if router.name == 'r1'
router bgp 65000
no bgp ebgp-requires-policy
neighbor {{ routers.r2.ifaces[0].ip4[0].ip }} remote-as 65001
neighbor {{ routers.r2.ifaces[0].ip4[0].ip }} timers 3 10
address-family ipv4 unicast
redistribute connected route-map r2-out
exit-address-family
no bgp ebgp-requires-policy
neighbor {{ routers.r2.ifaces[0].ip4[0].ip }} remote-as 65001
neighbor {{ routers.r2.ifaces[0].ip4[0].ip }} timers 3 10
address-family ipv4 unicast
redistribute connected route-map r2-out
exit-address-family
!
route-map r2-out permit 10
set community 111:111 222:222 333:333 444:444
set community 111:111 222:222 333:333 444:444
!
#% elif router.name == 'r2'
router bgp 65001
no bgp ebgp-requires-policy
neighbor {{ routers.r1.ifaces[0].ip4[0].ip }} remote-as 65000
neighbor {{ routers.r1.ifaces[0].ip4[0].ip }} timers 3 10
address-family ipv4
neighbor {{ routers.r1.ifaces[0].ip4[0].ip }} route-map r1-in in
exit-address-family
no bgp ebgp-requires-policy
neighbor {{ routers.r1.ifaces[0].ip4[0].ip }} remote-as 65000
neighbor {{ routers.r1.ifaces[0].ip4[0].ip }} timers 3 10
address-family ipv4
neighbor {{ routers.r1.ifaces[0].ip4[0].ip }} route-map r1-in in
exit-address-family
!
bgp community-list standard r1 permit 333:333
!
route-map r1-in permit 10
set comm-list r1 delete
set comm-list r1 delete
!
#% endif
#% endblock
Expand Down
16 changes: 10 additions & 6 deletions test_bgp_default-originate_route-map_match.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
from topotato import *
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2022 Nathan Mangar

"""
Test if default-originate works with ONLY match operations.
"""

from topotato import *


@topology_fixture()
def allproto_topo(topo):
Expand All @@ -28,12 +32,12 @@ class Configs(FRRConfigs):
#% block main
#% if router.name == 'r1'
interface lo
ip address {{ routers.r1.lo_ip4[0] }}
ip address {{ routers.r1.lo_ip4[0] }}
!
#% endif
#% for iface in router.ifaces
interface {{ iface.ifname }}
ip address {{ iface.ip4[0] }}
ip address {{ iface.ip4[0] }}
!
#% endfor
ip forwarding
Expand All @@ -42,7 +46,7 @@ class Configs(FRRConfigs):
"""

bgpd = """
#% block main
#% block main
#% if router.name == 'r2'
router bgp 65001
no bgp ebgp-requires-policy
Expand Down Expand Up @@ -72,8 +76,8 @@ class Configs(FRRConfigs):
set community 65000:1
!
#% endif
#% endblock
"""
#% endblock
"""


@config_fixture(Configs)
Expand Down
15 changes: 8 additions & 7 deletions test_bgp_default_originate_route_map_match_set.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2022 Nathan Mangar

Expand Down Expand Up @@ -37,14 +38,14 @@ class Configs(FRRConfigs):
#% block main
#% if router.name == 'r1'
interface lo
ip address {{ routers.r1.lo_ip4[0] }}
ip address {{ routers.r1.lo_ip4[0] }}
!
ip route 192.168.13.0./24 Null0
!
#% endif
#% for iface in router.ifaces
interface {{ iface.ifname }}
ip address {{ iface.ip4[0] }}
ip address {{ iface.ip4[0] }}
!
#% endfor
ip forwarding
Expand All @@ -53,7 +54,7 @@ class Configs(FRRConfigs):
"""

bgpd = """
#% block main
#% block main
#% if router.name == 'r2'
router bgp 65001
no bgp ebgp-requires-policy
Expand All @@ -70,8 +71,8 @@ class Configs(FRRConfigs):
neighbor {{ routers.r2.ifaces[0].ip4[0].ip }} timers 3 10
address-family ipv4 unicast
redistribute connected
network 192.168.13.0/24 route-map internal
neighbor {{ routers.r2.ifaces[0].ip4[0].ip }} default-originate route-map default
network 192.168.13.0/24 route-map internal
neighbor {{ routers.r2.ifaces[0].ip4[0].ip }} default-originate route-map default
exit-address-family
!
bgp community-list standard default seq 5 permit 65000:1
Expand All @@ -85,8 +86,8 @@ class Configs(FRRConfigs):
set community 65000:1
!
#% endif
#% endblock
"""
#% endblock
"""


class BGPDefaultOriginateRouteMapMatchSet(
Expand Down
6 changes: 3 additions & 3 deletions test_bgp_distance_change.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2022 Jugroo Jesvin Brian

Expand Down Expand Up @@ -58,16 +59,15 @@ class Configs(FRRConfigs):
no bgp ebgp-requires-policy
neighbor {{ routers.r1.ifaces[0].ip4[0].ip }} remote-as 65000
neighbor {{ routers.r1.ifaces[0].ip4[0].ip }} timers 3 10
address-family ipv4
address-family ipv4
redistribute connected
exit-address-family
#% elif router.name == 'r1'
router bgp 65000
no bgp ebgp-requires-policy
neighbor {{ routers.r2.ifaces[0].ip4[0].ip }} remote-as 65001
neighbor {{ routers.r2.ifaces[0].ip4[0].ip }} timers 3 10
exit-address-family
!
!
#% endif
#% endblock
"""
Expand Down
16 changes: 10 additions & 6 deletions test_bgp_dont_capability_negotiate.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2022 Nathan Mangar

from topotato import *

"""
Expand Down Expand Up @@ -30,12 +34,12 @@ class Configs(FRRConfigs):
#% block main
#% if router.name == 'r1'
interface lo
ip address {{ routers.r1.lo_ip4[0] }}
ip address {{ routers.r1.lo_ip4[0] }}
!
#% endif
#% for iface in router.ifaces
interface {{ iface.ifname }}
ip address {{ iface.ip4[0] }}
ip address {{ iface.ip4[0] }}
!
#% endfor
ip forwarding
Expand All @@ -44,13 +48,13 @@ class Configs(FRRConfigs):
"""

bgpd = """
#% block main
#% block main
#% if router.name == 'r2'
router bgp 65002
no bgp ebgp-requires-policy
neighbor {{ routers.r1.ifaces[0].ip4[0].ip }} remote-as external
address-family ipv4 unicast
redistribute connected
redistribute connected
exit-address-family
!
#% elif router.name == 'r1'
Expand All @@ -60,8 +64,8 @@ class Configs(FRRConfigs):
neighbor {{ routers.r2.ifaces[0].ip4[0].ip }} dont-capability-negotiate
!
#% endif
#% endblock
"""
#% endblock
"""


@config_fixture(Configs)
Expand Down
11 changes: 6 additions & 5 deletions test_bgp_minimum_holdtime.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2022 Nathan Mangar

Expand Down Expand Up @@ -36,12 +37,12 @@ class Configs(FRRConfigs):
#% block main
#% if router.name == 'r1'
interface lo
ip address {{ routers.r1.lo_ip4[0] }}
ip address {{ routers.r1.lo_ip4[0] }}
!
#% endif
#% for iface in router.ifaces
interface {{ iface.ifname }}
ip address {{ iface.ip4[0] }}
ip address {{ iface.ip4[0] }}
!
#% endfor
ip forwarding
Expand All @@ -50,7 +51,7 @@ class Configs(FRRConfigs):
"""

bgpd = """
#% block main
#% block main
#% if router.name == 'r2'
router bgp 65001
no bgp ebgp-requires-policy
Expand All @@ -65,8 +66,8 @@ class Configs(FRRConfigs):
neighbor 192.168.255.2 timers connect 10
!
#% endif
#% endblock
"""
#% endblock
"""


class TestBGPMinimumHoldtime(TestBase, AutoFixture, topo=topology, configs=Configs):
Expand Down
Loading

0 comments on commit 34a250e

Please sign in to comment.