]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgp_l3vpn_to_bgp_vrf: clone bgp_l3vpn_to_bgp_direct as starting point
authorLou Berger <lberger@labn.net>
Sun, 21 Jan 2018 13:47:16 +0000 (08:47 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 28 Nov 2018 01:22:13 +0000 (20:22 -0500)
Signed-off-by: Lou Berger <lberger@labn.net>
29 files changed:
tests/topotests/bgp_l3vpn_to_bgp_vrf/__init__.py [new file with mode: 0755]
tests/topotests/bgp_l3vpn_to_bgp_vrf/ce1/bgpd.conf [new file with mode: 0644]
tests/topotests/bgp_l3vpn_to_bgp_vrf/ce1/zebra.conf [new file with mode: 0644]
tests/topotests/bgp_l3vpn_to_bgp_vrf/ce2/bgpd.conf [new file with mode: 0644]
tests/topotests/bgp_l3vpn_to_bgp_vrf/ce2/zebra.conf [new file with mode: 0644]
tests/topotests/bgp_l3vpn_to_bgp_vrf/ce3/bgpd.conf [new file with mode: 0644]
tests/topotests/bgp_l3vpn_to_bgp_vrf/ce3/zebra.conf [new file with mode: 0644]
tests/topotests/bgp_l3vpn_to_bgp_vrf/customize.py [new file with mode: 0644]
tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/bgpd.conf [new file with mode: 0644]
tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/ldpd.conf [new file with mode: 0644]
tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/ospfd.conf [new file with mode: 0644]
tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/zebra.conf [new file with mode: 0644]
tests/topotests/bgp_l3vpn_to_bgp_vrf/r2/bgpd.conf [new file with mode: 0644]
tests/topotests/bgp_l3vpn_to_bgp_vrf/r2/ldpd.conf [new file with mode: 0644]
tests/topotests/bgp_l3vpn_to_bgp_vrf/r2/ospfd.conf [new file with mode: 0644]
tests/topotests/bgp_l3vpn_to_bgp_vrf/r2/zebra.conf [new file with mode: 0644]
tests/topotests/bgp_l3vpn_to_bgp_vrf/r3/bgpd.conf [new file with mode: 0644]
tests/topotests/bgp_l3vpn_to_bgp_vrf/r3/ldpd.conf [new file with mode: 0644]
tests/topotests/bgp_l3vpn_to_bgp_vrf/r3/ospfd.conf [new file with mode: 0644]
tests/topotests/bgp_l3vpn_to_bgp_vrf/r3/zebra.conf [new file with mode: 0644]
tests/topotests/bgp_l3vpn_to_bgp_vrf/r4/bgpd.conf [new file with mode: 0644]
tests/topotests/bgp_l3vpn_to_bgp_vrf/r4/ldpd.conf [new file with mode: 0644]
tests/topotests/bgp_l3vpn_to_bgp_vrf/r4/ospfd.conf [new file with mode: 0644]
tests/topotests/bgp_l3vpn_to_bgp_vrf/r4/zebra.conf [new file with mode: 0644]
tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/add_routes.py [new file with mode: 0644]
tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/adjacencies.py [new file with mode: 0644]
tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_routes.py [new file with mode: 0644]
tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/cleanup_all.py [new file with mode: 0644]
tests/topotests/bgp_l3vpn_to_bgp_vrf/test_bgp_l3vpn_to_bgp_vrf.py [new file with mode: 0755]

diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/__init__.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/__init__.py
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce1/bgpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce1/bgpd.conf
new file mode 100644 (file)
index 0000000..bd10248
--- /dev/null
@@ -0,0 +1,33 @@
+frr defaults traditional
+!
+hostname ce1
+password zebra
+log stdout notifications
+log monitor notifications
+log commands
+router bgp 5226
+   bgp router-id 99.0.0.1
+   neighbor 192.168.1.1 remote-as 5226
+   neighbor 192.168.1.1 update-source 192.168.1.2
+   address-family ipv4 unicast
+     network 5.1.0.0/24 route-map rm-nh
+     network 5.1.1.0/24 route-map rm-nh
+     neighbor 192.168.1.1 activate
+ exit-address-family
+!
+access-list al-any permit any
+!
+route-map rm-nh permit 10
+ match ip address al-any
+ set ip next-hop 99.0.0.1
+ set local-preference 123
+ set metric 98
+ set large-community 12:34:56
+ set extcommunity rt 89:123
+ set community 0:67
+!
+
+end
+   
+   
+
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce1/zebra.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce1/zebra.conf
new file mode 100644 (file)
index 0000000..41cce5e
--- /dev/null
@@ -0,0 +1,17 @@
+log file /tmp/ce1-zebra.log
+!
+hostname ce1
+!
+interface lo
+ ip address 99.0.0.1/32
+!
+interface ce1-eth0
+ description to r1
+ ip address 192.168.1.2/24
+ no link-detect
+!
+ip forwarding
+!
+!
+line vty
+!
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce2/bgpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce2/bgpd.conf
new file mode 100644 (file)
index 0000000..ab86c5e
--- /dev/null
@@ -0,0 +1,33 @@
+frr defaults traditional
+!
+hostname ce2
+password zebra
+log stdout notifications
+log monitor notifications
+log commands
+router bgp 5226
+   bgp router-id 99.0.0.2
+   neighbor 192.168.1.1 remote-as 5226
+   neighbor 192.168.1.1 update-source 192.168.1.2
+   address-family ipv4 unicast
+     network 5.1.0.0/24 route-map rm-nh
+     network 5.1.1.0/24 route-map rm-nh
+     neighbor 192.168.1.1 activate
+ exit-address-family
+!
+access-list al-any permit any
+!
+route-map rm-nh permit 10
+ match ip address al-any
+ set ip next-hop 99.0.0.2
+ set local-preference 100
+ set metric 100
+ set large-community 12:34:56
+ set extcommunity rt 89:123
+ set community 0:67
+!
+
+end
+   
+   
+
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce2/zebra.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce2/zebra.conf
new file mode 100644 (file)
index 0000000..b12a9d6
--- /dev/null
@@ -0,0 +1,17 @@
+log file /tmp/ce2-zebra.log
+!
+hostname ce2
+!
+interface lo
+ ip address 99.0.0.2/32
+!
+interface ce2-eth0
+ description to r3
+ ip address 192.168.1.2/24
+ no link-detect
+!
+ip forwarding
+!
+!
+line vty
+!
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce3/bgpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce3/bgpd.conf
new file mode 100644 (file)
index 0000000..7d239b0
--- /dev/null
@@ -0,0 +1,33 @@
+frr defaults traditional
+!
+hostname ce3
+password zebra
+log stdout notifications
+log monitor notifications
+log commands
+router bgp 5226
+   bgp router-id 99.0.0.3
+   neighbor 192.168.1.1 remote-as 5226
+   neighbor 192.168.1.1 update-source 192.168.1.2
+   address-family ipv4 unicast
+     network 5.1.2.0/24 route-map rm-nh
+     network 5.1.3.0/24 route-map rm-nh
+     neighbor 192.168.1.1 activate
+ exit-address-family
+!
+access-list al-any permit any
+!
+route-map rm-nh permit 10
+ match ip address al-any
+ set ip next-hop 99.0.0.3
+ set local-preference 50
+ set metric 200
+ set large-community 12:34:56
+ set extcommunity rt 89:123
+ set community 0:67
+!
+
+end
+   
+   
+
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce3/zebra.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce3/zebra.conf
new file mode 100644 (file)
index 0000000..65a5bfc
--- /dev/null
@@ -0,0 +1,17 @@
+log file /tmp/ce3-zebra.log
+!
+hostname ce3
+!
+interface lo
+ ip address 99.0.0.3/32
+!
+interface ce3-eth0
+ description to r4
+ ip address 192.168.1.2/24
+ no link-detect
+!
+ip forwarding
+!
+!
+line vty
+!
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/customize.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/customize.py
new file mode 100644 (file)
index 0000000..0d5bc0c
--- /dev/null
@@ -0,0 +1,177 @@
+#!/usr/bin/env python
+
+#
+# Part of NetDEF Topology Tests
+#
+# Copyright (c) 2017 by
+# Network Device Education Foundation, Inc. ("NetDEF")
+#
+# Permission to use, copy, modify, and/or distribute this software
+# for any purpose with or without fee is hereby granted, provided
+# that the above copyright notice and this permission notice appear
+# in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND NETDEF DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NETDEF BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
+# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+#
+
+"""
+customize.py: Simple FRR/Quagga MPLS L3VPN test topology
+
+                  |
+             +----+----+
+             |   ce1   |
+             | 99.0.0.1|                              CE Router
+             +----+----+
+       192.168.1. | .2  ce1-eth0
+                  | .1  r1-eth4
+             +---------+
+             |    r1   |
+             | 1.1.1.1 |                              PE Router
+             +----+----+
+                  | .1  r1-eth0
+                  |
+            ~~~~~~~~~~~~~
+          ~~     sw0     ~~
+          ~~ 10.0.1.0/24 ~~
+            ~~~~~~~~~~~~~
+                  |10.0.1.0/24
+                  |
+                  | .2  r2-eth0
+             +----+----+
+             |    r2   |
+             | 2.2.2.2 |                              P router
+             +--+---+--+
+    r2-eth2  .2 |   | .2  r2-eth1
+         ______/     \______
+        /                   \
+  ~~~~~~~~~~~~~        ~~~~~~~~~~~~~
+~~     sw2     ~~    ~~     sw1     ~~
+~~ 10.0.3.0/24 ~~    ~~ 10.0.2.0/24 ~~
+  ~~~~~~~~~~~~~        ~~~~~~~~~~~~~
+        |                 /    |
+         \      _________/     |
+          \    /                \
+r3-eth1 .3 |  | .3  r3-eth0      | .4 r4-eth0
+      +----+--+---+         +----+----+
+      |     r3    |         |    r4   |
+      |  3.3.3.3  |         | 4.4.4.4 |               PE Routers
+      +-----------+         +---------+
+ 192.168.1. | .1     192.168.1.  | .1    rX-eth4
+            | .2                 | .2    ceX-eth0
+      +-----+-----+         +----+-----+
+      |    ce2    |         |   ce3    |
+      | 99.0.0.2  |         | 99.0.0.3 |              CE Routers
+      +-----+-----+         +----+-----+
+            |                    |
+
+"""
+
+import os
+import sys
+import pytest
+
+# pylint: disable=C0413
+# Import topogen and topotest helpers
+from lib import topotest
+from lib.topogen import Topogen, TopoRouter, get_topogen
+from lib.topolog import logger
+
+# Required to instantiate the topology builder class.
+from mininet.topo import Topo
+
+import shutil
+CWD = os.path.dirname(os.path.realpath(__file__))
+# test name based on directory
+TEST = os.path.basename(CWD)
+
+class ThisTestTopo(Topo):
+    "Test topology builder"
+    def build(self, *_args, **_opts):
+        "Build function"
+        tgen = get_topogen(self)
+
+        # This function only purpose is to define allocation and relationship
+        # between routers, switches and hosts.
+        #
+        # Create P/PE routers
+        for routern in range(1, 5):
+            tgen.add_router('r{}'.format(routern))
+        # Create CE routers
+        for routern in range(1, 4):
+            tgen.add_router('ce{}'.format(routern))
+
+        #CE/PE links
+        tgen.add_link(tgen.gears['ce1'], tgen.gears['r1'], 'ce1-eth0', 'r1-eth4')
+        tgen.add_link(tgen.gears['ce2'], tgen.gears['r3'], 'ce2-eth0', 'r3-eth4')
+        tgen.add_link(tgen.gears['ce3'], tgen.gears['r4'], 'ce3-eth0', 'r4-eth4')
+
+        # Create a switch with just one router connected to it to simulate a
+        # empty network.
+        switch = {}
+        switch[0] = tgen.add_switch('sw0')
+        switch[0].add_link(tgen.gears['r1'], nodeif='r1-eth0')
+        switch[0].add_link(tgen.gears['r2'], nodeif='r2-eth0')
+
+        switch[1] = tgen.add_switch('sw1')
+        switch[1].add_link(tgen.gears['r2'], nodeif='r2-eth1')
+        switch[1].add_link(tgen.gears['r3'], nodeif='r3-eth0')
+        switch[1].add_link(tgen.gears['r4'], nodeif='r4-eth0')
+
+        switch[1] = tgen.add_switch('sw2')
+        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()
+
+    router = tgen.gears[rname]
+    ret = True
+    try:
+        if router.has_version(compstr, vstr):
+            ret = False
+            logger.debug('version check failed, version {} {}'.format(compstr, vstr))
+    except:
+        ret = True
+    if ret == False:
+        ret = 'Skipping main tests on old version ({}{})'.format(compstr, vstr)
+        logger.info(ret)
+    if cli:
+        logger.info('calling mininet CLI')
+        tgen.mininet_cli()
+        logger.info('exited mininet CLI')
+    return ret
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/bgpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/bgpd.conf
new file mode 100644 (file)
index 0000000..7ec941e
--- /dev/null
@@ -0,0 +1,40 @@
+frr defaults traditional
+!
+hostname r1
+password zebra
+log stdout notifications
+log monitor notifications
+log commands
+router bgp 5226
+   bgp router-id 1.1.1.1
+   bgp cluster-id 1.1.1.1
+   neighbor 192.168.1.2 remote-as 5226
+   neighbor 192.168.1.2 update-source 192.168.1.1
+   neighbor 192.168.1.2 route-reflector-client
+   neighbor 2.2.2.2 remote-as 5226
+   neighbor 2.2.2.2 update-source 1.1.1.1
+!
+   address-family ipv4 unicast
+     redistribute vnc-direct
+     neighbor 192.168.1.2 activate
+     neighbor 192.168.1.2 next-hop-self
+     no neighbor 2.2.2.2 activate
+   exit-address-family
+!
+   address-family ipv4 vpn
+     neighbor 2.2.2.2 activate
+   exit-address-family
+!
+   vrf-policy cust1
+      label 101
+      rd 10:1
+      rt both 52:100
+      nexthop 192.168.1.1
+   exit-vrf-policy
+!
+ vnc export bgp mode group-nve
+ vnc export bgp group-nve group cust1
+ vnc redistribute mode resolve-nve
+ vnc redistribute ipv4 bgp-direct
+ !
+end
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/ldpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/ldpd.conf
new file mode 100644 (file)
index 0000000..428b674
--- /dev/null
@@ -0,0 +1,23 @@
+hostname r1
+log file /tmp/r1-ldpd.log
+!
+debug mpls ldp zebra
+debug mpls ldp event
+debug mpls ldp errors
+debug mpls ldp messages recv
+debug mpls ldp messages sent
+debug mpls ldp discovery hello recv
+debug mpls ldp discovery hello sent
+!
+mpls ldp
+ router-id 1.1.1.1
+ !
+ address-family ipv4
+  discovery transport-address 1.1.1.1
+  !
+  interface r1-eth0
+  !
+ !
+!
+line vty
+!
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/ospfd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/ospfd.conf
new file mode 100644 (file)
index 0000000..d05e7c9
--- /dev/null
@@ -0,0 +1,8 @@
+hostname r1
+log file /tmp/r1-ospfd.log
+!
+router ospf
+ router-id 1.1.1.1
+ network 0.0.0.0/4 area 0
+ redistribute static
+!
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/zebra.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/zebra.conf
new file mode 100644 (file)
index 0000000..cddc7b6
--- /dev/null
@@ -0,0 +1,24 @@
+log file /tmp/r1-zebra.log
+!
+hostname r1
+!
+interface lo
+ ip address 1.1.1.1/32
+!
+interface r1-eth0
+ description to sw0
+ ip address 10.0.1.1/24
+ no link-detect
+!
+interface r1-eth4
+ description to ce1
+ ip address 192.168.1.1/24
+ no link-detect
+!
+ip route 99.0.0.1/32 192.168.1.2
+!
+ip forwarding
+!
+!
+line vty
+!
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r2/bgpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r2/bgpd.conf
new file mode 100644 (file)
index 0000000..241c2ac
--- /dev/null
@@ -0,0 +1,33 @@
+frr defaults traditional
+!
+hostname r2
+password zebra
+log stdout notifications
+log monitor notifications
+log commands
+router bgp 5226
+   bgp router-id 2.2.2.2
+   bgp cluster-id 2.2.2.2
+   neighbor 1.1.1.1 remote-as 5226
+   neighbor 1.1.1.1 update-source 2.2.2.2
+   neighbor 3.3.3.3 remote-as 5226
+   neighbor 3.3.3.3 update-source 2.2.2.2
+   neighbor 4.4.4.4 remote-as 5226
+   neighbor 4.4.4.4 update-source 2.2.2.2
+   address-family ipv4 unicast
+     no neighbor 1.1.1.1 activate
+     no neighbor 3.3.3.3 activate
+     no neighbor 4.4.4.4 activate
+   exit-address-family
+   address-family ipv4 vpn
+     neighbor 1.1.1.1 activate
+     neighbor 1.1.1.1 route-reflector-client
+     neighbor 3.3.3.3 activate
+     neighbor 3.3.3.3 route-reflector-client
+     neighbor 4.4.4.4 activate
+     neighbor 4.4.4.4 route-reflector-client
+   exit-address-family
+end
+   
+   
+
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r2/ldpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r2/ldpd.conf
new file mode 100644 (file)
index 0000000..9bba8d8
--- /dev/null
@@ -0,0 +1,25 @@
+hostname r2
+log file /tmp/r2-ldpd.log
+!
+debug mpls ldp zebra
+debug mpls ldp event
+debug mpls ldp errors
+debug mpls ldp messages recv
+debug mpls ldp messages sent
+debug mpls ldp discovery hello recv
+debug mpls ldp discovery hello sent
+!
+mpls ldp
+ router-id 2.2.2.2
+ !
+ address-family ipv4
+  discovery transport-address 2.2.2.2
+  !
+  interface r2-eth0
+  !
+  interface r2-eth1
+  !
+ !
+!
+line vty
+!
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r2/ospfd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r2/ospfd.conf
new file mode 100644 (file)
index 0000000..c58914a
--- /dev/null
@@ -0,0 +1,7 @@
+hostname r2
+log file /tmp/r2-ospfd.log
+!
+router ospf
+ router-id 2.2.2.2
+ network 0.0.0.0/0 area 0
+!
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r2/zebra.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r2/zebra.conf
new file mode 100644 (file)
index 0000000..b74ce31
--- /dev/null
@@ -0,0 +1,27 @@
+log file /tmp/r2-zebra.log
+!
+hostname r2
+!
+interface lo
+ ip address 2.2.2.2/32
+!
+interface r2-eth0
+ description to sw0
+ ip address 10.0.1.2/24
+ no link-detect
+!
+interface r2-eth1
+ description to sw1
+ ip address 10.0.2.2/24
+ no link-detect
+!
+interface r2-eth2
+ description to sw2
+ ip address 10.0.3.2/24
+ no link-detect
+!
+ip forwarding
+!
+!
+line vty
+!
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r3/bgpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r3/bgpd.conf
new file mode 100644 (file)
index 0000000..5591c63
--- /dev/null
@@ -0,0 +1,42 @@
+frr defaults traditional
+!
+hostname r3
+password zebra
+log stdout notifications
+log monitor notifications
+log commands
+router bgp 5226
+   bgp router-id 3.3.3.3
+   bgp cluster-id 3.3.3.3
+   neighbor 192.168.1.2 remote-as 5226
+   neighbor 192.168.1.2 update-source 192.168.1.2 
+   neighbor 192.168.1.2 route-reflector-client
+   neighbor 2.2.2.2 remote-as 5226
+   neighbor 2.2.2.2 update-source 3.3.3.3
+!
+   address-family ipv4 unicast
+     redistribute vnc-direct
+     neighbor 192.168.1.2 activate
+     neighbor 192.168.1.2 next-hop-self
+     no neighbor 2.2.2.2 activate
+   exit-address-family
+   address-family ipv4 vpn
+     neighbor 2.2.2.2 activate
+   exit-address-family
+!
+   vrf-policy cust1
+      label 103
+      rd 10:3
+      rt both 52:100
+      nexthop 192.168.1.1
+   exit-vrf-policy
+!
+ vnc export bgp mode group-nve
+ vnc export bgp group-nve group cust1
+ vnc redistribute mode resolve-nve
+ vnc redistribute ipv4 bgp-direct
+!
+end
+   
+   
+
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r3/ldpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r3/ldpd.conf
new file mode 100644 (file)
index 0000000..53ccf9e
--- /dev/null
@@ -0,0 +1,23 @@
+hostname r3
+log file /tmp/r3-ldpd.log
+!
+debug mpls ldp zebra
+debug mpls ldp event
+debug mpls ldp errors
+debug mpls ldp messages recv
+debug mpls ldp messages sent
+debug mpls ldp discovery hello recv
+debug mpls ldp discovery hello sent
+!
+mpls ldp
+ router-id 3.3.3.3
+ !
+ address-family ipv4
+  discovery transport-address 3.3.3.3
+  !
+  interface r3-eth0
+  !
+ !
+!
+line vty
+!
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r3/ospfd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r3/ospfd.conf
new file mode 100644 (file)
index 0000000..bbd9487
--- /dev/null
@@ -0,0 +1,9 @@
+hostname r3
+password 1
+log file /tmp/r3-ospfd.log
+!
+router ospf
+ router-id 3.3.3.3
+ network 0.0.0.0/4 area 0
+ redistribute static
+!
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r3/zebra.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r3/zebra.conf
new file mode 100644 (file)
index 0000000..eff266b
--- /dev/null
@@ -0,0 +1,29 @@
+log file /tmp/r3-zebra.log
+!
+hostname r3
+!
+interface lo
+ ip address 3.3.3.3/32
+!
+interface r3-eth0
+ description to sw1
+ ip address 10.0.2.3/24
+ no link-detect
+!
+interface r3-eth1
+ description to sw2
+ ip address 10.0.3.3/24
+ no link-detect
+!
+interface r3-eth4
+ description to ce2
+ ip address 192.168.1.1/24
+ no link-detect
+!
+ip route 99.0.0.2/32 192.168.1.2
+!
+ip forwarding
+!
+!
+line vty
+!
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r4/bgpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r4/bgpd.conf
new file mode 100644 (file)
index 0000000..145390d
--- /dev/null
@@ -0,0 +1,42 @@
+frr defaults traditional
+!
+hostname r4
+password zebra
+log stdout notifications
+log monitor notifications
+log commands
+router bgp 5226
+   bgp router-id 4.4.4.4
+   bgp cluster-id 4.4.4.4
+   neighbor 192.168.1.2 remote-as 5226
+   neighbor 192.168.1.2 update-source 192.168.1.1
+   neighbor 192.168.1.2 route-reflector-client
+   neighbor 2.2.2.2 remote-as 5226
+   neighbor 2.2.2.2 update-source 4.4.4.4
+!
+   address-family ipv4 unicast
+     redistribute vnc-direct
+     neighbor 192.168.1.2 activate
+     neighbor 192.168.1.2 next-hop-self
+     no neighbor 2.2.2.2 activate
+   exit-address-family
+   address-family ipv4 vpn
+     neighbor 2.2.2.2 activate
+   exit-address-family
+!
+   vrf-policy cust1
+      label 104
+      rd 10:4
+      rt both 52:100
+      nexthop 192.168.1.1
+   exit-vrf-policy
+!
+ vnc export bgp mode group-nve
+ vnc export bgp group-nve group cust1
+ vnc redistribute mode resolve-nve
+ vnc redistribute ipv4 bgp-direct
+!
+end
+   
+   
+
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r4/ldpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r4/ldpd.conf
new file mode 100644 (file)
index 0000000..7bfdf7f
--- /dev/null
@@ -0,0 +1,23 @@
+hostname r4
+log file /tmp/r4-ldpd.log
+!
+debug mpls ldp zebra
+debug mpls ldp event
+debug mpls ldp errors
+debug mpls ldp messages recv
+debug mpls ldp messages sent
+debug mpls ldp discovery hello recv
+debug mpls ldp discovery hello sent
+!
+mpls ldp
+ router-id 4.4.4.4
+ !
+ address-family ipv4
+  discovery transport-address 4.4.4.4
+  !
+  interface r4-eth0
+  !
+ !
+!
+line vty
+!
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r4/ospfd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r4/ospfd.conf
new file mode 100644 (file)
index 0000000..c2355d2
--- /dev/null
@@ -0,0 +1,8 @@
+hostname r4
+log file /tmp/r4-ospfd.log
+!
+router ospf
+ router-id 4.4.4.4
+ network 0.0.0.0/4 area 0
+ redistribute static
+!
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r4/zebra.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r4/zebra.conf
new file mode 100644 (file)
index 0000000..6bcb302
--- /dev/null
@@ -0,0 +1,23 @@
+log file /tmp/r4-zebra.log
+!
+hostname r4
+!
+interface lo
+ ip address 4.4.4.4/32
+!
+interface r4-eth0
+ description to sw1
+ ip address 10.0.2.4/24
+ no link-detect
+!
+interface r4-eth4
+ description to ce3
+ ip address 192.168.1.1/24
+ no link-detect
+!
+ip route 99.0.0.3/32 192.168.1.2
+!
+ip forwarding
+!
+line vty
+!
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/add_routes.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/add_routes.py
new file mode 100644 (file)
index 0000000..2b853b9
--- /dev/null
@@ -0,0 +1,19 @@
+from lutil import luCommand
+luCommand('r1','vtysh -c "add vrf cust1 prefix 99.0.0.1/32"','.','none','IP Address')
+luCommand('r3','vtysh -c "show bgp ipv4 vpn"','i99.0.0.1/32','wait','See R1s address')
+luCommand('r4','vtysh -c "show bgp ipv4 vpn"','i99.0.0.1/32','wait','See R1s address')
+luCommand('r3','vtysh -c "add vrf cust1 prefix 99.0.0.2/32"','.','none','IP Address')
+luCommand('r1','vtysh -c "show bgp ipv4 vpn"','i99.0.0.2/32','wait','See R3s address')
+luCommand('r4','vtysh -c "show bgp ipv4 vpn"','i99.0.0.2/32','wait','See R3s address')
+luCommand('r4','vtysh -c "add vrf cust1 prefix 99.0.0.3/32"','.','none','IP Address')
+luCommand('r1','vtysh -c "show bgp ipv4 vpn"','i99.0.0.3/32','wait','See R4s address')
+luCommand('r3','vtysh -c "show bgp ipv4 vpn"','i99.0.0.3/32','wait','See R4s address')
+luCommand('r1','vtysh -c "show vnc registrations local"','99.0.0.1','pass','Local Registration')
+luCommand('r3','vtysh -c "show vnc registrations local"','99.0.0.2','pass','Local Registration')
+luCommand('r4','vtysh -c "show vnc registrations local"','99.0.0.3','pass','Local Registration')
+luCommand('r1','vtysh -c "show vnc registrations remote"','4 out of 4','wait','Remote Registration')
+luCommand('r3','vtysh -c "show vnc registrations remote"','6 out of 6','wait','Remote Registration')
+luCommand('r4','vtysh -c "show vnc registrations remote"','4 out of 4','wait','Remote Registration')
+luCommand('r1','vtysh -c "show vnc registrations"','.','none')
+luCommand('r3','vtysh -c "show vnc registrations"','.','none')
+luCommand('r4','vtysh -c "show vnc registrations"','.','none')
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/adjacencies.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/adjacencies.py
new file mode 100644 (file)
index 0000000..63addc8
--- /dev/null
@@ -0,0 +1,12 @@
+from lutil import luCommand
+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')
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_routes.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_routes.py
new file mode 100644 (file)
index 0000000..dab2f8c
--- /dev/null
@@ -0,0 +1,12 @@
+from lutil import luCommand
+luCommand('ce1','vtysh -c "show bgp ipv4 uni"','7 routes and 7','wait','Local and remote routes')
+luCommand('ce2','vtysh -c "show bgp ipv4 uni"','7 routes and 9','wait','Local and remote routes')
+luCommand('ce3','vtysh -c "show bgp ipv4 uni"','7 routes and 7','wait','Local and remote routes')
+luCommand('r1','vtysh -c "show bgp ipv4 uni"','7 routes and 9','pass','Unicast SAFI')
+luCommand('r2','vtysh -c "show bgp ipv4 uni"','No BGP prefixes displayed','pass','Unicast SAFI')
+luCommand('r3','vtysh -c "show bgp ipv4 uni"','7 routes and 9','pass','Unicast SAFI')
+luCommand('r4','vtysh -c "show bgp ipv4 uni"','7 routes and 9','pass','Unicast SAFI')
+luCommand('r1','vtysh -c "show bgp ipv4 vpn"','7 routes and 7','pass','VPN SAFI')
+luCommand('r2','vtysh -c "show bgp ipv4 vpn"','7 routes and 7','pass','VPN SAFI')
+luCommand('r3','vtysh -c "show bgp ipv4 vpn"','7 routes and 7','pass','VPN SAFI')
+luCommand('r4','vtysh -c "show bgp ipv4 vpn"','7 routes and 7','pass','VPN SAFI')
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/cleanup_all.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/cleanup_all.py
new file mode 100644 (file)
index 0000000..3a2f037
--- /dev/null
@@ -0,0 +1,17 @@
+from lutil import luCommand
+luCommand('r1','vtysh -c "clear vrf cust1 prefix 99.0.0.1/32"','.','none','Cleared VRF route')
+luCommand('r3','vtysh -c "clear vrf cust1 prefix 99.0.0.2/32"','.','none','Cleared VRF route')
+luCommand('r4','vtysh -c "clear vrf cust1 prefix 99.0.0.3/32"','.','none','Cleared VRF route')
+luCommand('r1','vtysh -c "show vnc registrations local"','99.0.0.1','fail','Local Registration cleared')
+luCommand('r3','vtysh -c "show vnc registrations local"','99.0.0.2','fail','Local Registration cleared')
+luCommand('r4','vtysh -c "show vnc registrations local"','99.0.0.3','fail','Local Registration cleared')
+luCommand('r1','vtysh -c "show bgp ipv4 uni"','2 routes and 2','wait','Unicast SAFI updated')
+luCommand('r2','vtysh -c "show bgp ipv4 uni"','No BGP prefixes displayed','pass','Unicast SAFI')
+luCommand('r3','vtysh -c "show bgp ipv4 uni"','2 routes and 2','wait','Unicast SAFI updated')
+luCommand('r4','vtysh -c "show bgp ipv4 uni"','2 routes and 2','wait','Unicast SAFI updated')
+luCommand('ce1','vtysh -c "show bgp ipv4 uni"','2 routes and 2','wait','Local and remote routes')
+luCommand('ce2','vtysh -c "show bgp ipv4 uni"','2 routes and 2','wait','Local and remote routes')
+luCommand('ce3','vtysh -c "show bgp ipv4 uni"','2 routes and 2','wait','Local and remote routes')
+luCommand('r1','vtysh -c "show vnc registrations remote"','Prefix ','fail','Remote Registration cleared')
+luCommand('r3','vtysh -c "show vnc registrations remote"','Prefix ','fail','Remote Registration cleared')
+luCommand('r4','vtysh -c "show vnc registrations remote"','Prefix ','fail','Remote Registration cleared')
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/test_bgp_l3vpn_to_bgp_vrf.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/test_bgp_l3vpn_to_bgp_vrf.py
new file mode 100755 (executable)
index 0000000..050f222
--- /dev/null
@@ -0,0 +1,75 @@
+#!/usr/bin/env python
+
+#
+# Part of NetDEF Topology Tests
+#
+# Copyright (c) 2018, LabN Consulting, L.L.C.
+# Authored by Lou Berger <lberger@labn.net>
+#
+# Permission to use, copy, modify, and/or distribute this software
+# for any purpose with or without fee is hereby granted, provided
+# that the above copyright notice and this permission notice appear
+# in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND NETDEF DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NETDEF BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
+# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+#
+
+import os
+import sys
+import pytest
+
+CWD = os.path.dirname(os.path.realpath(__file__))
+sys.path.append(os.path.join(CWD, '../'))
+sys.path.append(CWD)
+
+from lib.ltemplate import *
+
+def test_ltemplate_start():
+    ltemplate_start(CWD)
+
+def test_adjacencies():
+    CliOnFail = None
+    # For debugging, uncomment the next line
+    #CliOnFail = 'tgen.mininet_cli'
+    CheckFunc = 'versionCheck(\'3.1\')'
+    #uncomment next line to start cli *before* script is run
+    #CheckFunc = 'versionCheck(\'3.1\', cli=True)'
+    ltemplateTest('scripts/adjacencies.py', False, CliOnFail, CheckFunc)
+
+def test_add_routes():
+    CliOnFail = None
+    # For debugging, uncomment the next line
+    #CliOnFail = 'tgen.mininet_cli'
+    CheckFunc = 'versionCheck(\'3.1\')'
+    #uncomment next line to start cli *before* script is run
+    #CheckFunc = 'versionCheck(\'3.1\', cli=True)'
+    ltemplateTest('scripts/add_routes.py', False, CliOnFail, CheckFunc)
+
+def test_check_routes():
+    CliOnFail = None
+    # For debugging, uncomment the next line
+    #CliOnFail = 'tgen.mininet_cli'
+    CheckFunc = 'versionCheck(\'3.1\')'
+    #uncomment next line to start cli *before* script is run
+    #CheckFunc = 'versionCheck(\'3.1\', cli=True)'
+    ltemplateTest('scripts/check_routes.py', False, CliOnFail, CheckFunc)
+
+def test_cleanup_all():
+    CliOnFail = None
+    # For debugging, uncomment the next line
+    #CliOnFail = 'tgen.mininet_cli'
+    CheckFunc = 'versionCheck(\'3.1\')'
+    #uncomment next line to start cli *before* script is run
+    #CheckFunc = 'versionCheck(\'3.1\', cli=True)'
+    ltemplateTest('scripts/cleanup_all.py', False, CliOnFail, CheckFunc)
+
+if __name__ == '__main__':
+    retval = pytest.main(["-s"])
+    sys.exit(retval)