diff --git a/src/tests/OpenFlow-Ryu-NBI-Request/ADD LINKS.json b/src/tests/OpenFlow-Ryu-NBI-Request/ADD LINKS.json new file mode 100644 index 0000000000000000000000000000000000000000..1825145eea8d79284a6dda2804a7844a9bd873c9 --- /dev/null +++ b/src/tests/OpenFlow-Ryu-NBI-Request/ADD LINKS.json @@ -0,0 +1,61 @@ +{ + "links": [ + { + "link_id": {"link_uuid": {"uuid": "h1/h1-eth0==0000000000000002/s2-eth3"}}, + "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "h1"}}, "endpoint_uuid": {"uuid": "h1-eth0"}}, + {"device_id": {"device_uuid": {"uuid": "0000000000000002"}}, "endpoint_uuid": {"uuid": "s2-eth3"}} + ] +}, +{ + "link_id": {"link_uuid": {"uuid": "0000000000000002/s2-eth3==h1/h1-eth0"}}, + "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "0000000000000002"}}, "endpoint_uuid": {"uuid": "s2-eth3"}}, + {"device_id": {"device_uuid": {"uuid": "h1"}}, "endpoint_uuid": {"uuid": "h1-eth0"}} + ] + }, + { + "link_id": {"link_uuid": {"uuid": "h2/h2-eth0==0000000000000002/s2-eth4"}}, + "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "h2"}}, "endpoint_uuid": {"uuid": "h2-eth0"}}, + {"device_id": {"device_uuid": {"uuid": "0000000000000002"}}, "endpoint_uuid": {"uuid": "s2-eth4"}} + ] +}, +{ + "link_id": {"link_uuid": {"uuid": "0000000000000002/s2-eth4==h2/h2-eth0"}}, + "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "0000000000000002"}}, "endpoint_uuid": {"uuid": "s2-eth4"}}, + {"device_id": {"device_uuid": {"uuid": "h2"}}, "endpoint_uuid": {"uuid": "h2-eth0"}} + ] + }, + { + "link_id": {"link_uuid": {"uuid": "h3/h3-eth0==0000000000000005/s5-eth3"}}, + "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "h3"}}, "endpoint_uuid": {"uuid": "h3-eth0"}}, + {"device_id": {"device_uuid": {"uuid": "0000000000000005"}}, "endpoint_uuid": {"uuid": "s5-eth3"}} + ] +}, +{ + "link_id": {"link_uuid": {"uuid": "0000000000000005/s5-eth3==h3/h3-eth0"}}, + "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "0000000000000005"}}, "endpoint_uuid": {"uuid": "s5-eth3"}}, + {"device_id": {"device_uuid": {"uuid": "h3"}}, "endpoint_uuid": {"uuid": "h3-eth0"}} + ] + }, + { + "link_id": {"link_uuid": {"uuid": "h4/h4-eth0==0000000000000005/s5-eth4"}}, + "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "h4"}}, "endpoint_uuid": {"uuid": "h4-eth0"}}, + {"device_id": {"device_uuid": {"uuid": "0000000000000005"}}, "endpoint_uuid": {"uuid": "s5-eth4"}} + ] +}, +{ + "link_id": {"link_uuid": {"uuid": "0000000000000005/s5-eth4==h4/h4-eth0"}}, + "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "0000000000000005"}}, "endpoint_uuid": {"uuid": "s5-eth4"}}, + {"device_id": {"device_uuid": {"uuid": "h4"}}, "endpoint_uuid": {"uuid": "h4-eth0"}} + ] + } + ] +} + diff --git a/src/tests/OpenFlow-Ryu-NBI-Request/OpenFlow.json b/src/tests/OpenFlow-Ryu-NBI-Request/OpenFlow.json new file mode 100644 index 0000000000000000000000000000000000000000..1c9928376b89ae199b9efe701daf080140aa1281 --- /dev/null +++ b/src/tests/OpenFlow-Ryu-NBI-Request/OpenFlow.json @@ -0,0 +1,71 @@ +{ + "contexts": [ + {"context_id": {"context_uuid": {"uuid": "admin"}}} + ], + "topologies": [ + { + "topology_id": { + "context_id": {"context_uuid": {"uuid": "admin"}}, + "topology_uuid": {"uuid": "admin"} + } + } + ], + "devices": [ + { + "device_id": {"device_uuid": {"uuid": "RYU"}}, "device_type": "openflow-ryu-controller", + "device_config": {"config_rules": [ + {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "10.1.7.197"}}, + {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "8080"}}, + {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": {"timeout": 120}}} + ]}, + "device_drivers": ["DEVICEDRIVER_RYU"] + }, + { + "device_id": {"device_uuid": {"uuid": "h1"}}, "device_type": "emu-client", "device_drivers": [0], + "device_config": {"config_rules": [ + {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "127.0.0.1"}}, + {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "0"}}, + {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": {"endpoints": [ + {"uuid": "h1-eth0", "type": "copper/internal","mac_address":"00:00:00:00:00:01"}, + {"uuid": "int", "type": "copper/internal"} + ]}}} + ]} + }, + { + "device_id": {"device_uuid": {"uuid": "h2"}}, "device_type": "emu-client", "device_drivers": [0], + "device_config": {"config_rules": [ + {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "127.0.0.1"}}, + {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "0"}}, + {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": {"endpoints": [ + {"uuid": "h2-eth0", "type": "copper/internal"}, + {"uuid": "int", "type": "copper/internal"} + ]}}} + ]} + }, + { + "device_id": {"device_uuid": {"uuid": "h3"}}, "device_type": "emu-client", "device_drivers": [0], + "device_config": {"config_rules": [ + {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "127.0.0.1"}}, + {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "0"}}, + {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": {"endpoints": [ + {"uuid": "h3-eth0", "type": "copper/internal"}, + {"uuid": "int", "type": "copper/internal"} + ]}}} + ]} + }, + { + "device_id": {"device_uuid": {"uuid": "h4"}}, "device_type": "emu-client", "device_drivers": [0], + "device_config": {"config_rules": [ + {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "127.0.0.1"}}, + {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "0"}}, + {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": {"endpoints": [ + {"uuid": "h4-eth0", "type": "copper/internal"}, + {"uuid": "int", "type": "copper/internal"} + ]}}} + ]} + } + ] +} + + + diff --git a/src/tests/OpenFlow-Ryu-NBI-Request/commands.txt b/src/tests/OpenFlow-Ryu-NBI-Request/commands.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7a7291c21d2eef52e0498ffe4d52fac1d036667 --- /dev/null +++ b/src/tests/OpenFlow-Ryu-NBI-Request/commands.txt @@ -0,0 +1,3 @@ +sudo mn -c +ryu-manager --observe-links ryu.app.ofctl_rest ryu.app.gui_topology.gui_topology +sudo python3 ~/mininet/custom_pentagon_topology.py \ No newline at end of file diff --git a/src/tests/OpenFlow-Ryu-NBI-Request/custom_pentagon_topology.py b/src/tests/OpenFlow-Ryu-NBI-Request/custom_pentagon_topology.py new file mode 100644 index 0000000000000000000000000000000000000000..801e763078c87a55aeb8150708c62f9754e21b2a --- /dev/null +++ b/src/tests/OpenFlow-Ryu-NBI-Request/custom_pentagon_topology.py @@ -0,0 +1,40 @@ +from mininet.topo import Topo +from mininet.net import Mininet +from mininet.node import RemoteController +from mininet.cli import CLI +from mininet.link import TCLink + +class PentagonTopo(Topo): + def build(self): + sw1 = self.addSwitch('s1') + sw2 = self.addSwitch('s2') + sw3 = self.addSwitch('s3') + sw4 = self.addSwitch('s4') + sw5 = self.addSwitch('s5') + + h1 = self.addHost('h1', ip="10.0.0.1", mac="00:00:00:00:00:01") + h2 = self.addHost('h2', ip="10.0.0.2", mac="00:00:00:00:00:02") + h3 = self.addHost('h3', ip="10.0.0.3", mac="00:00:00:00:00:03") + h4 = self.addHost('h4', ip="10.0.0.4", mac="00:00:00:00:00:04") + + self.addLink(sw1, sw2) + self.addLink(sw2, sw3) + self.addLink(sw3, sw4) + self.addLink(sw4, sw5) + self.addLink(sw5, sw1) + + self.addLink(h1, sw2) + self.addLink(h2, sw2) + self.addLink(h3, sw5) + self.addLink(h4, sw5) + +if __name__ == '__main__': + topo = PentagonTopo() + net = Mininet(topo=topo, controller=lambda name: RemoteController(name, ip='127.0.0.1'), link=TCLink) + + net.start() + net.staticArp() + + print("Custom Pentagon Topology is up with static ARP.") + CLI(net) + net.stop()