1)OpenDaylight
1、利用Mininet平台搭建下图所示网络拓扑,并连接OpenDaylight;
SDN第七次实验_主机名
2、编写Python程序,调用OpenDaylight的北向接口下发指令删除s1上的流表数据。
SDN第七次实验_python_02
SDN第七次实验_平台搭建_03
3、编写Python程序,调用OpenDaylight的北向接口下发硬超时流表,实现拓扑内主机h1和h3网络中断20s。
SDN第七次实验_python语言_04
SDN第七次实验_平台搭建_05
4、编写Python程序,调用OpenDaylight的北向接口获取s1上活动的流表数。
SDN第七次实验_python_06
SDN第七次实验_平台搭建_07
2)Ryu
1、编写Python程序,调用Ryu的北向接口,实现上述OpenDaylight实验拓扑上相同的硬超时流表下发。
这里会报错,不知道什么原因!
SDN第七次实验_python语言_08
SDN第七次实验_主机名_09
2、利用Mininet平台搭建下图所示网络拓扑,要求支持OpenFlow 1.3协议,主机名、交换机名以及端口对应正确。拓扑生成后需连接Ryu,且Ryu应能够提供REST API服务
SDN第七次实验_平台搭建_10
3、整理一个Shell脚本,参考Ryu REST API的文档,利用curl命令,实现和实验2相同的VLAN。

curl -X POST -d '{
    "dpid": 1,
    "priority": 1,
    "match":{
        "in_port": 1
    },
    "actions":[
        {
            "type": "PUSH_VLAN",
            "ethertype": 33024
        },
        {
            "type": "SET_FIELD",
            "field": "vlan_vid",
            "value": 4096
        },
        {
            "type": "OUTPUT",
            "port": 3
        }
    ]
 }' http://localhost:8080/stats/flowentry/add
 
 curl -X POST -d '{
    "dpid": 1,
    "priority": 1,
    "match":{
        "in_port": 2
    },
    "actions":[
        {
            "type": "PUSH_VLAN", 
            "ethertype": 33024 
        },
        {
            "type": "SET_FIELD",
            "field": "vlan_vid",
            "value": 4097
        },
        {
            "type": "OUTPUT",
            "port": 3
        }
    ]
 }' http://localhost:8080/stats/flowentry/add
 
 curl -X POST -d '{
    "dpid": 1,
    "priority": 1,
    "match":{
        "vlan_vid": 0
    },
    "actions":[
        {
            "type": "POP_VLAN",
            "ethertype": 33024
        },
        {
            "type": "OUTPUT",
            "port": 1
        }
    ]
 }' http://localhost:8080/stats/flowentry/add
 
 curl -X POST -d '{
    "dpid": 1,
    "priority": 1,
    "match":{
        "vlan_vid": 1
    },
    "actions":[
        {
            "type": "POP_VLAN",
            "ethertype": 33024
        },
        {
            "type": "OUTPUT",
            "port": 2
        }
    ]
 }' http://localhost:8080/stats/flowentry/add
 
 curl -X POST -d '{
    "dpid": 2,
    "priority": 1,
    "match":{
        "in_port": 1
    },
    "actions":[
        {
            "type": "PUSH_VLAN",
            "ethertype": 33024 
        },
        {
            "type": "SET_FIELD",
            "field": "vlan_vid", 
            "value": 4096 
        },
        {
            "type": "OUTPUT",
            "port": 3
        }
    ]
 }' http://localhost:8080/stats/flowentry/add
 
 curl -X POST -d '{
    "dpid": 2,
    "priority": 1,
    "match":{
        "in_port": 2
    },
    "actions":[
        {
            "type": "PUSH_VLAN", 
            "ethertype": 33024
        },
        {
            "type": "SET_FIELD",
            "field": "vlan_vid",
            "value": 4097 
        },
        {
            "type": "OUTPUT",
            "port": 3
        }
    ]
 }' http://localhost:8080/stats/flowentry/add
 
 curl -X POST -d '{
    "dpid": 2,
    "priority": 1,
    "match":{
        "vlan_vid": 0
    },
    "actions":[
        {
            "type": "POP_VLAN",
            "ethertype": 33024 
        },
        {
            "type": "OUTPUT",
            "port": 1
        }
    ]
 }' http://localhost:8080/stats/flowentry/add
 
 curl -X POST -d '{
    "dpid": 2,
    "priority": 1,
    "match":{
        "vlan_vid": 1
    },
    "actions":[
        {
            "type": "POP_VLAN", 
            "ethertype": 33024 
        },
        {
            "type": "OUTPUT",
            "port": 2
        }
    ]
 }' http://localhost:8080/stats/flowentry/add

实验心得:这次实验一开始我就感到无从下手,真的是太难了,第一是不怎么会python语言;第二是不知道如何使用REST API;第三就是有很多地方会报错,但是又不知道如何解决,反正会出现各种各样的问题,然后实验是不怎么成功,可能后续会修改,还是有太多的地方不懂了,得好好去钻研了。反正有很多的不懂,参考了很多人的作业,也还是搞不懂。