]>
git.proxmox.com Git - mirror_frr.git/blob - tests/topotests/bgp_rfapi_basic_sanity/customize.py
2 # SPDX-License-Identifier: ISC
5 # Part of NetDEF Topology Tests
7 # Copyright (c) 2017-2018 by
8 # Network Device Education Foundation, Inc. ("NetDEF")
9 # Modified by LabN Consulting, L.L.C.
13 customize.py: Simple FRR MPLS L3VPN test topology
32 r2-eth2 .2 | | .2 r2-eth1
35 ~~~~~~~~~~~~~ ~~~~~~~~~~~~~
37 ~~ 10.0.3.0/24 ~~ ~~ 10.0.2.0/24 ~~
38 ~~~~~~~~~~~~~ ~~~~~~~~~~~~~
42 r3-eth1 .3 | | .3 r3-eth0 | .4 r4-eth0
43 +----+--+---+ +----+----+
45 | 3.3.3.3 | | 4.4.4.4 | PE Routers
46 +-----------+ +---------+
52 # pylint: disable=C0413
53 # Import topogen and topotest helpers
54 from lib
.topogen
import get_topogen
55 from lib
.topolog
import logger
56 from lib
.ltemplate
import ltemplateRtrCmd
58 # Required to instantiate the topology builder class.
61 CWD
= os
.path
.dirname(os
.path
.realpath(__file__
))
62 # test name based on directory
63 TEST
= os
.path
.basename(CWD
)
69 # This function only purpose is to define allocation and relationship
70 # between routers, switches and hosts.
74 for routern
in range(2, 5):
75 tgen
.add_router("r{}".format(routern
))
76 # Create a switch with just one router connected to it to simulate a
79 switch
[0] = tgen
.add_switch("sw0")
80 switch
[0].add_link(tgen
.gears
["r1"], nodeif
="r1-eth0")
81 switch
[0].add_link(tgen
.gears
["r2"], nodeif
="r2-eth0")
83 switch
[1] = tgen
.add_switch("sw1")
84 switch
[1].add_link(tgen
.gears
["r2"], nodeif
="r2-eth1")
85 switch
[1].add_link(tgen
.gears
["r3"], nodeif
="r3-eth0")
86 switch
[1].add_link(tgen
.gears
["r4"], nodeif
="r4-eth0")
88 switch
[2] = tgen
.add_switch("sw2")
89 switch
[2].add_link(tgen
.gears
["r2"], nodeif
="r2-eth2")
90 switch
[2].add_link(tgen
.gears
["r3"], nodeif
="r3-eth1")
93 def ltemplatePreRouterStartHook():
94 cc
= ltemplateRtrCmd()
96 logger
.info("pre router-start hook")
100 def ltemplatePostRouterStartHook():
101 logger
.info("post router-start hook")