Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #128 from LabNConsulting/working/bgp_rfapi_basic_s…
…anity bgp_rfapi_basic_sanity: added basic rfapi sanity topotest
- Loading branch information
Showing
21 changed files
with
678 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
#!/usr/bin/env python | ||
|
||
# | ||
# Part of NetDEF Topology Tests | ||
# | ||
# Copyright (c) 2017-2018 by | ||
# Network Device Education Foundation, Inc. ("NetDEF") | ||
# Modified by LabN Consulting, L.L.C. | ||
# | ||
# 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 | ||
+---------+ | ||
| 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 | ||
+-----------+ +---------+ | ||
""" | ||
|
||
import os | ||
import re | ||
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 | ||
from lib.ltemplate import ltemplateRtrCmd | ||
|
||
# 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 | ||
tgen.add_router('r1') | ||
for routern in range(2, 5): | ||
tgen.add_router('r{}'.format(routern)) | ||
# 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[2] = tgen.add_switch('sw2') | ||
switch[2].add_link(tgen.gears['r2'], nodeif='r2-eth2') | ||
switch[2].add_link(tgen.gears['r3'], nodeif='r3-eth1') | ||
|
||
def ltemplatePreRouterStartHook(): | ||
cc = ltemplateRtrCmd() | ||
tgen = get_topogen() | ||
logger.info('pre router-start hook') | ||
#check for normal init | ||
if len(tgen.net) == 1: | ||
logger.info('Topology not configured, skipping setup') | ||
return False | ||
return True | ||
|
||
def ltemplatePostRouterStartHook(): | ||
logger.info('post router-start hook') | ||
return True | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
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 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 | ||
no neighbor 2.2.2.2 activate | ||
exit-address-family | ||
! | ||
address-family ipv4 vpn | ||
neighbor 2.2.2.2 activate | ||
exit-address-family | ||
! | ||
rfp holddown-factor 100 | ||
! | ||
vnc defaults | ||
rd auto:vn:123 | ||
response-lifetime 45 | ||
rt both 1000:1 1000:2 | ||
exit-vnc | ||
! | ||
vnc nve-group red | ||
prefix vn 10.0.0.0/8 | ||
rd auto:vn:10 | ||
rt both 1000:10 | ||
exit-vnc | ||
! | ||
vnc nve-group blue | ||
prefix vn 20.0.0.0/8 | ||
rd auto:vn:20 | ||
rt both 1000:20 | ||
exit-vnc | ||
! | ||
vnc nve-group green | ||
prefix vn 30.0.0.0/8 | ||
rd auto:vn:20 | ||
rt both 1000:30 | ||
exit-vnc | ||
! | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
hostname r1 | ||
log file ospfd.log | ||
! | ||
router ospf | ||
router-id 1.1.1.1 | ||
network 0.0.0.0/4 area 0 | ||
redistribute static | ||
! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
log file 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 | ||
! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
hostname r2 | ||
log file ospfd.log | ||
! | ||
router ospf | ||
router-id 2.2.2.2 | ||
network 0.0.0.0/0 area 0 | ||
! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
log file 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 | ||
! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
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 2.2.2.2 remote-as 5226 | ||
neighbor 2.2.2.2 update-source 3.3.3.3 | ||
! | ||
address-family ipv4 unicast | ||
no neighbor 2.2.2.2 activate | ||
exit-address-family | ||
address-family ipv4 vpn | ||
neighbor 2.2.2.2 activate | ||
exit-address-family | ||
! | ||
rfp holddown-factor 100 | ||
! | ||
vnc defaults | ||
rd auto:vn:123 | ||
response-lifetime 45 | ||
rt both 1000:1 1000:2 | ||
exit-vnc | ||
! | ||
vnc nve-group red | ||
prefix vn 10.0.0.0/8 | ||
rd auto:vn:10 | ||
rt both 1000:10 | ||
exit-vnc | ||
! | ||
vnc nve-group blue | ||
prefix vn 20.0.0.0/8 | ||
rd auto:vn:20 | ||
rt both 1000:20 | ||
exit-vnc | ||
! | ||
vnc nve-group green | ||
prefix vn 30.0.0.0/8 | ||
rd auto:vn:20 | ||
rt both 1000:30 | ||
exit-vnc | ||
! | ||
end | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
hostname r3 | ||
password 1 | ||
log file ospfd.log | ||
! | ||
router ospf | ||
router-id 3.3.3.3 | ||
network 0.0.0.0/4 area 0 | ||
redistribute static | ||
! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
log file 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 | ||
! |
Oops, something went wrong.