ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

第七次SDN上机实验

2021-10-26 13:32:02  阅读:159  来源: 互联网

标签:上机 VLAN curl add actions 第七次 SDN type port


一、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上的流表数据。


3.编写Python程序,调用OpenDaylight的北向接口下发硬超时流表,实现拓扑内主机h1和h3网络中断20s。




二、Ryu
1.编写Python程序,调用Ryu的北向接口,实现上述OpenDaylight实验拓扑上相同的硬超时流表下发。



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

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

标签:上机,VLAN,curl,add,actions,第七次,SDN,type,port
来源: https://www.cnblogs.com/dbbb/p/15465289.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有