From 34a250e7a29ef79f892ade7bfa21c9b462dbb48e Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Tue, 13 Dec 2022 14:34:52 +0100 Subject: [PATCH] topotato: fix a bunch of formatting oddness Signed-off-by: David Lamparter --- test_bgp_aggregate_address_origin.py | 12 ++++--- test_bgp_aggregate_address_route_map.py | 11 ++++--- test_bgp_as_wide_bgp_identifier.py | 6 ++-- test_bgp_comm-list_delete.py | 31 ++++++++++--------- test_bgp_default-originate_route-map_match.py | 16 ++++++---- ...p_default_originate_route_map_match_set.py | 15 ++++----- test_bgp_distance_change.py | 6 ++-- test_bgp_dont_capability_negotiate.py | 16 ++++++---- test_bgp_minimum_holdtime.py | 11 ++++--- test_bgp_rmap_extcommunity_none.py | 5 +-- test_bgp_route_map_match_ipv6_nexthop.py | 7 +++-- test_bgp_set_aspath_replace.py | 9 +++--- 12 files changed, 81 insertions(+), 64 deletions(-) diff --git a/test_bgp_aggregate_address_origin.py b/test_bgp_aggregate_address_origin.py index 99e0166..51d9f1a 100644 --- a/test_bgp_aggregate_address_origin.py +++ b/test_bgp_aggregate_address_origin.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: GPL-2.0-or-later # Copyright (C) 2022 Nathan Mangar """ @@ -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 @@ -52,7 +54,7 @@ class Configs(FRRConfigs): """ bgpd = """ - #% block main + #% block main #% if router.name == 'r2' router bgp 65001 no bgp ebgp-requires-policy @@ -71,8 +73,8 @@ class Configs(FRRConfigs): exit-address-family ! #% endif - #% endblock - """ + #% endblock + """ class BGPAggregateAddressOrigin(TestBase, AutoFixture, topo=topology, configs=Configs): diff --git a/test_bgp_aggregate_address_route_map.py b/test_bgp_aggregate_address_route_map.py index 7e7359b..ba17b39 100644 --- a/test_bgp_aggregate_address_route_map.py +++ b/test_bgp_aggregate_address_route_map.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-or-later # Copyright (C) 2022 Nathan Mangar @@ -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 @@ -57,7 +58,7 @@ class Configs(FRRConfigs): """ bgpd = """ - #% block main + #% block main #% if router.name == 'r2' router bgp 65001 no bgp ebgp-requires-policy @@ -79,8 +80,8 @@ class Configs(FRRConfigs): set metric 123 ! #% endif - #% endblock - """ + #% endblock + """ class BGPAggregateAddressRouteMap( diff --git a/test_bgp_as_wide_bgp_identifier.py b/test_bgp_as_wide_bgp_identifier.py index 6db73c3..cda56f6 100644 --- a/test_bgp_as_wide_bgp_identifier.py +++ b/test_bgp_as_wide_bgp_identifier.py @@ -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 @@ -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 @@ -76,7 +76,7 @@ class Configs(FRRConfigs): ! #% endif #% endblock - """ + """ class TestBGPAsWideBGPIdentifier(TestBase, AutoFixture, topo=topology, configs=Configs): diff --git a/test_bgp_comm-list_delete.py b/test_bgp_comm-list_delete.py index 4b04db4..588dba8 100644 --- a/test_bgp_comm-list_delete.py +++ b/test_bgp_comm-list_delete.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-or-later # Copyright (C) 2022 Noah Krishnamoorty @@ -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 @@ -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 diff --git a/test_bgp_default-originate_route-map_match.py b/test_bgp_default-originate_route-map_match.py index 39e14f3..b98c970 100644 --- a/test_bgp_default-originate_route-map_match.py +++ b/test_bgp_default-originate_route-map_match.py @@ -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): @@ -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 @@ -42,7 +46,7 @@ class Configs(FRRConfigs): """ bgpd = """ - #% block main + #% block main #% if router.name == 'r2' router bgp 65001 no bgp ebgp-requires-policy @@ -72,8 +76,8 @@ class Configs(FRRConfigs): set community 65000:1 ! #% endif - #% endblock - """ + #% endblock + """ @config_fixture(Configs) diff --git a/test_bgp_default_originate_route_map_match_set.py b/test_bgp_default_originate_route_map_match_set.py index c9f3e8f..f8f3bb7 100644 --- a/test_bgp_default_originate_route_map_match_set.py +++ b/test_bgp_default_originate_route_map_match_set.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-or-later # Copyright (C) 2022 Nathan Mangar @@ -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 @@ -53,7 +54,7 @@ class Configs(FRRConfigs): """ bgpd = """ - #% block main + #% block main #% if router.name == 'r2' router bgp 65001 no bgp ebgp-requires-policy @@ -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 @@ -85,8 +86,8 @@ class Configs(FRRConfigs): set community 65000:1 ! #% endif - #% endblock - """ + #% endblock + """ class BGPDefaultOriginateRouteMapMatchSet( diff --git a/test_bgp_distance_change.py b/test_bgp_distance_change.py index d7084bf..cf4fb06 100644 --- a/test_bgp_distance_change.py +++ b/test_bgp_distance_change.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-or-later # Copyright (C) 2022 Jugroo Jesvin Brian @@ -58,7 +59,7 @@ 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' @@ -66,8 +67,7 @@ class Configs(FRRConfigs): 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 """ diff --git a/test_bgp_dont_capability_negotiate.py b/test_bgp_dont_capability_negotiate.py index 97a2f4f..49cb496 100644 --- a/test_bgp_dont_capability_negotiate.py +++ b/test_bgp_dont_capability_negotiate.py @@ -1,3 +1,7 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2022 Nathan Mangar + from topotato import * """ @@ -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 @@ -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' @@ -60,8 +64,8 @@ class Configs(FRRConfigs): neighbor {{ routers.r2.ifaces[0].ip4[0].ip }} dont-capability-negotiate ! #% endif - #% endblock - """ + #% endblock + """ @config_fixture(Configs) diff --git a/test_bgp_minimum_holdtime.py b/test_bgp_minimum_holdtime.py index 3f45201..b1f6ff7 100644 --- a/test_bgp_minimum_holdtime.py +++ b/test_bgp_minimum_holdtime.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-or-later # Copyright (C) 2022 Nathan Mangar @@ -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 @@ -50,7 +51,7 @@ class Configs(FRRConfigs): """ bgpd = """ - #% block main + #% block main #% if router.name == 'r2' router bgp 65001 no bgp ebgp-requires-policy @@ -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): diff --git a/test_bgp_rmap_extcommunity_none.py b/test_bgp_rmap_extcommunity_none.py index 7b4b270..ea0d507 100644 --- a/test_bgp_rmap_extcommunity_none.py +++ b/test_bgp_rmap_extcommunity_none.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-or-later # Copyright (C) 2022 Nathan Mangar @@ -39,12 +40,12 @@ class Configs(FRRConfigs): #% block main #% if router.name == 'r2' interface lo - ip address {{ routers.r2.lo_ip4[0] }} + ip address {{ routers.r2.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 diff --git a/test_bgp_route_map_match_ipv6_nexthop.py b/test_bgp_route_map_match_ipv6_nexthop.py index 0713efd..f6b515e 100644 --- a/test_bgp_route_map_match_ipv6_nexthop.py +++ b/test_bgp_route_map_match_ipv6_nexthop.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-or-later # Copyright (C) 2022 Nathan Mangar @@ -59,7 +60,7 @@ class Configs(FRRConfigs): """ bgpd = """ - #% block main + #% block main #% if router.name == 'r2' ! bgp send-extra-data zebra @@ -132,8 +133,8 @@ class Configs(FRRConfigs): set community 65002:5 ! #% endif - #% endblock - """ + #% endblock + """ class TestBGPRouteMapMatchIPV6NextHopAccessList( diff --git a/test_bgp_set_aspath_replace.py b/test_bgp_set_aspath_replace.py index abd0964..0479c57 100644 --- a/test_bgp_set_aspath_replace.py +++ b/test_bgp_set_aspath_replace.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-or-later # Copyright (C) 2022 Nathan Mangar @@ -42,7 +43,7 @@ class Configs(FRRConfigs): #% endif #% for iface in router.ifaces interface {{ iface.ifname }} - ip address {{ iface.ip4[0] }} + ip address {{ iface.ip4[0] }} ! #% endfor ip forwarding @@ -51,7 +52,7 @@ class Configs(FRRConfigs): """ bgpd = """ - #% block main + #% block main #% if router.name == 'r1' router bgp 65001 no bgp ebgp-requires-policy @@ -87,8 +88,8 @@ class Configs(FRRConfigs): exit-address-family ! #% endif - #% endblock - """ + #% endblock + """ class BGPSetAspathReplace(TestBase, AutoFixture, topo=topology, configs=Configs):