Skip to content
Snippets Groups Projects
Commit d8b99999 authored by Mohamad Rahhal's avatar Mohamad Rahhal
Browse files

Test - Ryu - OpenFlow :

- Added Test Files
parent 763165dc
No related branches found
No related tags found
2 merge requests!359Release TeraFlowSDN 5.0,!296Resolve "(CTTC) Add OpenFlow support through Ryu SDN controller"
{
"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"}}
]
}
]
}
{
"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"}
]}}}
]}
}
]
}
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
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()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment