From c30e3e40a6282470314717f92a2c5e08a1d06a23 Mon Sep 17 00:00:00 2001 From: Lou Berger Date: Tue, 9 Jan 2018 10:07:43 -0500 Subject: [PATCH] bgp_direct_to_bgp_vpn: enable mpls forwarding, add more details on adjacencies Signed-off-by: Lou Berger --- .../bgp_direct_to_bgp_vpn/customize.py | 28 +++++++++++++++++++ .../scripts/adjacencies.py | 15 +++++++--- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/tests/topotests/bgp_direct_to_bgp_vpn/customize.py b/tests/topotests/bgp_direct_to_bgp_vpn/customize.py index 175970e6a3..8d613b2921 100644 --- a/tests/topotests/bgp_direct_to_bgp_vpn/customize.py +++ b/tests/topotests/bgp_direct_to_bgp_vpn/customize.py @@ -128,6 +128,34 @@ class ThisTestTopo(Topo): switch[1].add_link(tgen.gears['r2'], nodeif='r2-eth2') switch[1].add_link(tgen.gears['r3'], nodeif='r3-eth1') +def doCmd(tgen, rtr, cmd): + output = tgen.net[rtr].cmd(cmd).strip() + if len(output): + logger.info('command output: ' + output) + +def autogenPreRouterStartHook(): + tgen = get_topogen() + logger.info('pre router-start hook') + #configure r2 mpls interfaces + intfs = ['lo', 'r2-eth0', 'r2-eth1', 'r2-eth2'] + for intf in intfs: + doCmd(tgen, 'r2', 'echo 1 > /proc/sys/net/mpls/conf/{}/input'.format(intf)) + #configure MPLS + rtrs = ['r1', 'r3', 'r4'] + cmds = ['echo 1 > /proc/sys/net/mpls/conf/lo/input'] + for rtr in rtrs: + for cmd in cmds: + doCmd(tgen, rtr, cmd) + intfs = ['lo', rtr+'-eth0', rtr+'-eth4'] + for intf in intfs: + doCmd(tgen, rtr, 'echo 1 > /proc/sys/net/mpls/conf/{}/input'.format(intf)) + logger.info('setup mpls input') + return; + +def autogenPostRouterStartHook(): + logger.info('post router-start hook') + return; + def versionCheck(vstr, rname='r1', compstr='<',cli=False): tgen = get_topogen() diff --git a/tests/topotests/bgp_direct_to_bgp_vpn/scripts/adjacencies.py b/tests/topotests/bgp_direct_to_bgp_vpn/scripts/adjacencies.py index 2645d28f30..63addc8544 100644 --- a/tests/topotests/bgp_direct_to_bgp_vpn/scripts/adjacencies.py +++ b/tests/topotests/bgp_direct_to_bgp_vpn/scripts/adjacencies.py @@ -1,5 +1,12 @@ from lutil import luCommand -luCommand('r1','vtysh -c "show bgp summary"',' 00:0.* 00:0','wait','Adjacencies up', 60) -luCommand('r2','vtysh -c "show bgp summary"',' 00:0.* 00:0','wait','Adjacencies up') -luCommand('r3','vtysh -c "show bgp summary"',' 00:0.* 00:0','wait','Adjacencies up') -luCommand('r4','vtysh -c "show bgp summary"',' 00:0.* 00:0','wait','Adjacencies up') +luCommand('r2','vtysh -c "show bgp summary"',' 00:0.* 00:0.* 00:0','wait','Core adjacencies up',90) +luCommand('r1','vtysh -c "show bgp summary"',' 00:0','pass','Core adjacencies up') +luCommand('r3','vtysh -c "show bgp summary"',' 00:0','pass','Core adjacencies up') +luCommand('r4','vtysh -c "show bgp summary"',' 00:0','pass','Core adjacencies up') + +luCommand('ce1','vtysh -c "show bgp summary"',' 00:0','wait','Adjacencies up',90) +luCommand('ce2','vtysh -c "show bgp summary"',' 00:0','wait','Adjacencies up') +luCommand('ce3','vtysh -c "show bgp summary"',' 00:0','wait','Adjacencies up') +luCommand('r1','vtysh -c "show bgp vrf all summary"',' 00:0.* 00:0','pass','All adjacencies up') +luCommand('r3','vtysh -c "show bgp vrf all summary"',' 00:0.* 00:0','pass','All adjacencies up') +luCommand('r4','vtysh -c "show bgp vrf all summary"',' 00:0.* 00:0','pass','All adjacencies up') -- 2.39.5