ovs & ryu & mininet

[root@kunpeng82 mininet]# ryu --version
ryu 4.34
[root@kunpeng82 mininet]#

[root@kunpeng82 ryu-master]# find ./ -name simple_switch_13.py
./ryu/app/simple_switch_13.py
./build/lib/ryu/app/simple_switch_13.py
[root@kunpeng82 ryu-master]# cd ryu/app/
[root@kunpeng82 app]# ryu-manager --verbose simple_switch_13.py ofctl_rest.py rest_topology.py
loading app simple_switch_13.py
loading app ofctl_rest.py
loading app rest_topology.py
require_app: ryu.topology.switches is required by rest_topology
loading app ryu.controller.ofp_handler
loading app ryu.topology.switches
loading app ryu.controller.ofp_handler
instantiating app None of DPSet
creating context dpset
creating context wsgi
instantiating app simple_switch_13.py of SimpleSwitch13
instantiating app ofctl_rest.py of RestStatsApi
instantiating app rest_topology.py of TopologyAPI
instantiating app ryu.controller.ofp_handler of OFPHandler
instantiating app ryu.topology.switches of Switches
BRICK dpset





[root@kunpeng82 mininet]# mn --controller=remote,ip=127.0.0.1,port=6653 *** Creating network *** Adding controller *** Adding hosts: h1 h2 *** Adding switches: s1 *** Adding links: (h1, s1) (h2, s1) *** Configuring hosts h1 h2 *** Starting controller c0 *** Starting 1 switches s1 ... *** Starting CLI: mininet>
http://10.10.16.82:8080/stats/desc/1

[root@kunpeng82 custom]# vi test.py
#!/user/bin/env python
from mininet.topo import Topo
class MyTopo(Topo):
    def build(self):
        left=[]
        left.append(self.addHost("h1"))
        left.append(self.addHost("h2"))
        right=[]
        right.append(self.addHost("h3"))
        right.append(self.addHost("h4"))
        switchs=[]
        switchs.append(self.addSwitch("s1"))
        switchs.append(self.addSwitch("s2"))

        self.addLink(left[0],switchs[0])
        self.addLink(left[1],switchs[0])
        self.addLink(right[0],switchs[1])
        self.addLink(right[1],switchs[1])
        self.addLink(switchs[0],switchs[1])


topos={'mytopo':(lambda : MyTopo())}
"test.py" [New] 22L, 648C written
[root@kunpeng82 custom]#  mn --controller=remote,ip=127.0.0.1,port=6653 --custom test.py --topo mytopo
*** Creating network
*** Adding controller
*** Adding hosts:
h1 h2 h3 h4 
*** Adding switches:
s1 s2 
*** Adding links:
(h1, s1) (h2, s1) (h3, s2) (h4, s2) (s1, s2) 
*** Configuring hosts
h1 h2 h3 h4 
*** Starting controller
c0 
*** Starting 2 switches
s1 s2 ...
*** Starting CLI:
mininet>  pingall
*** Ping: testing ping reachability
h1 -> h2 h3 h4 
h2 -> h1 h3 h4 
h3 -> h1 h2 h4 
h4 -> h1 h2 h3 
*** Results: 0% dropped (12/12 received)
mininet> 
http://10.10.16.82:8080/stats/switches

http://10.10.16.82:8080/stats/flow/1
{"1": [{"priority": 1, "cookie": 0, "idle_timeout": 0, "hard_timeout": 0, "byte_count": 238, "duration_sec": 264, "duration_nsec": 728000000, "packet_count": 3, "length": 104, "flags": 0, "actions": ["OUTPUT:1"], "match": {"in_port": 2, "dl_src": "ba:61:1d:41:32:b8", "dl_dst": "2e:1c:03:0e:97:18"}, "table_id": 0}, {"priority": 1, "cookie": 0, "idle_timeout": 0, "hard_timeout": 0, "byte_count": 140, "duration_sec": 264, "duration_nsec": 724000000, "packet_count": 2, "length": 104, "flags": 0, "actions": ["OUTPUT:2"], "match": {"in_port": 1, "dl_src": "2e:1c:03:0e:97:18", "dl_dst": "ba:61:1d:41:32:b8"}, "table_id": 0}, {"priority": 1, "cookie": 0, "idle_timeout": 0, "hard_timeout": 0, "byte_count": 238, "duration_sec": 264, "duration_nsec": 711000000, "packet_count": 3, "length": 104, "flags": 0, "actions": ["OUTPUT:1"], "match": {"in_port": 3, "dl_src": "42:d8:65:f5:84:82", "dl_dst": "2e:1c:03:0e:97:18"}, "table_id": 0}, {"priority": 1, "cookie": 0, "idle_timeout": 0, "hard_timeout": 0, "byte_count": 140, "duration_sec": 264, "duration_nsec": 709000000, "packet_count": 2, "length": 104, "flags": 0, "actions": ["OUTPUT:3"], "match": {"in_port": 1, "dl_src": "2e:1c:03:0e:97:18", "dl_dst": "42:d8:65:f5:84:82"}, "table_id": 0}, {"priority": 1, "cookie": 0, "idle_timeout": 0, "hard_timeout": 0, "byte_count": 238, "duration_sec": 264, "duration_nsec": 694000000, "packet_count": 3, "length": 104, "flags": 0, "actions": ["OUTPUT:1"], "match": {"in_port": 3, "dl_src": "82:cb:85:fa:1a:09", "dl_dst": "2e:1c:03:0e:97:18"}, "table_id": 0}, {"priority": 1, "cookie": 0, "idle_timeout": 0, "hard_timeout": 0, "byte_count": 140, "duration_sec": 264, "duration_nsec": 691000000, "packet_count": 2, "length": 104, "flags": 0, "actions": ["OUTPUT:3"], "match": {"in_port": 1, "dl_src": "2e:1c:03:0e:97:18", "dl_dst": "82:cb:85:fa:1a:09"}, "table_id": 0}, {"priority": 1, "cookie": 0, "idle_timeout": 0, "hard_timeout": 0, "byte_count": 238, "duration_sec": 264, "duration_nsec": 675000000, "packet_count": 3, "length": 104, "flags": 0, "actions": ["OUTPUT:2"], "match": {"in_port": 3, "dl_src": "42:d8:65:f5:84:82", "dl_dst": "ba:61:1d:41:32:b8"}, "table_id": 0}, {"priority": 1, "cookie": 0, "idle_timeout": 0, "hard_timeout": 0, "byte_count": 140, "duration_sec": 264, "duration_nsec": 672000000, "packet_count": 2, "length": 104, "flags": 0, "actions": ["OUTPUT:3"], "match": {"in_port": 2, "dl_src": "ba:61:1d:41:32:b8", "dl_dst": "42:d8:65:f5:84:82"}, "table_id": 0}, {"priority": 1, "cookie": 0, "idle_timeout": 0, "hard_timeout": 0, "byte_count": 238, "duration_sec": 264, "duration_nsec": 658000000, "packet_count": 3, "length": 104, "flags": 0, "actions": ["OUTPUT:2"], "match": {"in_port": 3, "dl_src": "82:cb:85:fa:1a:09", "dl_dst": "ba:61:1d:41:32:b8"}, "table_id": 0}, {"priority": 1, "cookie": 0, "idle_timeout": 0, "hard_timeout": 0, "byte_count": 140, "duration_sec": 264, "duration_nsec": 655000000, "packet_count": 2, "length": 104, "flags": 0, "actions": ["OUTPUT:3"], "match": {"in_port": 2, "dl_src": "ba:61:1d:41:32:b8", "dl_dst": "82:cb:85:fa:1a:09"}, "table_id": 0}, {"priority": 0, "cookie": 0, "idle_timeout": 0, "hard_timeout": 0, "byte_count": 4756, "duration_sec": 280, "duration_nsec": 242000000, "packet_count": 66, "length": 80, "flags": 0, "actions": ["OUTPUT:CONTROLLER"], "match": {}, "table_id": 0}]}

猜你喜欢

转载自www.cnblogs.com/dream397/p/12944856.html
ryu
ovs