aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/tools/tutorials/sdnip
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/onos/tools/tutorials/sdnip')
-rw-r--r--framework/src/onos/tools/tutorials/sdnip/configs-ipv6/addresses.json28
-rw-r--r--framework/src/onos/tools/tutorials/sdnip/configs-ipv6/gui.json9
-rw-r--r--framework/src/onos/tools/tutorials/sdnip/configs-ipv6/quagga-sdn.conf45
-rw-r--r--framework/src/onos/tools/tutorials/sdnip/configs-ipv6/quagga1.conf23
-rw-r--r--framework/src/onos/tools/tutorials/sdnip/configs-ipv6/quagga2.conf23
-rw-r--r--framework/src/onos/tools/tutorials/sdnip/configs-ipv6/quagga3.conf23
-rw-r--r--framework/src/onos/tools/tutorials/sdnip/configs-ipv6/quagga4.conf23
-rw-r--r--framework/src/onos/tools/tutorials/sdnip/configs-ipv6/sdnip.json54
-rw-r--r--framework/src/onos/tools/tutorials/sdnip/configs-ipv6/zebra.conf5
-rw-r--r--framework/src/onos/tools/tutorials/sdnip/configs/addresses.json28
-rw-r--r--framework/src/onos/tools/tutorials/sdnip/configs/gui.json9
-rw-r--r--framework/src/onos/tools/tutorials/sdnip/configs/quagga-sdn.conf35
-rw-r--r--framework/src/onos/tools/tutorials/sdnip/configs/quagga1.conf15
-rw-r--r--framework/src/onos/tools/tutorials/sdnip/configs/quagga2.conf15
-rw-r--r--framework/src/onos/tools/tutorials/sdnip/configs/quagga3.conf15
-rw-r--r--framework/src/onos/tools/tutorials/sdnip/configs/quagga4.conf15
-rw-r--r--framework/src/onos/tools/tutorials/sdnip/configs/sdnip.json54
-rw-r--r--framework/src/onos/tools/tutorials/sdnip/configs/zebra.conf5
-rwxr-xr-xframework/src/onos/tools/tutorials/sdnip/tutorial.py140
-rwxr-xr-xframework/src/onos/tools/tutorials/sdnip/tutorial_ipv6.py152
20 files changed, 716 insertions, 0 deletions
diff --git a/framework/src/onos/tools/tutorials/sdnip/configs-ipv6/addresses.json b/framework/src/onos/tools/tutorials/sdnip/configs-ipv6/addresses.json
new file mode 100644
index 00000000..9945e3f7
--- /dev/null
+++ b/framework/src/onos/tools/tutorials/sdnip/configs-ipv6/addresses.json
@@ -0,0 +1,28 @@
+{
+ "addresses" : [
+ {
+ "dpid" : "00:00:00:00:00:00:00:a1",
+ "port" : "1",
+ "ips" : ["2001:1::101/48"],
+ "mac" : "00:00:00:00:00:01"
+ },
+ {
+ "dpid" : "00:00:00:00:00:00:00:a2",
+ "port" : "1",
+ "ips" : ["2001:2::101/48"],
+ "mac" : "00:00:00:00:00:01"
+ },
+ {
+ "dpid" : "00:00:00:00:00:00:00:a5",
+ "port" : "1",
+ "ips" : ["2001:3::101/48"],
+ "mac" : "00:00:00:00:00:01"
+ },
+ {
+ "dpid" : "00:00:00:00:00:00:00:a6",
+ "port" : "1",
+ "ips" : ["2001:4::101/48"],
+ "mac" : "00:00:00:00:00:01"
+ }
+ ]
+}
diff --git a/framework/src/onos/tools/tutorials/sdnip/configs-ipv6/gui.json b/framework/src/onos/tools/tutorials/sdnip/configs-ipv6/gui.json
new file mode 100644
index 00000000..588214b1
--- /dev/null
+++ b/framework/src/onos/tools/tutorials/sdnip/configs-ipv6/gui.json
@@ -0,0 +1,9 @@
+{
+ "hosts" : [
+ { "mac": "00:00:00:00:00:01", "vlan": -1, "location": "of:00000000000000a3/1", "ip": "2001:1::101, 2001:2::101, 2001:3::101, 2001:4::101", "annotations": { "type": "bgpSpeaker" } },
+ { "mac": "00:00:00:00:01:01", "vlan": -1, "location": "of:00000000000000a1/1", "ip": "2001:1::1", "annotations": { "type": "router" } },
+ { "mac": "00:00:00:00:02:01", "vlan": -1, "location": "of:00000000000000a2/1", "ip": "2001:2::1", "annotations": { "type": "router" } },
+ { "mac": "00:00:00:00:03:01", "vlan": -1, "location": "of:00000000000000a5/1", "ip": "2001:3::1", "annotations": { "type": "router" } },
+ { "mac": "00:00:00:00:04:01", "vlan": -1, "location": "of:00000000000000a6/1", "ip": "2001:4::1", "annotations": { "type": "router" } }
+ ]
+}
diff --git a/framework/src/onos/tools/tutorials/sdnip/configs-ipv6/quagga-sdn.conf b/framework/src/onos/tools/tutorials/sdnip/configs-ipv6/quagga-sdn.conf
new file mode 100644
index 00000000..5d1fa9c1
--- /dev/null
+++ b/framework/src/onos/tools/tutorials/sdnip/configs-ipv6/quagga-sdn.conf
@@ -0,0 +1,45 @@
+!
+hostname bgp
+password sdnip
+!
+!
+router bgp 65000
+ bgp router-id 10.10.10.1
+ timers bgp 3 9
+ !
+ neighbor 2001:1::1 remote-as 65001
+ neighbor 2001:1::1 ebgp-multihop
+ neighbor 2001:1::1 timers connect 5
+ neighbor 2001:1::1 advertisement-interval 5
+ !
+ neighbor 2001:2::1 remote-as 65002
+ neighbor 2001:2::1 ebgp-multihop
+ neighbor 2001:2::1 timers connect 5
+ neighbor 2001:2::1 advertisement-interval 5
+ !
+ neighbor 2001:3::1 remote-as 65003
+ neighbor 2001:3::1 ebgp-multihop
+ neighbor 2001:3::1 timers connect 5
+ neighbor 2001:3::1 advertisement-interval 5
+ !
+ neighbor 2001:4::1 remote-as 65004
+ neighbor 2001:4::1 ebgp-multihop
+ neighbor 2001:4::1 timers connect 5
+ neighbor 2001:4::1 advertisement-interval 5
+ !
+ ! ONOS
+ neighbor 10.10.10.2 remote-as 65000
+ neighbor 10.10.10.2 port 2000
+ neighbor 10.10.10.2 timers connect 5
+ !
+ ! IPv6
+ !
+ address-family ipv6
+ neighbor 2001:1::1 activate
+ neighbor 2001:2::1 activate
+ neighbor 2001:3::1 activate
+ neighbor 2001:4::1 activate
+ neighbor 10.10.10.2 activate
+ exit-address-family
+!
+log stdout
diff --git a/framework/src/onos/tools/tutorials/sdnip/configs-ipv6/quagga1.conf b/framework/src/onos/tools/tutorials/sdnip/configs-ipv6/quagga1.conf
new file mode 100644
index 00000000..3c318e7f
--- /dev/null
+++ b/framework/src/onos/tools/tutorials/sdnip/configs-ipv6/quagga1.conf
@@ -0,0 +1,23 @@
+! BGP configuration for r1
+!
+hostname r1
+password sdnip
+!
+router bgp 65001
+ bgp router-id 10.0.1.1
+ timers bgp 3 9
+ neighbor 2001:1::101 remote-as 65000
+ neighbor 2001:1::101 ebgp-multihop
+ neighbor 2001:1::101 advertisement-interval 5
+ neighbor 2001:1::101 timers connect 5
+ neighbor 2001:1::101 route-map nexthop out
+!
+ address-family ipv6
+ network 2001:101::/48
+ neighbor 2001:1::101 activate
+ exit-address-family
+!
+route-map nexthop permit 10
+ set ipv6 next-hop global 2001:1::1
+!
+log stdout
diff --git a/framework/src/onos/tools/tutorials/sdnip/configs-ipv6/quagga2.conf b/framework/src/onos/tools/tutorials/sdnip/configs-ipv6/quagga2.conf
new file mode 100644
index 00000000..4d377eb4
--- /dev/null
+++ b/framework/src/onos/tools/tutorials/sdnip/configs-ipv6/quagga2.conf
@@ -0,0 +1,23 @@
+! BGP configuration for r2
+!
+hostname r2
+password sdnip
+!
+router bgp 65002
+ bgp router-id 10.0.2.1
+ timers bgp 3 9
+ neighbor 2001:2::101 remote-as 65000
+ neighbor 2001:2::101 ebgp-multihop
+ neighbor 2001:2::101 timers connect 5
+ neighbor 2001:2::101 advertisement-interval 5
+ neighbor 2001:2::101 route-map nexthop out
+!
+ address-family ipv6
+ network 2001:102::/48
+ neighbor 2001:2::101 activate
+ exit-address-family
+!
+route-map nexthop permit 10
+ set ipv6 next-hop global 2001:2::1
+!
+log stdout
diff --git a/framework/src/onos/tools/tutorials/sdnip/configs-ipv6/quagga3.conf b/framework/src/onos/tools/tutorials/sdnip/configs-ipv6/quagga3.conf
new file mode 100644
index 00000000..7cf7179c
--- /dev/null
+++ b/framework/src/onos/tools/tutorials/sdnip/configs-ipv6/quagga3.conf
@@ -0,0 +1,23 @@
+! BGP configuration for r3
+!
+hostname r3
+password sdnip
+!
+router bgp 65003
+ bgp router-id 10.0.3.1
+ timers bgp 3 9
+ neighbor 2001:3::101 remote-as 65000
+ neighbor 2001:3::101 ebgp-multihop
+ neighbor 2001:3::101 timers connect 5
+ neighbor 2001:3::101 advertisement-interval 5
+ neighbor 2001:3::101 route-map nexthop out
+!
+ address-family ipv6
+ network 2001:103::/48
+ neighbor 2001:3::101 activate
+ exit-address-family
+!
+route-map nexthop permit 10
+ set ipv6 next-hop global 2001:3::1
+!
+log stdout
diff --git a/framework/src/onos/tools/tutorials/sdnip/configs-ipv6/quagga4.conf b/framework/src/onos/tools/tutorials/sdnip/configs-ipv6/quagga4.conf
new file mode 100644
index 00000000..32cfe243
--- /dev/null
+++ b/framework/src/onos/tools/tutorials/sdnip/configs-ipv6/quagga4.conf
@@ -0,0 +1,23 @@
+! BGP configuration for r4
+!
+hostname r4
+password sdnip
+!
+router bgp 65004
+ bgp router-id 10.0.4.1
+ timers bgp 3 9
+ neighbor 2001:4::101 remote-as 65000
+ neighbor 2001:4::101 ebgp-multihop
+ neighbor 2001:4::101 timers connect 5
+ neighbor 2001:4::101 advertisement-interval 5
+ neighbor 2001:4::101 route-map nexthop out
+!
+ address-family ipv6
+ !network 2001:104::/48
+ neighbor 2001:4::101 activate
+ exit-address-family
+!
+route-map nexthop permit 10
+ set ipv6 next-hop global 2001:4::1
+!
+log stdout
diff --git a/framework/src/onos/tools/tutorials/sdnip/configs-ipv6/sdnip.json b/framework/src/onos/tools/tutorials/sdnip/configs-ipv6/sdnip.json
new file mode 100644
index 00000000..412fb5b8
--- /dev/null
+++ b/framework/src/onos/tools/tutorials/sdnip/configs-ipv6/sdnip.json
@@ -0,0 +1,54 @@
+{
+ "bgpPeers" : [
+ {
+ "attachmentDpid" : "00:00:00:00:00:00:00:a1",
+ "attachmentPort" : "1",
+ "ipAddress" : "2001:1::1"
+ },
+ {
+ "attachmentDpid" : "00:00:00:00:00:00:00:a2",
+ "attachmentPort" : "1",
+ "ipAddress" : "2001:2::1"
+ },
+ {
+ "attachmentDpid" : "00:00:00:00:00:00:00:a5",
+ "attachmentPort" : "1",
+ "ipAddress" : "2001:3::1"
+ },
+ {
+ "attachmentDpid" : "00:00:00:00:00:00:00:a6",
+ "attachmentPort" : "1",
+ "ipAddress" : "2001:4::1"
+ }
+ ],
+ "bgpSpeakers" : [
+ {
+ "name" : "bgp",
+ "attachmentDpid" : "00:00:00:00:00:00:00:a3",
+ "attachmentPort" : "1",
+ "macAddress" : "00:00:00:00:00:01",
+ "interfaceAddresses" : [
+ {
+ "interfaceDpid" : "00:00:00:00:00:00:00:a1",
+ "interfacePort" : "1",
+ "ipAddress" : "2001:1::101"
+ },
+ {
+ "interfaceDpid" : "00:00:00:00:00:00:00:a2",
+ "interfacePort" : "1",
+ "ipAddress" : "2001:2::101"
+ },
+ {
+ "interfaceDpid" : "00:00:00:00:00:00:00:a5",
+ "interfacePort" : "1",
+ "ipAddress" : "2001:3::101"
+ },
+ {
+ "interfaceDpid" : "00:00:00:00:00:00:00:a6",
+ "interfacePort" : "1",
+ "ipAddress" : "2001:4::101"
+ }
+ ]
+ }
+ ]
+}
diff --git a/framework/src/onos/tools/tutorials/sdnip/configs-ipv6/zebra.conf b/framework/src/onos/tools/tutorials/sdnip/configs-ipv6/zebra.conf
new file mode 100644
index 00000000..6a4ae953
--- /dev/null
+++ b/framework/src/onos/tools/tutorials/sdnip/configs-ipv6/zebra.conf
@@ -0,0 +1,5 @@
+! Configuration for zebra (NB: it is the same for all routers)
+!
+hostname zebra
+password sdnip
+log stdout
diff --git a/framework/src/onos/tools/tutorials/sdnip/configs/addresses.json b/framework/src/onos/tools/tutorials/sdnip/configs/addresses.json
new file mode 100644
index 00000000..5b733212
--- /dev/null
+++ b/framework/src/onos/tools/tutorials/sdnip/configs/addresses.json
@@ -0,0 +1,28 @@
+{
+ "addresses" : [
+ {
+ "dpid" : "00:00:00:00:00:00:00:a1",
+ "port" : "1",
+ "ips" : ["10.0.1.101/24"],
+ "mac" : "00:00:00:00:00:01"
+ },
+ {
+ "dpid" : "00:00:00:00:00:00:00:a2",
+ "port" : "1",
+ "ips" : ["10.0.2.101/24"],
+ "mac" : "00:00:00:00:00:01"
+ },
+ {
+ "dpid" : "00:00:00:00:00:00:00:a5",
+ "port" : "1",
+ "ips" : ["10.0.3.101/24"],
+ "mac" : "00:00:00:00:00:01"
+ },
+ {
+ "dpid" : "00:00:00:00:00:00:00:a6",
+ "port" : "1",
+ "ips" : ["10.0.4.101/24"],
+ "mac" : "00:00:00:00:00:01"
+ }
+ ]
+}
diff --git a/framework/src/onos/tools/tutorials/sdnip/configs/gui.json b/framework/src/onos/tools/tutorials/sdnip/configs/gui.json
new file mode 100644
index 00000000..fdc97575
--- /dev/null
+++ b/framework/src/onos/tools/tutorials/sdnip/configs/gui.json
@@ -0,0 +1,9 @@
+{
+ "hosts" : [
+ { "mac": "00:00:00:00:00:01", "vlan": -1, "location": "of:00000000000000a3/1", "ip": "10.0.1.101, 10.0.2.101, 10.0.3.101, 10.0.4.101", "annotations": { "type": "bgpSpeaker" } },
+ { "mac": "00:00:00:00:01:01", "vlan": -1, "location": "of:00000000000000a1/1", "ip": "10.0.1.1", "annotations": { "type": "router" } },
+ { "mac": "00:00:00:00:02:01", "vlan": -1, "location": "of:00000000000000a2/1", "ip": "10.0.2.1", "annotations": { "type": "router" } },
+ { "mac": "00:00:00:00:03:01", "vlan": -1, "location": "of:00000000000000a5/1", "ip": "10.0.3.1", "annotations": { "type": "router" } },
+ { "mac": "00:00:00:00:04:01", "vlan": -1, "location": "of:00000000000000a6/1", "ip": "10.0.4.1", "annotations": { "type": "router" } }
+ ]
+}
diff --git a/framework/src/onos/tools/tutorials/sdnip/configs/quagga-sdn.conf b/framework/src/onos/tools/tutorials/sdnip/configs/quagga-sdn.conf
new file mode 100644
index 00000000..983c96e6
--- /dev/null
+++ b/framework/src/onos/tools/tutorials/sdnip/configs/quagga-sdn.conf
@@ -0,0 +1,35 @@
+!
+hostname bgp
+password sdnip
+!
+!
+router bgp 65000
+ bgp router-id 10.10.10.1
+ timers bgp 3 9
+ !
+ neighbor 10.0.1.1 remote-as 65001
+ neighbor 10.0.1.1 ebgp-multihop
+ neighbor 10.0.1.1 timers connect 5
+ neighbor 10.0.1.1 advertisement-interval 5
+ !
+ neighbor 10.0.2.1 remote-as 65002
+ neighbor 10.0.2.1 ebgp-multihop
+ neighbor 10.0.2.1 timers connect 5
+ neighbor 10.0.2.1 advertisement-interval 5
+ !
+ neighbor 10.0.3.1 remote-as 65003
+ neighbor 10.0.3.1 ebgp-multihop
+ neighbor 10.0.3.1 timers connect 5
+ neighbor 10.0.3.1 advertisement-interval 5
+ !
+ neighbor 10.0.4.1 remote-as 65004
+ neighbor 10.0.4.1 ebgp-multihop
+ neighbor 10.0.4.1 timers connect 5
+ neighbor 10.0.4.1 advertisement-interval 5
+ !
+ ! ONOS
+ neighbor 10.10.10.2 remote-as 65000
+ neighbor 10.10.10.2 port 2000
+ neighbor 10.10.10.2 timers connect 5
+!
+log stdout
diff --git a/framework/src/onos/tools/tutorials/sdnip/configs/quagga1.conf b/framework/src/onos/tools/tutorials/sdnip/configs/quagga1.conf
new file mode 100644
index 00000000..6e65c96d
--- /dev/null
+++ b/framework/src/onos/tools/tutorials/sdnip/configs/quagga1.conf
@@ -0,0 +1,15 @@
+! BGP configuration for r1
+!
+hostname r1
+password sdnip
+!
+router bgp 65001
+ bgp router-id 10.0.1.1
+ timers bgp 3 9
+ neighbor 10.0.1.101 remote-as 65000
+ neighbor 10.0.1.101 ebgp-multihop
+ neighbor 10.0.1.101 timers connect 5
+ neighbor 10.0.1.101 advertisement-interval 5
+ network 192.168.1.0/24
+!
+log stdout
diff --git a/framework/src/onos/tools/tutorials/sdnip/configs/quagga2.conf b/framework/src/onos/tools/tutorials/sdnip/configs/quagga2.conf
new file mode 100644
index 00000000..8ab7205d
--- /dev/null
+++ b/framework/src/onos/tools/tutorials/sdnip/configs/quagga2.conf
@@ -0,0 +1,15 @@
+! BGP configuration for r2
+!
+hostname r2
+password sdnip
+!
+router bgp 65002
+ bgp router-id 10.0.2.1
+ timers bgp 3 9
+ neighbor 10.0.2.101 remote-as 65000
+ neighbor 10.0.2.101 ebgp-multihop
+ neighbor 10.0.2.101 timers connect 5
+ neighbor 10.0.2.101 advertisement-interval 5
+ network 192.168.2.0/24
+!
+log stdout
diff --git a/framework/src/onos/tools/tutorials/sdnip/configs/quagga3.conf b/framework/src/onos/tools/tutorials/sdnip/configs/quagga3.conf
new file mode 100644
index 00000000..53d9c8a1
--- /dev/null
+++ b/framework/src/onos/tools/tutorials/sdnip/configs/quagga3.conf
@@ -0,0 +1,15 @@
+! BGP configuration for r3
+!
+hostname r3
+password sdnip
+!
+router bgp 65003
+ bgp router-id 10.0.3.1
+ timers bgp 3 9
+ neighbor 10.0.3.101 remote-as 65000
+ neighbor 10.0.3.101 ebgp-multihop
+ neighbor 10.0.3.101 timers connect 5
+ neighbor 10.0.3.101 advertisement-interval 5
+ network 192.168.3.0/24
+!
+log stdout
diff --git a/framework/src/onos/tools/tutorials/sdnip/configs/quagga4.conf b/framework/src/onos/tools/tutorials/sdnip/configs/quagga4.conf
new file mode 100644
index 00000000..809d5005
--- /dev/null
+++ b/framework/src/onos/tools/tutorials/sdnip/configs/quagga4.conf
@@ -0,0 +1,15 @@
+! BGP configuration for r4
+!
+hostname r4
+password sdnip
+!
+router bgp 65004
+ bgp router-id 10.0.4.1
+ timers bgp 3 9
+ neighbor 10.0.4.101 remote-as 65000
+ neighbor 10.0.4.101 ebgp-multihop
+ neighbor 10.0.4.101 timers connect 5
+ neighbor 10.0.4.101 advertisement-interval 5
+ !network 192.168.4.0/24
+!
+log stdout
diff --git a/framework/src/onos/tools/tutorials/sdnip/configs/sdnip.json b/framework/src/onos/tools/tutorials/sdnip/configs/sdnip.json
new file mode 100644
index 00000000..dde8ea77
--- /dev/null
+++ b/framework/src/onos/tools/tutorials/sdnip/configs/sdnip.json
@@ -0,0 +1,54 @@
+{
+ "bgpPeers" : [
+ {
+ "attachmentDpid" : "00:00:00:00:00:00:00:a1",
+ "attachmentPort" : "1",
+ "ipAddress" : "10.0.1.1"
+ },
+ {
+ "attachmentDpid" : "00:00:00:00:00:00:00:a2",
+ "attachmentPort" : "1",
+ "ipAddress" : "10.0.2.1"
+ },
+ {
+ "attachmentDpid" : "00:00:00:00:00:00:00:a5",
+ "attachmentPort" : "1",
+ "ipAddress" : "10.0.3.1"
+ },
+ {
+ "attachmentDpid" : "00:00:00:00:00:00:00:a6",
+ "attachmentPort" : "1",
+ "ipAddress" : "10.0.4.1"
+ }
+ ],
+ "bgpSpeakers" : [
+ {
+ "name" : "bgp",
+ "attachmentDpid" : "00:00:00:00:00:00:00:a3",
+ "attachmentPort" : "1",
+ "macAddress" : "00:00:00:00:00:01",
+ "interfaceAddresses" : [
+ {
+ "interfaceDpid" : "00:00:00:00:00:00:00:a1",
+ "interfacePort" : "1",
+ "ipAddress" : "10.0.1.101"
+ },
+ {
+ "interfaceDpid" : "00:00:00:00:00:00:00:a2",
+ "interfacePort" : "1",
+ "ipAddress" : "10.0.2.101"
+ },
+ {
+ "interfaceDpid" : "00:00:00:00:00:00:00:a5",
+ "interfacePort" : "1",
+ "ipAddress" : "10.0.3.101"
+ },
+ {
+ "interfaceDpid" : "00:00:00:00:00:00:00:a6",
+ "interfacePort" : "1",
+ "ipAddress" : "10.0.4.101"
+ }
+ ]
+ }
+ ]
+}
diff --git a/framework/src/onos/tools/tutorials/sdnip/configs/zebra.conf b/framework/src/onos/tools/tutorials/sdnip/configs/zebra.conf
new file mode 100644
index 00000000..6a4ae953
--- /dev/null
+++ b/framework/src/onos/tools/tutorials/sdnip/configs/zebra.conf
@@ -0,0 +1,5 @@
+! Configuration for zebra (NB: it is the same for all routers)
+!
+hostname zebra
+password sdnip
+log stdout
diff --git a/framework/src/onos/tools/tutorials/sdnip/tutorial.py b/framework/src/onos/tools/tutorials/sdnip/tutorial.py
new file mode 100755
index 00000000..4f6d6bd1
--- /dev/null
+++ b/framework/src/onos/tools/tutorials/sdnip/tutorial.py
@@ -0,0 +1,140 @@
+#!/usr/bin/python
+
+from mininet.topo import Topo
+from mininet.net import Mininet
+from mininet.cli import CLI
+from mininet.log import setLogLevel, info, debug
+from mininet.node import Host, RemoteController
+
+QUAGGA_DIR = '/usr/lib/quagga'
+# Must exist and be owned by quagga user (quagga:quagga by default on Ubuntu)
+QUAGGA_RUN_DIR = '/var/run/quagga'
+CONFIG_DIR = 'configs'
+
+class SdnIpHost(Host):
+ def __init__(self, name, ip, route, *args, **kwargs):
+ Host.__init__(self, name, ip=ip, *args, **kwargs)
+
+ self.route = route
+
+ def config(self, **kwargs):
+ Host.config(self, **kwargs)
+
+ debug("configuring route %s" % self.route)
+
+ self.cmd('ip route add default via %s' % self.route)
+
+class Router(Host):
+ def __init__(self, name, quaggaConfFile, zebraConfFile, intfDict, *args, **kwargs):
+ Host.__init__(self, name, *args, **kwargs)
+
+ self.quaggaConfFile = quaggaConfFile
+ self.zebraConfFile = zebraConfFile
+ self.intfDict = intfDict
+
+ def config(self, **kwargs):
+ Host.config(self, **kwargs)
+ self.cmd('sysctl net.ipv4.ip_forward=1')
+
+ for intf, attrs in self.intfDict.items():
+ self.cmd('ip addr flush dev %s' % intf)
+ if 'mac' in attrs:
+ self.cmd('ip link set %s down' % intf)
+ self.cmd('ip link set %s address %s' % (intf, attrs['mac']))
+ self.cmd('ip link set %s up ' % intf)
+ for addr in attrs['ipAddrs']:
+ self.cmd('ip addr add %s dev %s' % (addr, intf))
+
+ self.cmd('/usr/lib/quagga/zebra -d -f %s -z %s/zebra%s.api -i %s/zebra%s.pid' % (self.zebraConfFile, QUAGGA_RUN_DIR, self.name, QUAGGA_RUN_DIR, self.name))
+ self.cmd('/usr/lib/quagga/bgpd -d -f %s -z %s/zebra%s.api -i %s/bgpd%s.pid' % (self.quaggaConfFile, QUAGGA_RUN_DIR, self.name, QUAGGA_RUN_DIR, self.name))
+
+
+ def terminate(self):
+ self.cmd("ps ax | egrep 'bgpd%s.pid|zebra%s.pid' | awk '{print $1}' | xargs kill" % (self.name, self.name))
+
+ Host.terminate(self)
+
+
+class SdnIpTopo( Topo ):
+ "SDN-IP tutorial topology"
+
+ def build( self ):
+ s1 = self.addSwitch('s1', dpid='00000000000000a1')
+ s2 = self.addSwitch('s2', dpid='00000000000000a2')
+ s3 = self.addSwitch('s3', dpid='00000000000000a3')
+ s4 = self.addSwitch('s4', dpid='00000000000000a4')
+ s5 = self.addSwitch('s5', dpid='00000000000000a5')
+ s6 = self.addSwitch('s6', dpid='00000000000000a6')
+
+ zebraConf = '%s/zebra.conf' % CONFIG_DIR
+
+ # Switches we want to attach our routers to, in the correct order
+ attachmentSwitches = [s1, s2, s5, s6]
+
+ for i in range(1, 4+1):
+ name = 'r%s' % i
+
+ eth0 = { 'mac' : '00:00:00:00:0%s:01' % i,
+ 'ipAddrs' : ['10.0.%s.1/24' % i] }
+ eth1 = { 'ipAddrs' : ['192.168.%s.254/24' % i] }
+ intfs = { '%s-eth0' % name : eth0,
+ '%s-eth1' % name : eth1 }
+
+ quaggaConf = '%s/quagga%s.conf' % (CONFIG_DIR, i)
+
+ router = self.addHost(name, cls=Router, quaggaConfFile=quaggaConf,
+ zebraConfFile=zebraConf, intfDict=intfs)
+
+ host = self.addHost('h%s' % i, cls=SdnIpHost,
+ ip='192.168.%s.1/24' % i,
+ route='192.168.%s.254' % i)
+
+ self.addLink(router, attachmentSwitches[i-1])
+ self.addLink(router, host)
+
+ # Set up the internal BGP speaker
+ bgpEth0 = { 'mac':'00:00:00:00:00:01',
+ 'ipAddrs' : ['10.0.1.101/24',
+ '10.0.2.101/24',
+ '10.0.3.101/24',
+ '10.0.4.101/24',] }
+ bgpEth1 = { 'ipAddrs' : ['10.10.10.1/24'] }
+ bgpIntfs = { 'bgp-eth0' : bgpEth0,
+ 'bgp-eth1' : bgpEth1 }
+
+ bgp = self.addHost( "bgp", cls=Router,
+ quaggaConfFile = '%s/quagga-sdn.conf' % CONFIG_DIR,
+ zebraConfFile = zebraConf,
+ intfDict=bgpIntfs )
+
+ self.addLink( bgp, s3 )
+
+ # Connect BGP speaker to the root namespace so it can peer with ONOS
+ root = self.addHost( 'root', inNamespace=False, ip='10.10.10.2/24' )
+ self.addLink( root, bgp )
+
+
+ # Wire up the switches in the topology
+ self.addLink( s1, s2 )
+ self.addLink( s1, s3 )
+ self.addLink( s2, s4 )
+ self.addLink( s3, s4 )
+ self.addLink( s3, s5 )
+ self.addLink( s4, s6 )
+ self.addLink( s5, s6 )
+
+topos = { 'sdnip' : SdnIpTopo }
+
+if __name__ == '__main__':
+ setLogLevel('debug')
+ topo = SDNTopo()
+
+ net = Mininet(topo=topo, controller=RemoteController)
+
+ net.start()
+
+ CLI(net)
+
+ net.stop()
+
+ info("done\n")
diff --git a/framework/src/onos/tools/tutorials/sdnip/tutorial_ipv6.py b/framework/src/onos/tools/tutorials/sdnip/tutorial_ipv6.py
new file mode 100755
index 00000000..9fc4f3f4
--- /dev/null
+++ b/framework/src/onos/tools/tutorials/sdnip/tutorial_ipv6.py
@@ -0,0 +1,152 @@
+#!/usr/bin/python
+
+from mininet.topo import Topo
+from mininet.net import Mininet
+from mininet.cli import CLI
+from mininet.log import setLogLevel, info, debug
+from mininet.node import Host, RemoteController, OVSSwitch
+
+QUAGGA_DIR = '/usr/lib/quagga'
+# Must exist and be owned by quagga user (quagga:quagga by default on Ubuntu)
+QUAGGA_RUN_DIR = '/var/run/quagga'
+CONFIG_DIR = 'configs-ipv6'
+
+class SdnIpHost(Host):
+ def __init__(self, name, ip, route, *args, **kwargs):
+ Host.__init__(self, name, ip=ip, *args, **kwargs)
+
+ self.name = name
+ self.ip = ip
+ self.route = route
+
+ def config(self, **kwargs):
+ Host.config(self, **kwargs)
+
+ debug("configuring route %s" % self.route)
+
+ self.cmd('ip addr add %s dev %s-eth0' % (self.ip, self.name))
+ self.cmd('ip route add default via %s' % self.route)
+
+class Router(Host):
+ def __init__(self, name, quaggaConfFile, zebraConfFile, intfDict, *args, **kwargs):
+ Host.__init__(self, name, *args, **kwargs)
+
+ self.quaggaConfFile = quaggaConfFile
+ self.zebraConfFile = zebraConfFile
+ self.intfDict = intfDict
+
+ def config(self, **kwargs):
+ Host.config(self, **kwargs)
+ self.cmd('sysctl net.ipv4.ip_forward=1')
+ self.cmd('sysctl net.ipv6.conf.all.forwarding=1')
+
+ for intf, attrs in self.intfDict.items():
+ self.cmd('ip addr flush dev %s' % intf)
+ if 'mac' in attrs:
+ self.cmd('ip link set %s down' % intf)
+ self.cmd('ip link set %s address %s' % (intf, attrs['mac']))
+ self.cmd('ip link set %s up ' % intf)
+ for addr in attrs['ipAddrs']:
+ self.cmd('ip addr add %s dev %s' % (addr, intf))
+
+ self.cmd('/usr/lib/quagga/zebra -d -f %s -z %s/zebra%s.api -i %s/zebra%s.pid' % (self.zebraConfFile, QUAGGA_RUN_DIR, self.name, QUAGGA_RUN_DIR, self.name))
+ self.cmd('/usr/lib/quagga/bgpd -d -f %s -z %s/zebra%s.api -i %s/bgpd%s.pid' % (self.quaggaConfFile, QUAGGA_RUN_DIR, self.name, QUAGGA_RUN_DIR, self.name))
+
+
+ def terminate(self):
+ self.cmd("ps ax | egrep 'bgpd%s.pid|zebra%s.pid' | awk '{print $1}' | xargs kill" % (self.name, self.name))
+
+ Host.terminate(self)
+
+class SdnSwitch(OVSSwitch):
+ def __init__(self, name, dpid, *args, **kwargs):
+ OVSSwitch.__init__(self, name, dpid=dpid, *args, **kwargs)
+
+ def start(self, controllers):
+ OVSSwitch.start(self, controllers)
+ self.cmd("ovs-vsctl set Bridge %s protocols=OpenFlow13" % self.name)
+
+
+class SdnIpTopo( Topo ):
+ "SDN-IP tutorial topology"
+
+ def build( self ):
+ s1 = self.addSwitch('s1', cls=SdnSwitch, dpid='00000000000000a1')
+ s2 = self.addSwitch('s2', cls=SdnSwitch, dpid='00000000000000a2')
+ s3 = self.addSwitch('s3', cls=SdnSwitch, dpid='00000000000000a3')
+ s4 = self.addSwitch('s4', cls=SdnSwitch, dpid='00000000000000a4')
+ s5 = self.addSwitch('s5', cls=SdnSwitch, dpid='00000000000000a5')
+ s6 = self.addSwitch('s6', cls=SdnSwitch, dpid='00000000000000a6')
+
+ zebraConf = '%s/zebra.conf' % CONFIG_DIR
+
+ # Switches we want to attach our routers to, in the correct order
+ attachmentSwitches = [s1, s2, s5, s6]
+
+ for i in range(1, 4+1):
+ name = 'r%s' % i
+
+ eth0 = { 'mac' : '00:00:00:00:0%s:01' % i,
+ 'ipAddrs' : ['2001:%s::1/48' % i] }
+ eth1 = { 'ipAddrs' : ['2001:10%s::101/48' % i] }
+ intfs = { '%s-eth0' % name : eth0,
+ '%s-eth1' % name : eth1 }
+
+ quaggaConf = '%s/quagga%s.conf' % (CONFIG_DIR, i)
+
+ router = self.addHost(name, cls=Router, quaggaConfFile=quaggaConf,
+ zebraConfFile=zebraConf, intfDict=intfs)
+
+ host = self.addHost('h%s' % i, cls=SdnIpHost,
+ ip='2001:10%s::1/48' % i,
+ route='2001:10%s::101' % i)
+
+ self.addLink(router, attachmentSwitches[i-1])
+ self.addLink(router, host)
+
+ # Set up the internal BGP speaker
+ bgpEth0 = { 'mac':'00:00:00:00:00:01',
+ 'ipAddrs' : ['2001:1::101/48',
+ '2001:2::101/48',
+ '2001:3::101/48',
+ '2001:4::101/48',] }
+ bgpEth1 = { 'ipAddrs' : ['10.10.10.1/24'] }
+ bgpIntfs = { 'bgp-eth0' : bgpEth0,
+ 'bgp-eth1' : bgpEth1 }
+
+ bgp = self.addHost( "bgp", cls=Router,
+ quaggaConfFile = '%s/quagga-sdn.conf' % CONFIG_DIR,
+ zebraConfFile = zebraConf,
+ intfDict=bgpIntfs )
+
+ self.addLink( bgp, s3 )
+
+ # Connect BGP speaker to the root namespace so it can peer with ONOS
+ root = self.addHost( 'root', inNamespace=False, ip='10.10.10.2/24' )
+ self.addLink( root, bgp )
+
+
+ # Wire up the switches in the topology
+ self.addLink( s1, s2 )
+ self.addLink( s1, s3 )
+ self.addLink( s2, s4 )
+ self.addLink( s3, s4 )
+ self.addLink( s3, s5 )
+ self.addLink( s4, s6 )
+ self.addLink( s5, s6 )
+
+topos = { 'sdnip' : SdnIpTopo }
+
+if __name__ == '__main__':
+ setLogLevel('debug')
+ topo = SdnIpTopo()
+
+ net = Mininet(topo=topo, controller=RemoteController)
+
+ net.start()
+
+ CLI(net)
+
+ net.stop()
+
+ info("done\n")