• ryu rest router


    https://osrg.github.io/ryu-book/en/html/rest_router.html

     https://zoo.cs.yale.edu/classes/cs434/cs434-2017-spring/lectures/02-prognet-openflow.pdf

    Go to file
    方法一: 您可以在xterm窗口中运行shell命令和脚本。 enter image description here
    
    方法二: 您可以直接在mininet控制台上运行。
    
    mininet> h1 bash script.sh
    Write sth on h1
    mininet>
    script.sh包含简单的echo命令。
     
     
     
     
    [root@kunpeng82 devuser]#  curl -X POST -d '{"address": "172.16.10.1/24"}' http://localhost:8080/router/0000000000000001/2
    {"result": "failure", "details": "Router SW is not connected. : switch_id=0000000000000001"}
    [root@kunpeng82 devuser]# 

     

    [root@kunpeng82 devuser]# curl http://localhost:8080/router/0000000000000001
    curl: (7) Failed connect to localhost:8080; Connection refused
    [root@kunpeng82 devuser]# ryu-manager ryu.app.rest_router
    loading app ryu.app.rest_router
    loading app ryu.controller.ofp_handler
    instantiating app None of DPSet
    creating context dpset
    creating context wsgi
    instantiating app ryu.app.rest_router of RestRouterAPI
    instantiating app ryu.controller.ofp_handler of OFPHandler
    (26654) wsgi starting up on http://0.0.0.0:8080
    (26654) accepted ('127.0.0.1', 45350)
    127.0.0.1 - - [11/Jul/2020 14:54:39] "POST /router/0000000000000001/2 HTTP/1.1" 404 215 0.004427
    (26654) accepted ('127.0.0.1', 45354)
    127.0.0.1 - - [11/Jul/2020 14:56:21] "POST /router/0000000000000001/2 HTTP/1.1" 404 215 0.000506
    [root@kunpeng82 devuser]# mn --topo linear,3,2 --mac --switch ovsk --controller remote -x
    *** Creating network
    *** Adding controller
    Unable to contact the remote controller at 127.0.0.1:6653
    Unable to contact the remote controller at 127.0.0.1:6633
    Setting remote controller to 127.0.0.1:6653
    *** Adding hosts:
    h1s1 h1s2 h1s3 h2s1 h2s2 h2s3 
    *** Adding switches:
    s1 s2 s3 
    *** Adding links:
    (h1s1, s1) (h1s2, s2) (h1s3, s3) (h2s1, s1) (h2s2, s2) (h2s3, s3) (s2, s1) (s3, s2) 
    *** Configuring hosts
    h1s1 h1s2 h1s3 h2s1 h2s2 h2s3 
    Error starting terms: Cannot connect to display
    *** Starting controller
    c0 
    *** Starting 3 switches
    s1 s2 s3 ...
    *** Starting CLI:
    mininet> 
    mininet> ip a show  h1s1-eth0
    *** Unknown command: ip a show  h1s1-eth0
    mininet> ip addr del 10.0.0.1/8 dev h1s1-eth0
    *** Unknown command: ip addr del 10.0.0.1/8 dev h1s1-eth0
    mininet> xterm c0
    Error: Cannot connect to display
    mininet> dump
    <Host h1s1: h1s1-eth0:10.0.0.1 pid=63595> 
    <Host h1s2: h1s2-eth0:10.0.0.2 pid=63598> 
    <Host h1s3: h1s3-eth0:10.0.0.3 pid=63600> 
    <Host h2s1: h2s1-eth0:10.0.0.4 pid=63602> 
    <Host h2s2: h2s2-eth0:10.0.0.5 pid=63604> 
    <Host h2s3: h2s3-eth0:10.0.0.6 pid=63606> 
    <OVSSwitch s1: lo:127.0.0.1,s1-eth1:None,s1-eth2:None,s1-eth3:None pid=63611> 
    <OVSSwitch s2: lo:127.0.0.1,s2-eth1:None,s2-eth2:None,s2-eth3:None,s2-eth4:None pid=63614> 
    <OVSSwitch s3: lo:127.0.0.1,s3-eth1:None,s3-eth2:None,s3-eth3:None pid=63618> 
    <RemoteController c0: 127.0.0.1:6653 pid=63587> 
    mininet> 
    mininet> h1s1 ip a
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        inet 127.0.0.1/8 scope host lo
           valid_lft forever preferred_lft forever
        inet6 ::1/128 scope host 
           valid_lft forever preferred_lft forever
    2: h1s1-eth0@if294: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
        link/ether 00:00:00:00:00:01 brd ff:ff:ff:ff:ff:ff link-netnsid 0
        inet 10.0.0.1/8 brd 10.255.255.255 scope global h1s1-eth0
           valid_lft forever preferred_lft forever
        inet6 fe80::200:ff:fe00:1/64 scope link 
           valid_lft forever preferred_lft forever
    mininet>
    mininet> xterm h1s1
    Error: Cannot connect to display
    mininet> h1s1  ip addr del 10.0.0.1/8 dev h1s1-eth0
    mininet> h1s1 ip link add link h1s1-eth0 name h1s1-eth0.2 type vlan id 2
    mininet> h1s1 ip addr add 172.16.10.10/24 dev h1s1-eth0.2
    mininet> h1s1 ip link set dev h1s1-eth0.2 up
    mininet>
    mininet> h2s1 bash ~/h2s1.sh
    mininet> h2s1  ip a
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        inet 127.0.0.1/8 scope host lo
           valid_lft forever preferred_lft forever
        inet6 ::1/128 scope host 
           valid_lft forever preferred_lft forever
    2: h2s1-eth0@if297: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
        link/ether 00:00:00:00:00:04 brd ff:ff:ff:ff:ff:ff link-netnsid 0
        inet6 fe80::200:ff:fe00:4/64 scope link 
           valid_lft forever preferred_lft forever
    3: h2s1-eth0.110@h2s1-eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
        link/ether 00:00:00:00:00:04 brd ff:ff:ff:ff:ff:ff
        inet 172.16.10.11/24 scope global h2s1-eth0.110
           valid_lft forever preferred_lft forever
        inet6 fe80::200:ff:fe00:4/64 scope link 
           valid_lft forever preferred_lft forever
    mininet> 
    [root@kunpeng82 ~]# ls h*
    h1s2.sh  h1s3.sh  h2s1.sh  h2s2.sh  h2s3.sh
    [root@kunpeng82 ~]# 
    

      

    mininet> h2s2 bash ~/h2s2.sh
    mininet> h1s3 bash ~/h1s3.sh
    mininet> h2s3 bash ~/h2s3.sh
    mininet> dump
    <Host h1s1: h1s1-eth0:10.0.0.1 pid=63595> 
    <Host h1s2: h1s2-eth0:10.0.0.2 pid=63598> 
    <Host h1s3: h1s3-eth0:10.0.0.3 pid=63600> 
    <Host h2s1: h2s1-eth0:10.0.0.4 pid=63602> 
    <Host h2s2: h2s2-eth0:10.0.0.5 pid=63604> 
    <Host h2s3: h2s3-eth0:10.0.0.6 pid=63606> 
    <OVSSwitch s1: lo:127.0.0.1,s1-eth1:None,s1-eth2:None,s1-eth3:None pid=63611> 
    <OVSSwitch s2: lo:127.0.0.1,s2-eth1:None,s2-eth2:None,s2-eth3:None,s2-eth4:None pid=63614> 
    <OVSSwitch s3: lo:127.0.0.1,s3-eth1:None,s3-eth2:None,s3-eth3:None pid=63618> 
    <RemoteController c0: 127.0.0.1:6653 pid=63587> 
    mininet> 
  • 相关阅读:
    asp.net ajax传递Json给aspx.cs后台 webmethod方法传递json
    新手 Redis 配置笔记(windows),附下载地址
    在 LINQ to Entities 查询中无法构造实体或复杂类型
    WebApi 4.0 默认方式不支持HttpGet 请求
    jQuery .Ajax Error Handling Function
    My97DatePicker 与 某个CSS冲突 ,导致无法显示
    基础连接已经关闭: 未能为 SSL/TLS 安全通道建立信任关系
    使用Autofac部署IIS6.0时未能加载文件或程序集“System.Core, Version=2.0.5.0...“
    Could not load file or assembly 'System.Core, Version=2.0.5.0 和autofac冲突的问题
    线程间操作无效: 从不是创建控件“textBox2”的线程访问它
  • 原文地址:https://www.cnblogs.com/dream397/p/13285984.html
Copyright © 2020-2023  润新知