Delete the OVSTunnel to use the UdpTunnel instead. Just need to fix an issue with...
[nepi.git] / examples / openvswitch / ovs_ping_2switches.py
index 5b7a208..4778911 100644 (file)
@@ -55,9 +55,10 @@ def add_ovs(ec, bridge_name, virtual_ip_pref, controller_ip, controller_port, no
     ec.register_connection(ovs, node)
     return ovs
 
-def add_port(ec, port_name, ovs):
+def add_port(ec, port_name, network, ovs):
     port = ec.register_resource("OVSPort")
     ec.set(port, "port_name", port_name)
+    ec.set(port, "network", network)
     ec.register_connection(port, ovs)
     return port
 
@@ -70,9 +71,8 @@ def add_tap(ec, endpoint_ip, endpoint_prefix, pointopoint, node):
     ec.register_connection(tap, node)
     return tap
 
-def add_tunnel(ec, network, port0, tap):
-    tunnel = ec.register_resource("OVSTunnel")
-    ec.set(tunnel, "network", network)
+def add_tunnel(ec, port0, tap):
+    tunnel = ec.register_resource("LinuxUdpTunnel")
     ec.register_connection(port0, tunnel)
     ec.register_connection(tunnel, tap)
     return tunnel
@@ -92,7 +92,7 @@ switch2 = "planetlab2.upc.es"
 host1 = "planetlab2.ionio.gr"
 host2 = "iraplab2.iralab.uni-karlsruhe.de"
 
-ip_controller = "xxx.yyy.zzz.ttt"
+ip_controller = "1.1.1.1"
 
 #XXX : Depends on the Vsys_tag of your slice
 network = "192.168.3.0"
@@ -111,10 +111,10 @@ ovs1 = add_ovs(ec, "nepi_bridge_1", "192.168.3.1/24", ip_controller, "6633", s1_
 ovs2 = add_ovs(ec, "nepi_bridge_2", "192.168.3.2/24", ip_controller, "6633", s2_node)
 
 # Add ports on ovs
-port1 = add_port(ec, "nepi_port1", ovs1)
-port3 = add_port(ec, "nepi_port3", ovs1)
-port2 = add_port(ec, "nepi_port2", ovs2)
-port4 = add_port(ec, "nepi_port4", ovs2)
+port1 = add_port(ec, "nepi_port1", network, ovs1)
+port3 = add_port(ec, "nepi_port3", network, ovs1)
+port2 = add_port(ec, "nepi_port2", network, ovs2)
+port4 = add_port(ec, "nepi_port4", network, ovs2)
 
 h1_node = add_node(ec, host1, slicename, pl_user, pl_password)
 h2_node = add_node(ec, host2, slicename, pl_user, pl_password)
@@ -124,9 +124,9 @@ tap1 = add_tap(ec, "192.168.3.3", 24, "192.168.3.1", h1_node)
 tap2 = add_tap(ec, "192.168.3.4", 24, "192.168.3.2", h2_node)
 
 # Connect the nodes
-tunnel1 = add_tunnel(ec, network, port1, tap1)
-tunnel2 = add_tunnel(ec, network, port2, tap2)
-tunnel3 = add_tunnel(ec, network, port3, port4)
+tunnel1 = add_tunnel(ec, port1, tap1)
+tunnel2 = add_tunnel(ec, port2, tap2)
+tunnel3 = add_tunnel(ec, port3, port4)
 
 # Add ping commands
 app1 = add_app(ec, "ping -c5 192.168.3.2", s1_node)