第七次SDN上机实验

一、OpenDaylight
1.利用Mininet平台搭建下图所示网络拓扑,并连接OpenDaylight;
搭建拓扑:sudo mn --topo=single,3 --mac --controller=remote,ip=127.0.0.1,port=6633 --switch ovsk,protocols=OpenFlow10
连接OpenDaylight(ODL目录下):./distribution-karaf-0.6.4-Carbon/bin/karaf
2.编写Python程序,调用OpenDaylight的北向接口下发指令删除s1上的流表数据。

第七次SDN上机实验
3.编写Python程序,调用OpenDaylight的北向接口下发硬超时流表,实现拓扑内主机h1和h3网络中断20s。
第七次SDN上机实验
第七次SDN上机实验
第七次SDN上机实验
第七次SDN上机实验
二、Ryu
1.编写Python程序,调用Ryu的北向接口,实现上述OpenDaylight实验拓扑上相同的硬超时流表下发。
第七次SDN上机实验
第七次SDN上机实验
第七次SDN上机实验
第七次SDN上机实验

3.整理一个Shell脚本,参考Ryu REST API的文档,利用curl命令,实现和实验2相同的VLAN。
curl -X POST -d '{
"dpid": 1,
"match": {
"in_port": 1
},
"actions": [
{
"type": "PUSH_VLAN",
"ethertype": 33024
},
{
"type": "SET_FIELD",
"field": "vlan_vid",
"value": 4096
},
{
"type":"OUTPUT",
"port": 3
}
],
"priority":5
}' http://localhost:8080/stats/flowentry/add

curl -X POST -d '
{
"dpid": 1,
"priority":5,
"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,
"match": {
"vlan_vid": 0
},
"actions": [
{
"type": "POP_VLAN",
"ethertype": 33024
},
{
"type":"OUTPUT",
"port": 1
}
],
"priority":5
}
' http://localhost:8080/stats/flowentry/add

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

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

curl -X POST -d '
{
"dpid": 2,
"match": {
"vlan_vid": 0
},
"actions": [
{
"type": "POP_VLAN",
"ethertype": 33024
},
{
"type":"OUTPUT",
"port": 1
}
],
"priority":5
}
' http://localhost:8080/stats/flowentry/add

curl -X POST -d'
{
"dpid": 2,
"match": {
"vlan_vid": 1
},
"actions": [
{
"type": "POP_VLAN",
"ethertype": 33024
},
{
"type":"OUTPUT",
"port": 2
}
],
"priority":5
}' http://localhost:8080/stats/flowentry/add
第七次SDN上机实验

实验心得:对于这次试验上升难度,很多地方都尝试很多次才行,特别是在python的编程上,遇到不少问题,虽然实验完成了
到还有很多代码不懂,不知道它有何作用,能做出来都是同学帮助,到现在也不知道为何而来,感觉自己就学到了一点皮毛,
深层读的知识还是,无法熟练掌握。

上一篇:libcurl源码分析


下一篇:curl to python 美化版