【问题标题】:How to add flows in mininet with an OpenDayLight controller using Python如何使用 Python 在带有 OpenDayLight 控制器的 mininet 中添加流
【发布时间】:2016-02-24 14:57:44
【问题描述】:

我正在使用一个简单的 mininet 拓扑,试图学习如何使用 ODL 控制器来操作流。拓扑为:

主机1--OFSwitch1--OFSwitch2--主机2--OFSwitch3--OFSwitch4--主机3

默认情况下,我试图实现从 Host1 到 Host3 的无连接,但是,一旦运行 python 脚本,就会添加一个允许 Host1 ping Host3 的流。

我刚开始学习 ODL,似乎无法让这个基本项目正常工作。

【问题讨论】:

    标签: python mininet openflow sdn opendaylight


    【解决方案1】:

    流程可以由 Opendaylight 控制器 REST api 创建,然后反映在 OVS 交换机中,其中使用 mininet 完成网络模拟。

    请参考以下步骤在 ODL 中创建流程并在 ODL 和 OVS 中进行验证:

    1) ODL 流创建

    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 中创建流的更多信息

    【讨论】:

      猜你喜欢
      • 2019-05-09
      • 2022-11-12
      • 1970-01-01
      • 2022-06-25
      • 1970-01-01
      • 2016-06-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多