我正在使用一个简单的 mininet 拓扑,尝试学习如何使用 ODL Controller 操纵流。拓扑结构为:
主机1 -- OFSwitch1 -- OFSwitch2 -- 主机2 -- OFSwitch3 -- OFSwitch4 -- 主机3
默认情况下,我试图实现从 Host1 到 Host3 的无连接,但是,一旦运行 python 脚本,就会添加一个流,允许 Host1 ping Host3。
我刚刚开始学习 ODL,似乎无法让这个基本项目正常运行。
最佳答案
流可以通过 Opendaylight Controller REST api 创建,进而反射(reflect)在 OVS 交换机中,其中使用 mininet 完成网络模拟。
请引用以下步骤在 ODL 中创建流程并在 ODL 和 OVS 中验证相同的流程:
1) ODL Flow 创建
curl -u admin:admin -H 'Content-Type: application/yang.data+xml' -X PUT -d @flow_data.xml http://192.168.1.196:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/0/flow/10
flow_date.xml 文件内容:
<flow xmlns="urn:opendaylight:flow:inventory"> <priority>14865</priority> <flow-name>jpsampleFlow</flow-name> <idle-timeout>12000</idle-timeout> <match> <ethernet-match> <ethernet-type> <type>2048</type> </ethernet-type> </ethernet-match> <ipv4-source>10.0.0.1/32</ipv4-source><ipv4-destination>10.0.0.2/32</ipv4-destination><ip-match><ip-dscp>28</ip-dscp> </ip-match></match> <id>9</id> <table_id>0</table_id> <instructions> <instruction> <order>6555</order> </instruction> <instruction> <order>0</order> <apply-actions> <action> <order>0</order><drop-action/> <output-action> <output-node-connector>1</output-node-connector> </output-action> </action> </apply-actions> </instruction> </instructions> </flow>
2)验证ODL中创建的流程:
curl -u admin:admin -X GET http://192.168.1.196:8181/restconf/operational/opendaylight-inventory:nodes/node/openflow:1/table/0/flow/10
3)在OVS中验证相同的内容:
sudo ovs-ofctl dump-flows <switch_id>
引用this wiki page了解有关 ODL 中流程创建的更多信息
关于python - 如何使用 Python 通过 OpenDayLight Controller 在 mininet 中添加流,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35605552/