From bf271fdf6eadab97017997cb3227e6e5dbc6ecd5 Mon Sep 17 00:00:00 2001 From: vikas89 Date: Tue, 9 Dec 2014 12:12:33 -0800 Subject: [PATCH 01/12] added bird files --- examples/bird_exp/__init__.py | 3 + examples/bird_exp/configs/a1/bird.conf | 48 +++ examples/bird_exp/configs/a1/bird.conf~ | 59 ++++ examples/bird_exp/configs/a1/envvars | 3 + examples/bird_exp/configs/b1/bird.conf | 48 +++ examples/bird_exp/configs/b1/bird.conf~ | 218 ++++++++++++++ examples/bird_exp/configs/b1/envvars | 3 + examples/bird_exp/configs/c1/bird.conf | 48 +++ examples/bird_exp/configs/c1/bird.conf~ | 95 ++++++ examples/bird_exp/configs/c1/envvars | 3 + examples/bird_exp/configs/c2/bird.conf | 48 +++ examples/bird_exp/configs/c2/bird.conf~ | 48 +++ examples/bird_exp/configs/c2/envvars | 3 + examples/bird_exp/configs/d1/bird.conf | 48 +++ examples/bird_exp/configs/d1/bird.conf~ | 218 ++++++++++++++ examples/bird_exp/configs/d1/envvars | 3 + examples/bird_exp/configs/rs/bird.conf | 139 +++++++++ examples/bird_exp/configs/rs/bird.conf~ | 375 ++++++++++++++++++++++++ examples/bird_exp/configs/rs/envvars | 3 + examples/bird_exp/start.py | 67 +++++ examples/bird_exp/start.py~ | 67 +++++ examples/bird_exp/topo.py | 77 +++++ examples/bird_exp/topo.pyc | Bin 0 -> 2460 bytes examples/bird_exp/topo.py~ | 77 +++++ mininext/services/bird.py | 96 ++++++ 25 files changed, 1797 insertions(+) create mode 100644 examples/bird_exp/__init__.py create mode 100755 examples/bird_exp/configs/a1/bird.conf create mode 100755 examples/bird_exp/configs/a1/bird.conf~ create mode 100755 examples/bird_exp/configs/a1/envvars create mode 100755 examples/bird_exp/configs/b1/bird.conf create mode 100755 examples/bird_exp/configs/b1/bird.conf~ create mode 100755 examples/bird_exp/configs/b1/envvars create mode 100755 examples/bird_exp/configs/c1/bird.conf create mode 100755 examples/bird_exp/configs/c1/bird.conf~ create mode 100755 examples/bird_exp/configs/c1/envvars create mode 100755 examples/bird_exp/configs/c2/bird.conf create mode 100755 examples/bird_exp/configs/c2/bird.conf~ create mode 100755 examples/bird_exp/configs/c2/envvars create mode 100755 examples/bird_exp/configs/d1/bird.conf create mode 100755 examples/bird_exp/configs/d1/bird.conf~ create mode 100755 examples/bird_exp/configs/d1/envvars create mode 100755 examples/bird_exp/configs/rs/bird.conf create mode 100755 examples/bird_exp/configs/rs/bird.conf~ create mode 100755 examples/bird_exp/configs/rs/envvars create mode 100755 examples/bird_exp/start.py create mode 100755 examples/bird_exp/start.py~ create mode 100644 examples/bird_exp/topo.py create mode 100644 examples/bird_exp/topo.pyc create mode 100644 examples/bird_exp/topo.py~ create mode 100644 mininext/services/bird.py diff --git a/examples/bird_exp/__init__.py b/examples/bird_exp/__init__.py new file mode 100644 index 0000000..5dd90ff --- /dev/null +++ b/examples/bird_exp/__init__.py @@ -0,0 +1,3 @@ +""" +Quagga IXP Example for MiniNExT +""" diff --git a/examples/bird_exp/configs/a1/bird.conf b/examples/bird_exp/configs/a1/bird.conf new file mode 100755 index 0000000..64cd0b6 --- /dev/null +++ b/examples/bird_exp/configs/a1/bird.conf @@ -0,0 +1,48 @@ +router id 172.0.1.1; + + +protocol kernel { + + persist; # Don't remove routes on bird shutdown + scan time 20; # Scan kernel routing table every 20 seconds + import all; + export all; # Default is export none + +} + + +protocol device { + scan time 10; # Scan interfaces every 10 seconds +} + + +protocol static { + + route 10.0.1.0:255.255.255.0 via 172.0.1.1; + +} + + + + +protocol bgp { + + description "AS 100"; + local as 100; + neighbor 172.0.254.254 as 65000; + import all; + export all; + hold time 240; + startup hold time 240; + connect retry time 120; + keepalive time 80; # defaults to hold time / 3 + start delay time 5; # How long do we wait before initial connect + error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive + + error forget time 300; # ... until this timeout expires) + disable after error; # Disable the protocol automatically when an error occurs + source address 172.0.1.1; # What local address we use for the TCP connection + +} + + diff --git a/examples/bird_exp/configs/a1/bird.conf~ b/examples/bird_exp/configs/a1/bird.conf~ new file mode 100755 index 0000000..af655d0 --- /dev/null +++ b/examples/bird_exp/configs/a1/bird.conf~ @@ -0,0 +1,59 @@ +router id 172.0.1.1; + + +protocol kernel { + + persist; # Don't remove routes on bird shutdown + scan time 20; # Scan kernel routing table every 20 seconds + import all; + export all; # Default is export none + +} + + +protocol device { + scan time 10; # Scan interfaces every 10 seconds +} + + +protocol static { + + route 10.0.1.0:255.255.255.0 via 172.0.1.1; + +} + + + + +protocol bgp { + + description "AS 100"; + local as 100; + neighbor 172.0.254.254 as 65000; + import all; + export all; + hold time 240; + startup hold time 240; + connect retry time 120; + keepalive time 80; # defaults to hold time / 3 + start delay time 5; # How long do we wait before initial connect + error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive + + error forget time 300; # ... until this timeout expires) + disable after error; # Disable the protocol automatically when an error occurs + source address 172.0.1.1; # What local address we use for the TCP connection + +} +# +# Template usage example +#template bgp rr_client { +# disabled; +# local as 65000; +# multihop; +# rr client; +# rr cluster id 1.0.0.1; +#} +# +#protocol bgp rr_abcd from rr_client { +# neighbor 10.1.4.7 as 65000; +#} diff --git a/examples/bird_exp/configs/a1/envvars b/examples/bird_exp/configs/a1/envvars new file mode 100755 index 0000000..9ca9baa --- /dev/null +++ b/examples/bird_exp/configs/a1/envvars @@ -0,0 +1,3 @@ +BIRD_RUN_USER=bird +BIRD_RUN_GROUP=bird +#BIRD_ARGS= diff --git a/examples/bird_exp/configs/b1/bird.conf b/examples/bird_exp/configs/b1/bird.conf new file mode 100755 index 0000000..7a39bd7 --- /dev/null +++ b/examples/bird_exp/configs/b1/bird.conf @@ -0,0 +1,48 @@ +router id 172.0.2.1; + + +protocol kernel { + + persist; # Don't remove routes on bird shutdown + scan time 20; # Scan kernel routing table every 20 seconds + import all; + export all; # Default is export none + +} + + +protocol device { + scan time 10; # Scan interfaces every 10 seconds +} + + +protocol static { + + route 10.0.2.0:255.255.255.0 via 172.0.2.1; + +} + + + + +protocol bgp { + + description "AS 200"; + local as 200; + neighbor 172.0.254.254 as 65000; + import all; + export all; + hold time 240; + startup hold time 240; + connect retry time 120; + keepalive time 80; # defaults to hold time / 3 + start delay time 5; # How long do we wait before initial connect + error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive + + error forget time 300; # ... until this timeout expires) + disable after error; # Disable the protocol automatically when an error occurs + source address 172.0.2.1; # What local address we use for the TCP connection + +} + + diff --git a/examples/bird_exp/configs/b1/bird.conf~ b/examples/bird_exp/configs/b1/bird.conf~ new file mode 100755 index 0000000..248182b --- /dev/null +++ b/examples/bird_exp/configs/b1/bird.conf~ @@ -0,0 +1,218 @@ +/* + * This is an example configuration file. + */ + +# Yes, even shell-like comments work... + +# Configure logging +#log syslog { debug, trace, info, remote, warning, error, auth, fatal, bug }; +#log stderr all; +#log "tmp" all; + +# Override router ID +router id 172.0.2.1; + +# You can define your own symbols... +#define xyzzy = (120+10); +#define '1a-a1' = (30+40); + +# Define a route filter... +#filter test_filter { +# if net ~ 10.0.0.0/16 then accept; +# else reject; +#} + +#filter sink { reject; } +#filter okay { accept; } + +#include "filters.conf"; + +# Define another routing table +#table testable; + +# Turn on global debugging of all protocols +#debug protocols all; + +# The direct protocol automatically generates device routes to +# all network interfaces. Can exist in as many instances as you wish +# if you want to populate multiple routing tables with device routes. +#protocol direct { +# interface "-eth*", "*"; # Restrict network interfaces it works with +#} + +# This pseudo-protocol performs synchronization between BIRD's routing +# tables and the kernel. If your kernel supports multiple routing tables +# (as Linux 2.2.x does), you can run multiple instances of the kernel +# protocol and synchronize different kernel tables with different BIRD tables. +protocol kernel { +# learn; # Learn all alien routes from the kernel + persist; # Don't remove routes on bird shutdown + scan time 20; # Scan kernel routing table every 20 seconds +# import none; # Default is import all + export all; # Default is export none +# kernel table 5; # Kernel table to synchronize with (default: main) +} + +# This pseudo-protocol watches all interface up/down events. +protocol device { + scan time 10; # Scan interfaces every 10 seconds +} + +# Static routes (again, there can be multiple instances, so that you +# can disable/enable various groups of static routes on the fly). +protocol static { +# disabled; # Disable by default +# table testable; # Connect to a non-default table +# preference 1000; # Default preference of routes +# debug { states, routes, filters, interfaces, events, packets }; +# debug all; +# route 0.0.0.0/0 via 198.51.100.13; +# route 198.51.100.0/25 unreachable; +# route 10.0.0.0/8 unreachable; +# route 10.1.1.0:255.255.255.0 via 198.51.100.3; + route 10.0.2.0:255.255.255.0 via 172.0.2.1; +# route 10.1.3.0:255.255.255.0 via 198.51.100.4; +# route 10.2.0.0/24 via "arc0"; +} + +# Pipe protocol connects two routing tables... Beware of loops. +#protocol pipe { +# peer table testable; +# Define what routes do we export to this protocol / import from it. +# import all; # default is all +# export all; # default is none +# import none; # If you wish to disable imports +# import filter test_filter; # Use named filter +# import where source = RTS_DEVICE; # Use explicit filter +#} + +# RIP aka Rest In Pieces... +#protocol rip MyRIP { # You can also use an explicit name +# preference xyzzy; +# debug all; +# port 1520; +# period 7; +# infinity 16; +# garbage time 60; +# interface "*" { mode broadcast; }; +# honor neighbor; # To whom do we agree to send the routing table +# honor always; +# honor never; +# passwords { +# password "nazdar"; +# }; +# authentication none; +# import filter { print "importing"; accept; }; +# export filter { print "exporting"; accept; }; +#} + +#protocol ospf MyOSPF { +# tick 2; +# rfc1583compat yes; +# area 0.0.0.0 { +# stub no; +# interface "eth*" { +# hello 9; +# retransmit 6; +# cost 10; +# transmit delay 5; +# dead count 5; +# wait 50; +# type broadcast; +# authentication simple; +# password "pass"; +# }; +# interface "arc0" { +# rx buffer large; +# type nonbroadcast; +# poll 14; +# dead 75; +# neighbors { +# 10.1.1.2 eligible; +# 10.1.1.4; +# }; +# strict nonbroadcast yes; +# }; +# interface "xxx0" { +# passwords { +# password "abc" { +# id 1; +# generate to "22-04-2003 11:00:06"; +# accept to "17-01-2004 12:01:05"; +# }; +# password "def" { +# id 2; +# generate from "22-04-2003 11:00:07"; +# accept from "17-01-2003 12:01:05"; +# }; +# }; +# authentication cryptographic; +# }; +# }; +# area 20 { +# stub 1; +# interface "ppp1" { +# hello 8; +# authentication none; +# }; +# interface "fr*"; +# virtual link 192.168.0.1 { +# password "sdsdffsdfg"; +# authentication cryptographic; +# }; +# }; +#} + + +protocol bgp { +# disabled; + description "AS 200"; + local as 200; + neighbor 172.0.254.254 as 65000; + export all; + import all; + hold time 240; + startup hold time 240; + connect retry time 120; + keepalive time 80; # defaults to hold time / 3 + start delay time 5; # How long do we wait before initial connect + error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive +# # errors occur, we increase the delay exponentially ... + error forget time 300; # ... until this timeout expires) + disable after error; # Disable the protocol automatically when an error occurs + #next hop self; # Disable next hop processing and always advertise our local address as nexthop + path metric 1; # Prefer routes with shorter paths (like Cisco does) + default bgp_med 0; # MED value we use for comparison when none is defined + default bgp_local_pref 0; # The same for local preference + source address 172.0.2.1; # What local address we use for the TCP connection +# password "secret"; # Password used for MD5 authentication +# rr client; # I am a route reflector and the neighor is my client +# rr cluster id 1.0.0.1; # Use this value for cluster id instead of my router id +# export where source=RTS_STATIC; +# export filter { +# if source = RTS_STATIC then { +# bgp_community = -empty-; bgp_community = add(bgp_community,(65000,5678)); +# bgp_origin = 0; +# bgp_community = -empty-; bgp_community.add((65000,5678)); +# if (65000,64501) ~ bgp_community then +# bgp_community.add((0, 1)); +# if bgp_path ~ [= 65000 =] then +# bgp_path.prepend(65000); +# accept; +# } +# reject; + #}; +} +# +# Template usage example +#template bgp rr_client { +# disabled; +# local as 65000; +# multihop; +# rr client; +# rr cluster id 1.0.0.1; +#} +# +#protocol bgp rr_abcd from rr_client { +# neighbor 10.1.4.7 as 65000; +#} diff --git a/examples/bird_exp/configs/b1/envvars b/examples/bird_exp/configs/b1/envvars new file mode 100755 index 0000000..9ca9baa --- /dev/null +++ b/examples/bird_exp/configs/b1/envvars @@ -0,0 +1,3 @@ +BIRD_RUN_USER=bird +BIRD_RUN_GROUP=bird +#BIRD_ARGS= diff --git a/examples/bird_exp/configs/c1/bird.conf b/examples/bird_exp/configs/c1/bird.conf new file mode 100755 index 0000000..6078a28 --- /dev/null +++ b/examples/bird_exp/configs/c1/bird.conf @@ -0,0 +1,48 @@ +router id 172.0.3.2; + + +protocol kernel { + + persist; # Don't remove routes on bird shutdown + scan time 20; # Scan kernel routing table every 20 seconds + import all; + export all; # Default is export none + +} + + +protocol device { + scan time 10; # Scan interfaces every 10 seconds +} + + +protocol static { + + route 10.0.3.0:255.255.255.0 via 172.0.3.2; + +} + + + + +protocol bgp { + + description "AS 300_1"; + local as 300; + neighbor 172.0.254.254 as 65000; + import all; + export all; + hold time 240; + startup hold time 240; + connect retry time 120; + keepalive time 80; # defaults to hold time / 3 + start delay time 5; # How long do we wait before initial connect + error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive + + error forget time 300; # ... until this timeout expires) + disable after error; # Disable the protocol automatically when an error occurs + source address 172.0.3.2; # What local address we use for the TCP connection + +} + + diff --git a/examples/bird_exp/configs/c1/bird.conf~ b/examples/bird_exp/configs/c1/bird.conf~ new file mode 100755 index 0000000..a7e5f16 --- /dev/null +++ b/examples/bird_exp/configs/c1/bird.conf~ @@ -0,0 +1,95 @@ +/* + * This is an example configuration file. + */ + +# Yes, even shell-like comments work... + +# Configure logging +#log syslog { debug, trace, info, remote, warning, error, auth, fatal, bug }; +#log stderr all; +#log "tmp" all; + +# Override router ID +router id 172.0.3.2; + +# You can define your own symbols... +#define xyzzy = (120+10); +#define '1a-a1' = (30+40); + +# Define a route filter... +#filter test_filter { +# if net ~ 10.0.0.0/16 then accept; +# else reject; +#} + +#filter sink { reject; } +#filter okay { accept; } + +#include "filters.conf"; + +# Define another routing table +#table testable; + +# Turn on global debugging of all protocols +#debug protocols all; + +# The direct protocol automatically generates device routes to +# all network interfaces. Can exist in as many instances as you wish +# if you want to populate multiple routing tables with device routes. +#protocol direct { +# interface "-eth*", "*"; # Restrict network interfaces it works with +#} + +# This pseudo-protocol performs synchronization between BIRD's routing +# tables and the kernel. If your kernel supports multiple routing tables +# (as Linux 2.2.x does), you can run multiple instances of the kernel +# protocol and synchronize different kernel tables with different BIRD tables. +protocol kernel { + + persist; # Don't remove routes on bird shutdown + scan time 20; # Scan kernel routing table every 20 seconds + import all; # Default is import all + export all; # Default is export none + +} + +# This pseudo-protocol watches all interface up/down events. +protocol device { + scan time 10; # Scan interfaces every 10 seconds +} + +# Static routes (again, there can be multiple instances, so that you +# can disable/enable various groups of static routes on the fly). +protocol static { + + route 10.1.3.0:255.255.255.0 via 172.0.3.2; + +} + + + +protocol bgp { + + description "AS 300_1"; + local as 300; + neighbor 172.0.254.254 as 65000; + export all; + import all; + hold time 240; + startup hold time 240; + connect retry time 120; + keepalive time 80; # defaults to hold time / 3 + start delay time 5; # How long do we wait before initial connect + error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive +# # errors occur, we increase the delay exponentially ... + error forget time 300; # ... until this timeout expires) + disable after error; # Disable the protocol automatically when an error occurs + #next hop self; # Disable next hop processing and always advertise our local address as nexthop + path metric 1; # Prefer routes with shorter paths (like Cisco does) + default bgp_med 0; # MED value we use for comparison when none is defined + default bgp_local_pref 0; # The same for local preference + source address 172.0.3.2; # What local address we use for the TCP connection + +} + + diff --git a/examples/bird_exp/configs/c1/envvars b/examples/bird_exp/configs/c1/envvars new file mode 100755 index 0000000..9ca9baa --- /dev/null +++ b/examples/bird_exp/configs/c1/envvars @@ -0,0 +1,3 @@ +BIRD_RUN_USER=bird +BIRD_RUN_GROUP=bird +#BIRD_ARGS= diff --git a/examples/bird_exp/configs/c2/bird.conf b/examples/bird_exp/configs/c2/bird.conf new file mode 100755 index 0000000..1d4cbe8 --- /dev/null +++ b/examples/bird_exp/configs/c2/bird.conf @@ -0,0 +1,48 @@ +router id 172.0.3.1; + + +protocol kernel { + + persist; # Don't remove routes on bird shutdown + scan time 20; # Scan kernel routing table every 20 seconds + import all; + export all; # Default is export none + +} + + +protocol device { + scan time 10; # Scan interfaces every 10 seconds +} + + +protocol static { + + route 10.0.3.0:255.255.255.0 via 172.0.3.1; + +} + + + + +protocol bgp { + + description "AS 300_2"; + local as 300; + neighbor 172.0.254.254 as 65000; + import all; + export all; + hold time 240; + startup hold time 240; + connect retry time 120; + keepalive time 80; # defaults to hold time / 3 + start delay time 5; # How long do we wait before initial connect + error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive + + error forget time 300; # ... until this timeout expires) + disable after error; # Disable the protocol automatically when an error occurs + source address 172.0.3.1; # What local address we use for the TCP connection + +} + + diff --git a/examples/bird_exp/configs/c2/bird.conf~ b/examples/bird_exp/configs/c2/bird.conf~ new file mode 100755 index 0000000..1d4cbe8 --- /dev/null +++ b/examples/bird_exp/configs/c2/bird.conf~ @@ -0,0 +1,48 @@ +router id 172.0.3.1; + + +protocol kernel { + + persist; # Don't remove routes on bird shutdown + scan time 20; # Scan kernel routing table every 20 seconds + import all; + export all; # Default is export none + +} + + +protocol device { + scan time 10; # Scan interfaces every 10 seconds +} + + +protocol static { + + route 10.0.3.0:255.255.255.0 via 172.0.3.1; + +} + + + + +protocol bgp { + + description "AS 300_2"; + local as 300; + neighbor 172.0.254.254 as 65000; + import all; + export all; + hold time 240; + startup hold time 240; + connect retry time 120; + keepalive time 80; # defaults to hold time / 3 + start delay time 5; # How long do we wait before initial connect + error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive + + error forget time 300; # ... until this timeout expires) + disable after error; # Disable the protocol automatically when an error occurs + source address 172.0.3.1; # What local address we use for the TCP connection + +} + + diff --git a/examples/bird_exp/configs/c2/envvars b/examples/bird_exp/configs/c2/envvars new file mode 100755 index 0000000..9ca9baa --- /dev/null +++ b/examples/bird_exp/configs/c2/envvars @@ -0,0 +1,3 @@ +BIRD_RUN_USER=bird +BIRD_RUN_GROUP=bird +#BIRD_ARGS= diff --git a/examples/bird_exp/configs/d1/bird.conf b/examples/bird_exp/configs/d1/bird.conf new file mode 100755 index 0000000..a9f0434 --- /dev/null +++ b/examples/bird_exp/configs/d1/bird.conf @@ -0,0 +1,48 @@ +router id 172.0.4.1; + + +protocol kernel { + + persist; # Don't remove routes on bird shutdown + scan time 20; # Scan kernel routing table every 20 seconds + import all; + export all; # Default is export none + +} + + +protocol device { + scan time 10; # Scan interfaces every 10 seconds +} + + +protocol static { + + route 10.0.4.0:255.255.255.0 via 172.0.4.1; + +} + + + + +protocol bgp { + + description "AS 400"; + local as 400; + neighbor 172.0.254.254 as 65000; + import all; + export all; + hold time 240; + startup hold time 240; + connect retry time 120; + keepalive time 80; # defaults to hold time / 3 + start delay time 5; # How long do we wait before initial connect + error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive + + error forget time 300; # ... until this timeout expires) + disable after error; # Disable the protocol automatically when an error occurs + source address 172.0.4.1; # What local address we use for the TCP connection + +} + + diff --git a/examples/bird_exp/configs/d1/bird.conf~ b/examples/bird_exp/configs/d1/bird.conf~ new file mode 100755 index 0000000..675d5ce --- /dev/null +++ b/examples/bird_exp/configs/d1/bird.conf~ @@ -0,0 +1,218 @@ +/* + * This is an example configuration file. + */ + +# Yes, even shell-like comments work... + +# Configure logging +#log syslog { debug, trace, info, remote, warning, error, auth, fatal, bug }; +#log stderr all; +#log "tmp" all; + +# Override router ID +router id 172.0.4.1; + +# You can define your own symbols... +#define xyzzy = (120+10); +#define '1a-a1' = (30+40); + +# Define a route filter... +#filter test_filter { +# if net ~ 10.0.0.0/16 then accept; +# else reject; +#} + +#filter sink { reject; } +#filter okay { accept; } + +#include "filters.conf"; + +# Define another routing table +#table testable; + +# Turn on global debugging of all protocols +#debug protocols all; + +# The direct protocol automatically generates device routes to +# all network interfaces. Can exist in as many instances as you wish +# if you want to populate multiple routing tables with device routes. +#protocol direct { +# interface "-eth*", "*"; # Restrict network interfaces it works with +#} + +# This pseudo-protocol performs synchronization between BIRD's routing +# tables and the kernel. If your kernel supports multiple routing tables +# (as Linux 2.2.x does), you can run multiple instances of the kernel +# protocol and synchronize different kernel tables with different BIRD tables. +protocol kernel { +# learn; # Learn all alien routes from the kernel + persist; # Don't remove routes on bird shutdown + scan time 20; # Scan kernel routing table every 20 seconds +# import none; # Default is import all + export all; # Default is export none +# kernel table 5; # Kernel table to synchronize with (default: main) +} + +# This pseudo-protocol watches all interface up/down events. +protocol device { + scan time 10; # Scan interfaces every 10 seconds +} + +# Static routes (again, there can be multiple instances, so that you +# can disable/enable various groups of static routes on the fly). +protocol static { +# disabled; # Disable by default +# table testable; # Connect to a non-default table +# preference 1000; # Default preference of routes +# debug { states, routes, filters, interfaces, events, packets }; +# debug all; +# route 0.0.0.0/0 via 198.51.100.13; +# route 198.51.100.0/25 unreachable; +# route 10.0.0.0/8 unreachable; +# route 10.1.1.0:255.255.255.0 via 198.51.100.3; + route 10.1.4.0:255.255.255.0 via 172.0.4.1; +# route 10.1.4.0:255.255.255.0 via 198.51.100.4; +# route 10.2.0.0/24 via "arc0"; +} + +# Pipe protocol connects two routing tables... Beware of loops. +#protocol pipe { +# peer table testable; +# Define what routes do we export to this protocol / import from it. +# import all; # default is all +# export all; # default is none +# import none; # If you wish to disable imports +# import filter test_filter; # Use named filter +# import where source = RTS_DEVICE; # Use explicit filter +#} + +# RIP aka Rest In Pieces... +#protocol rip MyRIP { # You can also use an explicit name +# preference xyzzy; +# debug all; +# port 1520; +# period 7; +# infinity 16; +# garbage time 60; +# interface "*" { mode broadcast; }; +# honor neighbor; # To whom do we agree to send the routing table +# honor always; +# honor never; +# passwords { +# password "nazdar"; +# }; +# authentication none; +# import filter { print "importing"; accept; }; +# export filter { print "exporting"; accept; }; +#} + +#protocol ospf MyOSPF { +# tick 2; +# rfc1583compat yes; +# area 0.0.0.0 { +# stub no; +# interface "eth*" { +# hello 9; +# retransmit 6; +# cost 10; +# transmit delay 5; +# dead count 5; +# wait 50; +# type broadcast; +# authentication simple; +# password "pass"; +# }; +# interface "arc0" { +# rx buffer large; +# type nonbroadcast; +# poll 14; +# dead 75; +# neighbors { +# 10.1.1.2 eligible; +# 10.1.1.4; +# }; +# strict nonbroadcast yes; +# }; +# interface "xxx0" { +# passwords { +# password "abc" { +# id 1; +# generate to "22-04-2003 11:00:06"; +# accept to "17-01-2004 12:01:05"; +# }; +# password "def" { +# id 2; +# generate from "22-04-2003 11:00:07"; +# accept from "17-01-2003 12:01:05"; +# }; +# }; +# authentication cryptographic; +# }; +# }; +# area 20 { +# stub 1; +# interface "ppp1" { +# hello 8; +# authentication none; +# }; +# interface "fr*"; +# virtual link 192.168.0.1 { +# password "sdsdffsdfg"; +# authentication cryptographic; +# }; +# }; +#} + + +protocol bgp { +# disabled; + description "AS 400"; + local as 400; + neighbor 172.0.254.254 as 65000; + export all; + import all; + hold time 240; + startup hold time 240; + connect retry time 120; + keepalive time 80; # defaults to hold time / 3 + start delay time 5; # How long do we wait before initial connect + error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive +# # errors occur, we increase the delay exponentially ... + error forget time 300; # ... until this timeout expires) + disable after error; # Disable the protocol automatically when an error occurs + #next hop self; # Disable next hop processing and always advertise our local address as nexthop + path metric 1; # Prefer routes with shorter paths (like Cisco does) + default bgp_med 0; # MED value we use for comparison when none is defined + default bgp_local_pref 0; # The same for local preference + source address 172.0.4.1; # What local address we use for the TCP connection +# password "secret"; # Password used for MD5 authentication +# rr client; # I am a route reflector and the neighor is my client +# rr cluster id 1.0.0.1; # Use this value for cluster id instead of my router id +# export where source=RTS_STATIC; +# export filter { +# if source = RTS_STATIC then { +# bgp_community = -empty-; bgp_community = add(bgp_community,(65000,5678)); +# bgp_origin = 0; +# bgp_community = -empty-; bgp_community.add((65000,5678)); +# if (65000,64501) ~ bgp_community then +# bgp_community.add((0, 1)); +# if bgp_path ~ [= 65000 =] then +# bgp_path.prepend(65000); +# accept; +# } +# reject; + #}; +} +# +# Template usage example +#template bgp rr_client { +# disabled; +# local as 65000; +# multihop; +# rr client; +# rr cluster id 1.0.0.1; +#} +# +#protocol bgp rr_abcd from rr_client { +# neighbor 10.1.4.7 as 65000; +#} diff --git a/examples/bird_exp/configs/d1/envvars b/examples/bird_exp/configs/d1/envvars new file mode 100755 index 0000000..9ca9baa --- /dev/null +++ b/examples/bird_exp/configs/d1/envvars @@ -0,0 +1,3 @@ +BIRD_RUN_USER=bird +BIRD_RUN_GROUP=bird +#BIRD_ARGS= diff --git a/examples/bird_exp/configs/rs/bird.conf b/examples/bird_exp/configs/rs/bird.conf new file mode 100755 index 0000000..930f7a3 --- /dev/null +++ b/examples/bird_exp/configs/rs/bird.conf @@ -0,0 +1,139 @@ +router id 172.0.254.254; + +protocol kernel { + + persist; # Don't remove routes on bird shutdown + scan time 20; # Scan kernel routing table every 20 seconds + import all; + export all; # Default is export none +} + + +protocol device { + scan time 10; # Scan interfaces every 10 seconds +} + + +protocol bgp v_0 { + + description "Route Server"; + local as 65000; + neighbor 172.0.1.1 as 100; + import all; + export all; + hold time 240; + startup hold time 240; + connect retry time 120; + keepalive time 80; # defaults to hold time / 3 + start delay time 5; # How long do we wait before initial connect + error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive + + error forget time 300; # ... until this timeout expires) + disable after error; # Disable the protocol automatically when an error occurs + + path metric 1; # Prefer routes with shorter paths (like Cisco does) + default bgp_med 0; # MED value we use for comparison when none is defined + default bgp_local_pref 0; # The same for local preference + source address 172.0.254.254; + rs client; # What local address we use for the TCP connection + +} + +protocol bgp v_1 { + + description "Route Server"; + local as 65000; + neighbor 172.0.2.1 as 200; + + export all; + import all; + hold time 240; + startup hold time 240; + connect retry time 120; + keepalive time 80; # defaults to hold time / 3 + start delay time 5; # How long do we wait before initial connect + error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive + + error forget time 300; # ... until this timeout expires) + disable after error; # Disable the protocol automatically when an error occurs + + path metric 1; # Prefer routes with shorter paths (like Cisco does) + default bgp_med 0; # MED value we use for comparison when none is defined + default bgp_local_pref 0; # The same for local preference + source address 172.0.254.254; + rs client; +} + +protocol bgp v_2 { + + description "Route Server"; + local as 65000; + neighbor 172.0.3.1 as 300; + export all; + import all; + hold time 240; + startup hold time 240; + connect retry time 120; + keepalive time 80; # defaults to hold time / 3 + start delay time 5; # How long do we wait before initial connect + error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive + + error forget time 300; # ... until this timeout expires) + disable after error; # Disable the protocol automatically when an error occurs + + path metric 1; # Prefer routes with shorter paths (like Cisco does) + default bgp_med 0; # MED value we use for comparison when none is defined + default bgp_local_pref 0; # The same for local preference + source address 172.0.254.254; +rs client; +} + +protocol bgp v_3 { + + description "Route Server"; + local as 65000; + neighbor 172.0.3.2 as 300; + export all; + import all; + hold time 240; + startup hold time 240; + connect retry time 120; + keepalive time 80; # defaults to hold time / 3 + start delay time 5; # How long do we wait before initial connect + error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive + + error forget time 300; # ... until this timeout expires) + disable after error; # Disable the protocol automatically when an error occurs + path metric 1; # Prefer routes with shorter paths (like Cisco does) + default bgp_med 0; # MED value we use for comparison when none is defined + default bgp_local_pref 0; # The same for local preference + source address 172.0.254.254; +rs client; +} + +protocol bgp v_4 { + + description "Route Server"; + local as 65000; + neighbor 172.0.4.1 as 400; + export all; + import all; + + hold time 240; + startup hold time 240; + connect retry time 120; + keepalive time 80; # defaults to hold time / 3 + start delay time 5; # How long do we wait before initial connect + error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive + + error forget time 300; # ... until this timeout expires) + disable after error; # Disable the protocol automatically when an error occurs + path metric 1; # Prefer routes with shorter paths (like Cisco does) + default bgp_med 0; # MED value we use for comparison when none is defined + default bgp_local_pref 0; # The same for local preference + source address 172.0.254.254; + rs client; +} + + + diff --git a/examples/bird_exp/configs/rs/bird.conf~ b/examples/bird_exp/configs/rs/bird.conf~ new file mode 100755 index 0000000..a37d78a --- /dev/null +++ b/examples/bird_exp/configs/rs/bird.conf~ @@ -0,0 +1,375 @@ +/* + * This is an example configuration file. + */ + +# Yes, even shell-like comments work... + +# Configure logging +#log syslog { debug, trace, info, remote, warning, error, auth, fatal, bug }; +#log stderr all; +#log "tmp" all; + +# Override router ID +router id 172.0.254.254; + +# You can define your own symbols... +#define xyzzy = (120+10); +#define '1a-a1' = (30+40); + +# Define a route filter... +#filter test_filter { +# if net ~ 10.0.0.0/16 then accept; +# else reject; +#} + +#filter sink { reject; } +#filter okay { accept; } + +#include "filters.conf"; + +# Define another routing table +#table testable; + +# Turn on global debugging of all protocols +#debug protocols all; + +# The direct protocol automatically generates device routes to +# all network interfaces. Can exist in as many instances as you wish +# if you want to populate multiple routing tables with device routes. +#protocol direct { +# interface "-eth*", "*"; # Restrict network interfaces it works with +#} + +# This pseudo-protocol performs synchronization between BIRD's routing +# tables and the kernel. If your kernel supports multiple routing tables +# (as Linux 2.2.x does), you can run multiple instances of the kernel +# protocol and synchronize different kernel tables with different BIRD tables. +protocol kernel { +# learn; # Learn all alien routes from the kernel + persist; # Don't remove routes on bird shutdown + scan time 20; # Scan kernel routing table every 20 seconds +# import none; # Default is import all + export all; # Default is export none +# kernel table 5; # Kernel table to synchronize with (default: main) +} + +# This pseudo-protocol watches all interface up/down events. +protocol device { + scan time 10; # Scan interfaces every 10 seconds +} + +# Static routes (again, there can be multiple instances, so that you +# can disable/enable various groups of static routes on the fly). +protocol static { +# disabled; # Disable by default +# table testable; # Connect to a non-default table +# preference 1000; # Default preference of routes +# debug { states, routes, filters, interfaces, events, packets }; +# debug all; +# route 0.0.0.0/0 via 198.51.100.13; +# route 198.51.100.0/25 unreachable; +# route 10.0.0.0/8 unreachable; +# route 10.1.1.0:255.255.255.0 via 198.51.100.3; +# route 10.1.2.0:255.255.255.0 via 198.51.100.3; +# route 10.1.3.0:255.255.255.0 via 198.51.100.4; +# route 10.2.0.0/24 via "arc0"; +} + +# Pipe protocol connects two routing tables... Beware of loops. +#protocol pipe { +# peer table testable; +# Define what routes do we export to this protocol / import from it. +# import all; # default is all +# export all; # default is none +# import none; # If you wish to disable imports +# import filter test_filter; # Use named filter +# import where source = RTS_DEVICE; # Use explicit filter +#} + +# RIP aka Rest In Pieces... +#protocol rip MyRIP { # You can also use an explicit name +# preference xyzzy; +# debug all; +# port 1520; +# period 7; +# infinity 16; +# garbage time 60; +# interface "*" { mode broadcast; }; +# honor neighbor; # To whom do we agree to send the routing table +# honor always; +# honor never; +# passwords { +# password "nazdar"; +# }; +# authentication none; +# import filter { print "importing"; accept; }; +# export filter { print "exporting"; accept; }; +#} + +#protocol ospf MyOSPF { +# tick 2; +# rfc1583compat yes; +# area 0.0.0.0 { +# stub no; +# interface "eth*" { +# hello 9; +# retransmit 6; +# cost 10; +# transmit delay 5; +# dead count 5; +# wait 50; +# type broadcast; +# authentication simple; +# password "pass"; +# }; +# interface "arc0" { +# rx buffer large; +# type nonbroadcast; +# poll 14; +# dead 75; +# neighbors { +# 10.1.1.2 eligible; +# 10.1.1.4; +# }; +# strict nonbroadcast yes; +# }; +# interface "xxx0" { +# passwords { +# password "abc" { +# id 1; +# generate to "22-04-2003 11:00:06"; +# accept to "17-01-2004 12:01:05"; +# }; +# password "def" { +# id 2; +# generate from "22-04-2003 11:00:07"; +# accept from "17-01-2003 12:01:05"; +# }; +# }; +# authentication cryptographic; +# }; +# }; +# area 20 { +# stub 1; +# interface "ppp1" { +# hello 8; +# authentication none; +# }; +# interface "fr*"; +# virtual link 192.168.0.1 { +# password "sdsdffsdfg"; +# authentication cryptographic; +# }; +# }; +#} + + +protocol bgp v_0 { +# disabled; + description "Route Server"; + local as 65000; + neighbor 172.0.1.1 as 100; + import all; + export all; + hold time 240; + startup hold time 240; + connect retry time 120; + keepalive time 80; # defaults to hold time / 3 + start delay time 5; # How long do we wait before initial connect + error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive +# # errors occur, we increase the delay exponentially ... + error forget time 300; # ... until this timeout expires) + disable after error; # Disable the protocol automatically when an error occurs + #next hop self; # Disable next hop processing and always advertise our local address as nexthop + path metric 1; # Prefer routes with shorter paths (like Cisco does) + default bgp_med 0; # MED value we use for comparison when none is defined + default bgp_local_pref 0; # The same for local preference + source address 172.0.254.254; + rs client; # What local address we use for the TCP connection +# password "secret"; # Password used for MD5 authentication +# rr client; # I am a route reflector and the neighor is my client +# rr cluster id 1.0.0.1; # Use this value for cluster id instead of my router id +# export where source=RTS_STATIC; +# export filter { +# if source = RTS_STATIC then { +# bgp_community = -empty-; bgp_community = add(bgp_community,(65000,5678)); +# bgp_origin = 0; +# bgp_community = -empty-; bgp_community.add((65000,5678)); +# if (65000,64501) ~ bgp_community then +# bgp_community.add((0, 1)); +# if bgp_path ~ [= 65000 =] then +# bgp_path.prepend(65000); +# accept; +# } +# reject; + #}; +} + +protocol bgp v_1 { +# disabled; + description "Route Server"; + local as 65000; + neighbor 172.0.2.1 as 200; + + export all; + import all; + hold time 240; + startup hold time 240; + connect retry time 120; + keepalive time 80; # defaults to hold time / 3 + start delay time 5; # How long do we wait before initial connect + error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive +# # errors occur, we increase the delay exponentially ... + error forget time 300; # ... until this timeout expires) + disable after error; # Disable the protocol automatically when an error occurs + #next hop self; # Disable next hop processing and always advertise our local address as nexthop + path metric 1; # Prefer routes with shorter paths (like Cisco does) + default bgp_med 0; # MED value we use for comparison when none is defined + default bgp_local_pref 0; # The same for local preference + source address 172.0.254.254; + rs client; # What local address we use for the TCP connection +# password "secret"; # Password used for MD5 authentication +# rr client; # I am a route reflector and the neighor is my client +# rr cluster id 1.0.0.1; # Use this value for cluster id instead of my router id +# export where source=RTS_STATIC; +# export filter { +# if source = RTS_STATIC then { +# bgp_community = -empty-; bgp_community = add(bgp_community,(65000,5678)); +# bgp_origin = 0; +# bgp_community = -empty-; bgp_community.add((65000,5678)); +# if (65000,64501) ~ bgp_community then +# bgp_community.add((0, 1)); +# if bgp_path ~ [= 65000 =] then +# bgp_path.prepend(65000); +# accept; +# } +# reject; + #}; +} + +protocol bgp v_2 { +# disabled; + description "Route Server"; + local as 65000; + neighbor 172.0.3.1 as 300; + export all; + import all; + hold time 240; + startup hold time 240; + connect retry time 120; + keepalive time 80; # defaults to hold time / 3 + start delay time 5; # How long do we wait before initial connect + error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive +# # errors occur, we increase the delay exponentially ... + error forget time 300; # ... until this timeout expires) + disable after error; # Disable the protocol automatically when an error occurs + #next hop self; # Disable next hop processing and always advertise our local address as nexthop + path metric 1; # Prefer routes with shorter paths (like Cisco does) + default bgp_med 0; # MED value we use for comparison when none is defined + default bgp_local_pref 0; # The same for local preference + source address 172.0.254.254; +rs client; # What local address we use for the TCP connection +# password "secret"; # Password used for MD5 authentication +# rr client; # I am a route reflector and the neighor is my client +# rr cluster id 1.0.0.1; # Use this value for cluster id instead of my router id +# export where source=RTS_STATIC; +# export filter { +# if source = RTS_STATIC then { +# bgp_community = -empty-; bgp_community = add(bgp_community,(65000,5678)); +# bgp_origin = 0; +# bgp_community = -empty-; bgp_community.add((65000,5678)); +# if (65000,64501) ~ bgp_community then +# bgp_community.add((0, 1)); +# if bgp_path ~ [= 65000 =] then +# bgp_path.prepend(65000); +# accept; +# } +# reject; + #}; +} + +protocol bgp v_3 { +# disabled; + description "Route Server"; + local as 65000; + neighbor 172.0.3.2 as 300; + export all; + import all; + hold time 240; + startup hold time 240; + connect retry time 120; + keepalive time 80; # defaults to hold time / 3 + start delay time 5; # How long do we wait before initial connect + error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive +# # errors occur, we increase the delay exponentially ... + error forget time 300; # ... until this timeout expires) + disable after error; # Disable the protocol automatically when an error occurs + #next hop self; # Disable next hop processing and always advertise our local address as nexthop + path metric 1; # Prefer routes with shorter paths (like Cisco does) + default bgp_med 0; # MED value we use for comparison when none is defined + default bgp_local_pref 0; # The same for local preference + source address 172.0.254.254; +rs client; # What local address we use for the TCP connection +# password "secret"; # Password used for MD5 authentication +# rr client; # I am a route reflector and the neighor is my client +# rr cluster id 1.0.0.1; # Use this value for cluster id instead of my router id +# export where source=RTS_STATIC; +# export filter { +# if source = RTS_STATIC then { +# bgp_community = -empty-; bgp_community = add(bgp_community,(65000,5678)); +# bgp_origin = 0; +# bgp_community = -empty-; bgp_community.add((65000,5678)); +# if (65000,64501) ~ bgp_community then +# bgp_community.add((0, 1)); +# if bgp_path ~ [= 65000 =] then +# bgp_path.prepend(65000); +# accept; +# } +# reject; + #}; +} + +protocol bgp v_4 { +# disabled; + description "Route Server"; + local as 65000; + neighbor 172.0.4.1 as 400; + export all; + import all; + + hold time 240; + startup hold time 240; + connect retry time 120; + keepalive time 80; # defaults to hold time / 3 + start delay time 5; # How long do we wait before initial connect + error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive +# # errors occur, we increase the delay exponentially ... + error forget time 300; # ... until this timeout expires) + disable after error; # Disable the protocol automatically when an error occurs + #next hop self; # Disable next hop processing and always advertise our local address as nexthop + path metric 1; # Prefer routes with shorter paths (like Cisco does) + default bgp_med 0; # MED value we use for comparison when none is defined + default bgp_local_pref 0; # The same for local preference + source address 172.0.254.254; + rs client; # What local address we use for the TCP connection +# password "secret"; # Password used for MD5 authentication +# rr client; # I am a route reflector and the neighor is my client +# rr cluster id 1.0.0.1; # Use this value for cluster id instead of my router id +# export where source=RTS_STATIC; +# export filter { +# if source = RTS_STATIC then { +# bgp_community = -empty-; bgp_community = add(bgp_community,(65000,5678)); +# bgp_origin = 0; +# bgp_community = -empty-; bgp_community.add((65000,5678)); +# if (65000,64501) ~ bgp_community then +# bgp_community.add((0, 1)); +# if bgp_path ~ [= 65000 =] then +# bgp_path.prepend(65000); +# accept; +# } +# reject; + #}; +} + + + diff --git a/examples/bird_exp/configs/rs/envvars b/examples/bird_exp/configs/rs/envvars new file mode 100755 index 0000000..9ca9baa --- /dev/null +++ b/examples/bird_exp/configs/rs/envvars @@ -0,0 +1,3 @@ +BIRD_RUN_USER=bird +BIRD_RUN_GROUP=bird +#BIRD_ARGS= diff --git a/examples/bird_exp/start.py b/examples/bird_exp/start.py new file mode 100755 index 0000000..8054252 --- /dev/null +++ b/examples/bird_exp/start.py @@ -0,0 +1,67 @@ +#!/usr/bin/python + +""" +Example network of Bird routers +(BirdTopo + BirdService) +""" + +import sys +import atexit + +# patch isShellBuiltin +import mininet.util +import mininext.util +mininet.util.isShellBuiltin = mininext.util.isShellBuiltin +sys.modules['mininet.util'] = mininet.util + +from mininet.util import dumpNodeConnections +from mininet.node import OVSController +from mininet.log import setLogLevel, info + +from mininext.cli import CLI +from mininext.net import MiniNExT + +from topo import BirdTopo + +net = None + + +def startNetwork(): + "instantiates a topo, then starts the network and prints debug information" + + info('** Creating Bird network topology\n') + topo = BirdTopo() + + info('** Starting the network\n') + global net + net = MiniNExT(topo, controller=OVSController) + net.start() + + info('** Dumping host connections\n') + dumpNodeConnections(net.hosts) + + info('** Testing network connectivity\n') + net.ping(net.hosts) + + info('** Dumping host processes\n') + for host in net.hosts: + host.cmdPrint("ps aux") + + info('** Running CLI\n') + CLI(net) + + +def stopNetwork(): + "stops a network (only called on a forced cleanup)" + + if net is not None: + info('** Tearing down Bird network\n') + net.stop() + +if __name__ == '__main__': + # Force cleanup on exit by registering a cleanup function + atexit.register(stopNetwork) + + # Tell mininet to print useful information + setLogLevel('info') + startNetwork() diff --git a/examples/bird_exp/start.py~ b/examples/bird_exp/start.py~ new file mode 100755 index 0000000..66f278f --- /dev/null +++ b/examples/bird_exp/start.py~ @@ -0,0 +1,67 @@ +#!/usr/bin/python + +""" +Example network of Quagga routers +(QuaggaTopo + QuaggaService) +""" + +import sys +import atexit + +# patch isShellBuiltin +import mininet.util +import mininext.util +mininet.util.isShellBuiltin = mininext.util.isShellBuiltin +sys.modules['mininet.util'] = mininet.util + +from mininet.util import dumpNodeConnections +from mininet.node import OVSController +from mininet.log import setLogLevel, info + +from mininext.cli import CLI +from mininext.net import MiniNExT + +from topo import BirdTopo + +net = None + + +def startNetwork(): + "instantiates a topo, then starts the network and prints debug information" + + info('** Creating Quagga network topology\n') + topo = BirdTopo() + + info('** Starting the network\n') + global net + net = MiniNExT(topo, controller=OVSController) + net.start() + + info('** Dumping host connections\n') + dumpNodeConnections(net.hosts) + + info('** Testing network connectivity\n') + net.ping(net.hosts) + + info('** Dumping host processes\n') + for host in net.hosts: + host.cmdPrint("ps aux") + + info('** Running CLI\n') + CLI(net) + + +def stopNetwork(): + "stops a network (only called on a forced cleanup)" + + if net is not None: + info('** Tearing down Quagga network\n') + net.stop() + +if __name__ == '__main__': + # Force cleanup on exit by registering a cleanup function + atexit.register(stopNetwork) + + # Tell mininet to print useful information + setLogLevel('info') + startNetwork() diff --git a/examples/bird_exp/topo.py b/examples/bird_exp/topo.py new file mode 100644 index 0000000..89847c7 --- /dev/null +++ b/examples/bird_exp/topo.py @@ -0,0 +1,77 @@ +""" +Example topology of Bird routers +""" + +import inspect +import os +from mininext.topo import Topo +from mininext.services.bird import BirdService + +from collections import namedtuple + +BirdHost = namedtuple("BirdHost", "name ip loIP") +net = None + + +class BirdTopo(Topo): + + "Creates a topology of Bird routers" + + def __init__(self): + """Initialize a Bird topology with 5 routers, configure their IP + addresses, loop back interfaces, and paths to their private + configuration directories.""" + Topo.__init__(self) + + # Directory where this file / script is located" + selfPath = os.path.dirname(os.path.abspath( + inspect.getfile(inspect.currentframe()))) # script directory + + # Initialize a service helper for Bird with default options + BirdSvc = BirdService(autoStop=False) + + # Path configurations for mounts + BirdBaseConfigPath = selfPath + '/configs/' + + # List of Bird host configs + BirdHosts = [] + BirdHosts.append(BirdHost(name='a1', ip='172.0.1.1/16', + loIP='10.0.1.1/24')) + BirdHosts.append(BirdHost(name='b1', ip='172.0.2.1/16', + loIP='10.0.2.1/24')) + BirdHosts.append(BirdHost(name='c1', ip='172.0.3.2/16', + loIP='10.0.3.1/24')) + BirdHosts.append(BirdHost(name='c2', ip='172.0.3.1/16', + loIP='10.0.3.1/24')) + BirdHosts.append(BirdHost(name='d1', ip='172.0.4.1/16', + loIP='10.0.4.1/24')) + BirdHosts.append(BirdHost(name='rs', ip='172.0.254.254/16', + loIP=None)) + + # Add switch for IXP fabric + ixpfabric = self.addSwitch('fabric-sw1') + + # Setup each Bird router, add a link between it and the IXP fabric + for host in BirdHosts: + + # Create an instance of a host, called a BirdContainer + BirdContainer = self.addHost(name=host.name, + ip=host.ip, + hostname=host.name, + privateLogDir=True, + privateRunDir=True, + inMountNamespace=True, + inPIDNamespace=True, + inUTSNamespace=True) + + # Add a loopback interface with an IP in router's announced range + self.addNodeLoopbackIntf(node=host.name, ip=host.loIP) + + # Configure and setup the Bird service for this node + BirdSvcConfig = \ + {'BirdConfigPath': BirdBaseConfigPath + host.name} + self.addNodeService(node=host.name, service=BirdSvc, + nodeConfig=BirdSvcConfig) + + # Attach the BirdContainer to the IXP Fabric Switch + self.addLink(BirdContainer, ixpfabric) diff --git a/examples/bird_exp/topo.pyc b/examples/bird_exp/topo.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0f59a0a7653de9eec2202fcf956f1618a5cf4c12 GIT binary patch literal 2460 zcmb_d-)|d55T5hdj^iY4XhYLqlq`M-GL4}fpxE{>@JPuSk^-t4zCJ2T(Txqq%Szxu)+gj9Z9{C|sKrVtTP z57MEiLa{?VOp1AhdKHNUtw4T|a%Ezmi( zFS5DwUHO**YCBh-`4;04jb{hb;07*@WJiR%jw+Tc5f#B$`%fQl;Z1 zvPiVcHH&IxWl)WCa@pHI5HJQrlWP|(U5S7tAXWr%?MlRTL9G4<;v+%a5X8+ZZLA66 zV?jKeA&{hN6y4(Br!_kJouk|SlC!FNq2aI}7*xlI-x?})rB@}9{1 zEYGPiT@WKTDf;AMOJQUUs})D1JQvp2qX+bS+7LX>IKzKR6Y#>Li6qzIGu@&I?AG`u zIB&joeu^G~@5~hQ9%3iaRtK^ERe>?W^BM8qYJ228yWssJFHDnx9*%R|jU%OVZ)dOR zU4DWn%9Sz7JOY)|%sULi6Hh0&GJ_ywZIDD>7T6;LVwM)NT%Urh^JXrb1Xibs7wKGu zHqEs%ZMhu5*rxk9p<(`Z3b5(OJ>*LUx)KFl`O}%)ukM!{?I-PSyW8nL7aU(S!&kNY zq+Hn8lnsa7xeXh#;S$HsB`%!DJ#BBm@Fni)9ByOI9_w)cK3_DyfAa%B{9O9UjalVm zN&p+rHrp8Ni#y67ILvkU*u3pZT8_|7B>okwm05kA4!3n~=QRE}VGSGA$q(r`vAf8b z$xt7AO_X~(+aIcaJlMZfalcE_sDLwDUJ57nP*%HuHB)px^nwCcEbq3sbNLt~r|tJO zSl91MHgIyb%FGZGD7i$!=7K{UuGH(qWZ;5ehRO~!nko0saGd8Vv4b3;_|lYX(0&)h zMxkfHMwY20@?A{D(QcY3bSx}H(LN|17H;vxE!pQSJ~wFrALL_YZx-NP#Qhq~W@7Ka zq0dGnZ`jL=W!sk%LiJiFCoREnd`86s37#jje97D5G{p5U-W*$jQFAHf-3*bJg&bO+ zWku=bcwBZVa9Ii)=tLDIFD)0wTChVR%nQsqN9jm)PW4G(I@`*e;68OmD9P@tvxCRo z_GbG@M-^{D(|I!vhQr`7{C2o8w6k~q9hg|dFk28*U2$(X_uT7l)2%zVo#s^otBhL2 zw_bi1-TT!wU>DpLr>EovS021z`t Date: Tue, 9 Dec 2014 12:43:25 -0800 Subject: [PATCH 02/12] Update __init__.py --- examples/bird_exp/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/bird_exp/__init__.py b/examples/bird_exp/__init__.py index 5dd90ff..6198c5c 100644 --- a/examples/bird_exp/__init__.py +++ b/examples/bird_exp/__init__.py @@ -1,3 +1,3 @@ """ -Quagga IXP Example for MiniNExT +BIRD IXP Example for MiniNExT """ From 1ee61f621e76c0758243efd041e7b5a8c32ab103 Mon Sep 17 00:00:00 2001 From: vikaskamath Date: Tue, 9 Dec 2014 14:23:35 -0800 Subject: [PATCH 03/12] Delete start.py~ --- examples/bird_exp/start.py~ | 67 ------------------------------------- 1 file changed, 67 deletions(-) delete mode 100755 examples/bird_exp/start.py~ diff --git a/examples/bird_exp/start.py~ b/examples/bird_exp/start.py~ deleted file mode 100755 index 66f278f..0000000 --- a/examples/bird_exp/start.py~ +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/python - -""" -Example network of Quagga routers -(QuaggaTopo + QuaggaService) -""" - -import sys -import atexit - -# patch isShellBuiltin -import mininet.util -import mininext.util -mininet.util.isShellBuiltin = mininext.util.isShellBuiltin -sys.modules['mininet.util'] = mininet.util - -from mininet.util import dumpNodeConnections -from mininet.node import OVSController -from mininet.log import setLogLevel, info - -from mininext.cli import CLI -from mininext.net import MiniNExT - -from topo import BirdTopo - -net = None - - -def startNetwork(): - "instantiates a topo, then starts the network and prints debug information" - - info('** Creating Quagga network topology\n') - topo = BirdTopo() - - info('** Starting the network\n') - global net - net = MiniNExT(topo, controller=OVSController) - net.start() - - info('** Dumping host connections\n') - dumpNodeConnections(net.hosts) - - info('** Testing network connectivity\n') - net.ping(net.hosts) - - info('** Dumping host processes\n') - for host in net.hosts: - host.cmdPrint("ps aux") - - info('** Running CLI\n') - CLI(net) - - -def stopNetwork(): - "stops a network (only called on a forced cleanup)" - - if net is not None: - info('** Tearing down Quagga network\n') - net.stop() - -if __name__ == '__main__': - # Force cleanup on exit by registering a cleanup function - atexit.register(stopNetwork) - - # Tell mininet to print useful information - setLogLevel('info') - startNetwork() From dc0f2a38bc909c4de6c253e74fbd24d5fabdcac3 Mon Sep 17 00:00:00 2001 From: vikaskamath Date: Tue, 9 Dec 2014 14:24:11 -0800 Subject: [PATCH 04/12] Delete bird.conf~ --- examples/bird_exp/configs/a1/bird.conf~ | 59 ------------------------- 1 file changed, 59 deletions(-) delete mode 100755 examples/bird_exp/configs/a1/bird.conf~ diff --git a/examples/bird_exp/configs/a1/bird.conf~ b/examples/bird_exp/configs/a1/bird.conf~ deleted file mode 100755 index af655d0..0000000 --- a/examples/bird_exp/configs/a1/bird.conf~ +++ /dev/null @@ -1,59 +0,0 @@ -router id 172.0.1.1; - - -protocol kernel { - - persist; # Don't remove routes on bird shutdown - scan time 20; # Scan kernel routing table every 20 seconds - import all; - export all; # Default is export none - -} - - -protocol device { - scan time 10; # Scan interfaces every 10 seconds -} - - -protocol static { - - route 10.0.1.0:255.255.255.0 via 172.0.1.1; - -} - - - - -protocol bgp { - - description "AS 100"; - local as 100; - neighbor 172.0.254.254 as 65000; - import all; - export all; - hold time 240; - startup hold time 240; - connect retry time 120; - keepalive time 80; # defaults to hold time / 3 - start delay time 5; # How long do we wait before initial connect - error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive - - error forget time 300; # ... until this timeout expires) - disable after error; # Disable the protocol automatically when an error occurs - source address 172.0.1.1; # What local address we use for the TCP connection - -} -# -# Template usage example -#template bgp rr_client { -# disabled; -# local as 65000; -# multihop; -# rr client; -# rr cluster id 1.0.0.1; -#} -# -#protocol bgp rr_abcd from rr_client { -# neighbor 10.1.4.7 as 65000; -#} From ca97e23dbed2f6e84a1f87beb7b163b7f8e26b4a Mon Sep 17 00:00:00 2001 From: vikaskamath Date: Tue, 9 Dec 2014 14:24:15 -0800 Subject: [PATCH 05/12] Delete bird.conf~ --- examples/bird_exp/configs/b1/bird.conf~ | 218 ------------------------ 1 file changed, 218 deletions(-) delete mode 100755 examples/bird_exp/configs/b1/bird.conf~ diff --git a/examples/bird_exp/configs/b1/bird.conf~ b/examples/bird_exp/configs/b1/bird.conf~ deleted file mode 100755 index 248182b..0000000 --- a/examples/bird_exp/configs/b1/bird.conf~ +++ /dev/null @@ -1,218 +0,0 @@ -/* - * This is an example configuration file. - */ - -# Yes, even shell-like comments work... - -# Configure logging -#log syslog { debug, trace, info, remote, warning, error, auth, fatal, bug }; -#log stderr all; -#log "tmp" all; - -# Override router ID -router id 172.0.2.1; - -# You can define your own symbols... -#define xyzzy = (120+10); -#define '1a-a1' = (30+40); - -# Define a route filter... -#filter test_filter { -# if net ~ 10.0.0.0/16 then accept; -# else reject; -#} - -#filter sink { reject; } -#filter okay { accept; } - -#include "filters.conf"; - -# Define another routing table -#table testable; - -# Turn on global debugging of all protocols -#debug protocols all; - -# The direct protocol automatically generates device routes to -# all network interfaces. Can exist in as many instances as you wish -# if you want to populate multiple routing tables with device routes. -#protocol direct { -# interface "-eth*", "*"; # Restrict network interfaces it works with -#} - -# This pseudo-protocol performs synchronization between BIRD's routing -# tables and the kernel. If your kernel supports multiple routing tables -# (as Linux 2.2.x does), you can run multiple instances of the kernel -# protocol and synchronize different kernel tables with different BIRD tables. -protocol kernel { -# learn; # Learn all alien routes from the kernel - persist; # Don't remove routes on bird shutdown - scan time 20; # Scan kernel routing table every 20 seconds -# import none; # Default is import all - export all; # Default is export none -# kernel table 5; # Kernel table to synchronize with (default: main) -} - -# This pseudo-protocol watches all interface up/down events. -protocol device { - scan time 10; # Scan interfaces every 10 seconds -} - -# Static routes (again, there can be multiple instances, so that you -# can disable/enable various groups of static routes on the fly). -protocol static { -# disabled; # Disable by default -# table testable; # Connect to a non-default table -# preference 1000; # Default preference of routes -# debug { states, routes, filters, interfaces, events, packets }; -# debug all; -# route 0.0.0.0/0 via 198.51.100.13; -# route 198.51.100.0/25 unreachable; -# route 10.0.0.0/8 unreachable; -# route 10.1.1.0:255.255.255.0 via 198.51.100.3; - route 10.0.2.0:255.255.255.0 via 172.0.2.1; -# route 10.1.3.0:255.255.255.0 via 198.51.100.4; -# route 10.2.0.0/24 via "arc0"; -} - -# Pipe protocol connects two routing tables... Beware of loops. -#protocol pipe { -# peer table testable; -# Define what routes do we export to this protocol / import from it. -# import all; # default is all -# export all; # default is none -# import none; # If you wish to disable imports -# import filter test_filter; # Use named filter -# import where source = RTS_DEVICE; # Use explicit filter -#} - -# RIP aka Rest In Pieces... -#protocol rip MyRIP { # You can also use an explicit name -# preference xyzzy; -# debug all; -# port 1520; -# period 7; -# infinity 16; -# garbage time 60; -# interface "*" { mode broadcast; }; -# honor neighbor; # To whom do we agree to send the routing table -# honor always; -# honor never; -# passwords { -# password "nazdar"; -# }; -# authentication none; -# import filter { print "importing"; accept; }; -# export filter { print "exporting"; accept; }; -#} - -#protocol ospf MyOSPF { -# tick 2; -# rfc1583compat yes; -# area 0.0.0.0 { -# stub no; -# interface "eth*" { -# hello 9; -# retransmit 6; -# cost 10; -# transmit delay 5; -# dead count 5; -# wait 50; -# type broadcast; -# authentication simple; -# password "pass"; -# }; -# interface "arc0" { -# rx buffer large; -# type nonbroadcast; -# poll 14; -# dead 75; -# neighbors { -# 10.1.1.2 eligible; -# 10.1.1.4; -# }; -# strict nonbroadcast yes; -# }; -# interface "xxx0" { -# passwords { -# password "abc" { -# id 1; -# generate to "22-04-2003 11:00:06"; -# accept to "17-01-2004 12:01:05"; -# }; -# password "def" { -# id 2; -# generate from "22-04-2003 11:00:07"; -# accept from "17-01-2003 12:01:05"; -# }; -# }; -# authentication cryptographic; -# }; -# }; -# area 20 { -# stub 1; -# interface "ppp1" { -# hello 8; -# authentication none; -# }; -# interface "fr*"; -# virtual link 192.168.0.1 { -# password "sdsdffsdfg"; -# authentication cryptographic; -# }; -# }; -#} - - -protocol bgp { -# disabled; - description "AS 200"; - local as 200; - neighbor 172.0.254.254 as 65000; - export all; - import all; - hold time 240; - startup hold time 240; - connect retry time 120; - keepalive time 80; # defaults to hold time / 3 - start delay time 5; # How long do we wait before initial connect - error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive -# # errors occur, we increase the delay exponentially ... - error forget time 300; # ... until this timeout expires) - disable after error; # Disable the protocol automatically when an error occurs - #next hop self; # Disable next hop processing and always advertise our local address as nexthop - path metric 1; # Prefer routes with shorter paths (like Cisco does) - default bgp_med 0; # MED value we use for comparison when none is defined - default bgp_local_pref 0; # The same for local preference - source address 172.0.2.1; # What local address we use for the TCP connection -# password "secret"; # Password used for MD5 authentication -# rr client; # I am a route reflector and the neighor is my client -# rr cluster id 1.0.0.1; # Use this value for cluster id instead of my router id -# export where source=RTS_STATIC; -# export filter { -# if source = RTS_STATIC then { -# bgp_community = -empty-; bgp_community = add(bgp_community,(65000,5678)); -# bgp_origin = 0; -# bgp_community = -empty-; bgp_community.add((65000,5678)); -# if (65000,64501) ~ bgp_community then -# bgp_community.add((0, 1)); -# if bgp_path ~ [= 65000 =] then -# bgp_path.prepend(65000); -# accept; -# } -# reject; - #}; -} -# -# Template usage example -#template bgp rr_client { -# disabled; -# local as 65000; -# multihop; -# rr client; -# rr cluster id 1.0.0.1; -#} -# -#protocol bgp rr_abcd from rr_client { -# neighbor 10.1.4.7 as 65000; -#} From a436a7bf5872c3bb31ddb877ed9a1542425e1138 Mon Sep 17 00:00:00 2001 From: vikaskamath Date: Tue, 9 Dec 2014 14:24:18 -0800 Subject: [PATCH 06/12] Delete bird.conf~ --- examples/bird_exp/configs/c1/bird.conf~ | 95 ------------------------- 1 file changed, 95 deletions(-) delete mode 100755 examples/bird_exp/configs/c1/bird.conf~ diff --git a/examples/bird_exp/configs/c1/bird.conf~ b/examples/bird_exp/configs/c1/bird.conf~ deleted file mode 100755 index a7e5f16..0000000 --- a/examples/bird_exp/configs/c1/bird.conf~ +++ /dev/null @@ -1,95 +0,0 @@ -/* - * This is an example configuration file. - */ - -# Yes, even shell-like comments work... - -# Configure logging -#log syslog { debug, trace, info, remote, warning, error, auth, fatal, bug }; -#log stderr all; -#log "tmp" all; - -# Override router ID -router id 172.0.3.2; - -# You can define your own symbols... -#define xyzzy = (120+10); -#define '1a-a1' = (30+40); - -# Define a route filter... -#filter test_filter { -# if net ~ 10.0.0.0/16 then accept; -# else reject; -#} - -#filter sink { reject; } -#filter okay { accept; } - -#include "filters.conf"; - -# Define another routing table -#table testable; - -# Turn on global debugging of all protocols -#debug protocols all; - -# The direct protocol automatically generates device routes to -# all network interfaces. Can exist in as many instances as you wish -# if you want to populate multiple routing tables with device routes. -#protocol direct { -# interface "-eth*", "*"; # Restrict network interfaces it works with -#} - -# This pseudo-protocol performs synchronization between BIRD's routing -# tables and the kernel. If your kernel supports multiple routing tables -# (as Linux 2.2.x does), you can run multiple instances of the kernel -# protocol and synchronize different kernel tables with different BIRD tables. -protocol kernel { - - persist; # Don't remove routes on bird shutdown - scan time 20; # Scan kernel routing table every 20 seconds - import all; # Default is import all - export all; # Default is export none - -} - -# This pseudo-protocol watches all interface up/down events. -protocol device { - scan time 10; # Scan interfaces every 10 seconds -} - -# Static routes (again, there can be multiple instances, so that you -# can disable/enable various groups of static routes on the fly). -protocol static { - - route 10.1.3.0:255.255.255.0 via 172.0.3.2; - -} - - - -protocol bgp { - - description "AS 300_1"; - local as 300; - neighbor 172.0.254.254 as 65000; - export all; - import all; - hold time 240; - startup hold time 240; - connect retry time 120; - keepalive time 80; # defaults to hold time / 3 - start delay time 5; # How long do we wait before initial connect - error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive -# # errors occur, we increase the delay exponentially ... - error forget time 300; # ... until this timeout expires) - disable after error; # Disable the protocol automatically when an error occurs - #next hop self; # Disable next hop processing and always advertise our local address as nexthop - path metric 1; # Prefer routes with shorter paths (like Cisco does) - default bgp_med 0; # MED value we use for comparison when none is defined - default bgp_local_pref 0; # The same for local preference - source address 172.0.3.2; # What local address we use for the TCP connection - -} - - From 9d389b7d18fd6d07f90ba62b4adc3dd6005fcc69 Mon Sep 17 00:00:00 2001 From: vikaskamath Date: Tue, 9 Dec 2014 14:24:22 -0800 Subject: [PATCH 07/12] Delete bird.conf~ --- examples/bird_exp/configs/c2/bird.conf~ | 48 ------------------------- 1 file changed, 48 deletions(-) delete mode 100755 examples/bird_exp/configs/c2/bird.conf~ diff --git a/examples/bird_exp/configs/c2/bird.conf~ b/examples/bird_exp/configs/c2/bird.conf~ deleted file mode 100755 index 1d4cbe8..0000000 --- a/examples/bird_exp/configs/c2/bird.conf~ +++ /dev/null @@ -1,48 +0,0 @@ -router id 172.0.3.1; - - -protocol kernel { - - persist; # Don't remove routes on bird shutdown - scan time 20; # Scan kernel routing table every 20 seconds - import all; - export all; # Default is export none - -} - - -protocol device { - scan time 10; # Scan interfaces every 10 seconds -} - - -protocol static { - - route 10.0.3.0:255.255.255.0 via 172.0.3.1; - -} - - - - -protocol bgp { - - description "AS 300_2"; - local as 300; - neighbor 172.0.254.254 as 65000; - import all; - export all; - hold time 240; - startup hold time 240; - connect retry time 120; - keepalive time 80; # defaults to hold time / 3 - start delay time 5; # How long do we wait before initial connect - error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive - - error forget time 300; # ... until this timeout expires) - disable after error; # Disable the protocol automatically when an error occurs - source address 172.0.3.1; # What local address we use for the TCP connection - -} - - From d404049e473222f48979eb893a1f90af201e221f Mon Sep 17 00:00:00 2001 From: vikaskamath Date: Tue, 9 Dec 2014 14:24:24 -0800 Subject: [PATCH 08/12] Delete bird.conf~ --- examples/bird_exp/configs/d1/bird.conf~ | 218 ------------------------ 1 file changed, 218 deletions(-) delete mode 100755 examples/bird_exp/configs/d1/bird.conf~ diff --git a/examples/bird_exp/configs/d1/bird.conf~ b/examples/bird_exp/configs/d1/bird.conf~ deleted file mode 100755 index 675d5ce..0000000 --- a/examples/bird_exp/configs/d1/bird.conf~ +++ /dev/null @@ -1,218 +0,0 @@ -/* - * This is an example configuration file. - */ - -# Yes, even shell-like comments work... - -# Configure logging -#log syslog { debug, trace, info, remote, warning, error, auth, fatal, bug }; -#log stderr all; -#log "tmp" all; - -# Override router ID -router id 172.0.4.1; - -# You can define your own symbols... -#define xyzzy = (120+10); -#define '1a-a1' = (30+40); - -# Define a route filter... -#filter test_filter { -# if net ~ 10.0.0.0/16 then accept; -# else reject; -#} - -#filter sink { reject; } -#filter okay { accept; } - -#include "filters.conf"; - -# Define another routing table -#table testable; - -# Turn on global debugging of all protocols -#debug protocols all; - -# The direct protocol automatically generates device routes to -# all network interfaces. Can exist in as many instances as you wish -# if you want to populate multiple routing tables with device routes. -#protocol direct { -# interface "-eth*", "*"; # Restrict network interfaces it works with -#} - -# This pseudo-protocol performs synchronization between BIRD's routing -# tables and the kernel. If your kernel supports multiple routing tables -# (as Linux 2.2.x does), you can run multiple instances of the kernel -# protocol and synchronize different kernel tables with different BIRD tables. -protocol kernel { -# learn; # Learn all alien routes from the kernel - persist; # Don't remove routes on bird shutdown - scan time 20; # Scan kernel routing table every 20 seconds -# import none; # Default is import all - export all; # Default is export none -# kernel table 5; # Kernel table to synchronize with (default: main) -} - -# This pseudo-protocol watches all interface up/down events. -protocol device { - scan time 10; # Scan interfaces every 10 seconds -} - -# Static routes (again, there can be multiple instances, so that you -# can disable/enable various groups of static routes on the fly). -protocol static { -# disabled; # Disable by default -# table testable; # Connect to a non-default table -# preference 1000; # Default preference of routes -# debug { states, routes, filters, interfaces, events, packets }; -# debug all; -# route 0.0.0.0/0 via 198.51.100.13; -# route 198.51.100.0/25 unreachable; -# route 10.0.0.0/8 unreachable; -# route 10.1.1.0:255.255.255.0 via 198.51.100.3; - route 10.1.4.0:255.255.255.0 via 172.0.4.1; -# route 10.1.4.0:255.255.255.0 via 198.51.100.4; -# route 10.2.0.0/24 via "arc0"; -} - -# Pipe protocol connects two routing tables... Beware of loops. -#protocol pipe { -# peer table testable; -# Define what routes do we export to this protocol / import from it. -# import all; # default is all -# export all; # default is none -# import none; # If you wish to disable imports -# import filter test_filter; # Use named filter -# import where source = RTS_DEVICE; # Use explicit filter -#} - -# RIP aka Rest In Pieces... -#protocol rip MyRIP { # You can also use an explicit name -# preference xyzzy; -# debug all; -# port 1520; -# period 7; -# infinity 16; -# garbage time 60; -# interface "*" { mode broadcast; }; -# honor neighbor; # To whom do we agree to send the routing table -# honor always; -# honor never; -# passwords { -# password "nazdar"; -# }; -# authentication none; -# import filter { print "importing"; accept; }; -# export filter { print "exporting"; accept; }; -#} - -#protocol ospf MyOSPF { -# tick 2; -# rfc1583compat yes; -# area 0.0.0.0 { -# stub no; -# interface "eth*" { -# hello 9; -# retransmit 6; -# cost 10; -# transmit delay 5; -# dead count 5; -# wait 50; -# type broadcast; -# authentication simple; -# password "pass"; -# }; -# interface "arc0" { -# rx buffer large; -# type nonbroadcast; -# poll 14; -# dead 75; -# neighbors { -# 10.1.1.2 eligible; -# 10.1.1.4; -# }; -# strict nonbroadcast yes; -# }; -# interface "xxx0" { -# passwords { -# password "abc" { -# id 1; -# generate to "22-04-2003 11:00:06"; -# accept to "17-01-2004 12:01:05"; -# }; -# password "def" { -# id 2; -# generate from "22-04-2003 11:00:07"; -# accept from "17-01-2003 12:01:05"; -# }; -# }; -# authentication cryptographic; -# }; -# }; -# area 20 { -# stub 1; -# interface "ppp1" { -# hello 8; -# authentication none; -# }; -# interface "fr*"; -# virtual link 192.168.0.1 { -# password "sdsdffsdfg"; -# authentication cryptographic; -# }; -# }; -#} - - -protocol bgp { -# disabled; - description "AS 400"; - local as 400; - neighbor 172.0.254.254 as 65000; - export all; - import all; - hold time 240; - startup hold time 240; - connect retry time 120; - keepalive time 80; # defaults to hold time / 3 - start delay time 5; # How long do we wait before initial connect - error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive -# # errors occur, we increase the delay exponentially ... - error forget time 300; # ... until this timeout expires) - disable after error; # Disable the protocol automatically when an error occurs - #next hop self; # Disable next hop processing and always advertise our local address as nexthop - path metric 1; # Prefer routes with shorter paths (like Cisco does) - default bgp_med 0; # MED value we use for comparison when none is defined - default bgp_local_pref 0; # The same for local preference - source address 172.0.4.1; # What local address we use for the TCP connection -# password "secret"; # Password used for MD5 authentication -# rr client; # I am a route reflector and the neighor is my client -# rr cluster id 1.0.0.1; # Use this value for cluster id instead of my router id -# export where source=RTS_STATIC; -# export filter { -# if source = RTS_STATIC then { -# bgp_community = -empty-; bgp_community = add(bgp_community,(65000,5678)); -# bgp_origin = 0; -# bgp_community = -empty-; bgp_community.add((65000,5678)); -# if (65000,64501) ~ bgp_community then -# bgp_community.add((0, 1)); -# if bgp_path ~ [= 65000 =] then -# bgp_path.prepend(65000); -# accept; -# } -# reject; - #}; -} -# -# Template usage example -#template bgp rr_client { -# disabled; -# local as 65000; -# multihop; -# rr client; -# rr cluster id 1.0.0.1; -#} -# -#protocol bgp rr_abcd from rr_client { -# neighbor 10.1.4.7 as 65000; -#} From fb9c1b994377b1d40c6da63f3fa4f54daf09e8e1 Mon Sep 17 00:00:00 2001 From: vikaskamath Date: Tue, 9 Dec 2014 14:24:28 -0800 Subject: [PATCH 09/12] Delete bird.conf~ --- examples/bird_exp/configs/rs/bird.conf~ | 375 ------------------------ 1 file changed, 375 deletions(-) delete mode 100755 examples/bird_exp/configs/rs/bird.conf~ diff --git a/examples/bird_exp/configs/rs/bird.conf~ b/examples/bird_exp/configs/rs/bird.conf~ deleted file mode 100755 index a37d78a..0000000 --- a/examples/bird_exp/configs/rs/bird.conf~ +++ /dev/null @@ -1,375 +0,0 @@ -/* - * This is an example configuration file. - */ - -# Yes, even shell-like comments work... - -# Configure logging -#log syslog { debug, trace, info, remote, warning, error, auth, fatal, bug }; -#log stderr all; -#log "tmp" all; - -# Override router ID -router id 172.0.254.254; - -# You can define your own symbols... -#define xyzzy = (120+10); -#define '1a-a1' = (30+40); - -# Define a route filter... -#filter test_filter { -# if net ~ 10.0.0.0/16 then accept; -# else reject; -#} - -#filter sink { reject; } -#filter okay { accept; } - -#include "filters.conf"; - -# Define another routing table -#table testable; - -# Turn on global debugging of all protocols -#debug protocols all; - -# The direct protocol automatically generates device routes to -# all network interfaces. Can exist in as many instances as you wish -# if you want to populate multiple routing tables with device routes. -#protocol direct { -# interface "-eth*", "*"; # Restrict network interfaces it works with -#} - -# This pseudo-protocol performs synchronization between BIRD's routing -# tables and the kernel. If your kernel supports multiple routing tables -# (as Linux 2.2.x does), you can run multiple instances of the kernel -# protocol and synchronize different kernel tables with different BIRD tables. -protocol kernel { -# learn; # Learn all alien routes from the kernel - persist; # Don't remove routes on bird shutdown - scan time 20; # Scan kernel routing table every 20 seconds -# import none; # Default is import all - export all; # Default is export none -# kernel table 5; # Kernel table to synchronize with (default: main) -} - -# This pseudo-protocol watches all interface up/down events. -protocol device { - scan time 10; # Scan interfaces every 10 seconds -} - -# Static routes (again, there can be multiple instances, so that you -# can disable/enable various groups of static routes on the fly). -protocol static { -# disabled; # Disable by default -# table testable; # Connect to a non-default table -# preference 1000; # Default preference of routes -# debug { states, routes, filters, interfaces, events, packets }; -# debug all; -# route 0.0.0.0/0 via 198.51.100.13; -# route 198.51.100.0/25 unreachable; -# route 10.0.0.0/8 unreachable; -# route 10.1.1.0:255.255.255.0 via 198.51.100.3; -# route 10.1.2.0:255.255.255.0 via 198.51.100.3; -# route 10.1.3.0:255.255.255.0 via 198.51.100.4; -# route 10.2.0.0/24 via "arc0"; -} - -# Pipe protocol connects two routing tables... Beware of loops. -#protocol pipe { -# peer table testable; -# Define what routes do we export to this protocol / import from it. -# import all; # default is all -# export all; # default is none -# import none; # If you wish to disable imports -# import filter test_filter; # Use named filter -# import where source = RTS_DEVICE; # Use explicit filter -#} - -# RIP aka Rest In Pieces... -#protocol rip MyRIP { # You can also use an explicit name -# preference xyzzy; -# debug all; -# port 1520; -# period 7; -# infinity 16; -# garbage time 60; -# interface "*" { mode broadcast; }; -# honor neighbor; # To whom do we agree to send the routing table -# honor always; -# honor never; -# passwords { -# password "nazdar"; -# }; -# authentication none; -# import filter { print "importing"; accept; }; -# export filter { print "exporting"; accept; }; -#} - -#protocol ospf MyOSPF { -# tick 2; -# rfc1583compat yes; -# area 0.0.0.0 { -# stub no; -# interface "eth*" { -# hello 9; -# retransmit 6; -# cost 10; -# transmit delay 5; -# dead count 5; -# wait 50; -# type broadcast; -# authentication simple; -# password "pass"; -# }; -# interface "arc0" { -# rx buffer large; -# type nonbroadcast; -# poll 14; -# dead 75; -# neighbors { -# 10.1.1.2 eligible; -# 10.1.1.4; -# }; -# strict nonbroadcast yes; -# }; -# interface "xxx0" { -# passwords { -# password "abc" { -# id 1; -# generate to "22-04-2003 11:00:06"; -# accept to "17-01-2004 12:01:05"; -# }; -# password "def" { -# id 2; -# generate from "22-04-2003 11:00:07"; -# accept from "17-01-2003 12:01:05"; -# }; -# }; -# authentication cryptographic; -# }; -# }; -# area 20 { -# stub 1; -# interface "ppp1" { -# hello 8; -# authentication none; -# }; -# interface "fr*"; -# virtual link 192.168.0.1 { -# password "sdsdffsdfg"; -# authentication cryptographic; -# }; -# }; -#} - - -protocol bgp v_0 { -# disabled; - description "Route Server"; - local as 65000; - neighbor 172.0.1.1 as 100; - import all; - export all; - hold time 240; - startup hold time 240; - connect retry time 120; - keepalive time 80; # defaults to hold time / 3 - start delay time 5; # How long do we wait before initial connect - error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive -# # errors occur, we increase the delay exponentially ... - error forget time 300; # ... until this timeout expires) - disable after error; # Disable the protocol automatically when an error occurs - #next hop self; # Disable next hop processing and always advertise our local address as nexthop - path metric 1; # Prefer routes with shorter paths (like Cisco does) - default bgp_med 0; # MED value we use for comparison when none is defined - default bgp_local_pref 0; # The same for local preference - source address 172.0.254.254; - rs client; # What local address we use for the TCP connection -# password "secret"; # Password used for MD5 authentication -# rr client; # I am a route reflector and the neighor is my client -# rr cluster id 1.0.0.1; # Use this value for cluster id instead of my router id -# export where source=RTS_STATIC; -# export filter { -# if source = RTS_STATIC then { -# bgp_community = -empty-; bgp_community = add(bgp_community,(65000,5678)); -# bgp_origin = 0; -# bgp_community = -empty-; bgp_community.add((65000,5678)); -# if (65000,64501) ~ bgp_community then -# bgp_community.add((0, 1)); -# if bgp_path ~ [= 65000 =] then -# bgp_path.prepend(65000); -# accept; -# } -# reject; - #}; -} - -protocol bgp v_1 { -# disabled; - description "Route Server"; - local as 65000; - neighbor 172.0.2.1 as 200; - - export all; - import all; - hold time 240; - startup hold time 240; - connect retry time 120; - keepalive time 80; # defaults to hold time / 3 - start delay time 5; # How long do we wait before initial connect - error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive -# # errors occur, we increase the delay exponentially ... - error forget time 300; # ... until this timeout expires) - disable after error; # Disable the protocol automatically when an error occurs - #next hop self; # Disable next hop processing and always advertise our local address as nexthop - path metric 1; # Prefer routes with shorter paths (like Cisco does) - default bgp_med 0; # MED value we use for comparison when none is defined - default bgp_local_pref 0; # The same for local preference - source address 172.0.254.254; - rs client; # What local address we use for the TCP connection -# password "secret"; # Password used for MD5 authentication -# rr client; # I am a route reflector and the neighor is my client -# rr cluster id 1.0.0.1; # Use this value for cluster id instead of my router id -# export where source=RTS_STATIC; -# export filter { -# if source = RTS_STATIC then { -# bgp_community = -empty-; bgp_community = add(bgp_community,(65000,5678)); -# bgp_origin = 0; -# bgp_community = -empty-; bgp_community.add((65000,5678)); -# if (65000,64501) ~ bgp_community then -# bgp_community.add((0, 1)); -# if bgp_path ~ [= 65000 =] then -# bgp_path.prepend(65000); -# accept; -# } -# reject; - #}; -} - -protocol bgp v_2 { -# disabled; - description "Route Server"; - local as 65000; - neighbor 172.0.3.1 as 300; - export all; - import all; - hold time 240; - startup hold time 240; - connect retry time 120; - keepalive time 80; # defaults to hold time / 3 - start delay time 5; # How long do we wait before initial connect - error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive -# # errors occur, we increase the delay exponentially ... - error forget time 300; # ... until this timeout expires) - disable after error; # Disable the protocol automatically when an error occurs - #next hop self; # Disable next hop processing and always advertise our local address as nexthop - path metric 1; # Prefer routes with shorter paths (like Cisco does) - default bgp_med 0; # MED value we use for comparison when none is defined - default bgp_local_pref 0; # The same for local preference - source address 172.0.254.254; -rs client; # What local address we use for the TCP connection -# password "secret"; # Password used for MD5 authentication -# rr client; # I am a route reflector and the neighor is my client -# rr cluster id 1.0.0.1; # Use this value for cluster id instead of my router id -# export where source=RTS_STATIC; -# export filter { -# if source = RTS_STATIC then { -# bgp_community = -empty-; bgp_community = add(bgp_community,(65000,5678)); -# bgp_origin = 0; -# bgp_community = -empty-; bgp_community.add((65000,5678)); -# if (65000,64501) ~ bgp_community then -# bgp_community.add((0, 1)); -# if bgp_path ~ [= 65000 =] then -# bgp_path.prepend(65000); -# accept; -# } -# reject; - #}; -} - -protocol bgp v_3 { -# disabled; - description "Route Server"; - local as 65000; - neighbor 172.0.3.2 as 300; - export all; - import all; - hold time 240; - startup hold time 240; - connect retry time 120; - keepalive time 80; # defaults to hold time / 3 - start delay time 5; # How long do we wait before initial connect - error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive -# # errors occur, we increase the delay exponentially ... - error forget time 300; # ... until this timeout expires) - disable after error; # Disable the protocol automatically when an error occurs - #next hop self; # Disable next hop processing and always advertise our local address as nexthop - path metric 1; # Prefer routes with shorter paths (like Cisco does) - default bgp_med 0; # MED value we use for comparison when none is defined - default bgp_local_pref 0; # The same for local preference - source address 172.0.254.254; -rs client; # What local address we use for the TCP connection -# password "secret"; # Password used for MD5 authentication -# rr client; # I am a route reflector and the neighor is my client -# rr cluster id 1.0.0.1; # Use this value for cluster id instead of my router id -# export where source=RTS_STATIC; -# export filter { -# if source = RTS_STATIC then { -# bgp_community = -empty-; bgp_community = add(bgp_community,(65000,5678)); -# bgp_origin = 0; -# bgp_community = -empty-; bgp_community.add((65000,5678)); -# if (65000,64501) ~ bgp_community then -# bgp_community.add((0, 1)); -# if bgp_path ~ [= 65000 =] then -# bgp_path.prepend(65000); -# accept; -# } -# reject; - #}; -} - -protocol bgp v_4 { -# disabled; - description "Route Server"; - local as 65000; - neighbor 172.0.4.1 as 400; - export all; - import all; - - hold time 240; - startup hold time 240; - connect retry time 120; - keepalive time 80; # defaults to hold time / 3 - start delay time 5; # How long do we wait before initial connect - error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive -# # errors occur, we increase the delay exponentially ... - error forget time 300; # ... until this timeout expires) - disable after error; # Disable the protocol automatically when an error occurs - #next hop self; # Disable next hop processing and always advertise our local address as nexthop - path metric 1; # Prefer routes with shorter paths (like Cisco does) - default bgp_med 0; # MED value we use for comparison when none is defined - default bgp_local_pref 0; # The same for local preference - source address 172.0.254.254; - rs client; # What local address we use for the TCP connection -# password "secret"; # Password used for MD5 authentication -# rr client; # I am a route reflector and the neighor is my client -# rr cluster id 1.0.0.1; # Use this value for cluster id instead of my router id -# export where source=RTS_STATIC; -# export filter { -# if source = RTS_STATIC then { -# bgp_community = -empty-; bgp_community = add(bgp_community,(65000,5678)); -# bgp_origin = 0; -# bgp_community = -empty-; bgp_community.add((65000,5678)); -# if (65000,64501) ~ bgp_community then -# bgp_community.add((0, 1)); -# if bgp_path ~ [= 65000 =] then -# bgp_path.prepend(65000); -# accept; -# } -# reject; - #}; -} - - - From 77243df580db345cff083bd57ff522e38c09f4f9 Mon Sep 17 00:00:00 2001 From: vikaskamath Date: Tue, 9 Dec 2014 14:24:34 -0800 Subject: [PATCH 10/12] Delete topo.py~ --- examples/bird_exp/topo.py~ | 77 -------------------------------------- 1 file changed, 77 deletions(-) delete mode 100644 examples/bird_exp/topo.py~ diff --git a/examples/bird_exp/topo.py~ b/examples/bird_exp/topo.py~ deleted file mode 100644 index 77b20e3..0000000 --- a/examples/bird_exp/topo.py~ +++ /dev/null @@ -1,77 +0,0 @@ -""" -Example topology of Quagga routers -""" - -import inspect -import os -from mininext.topo import Topo -from mininext.services.quagga import QuaggaService - -from collections import namedtuple - -QuaggaHost = namedtuple("QuaggaHost", "name ip loIP") -net = None - - -class QuaggaTopo(Topo): - - "Creates a topology of Quagga routers" - - def __init__(self): - """Initialize a Quagga topology with 5 routers, configure their IP - addresses, loop back interfaces, and paths to their private - configuration directories.""" - Topo.__init__(self) - - # Directory where this file / script is located" - selfPath = os.path.dirname(os.path.abspath( - inspect.getfile(inspect.currentframe()))) # script directory - - # Initialize a service helper for Quagga with default options - quaggaSvc = QuaggaService(autoStop=False) - - # Path configurations for mounts - quaggaBaseConfigPath = selfPath + '/configs/' - - # List of Quagga host configs - quaggaHosts = [] - quaggaHosts.append(QuaggaHost(name='a1', ip='172.0.1.1/16', - loIP='10.0.1.1/24')) - quaggaHosts.append(QuaggaHost(name='b1', ip='172.0.2.1/16', - loIP='10.0.2.1/24')) - quaggaHosts.append(QuaggaHost(name='c1', ip='172.0.3.2/16', - loIP='10.0.3.1/24')) - quaggaHosts.append(QuaggaHost(name='c2', ip='172.0.3.1/16', - loIP='10.0.3.1/24')) - quaggaHosts.append(QuaggaHost(name='d1', ip='172.0.4.1/16', - loIP='10.0.4.1/24')) - quaggaHosts.append(QuaggaHost(name='rs', ip='172.0.254.254/16', - loIP=None)) - - # Add switch for IXP fabric - ixpfabric = self.addSwitch('fabric-sw1') - - # Setup each Quagga router, add a link between it and the IXP fabric - for host in quaggaHosts: - - # Create an instance of a host, called a quaggaContainer - quaggaContainer = self.addHost(name=host.name, - ip=host.ip, - hostname=host.name, - privateLogDir=True, - privateRunDir=True, - inMountNamespace=True, - inPIDNamespace=True, - inUTSNamespace=True) - - # Add a loopback interface with an IP in router's announced range - self.addNodeLoopbackIntf(node=host.name, ip=host.loIP) - - # Configure and setup the Quagga service for this node - quaggaSvcConfig = \ - {'quaggaConfigPath': quaggaBaseConfigPath + host.name} - self.addNodeService(node=host.name, service=quaggaSvc, - nodeConfig=quaggaSvcConfig) - - # Attach the quaggaContainer to the IXP Fabric Switch - self.addLink(quaggaContainer, ixpfabric) From f75b97be0d88c19bc3aa2a70d813bd00f74b971e Mon Sep 17 00:00:00 2001 From: vikas89 Date: Wed, 31 Dec 2014 01:36:27 -0800 Subject: [PATCH 11/12] adding new bird example --- examples/bird_exp_2/__init__.py | 3 + examples/bird_exp_2/configs/Client1/bird.conf | 48 +++++++ examples/bird_exp_2/configs/Client1/envvars | 3 + examples/bird_exp_2/configs/Client2/bird.conf | 48 +++++++ examples/bird_exp_2/configs/Client2/envvars | 3 + examples/bird_exp_2/configs/Peer1/bird.conf | 48 +++++++ examples/bird_exp_2/configs/Peer1/envvars | 3 + examples/bird_exp_2/configs/Peer2/bird.conf | 48 +++++++ examples/bird_exp_2/configs/Peer2/envvars | 3 + examples/bird_exp_2/configs/rs/bird.conf | 116 ++++++++++++++++ examples/bird_exp_2/configs/rs/envvars | 3 + examples/bird_exp_2/start.py | 73 ++++++++++ examples/bird_exp_2/topo.py | 128 ++++++++++++++++++ examples/bird_exp_2/topo.pyc | Bin 0 -> 2975 bytes 14 files changed, 527 insertions(+) create mode 100644 examples/bird_exp_2/__init__.py create mode 100755 examples/bird_exp_2/configs/Client1/bird.conf create mode 100755 examples/bird_exp_2/configs/Client1/envvars create mode 100755 examples/bird_exp_2/configs/Client2/bird.conf create mode 100755 examples/bird_exp_2/configs/Client2/envvars create mode 100755 examples/bird_exp_2/configs/Peer1/bird.conf create mode 100755 examples/bird_exp_2/configs/Peer1/envvars create mode 100755 examples/bird_exp_2/configs/Peer2/bird.conf create mode 100755 examples/bird_exp_2/configs/Peer2/envvars create mode 100755 examples/bird_exp_2/configs/rs/bird.conf create mode 100755 examples/bird_exp_2/configs/rs/envvars create mode 100755 examples/bird_exp_2/start.py create mode 100644 examples/bird_exp_2/topo.py create mode 100644 examples/bird_exp_2/topo.pyc diff --git a/examples/bird_exp_2/__init__.py b/examples/bird_exp_2/__init__.py new file mode 100644 index 0000000..5dd90ff --- /dev/null +++ b/examples/bird_exp_2/__init__.py @@ -0,0 +1,3 @@ +""" +Quagga IXP Example for MiniNExT +""" diff --git a/examples/bird_exp_2/configs/Client1/bird.conf b/examples/bird_exp_2/configs/Client1/bird.conf new file mode 100755 index 0000000..b586b18 --- /dev/null +++ b/examples/bird_exp_2/configs/Client1/bird.conf @@ -0,0 +1,48 @@ +router id 192.168.1.2; + + +protocol kernel { + + + scan time 20; # Scan kernel routing table every 20 seconds + import all; + export all; # Default is export none + +} + + +protocol device { + scan time 10; # Scan interfaces every 10 seconds +} + + +protocol static { + + route 10.0.3.0:255.255.255.0 via 192.168.1.2; + +} + + + + +protocol bgp { + + description "AS 65550"; + local as 65550; + neighbor 192.168.1.4 as 65000; + import all; + export all; + hold time 240; + startup hold time 240; + connect retry time 120; + keepalive time 80; # defaults to hold time / 3 + start delay time 5; # How long do we wait before initial connect + error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive + + error forget time 300; # ... until this timeout expires) + disable after error; # Disable the protocol automatically when an error occurs + source address 192.168.1.2; # What local address we use for the TCP connection + +} + + diff --git a/examples/bird_exp_2/configs/Client1/envvars b/examples/bird_exp_2/configs/Client1/envvars new file mode 100755 index 0000000..9ca9baa --- /dev/null +++ b/examples/bird_exp_2/configs/Client1/envvars @@ -0,0 +1,3 @@ +BIRD_RUN_USER=bird +BIRD_RUN_GROUP=bird +#BIRD_ARGS= diff --git a/examples/bird_exp_2/configs/Client2/bird.conf b/examples/bird_exp_2/configs/Client2/bird.conf new file mode 100755 index 0000000..ac959b4 --- /dev/null +++ b/examples/bird_exp_2/configs/Client2/bird.conf @@ -0,0 +1,48 @@ +router id 192.168.1.3; + + +protocol kernel { + + + scan time 20; # Scan kernel routing table every 20 seconds + import all; + export all; # Default is export none + +} + + +protocol device { + scan time 10; # Scan interfaces every 10 seconds +} + + +protocol static { + + route 10.0.4.0:255.255.255.0 via 192.168.1.3; + +} + + + + +protocol bgp { + + description "AS 65560"; + local as 65560; + neighbor 192.168.1.4 as 65000; + import all; + export all; + hold time 240; + startup hold time 240; + connect retry time 120; + keepalive time 80; # defaults to hold time / 3 + start delay time 5; # How long do we wait before initial connect + error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive + + error forget time 300; # ... until this timeout expires) + disable after error; # Disable the protocol automatically when an error occurs + source address 192.168.1.3; # What local address we use for the TCP connection + +} + + diff --git a/examples/bird_exp_2/configs/Client2/envvars b/examples/bird_exp_2/configs/Client2/envvars new file mode 100755 index 0000000..9ca9baa --- /dev/null +++ b/examples/bird_exp_2/configs/Client2/envvars @@ -0,0 +1,3 @@ +BIRD_RUN_USER=bird +BIRD_RUN_GROUP=bird +#BIRD_ARGS= diff --git a/examples/bird_exp_2/configs/Peer1/bird.conf b/examples/bird_exp_2/configs/Peer1/bird.conf new file mode 100755 index 0000000..5b14657 --- /dev/null +++ b/examples/bird_exp_2/configs/Peer1/bird.conf @@ -0,0 +1,48 @@ +router id 172.0.1.1; + + +protocol kernel { + + + scan time 20; # Scan kernel routing table every 20 seconds + import all; + export all; # Default is export none + +} + + +protocol device { + scan time 10; # Scan interfaces every 10 seconds +} + + +protocol static { + + route 10.0.1.0:255.255.255.0 via 172.0.1.1; + +} + + + + +protocol bgp { + + description "AS 100"; + local as 100; + neighbor 172.0.254.254 as 65000; + import all; + export all; + hold time 240; + startup hold time 240; + connect retry time 120; + keepalive time 80; # defaults to hold time / 3 + start delay time 5; # How long do we wait before initial connect + error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive + + error forget time 300; # ... until this timeout expires) + disable after error; # Disable the protocol automatically when an error occurs + source address 172.0.1.1; # What local address we use for the TCP connection + +} + + diff --git a/examples/bird_exp_2/configs/Peer1/envvars b/examples/bird_exp_2/configs/Peer1/envvars new file mode 100755 index 0000000..9ca9baa --- /dev/null +++ b/examples/bird_exp_2/configs/Peer1/envvars @@ -0,0 +1,3 @@ +BIRD_RUN_USER=bird +BIRD_RUN_GROUP=bird +#BIRD_ARGS= diff --git a/examples/bird_exp_2/configs/Peer2/bird.conf b/examples/bird_exp_2/configs/Peer2/bird.conf new file mode 100755 index 0000000..fb44e8c --- /dev/null +++ b/examples/bird_exp_2/configs/Peer2/bird.conf @@ -0,0 +1,48 @@ +router id 172.0.2.1; + + +protocol kernel { + + + scan time 20; # Scan kernel routing table every 20 seconds + import all; + export all; # Default is export none + +} + + +protocol device { + scan time 10; # Scan interfaces every 10 seconds +} + + +protocol static { + + route 10.0.2.0:255.255.255.0 via 172.0.2.1; + +} + + + + +protocol bgp { + + description "AS 200"; + local as 200; + neighbor 172.0.254.254 as 65000; + import all; + export all; + hold time 240; + startup hold time 240; + connect retry time 120; + keepalive time 80; # defaults to hold time / 3 + start delay time 5; # How long do we wait before initial connect + error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive + + error forget time 300; # ... until this timeout expires) + disable after error; # Disable the protocol automatically when an error occurs + source address 172.0.2.1; # What local address we use for the TCP connection + +} + + diff --git a/examples/bird_exp_2/configs/Peer2/envvars b/examples/bird_exp_2/configs/Peer2/envvars new file mode 100755 index 0000000..9ca9baa --- /dev/null +++ b/examples/bird_exp_2/configs/Peer2/envvars @@ -0,0 +1,3 @@ +BIRD_RUN_USER=bird +BIRD_RUN_GROUP=bird +#BIRD_ARGS= diff --git a/examples/bird_exp_2/configs/rs/bird.conf b/examples/bird_exp_2/configs/rs/bird.conf new file mode 100755 index 0000000..70ecf80 --- /dev/null +++ b/examples/bird_exp_2/configs/rs/bird.conf @@ -0,0 +1,116 @@ + + +protocol kernel { + + + scan time 20; # Scan kernel routing table every 20 seconds + import all; + export all; # Default is export none +} + + +protocol device { + scan time 10; # Scan interfaces every 10 seconds +} + + +protocol bgp v_0 { + + description "Route Server"; + local as 65000; + neighbor 172.0.1.1 as 100; + import all; + export all; + hold time 240; + startup hold time 240; + connect retry time 120; + keepalive time 80; # defaults to hold time / 3 + start delay time 5; # How long do we wait before initial connect + error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive + + error forget time 300; # ... until this timeout expires) + disable after error; # Disable the protocol automatically when an error occurs + + path metric 1; # Prefer routes with shorter paths (like Cisco does) + default bgp_med 0; # MED value we use for comparison when none is defined + default bgp_local_pref 0; # The same for local preference + source address 172.0.254.254; + rs client; # What local address we use for the TCP connection + +} + +protocol bgp v_1 { + + description "Route Server"; + local as 65000; + neighbor 172.0.2.1 as 200; + + export all; + import all; + hold time 240; + startup hold time 240; + connect retry time 120; + keepalive time 80; # defaults to hold time / 3 + start delay time 5; # How long do we wait before initial connect + error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive + + error forget time 300; # ... until this timeout expires) + disable after error; # Disable the protocol automatically when an error occurs + + path metric 1; # Prefer routes with shorter paths (like Cisco does) + default bgp_med 0; # MED value we use for comparison when none is defined + default bgp_local_pref 0; # The same for local preference + source address 172.0.254.254; + rs client; +} + +protocol bgp v_2 { + + description "Route Server"; + local as 65000; + neighbor 192.168.1.2 as 65550; + export all; + import all; + hold time 240; + startup hold time 240; + connect retry time 120; + keepalive time 80; # defaults to hold time / 3 + start delay time 5; # How long do we wait before initial connect + error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive + + error forget time 300; # ... until this timeout expires) + disable after error; # Disable the protocol automatically when an error occurs + + path metric 1; # Prefer routes with shorter paths (like Cisco does) + default bgp_med 0; # MED value we use for comparison when none is defined + default bgp_local_pref 0; # The same for local preference + source address 192.168.1.4; +rs client; +} + +protocol bgp v_3 { + + description "Route Server"; + local as 65000; + neighbor 192.168.1.3 as 65560; + export all; + import all; + hold time 240; + startup hold time 240; + connect retry time 120; + keepalive time 80; # defaults to hold time / 3 + start delay time 5; # How long do we wait before initial connect + error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive + + error forget time 300; # ... until this timeout expires) + disable after error; # Disable the protocol automatically when an error occurs + path metric 1; # Prefer routes with shorter paths (like Cisco does) + default bgp_med 0; # MED value we use for comparison when none is defined + default bgp_local_pref 0; # The same for local preference + source address 192.168.1.4; +rs client; +} + + + + diff --git a/examples/bird_exp_2/configs/rs/envvars b/examples/bird_exp_2/configs/rs/envvars new file mode 100755 index 0000000..9ca9baa --- /dev/null +++ b/examples/bird_exp_2/configs/rs/envvars @@ -0,0 +1,3 @@ +BIRD_RUN_USER=bird +BIRD_RUN_GROUP=bird +#BIRD_ARGS= diff --git a/examples/bird_exp_2/start.py b/examples/bird_exp_2/start.py new file mode 100755 index 0000000..cce2e02 --- /dev/null +++ b/examples/bird_exp_2/start.py @@ -0,0 +1,73 @@ +#!/usr/bin/python + +""" +Example network of Bird routers +(BirdTopo + BirdService) +""" + +import sys +import atexit + +# patch isShellBuiltin +import mininet.util +import mininext.util +mininet.util.isShellBuiltin = mininext.util.isShellBuiltin +sys.modules['mininet.util'] = mininet.util + +from mininet.util import dumpNodeConnections +from mininet.node import OVSController +from mininet.log import setLogLevel, info + +from mininext.cli import CLI +from mininext.net import MiniNExT + +from topo import BirdTopo + +net = None + + +def startNetwork(): + "instantiates a topo, then starts the network and prints debug information" + + info('** Creating Bird network topology\n') + topo = BirdTopo() + + info('** Starting the network\n') + global net + net = MiniNExT(topo, controller=OVSController) + net.start() + + info('** Dumping host connections\n') + dumpNodeConnections(net.hosts) + + info('** Testing network connectivity\n') + net.ping(net.hosts) + + info('** Dumping host processes\n') + for host in net.hosts: + host.cmdPrint("ps aux") + + if host.name == "rs": + host.cmd('ifconfig rs-eth1 192.168.1.4 netmask 255.255.255.0') + host.cmd('sysctl -w net.ipv4.ip_forward=1') + host.cmd('sysctl -p /etc/sysctl.conf') + host.cmd('/etc/init.d/procps restart') + + info('** Running CLI\n') + CLI(net) + + +def stopNetwork(): + "stops a network (only called on a forced cleanup)" + + if net is not None: + info('** Tearing down Bird network\n') + net.stop() + +if __name__ == '__main__': + # Force cleanup on exit by registering a cleanup function + atexit.register(stopNetwork) + + # Tell mininet to print useful information + setLogLevel('info') + startNetwork() diff --git a/examples/bird_exp_2/topo.py b/examples/bird_exp_2/topo.py new file mode 100644 index 0000000..8c1d03d --- /dev/null +++ b/examples/bird_exp_2/topo.py @@ -0,0 +1,128 @@ +""" +Example topology of Bird routers +""" + +import inspect +import os +from mininext.topo import Topo +from mininext.services.bird import BirdService +from mininet.net import Mininet +from collections import namedtuple + +BirdHost = namedtuple("BirdHost", "name ip loIP") +net = None + + +class BirdTopo(Topo): + + "Creates a topology of Bird routers" + + def __init__(self): + """Initialize a Bird topology with 5 routers, configure their IP + addresses, loop back interfaces, and paths to their private + configuration directories.""" + Topo.__init__(self) + + # Directory where this file / script is located" + selfPath = os.path.dirname(os.path.abspath( + inspect.getfile(inspect.currentframe()))) # script directory + + # Initialize a service helper for Bird with default options + BirdSvc = BirdService(autoStop=False) + + # Path configurations for mounts + BirdBaseConfigPath = selfPath + '/configs/' + + # List of Bird host configs + BirdHosts = [] + BirdClient = [] + BirdRS = [] + BirdHosts.append(BirdHost(name='Peer1', ip='172.0.1.1/16', + loIP='10.0.1.1/24')) + BirdHosts.append(BirdHost(name='Peer2', ip='172.0.2.1/16', + loIP='10.0.2.1/24')) + BirdClient.append(BirdHost(name='Client1', ip='192.168.1.2/24', + loIP='10.0.3.1/24')) + BirdClient.append(BirdHost(name='Client2', ip='192.168.1.3/24', + loIP='10.0.4.1/24')) + BirdRS.append(BirdHost(name='rs', ip='172.0.254.254/16',loIP=None)) + + # Add switch for IXP fabric + ixpfabric = self.addSwitch('fabric-sw1') + clientsw = self.addSwitch('fabric-sw2') + # Setup each Bird router, add a link between it and the IXP fabric + for host in BirdHosts: + + # Create an instance of a host, called a BirdContainer + BirdContainer = self.addHost(name=host.name, + ip=host.ip, + + hostname=host.name, + privateLogDir=True, + privateRunDir=True, + inMountNamespace=True, + inPIDNamespace=True, + inUTSNamespace=True) + + # Add a loopback interface with an IP in router's announced range + self.addNodeLoopbackIntf(node=host.name, ip=host.loIP) + + # Configure and setup the Bird service for this node + BirdSvcConfig = \ + {'BirdConfigPath': BirdBaseConfigPath + host.name} + self.addNodeService(node=host.name, service=BirdSvc, + nodeConfig=BirdSvcConfig) + + # Attach the BirdContainer to the IXP Fabric Switch + self.addLink(BirdContainer, ixpfabric) + + for host in BirdClient: + + # Create an instance of a host, called a BirdContainer + BirdClientContainer = self.addHost(name=host.name, + ip=host.ip, + + hostname=host.name, + privateLogDir=True, + privateRunDir=True, + inMountNamespace=True, + inPIDNamespace=True, + inUTSNamespace=True) + + # Add a loopback interface with an IP in router's announced range + # Add a loopback interface with an IP in router's announced range + self.addNodeLoopbackIntf(node=host.name, ip=host.loIP) + + # Configure and setup the Bird service for this node + BirdSvcConfig = \ + {'BirdConfigPath': BirdBaseConfigPath + host.name} + self.addNodeService(node=host.name, service=BirdSvc, + nodeConfig=BirdSvcConfig) + + # Attach the BirdContainer to the IXP Fabric Switch + self.addLink(BirdClientContainer, clientsw) + + + BirdRSContainer = self.addHost(name='rs', + ip='172.0.254.254/16', + + hostname='rs', + privateLogDir=True, + privateRunDir=True, + inMountNamespace=True, + inPIDNamespace=True, + inUTSNamespace=True) + + + + + # Configure and setup the Bird service for this node + BirdSvcConfig = \ + {'BirdConfigPath': BirdBaseConfigPath + 'rs'} + + self.addNodeService(node='rs', service=BirdSvc, + nodeConfig=BirdSvcConfig) + + + self.addLink(BirdRSContainer, ixpfabric) + self.addLink(BirdRSContainer, clientsw) diff --git a/examples/bird_exp_2/topo.pyc b/examples/bird_exp_2/topo.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b44d63afa83dab173952fac5d91e9da797df152d GIT binary patch literal 2975 zcmcImOK;mo5FUzpSh5}4i4*75ludikA(0}*NgpVJB5{ivNDPB=5mZ1S(B#UdO_2(B zf*(|7pPm1cb5{E21V)?$>F&oB_$e^sav+=5+xNH%u#pFj?0u( zX;7nXjT}{@s6x>ky@t7Y_R(FWs7k6xeVD4zFGR12e(YZ0xlVna!@3Po`}Q~(3=`#< zY?vk4-YYNbdynHh^73qCRIY3B-}r3R9e_;{Vh2DwVj~RgsQf4nl~q=td={s1s*F|C zph$y(ip&Up%-m$r_n9_&VKV2%LodlTw`a5LWX2=AevC)2K`8Kuj39+I(*kLQ=kKv4vI8+DUm7DK}94;77%dw z8#`pGynm(!y)!P*iR|mz*rh$9aZzMRWSLHibTCh5fg+bTI4V(8p6(pE?D-r5hJmnq zI}h^~Q95G-mVm%sWA`t-7qKLWWkIaW5Xfd0$3;P05`;HHfDRPPs^nNKc?0+z(%8WJ8C#q(HenEB8%*S(Z+yb1paWz>Z#M`J zy*Ned=?5WegEaDnf!WtM&l3y7JU+r1KWk>{BrtK7dQqIK&}4b6bVGVdFfv&O5$Y;p zZ(6W!Nq|^L`~oi8m_CKye;eL@3x59`eBHu1@?7g>HY}01AFMa< zAbQPBxF781ad=n1Y@Hvrg`s`)W1(UZ&PE~w`q*-L)TsTjpJhrjJ!jHC>3A(Ap+3Br1_kJG_NwmElt{Btn z$#x-fw#r2!Cb0XG3DX_yBDje@PW2FFA(%a7`Z2B}zJbC~o?}n?Ia2ZEp5t=(E=aUO z*N2VaP^FR2KE%;hhRcl$3ANinwTIR%MtrIH?AGUL0q^7^WiDCp7V>_IBIg?4ghQW` z6yC6wCnqI6bU0tzt>5q%Xj0KOC6iLt;TxeUQ^lMD!RD~pFMRv?6sTRb{fN1 z{xz6b#iNfQsJQ4}bZ)pyZp|$_{JrYb&ONu?C1pLbH&*l z)|Ly_uB@u86fR@UvQw8D;h#9Y9+w~rl()Fo8)VTa;UO1CuNP%uuO}g&lJLQp;Ns;2 zsyP_MS*SDl{#Pt+vA7N)o5}R1ptr#!+QW4Pb2IhiEb0dHZBGVwKRa(4I0Zg89mC2n yOA;I|bYJb`*A&Td@jvBh9x|2#`|$Znv3_j{e#EXcABA#Z!C7#Y?YDsaa{mFV@O}jV literal 0 HcmV?d00001 From 6dcf959eec26df50787099a3913a492ba0b35756 Mon Sep 17 00:00:00 2001 From: vikas89 Date: Sun, 4 Jan 2015 21:06:49 -0800 Subject: [PATCH 12/12] adding new bird example --- examples/{bird_exp_2 => peering-ixp}/__init__.py | 0 .../configs/Client1/bird.conf | 0 .../configs/Client1/envvars | 0 .../configs/Client2/bird.conf | 0 .../configs/Client2/envvars | 0 .../configs/Peer1/bird.conf | 0 .../configs/Peer1/envvars | 0 .../configs/Peer2/bird.conf | 0 .../configs/Peer2/envvars | 0 .../configs/rs/bird.conf | 0 .../{bird_exp_2 => peering-ixp}/configs/rs/envvars | 0 examples/{bird_exp_2 => peering-ixp}/start.py | 0 examples/{bird_exp_2 => peering-ixp}/topo.py | 0 examples/{bird_exp_2 => peering-ixp}/topo.pyc | Bin 14 files changed, 0 insertions(+), 0 deletions(-) rename examples/{bird_exp_2 => peering-ixp}/__init__.py (100%) rename examples/{bird_exp_2 => peering-ixp}/configs/Client1/bird.conf (100%) rename examples/{bird_exp_2 => peering-ixp}/configs/Client1/envvars (100%) rename examples/{bird_exp_2 => peering-ixp}/configs/Client2/bird.conf (100%) rename examples/{bird_exp_2 => peering-ixp}/configs/Client2/envvars (100%) rename examples/{bird_exp_2 => peering-ixp}/configs/Peer1/bird.conf (100%) rename examples/{bird_exp_2 => peering-ixp}/configs/Peer1/envvars (100%) rename examples/{bird_exp_2 => peering-ixp}/configs/Peer2/bird.conf (100%) rename examples/{bird_exp_2 => peering-ixp}/configs/Peer2/envvars (100%) rename examples/{bird_exp_2 => peering-ixp}/configs/rs/bird.conf (100%) rename examples/{bird_exp_2 => peering-ixp}/configs/rs/envvars (100%) rename examples/{bird_exp_2 => peering-ixp}/start.py (100%) rename examples/{bird_exp_2 => peering-ixp}/topo.py (100%) rename examples/{bird_exp_2 => peering-ixp}/topo.pyc (100%) diff --git a/examples/bird_exp_2/__init__.py b/examples/peering-ixp/__init__.py similarity index 100% rename from examples/bird_exp_2/__init__.py rename to examples/peering-ixp/__init__.py diff --git a/examples/bird_exp_2/configs/Client1/bird.conf b/examples/peering-ixp/configs/Client1/bird.conf similarity index 100% rename from examples/bird_exp_2/configs/Client1/bird.conf rename to examples/peering-ixp/configs/Client1/bird.conf diff --git a/examples/bird_exp_2/configs/Client1/envvars b/examples/peering-ixp/configs/Client1/envvars similarity index 100% rename from examples/bird_exp_2/configs/Client1/envvars rename to examples/peering-ixp/configs/Client1/envvars diff --git a/examples/bird_exp_2/configs/Client2/bird.conf b/examples/peering-ixp/configs/Client2/bird.conf similarity index 100% rename from examples/bird_exp_2/configs/Client2/bird.conf rename to examples/peering-ixp/configs/Client2/bird.conf diff --git a/examples/bird_exp_2/configs/Client2/envvars b/examples/peering-ixp/configs/Client2/envvars similarity index 100% rename from examples/bird_exp_2/configs/Client2/envvars rename to examples/peering-ixp/configs/Client2/envvars diff --git a/examples/bird_exp_2/configs/Peer1/bird.conf b/examples/peering-ixp/configs/Peer1/bird.conf similarity index 100% rename from examples/bird_exp_2/configs/Peer1/bird.conf rename to examples/peering-ixp/configs/Peer1/bird.conf diff --git a/examples/bird_exp_2/configs/Peer1/envvars b/examples/peering-ixp/configs/Peer1/envvars similarity index 100% rename from examples/bird_exp_2/configs/Peer1/envvars rename to examples/peering-ixp/configs/Peer1/envvars diff --git a/examples/bird_exp_2/configs/Peer2/bird.conf b/examples/peering-ixp/configs/Peer2/bird.conf similarity index 100% rename from examples/bird_exp_2/configs/Peer2/bird.conf rename to examples/peering-ixp/configs/Peer2/bird.conf diff --git a/examples/bird_exp_2/configs/Peer2/envvars b/examples/peering-ixp/configs/Peer2/envvars similarity index 100% rename from examples/bird_exp_2/configs/Peer2/envvars rename to examples/peering-ixp/configs/Peer2/envvars diff --git a/examples/bird_exp_2/configs/rs/bird.conf b/examples/peering-ixp/configs/rs/bird.conf similarity index 100% rename from examples/bird_exp_2/configs/rs/bird.conf rename to examples/peering-ixp/configs/rs/bird.conf diff --git a/examples/bird_exp_2/configs/rs/envvars b/examples/peering-ixp/configs/rs/envvars similarity index 100% rename from examples/bird_exp_2/configs/rs/envvars rename to examples/peering-ixp/configs/rs/envvars diff --git a/examples/bird_exp_2/start.py b/examples/peering-ixp/start.py similarity index 100% rename from examples/bird_exp_2/start.py rename to examples/peering-ixp/start.py diff --git a/examples/bird_exp_2/topo.py b/examples/peering-ixp/topo.py similarity index 100% rename from examples/bird_exp_2/topo.py rename to examples/peering-ixp/topo.py diff --git a/examples/bird_exp_2/topo.pyc b/examples/peering-ixp/topo.pyc similarity index 100% rename from examples/bird_exp_2/topo.pyc rename to examples/peering-ixp/topo.pyc