使用Postman下发流表

实验环境检查

查看Opendaylight控制器

68324582647

登陆Opendaylight控制器,在查看控制器主机的6633端口监听状态

root@guest-virtual-machine:/home/guest# netstat -an|grep 6633

68324632013

关闭防火墙

sudo ufw disable

访问WEB页面

68324642802

在OVS主机(Miniet主机)中创建拓扑结构,并测试连通性

sudo mn --topo=single,3 --controller=remote,ip=192.168.123.10,port=6633 --switch ovsk,protocols=OpenFlow13

68324677224

在控制器页面查看到的拓扑图

68324681237

使用postman查看交换机id信息,交换机id为1

http://192.168.123.10:8080/restconf/operational/network-topology:network-topology

68324733334

下发第一条流表

PUT

http://192.168.123.10:8080/restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/0/flow/1

68324871215

主机1的MAC地址:00:0c:29:91:9c:e6
主机2的MAC地址:42:59:6f:b2:ee:64
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<flow xmlns="urn:opendaylight:flow:inventory">
<priority>200</priority>
<flow-name>Foo1</flow-name>
<idle-timeout>0</idle-timeout>
<hard-timeout>0</hard-timeout>
<match>
<ethernet-match>
<ethernet-source>
<address>00:0c:29:91:9c:e6</address>
</ethernet-source>
<ethernet-destination>
<address>42:59:6f:b2:ee:64</address>
</ethernet-destination>
</ethernet-match>
</match>
<id>1</id>
<table_id>0</table_id>
<instructions>
<instruction>
<order>0</order>
<apply-actions>
<action>
<order>0</order>
<output-action>
<output-node-connector>2</output-node-connector>
</output-action>
</action>
</apply-actions>
</instruction>
</instructions>
</flow>

下发第二条流表

http://192.168.123.10:8080/restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/0/flow/2
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<flow xmlns="urn:opendaylight:flow:inventory">
<priority>200</priority>
<flow-name>Foo1</flow-name>
<idle-timeout>0</idle-timeout>
<hard-timeout>0</hard-timeout>
<match>
<ethernet-match>
<ethernet-source>
<address>42:59:6f:b2:ee:64</address>
</ethernet-source>
<ethernet-destination>
<address>00:0c:29:91:9c:e6</address>
</ethernet-destination>
</ethernet-match>
</match>
<id>2</id>
<table_id>0</table_id>
<instructions>
<instruction>
<order>0</order>
<apply-actions>
<action>
<order>0</order>
<output-action>
<output-node-connector>1</output-node-connector>
</output-action>
</action>
</apply-actions>
</instruction>
</instructions>
</flow>

68324910358

登陆交换机,查看流表

ovs-ofctl dump-flows s1

删除第一条流表

http://192.168.123.10:8080/restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/0/flow/1

68324966554

删除第二条流表

http://192.168.123.10:8080/restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/0/flow/2

68324977418

最后修改:2023 年 05 月 11 日
如果觉得我的文章对你有用,请随意赞赏