OpenDaylight Boron-SR2版本简单应用及流表操作指南

来源:互联网 发布:手机里js文件怎么打开 编辑:程序博客网 时间:2024/06/03 21:55

OpenDaylight Boron-SR2版本简单应用及流表操作指南
1.1 ODL 控制器与mininet的连接:
ruby # sudo mn --controller=remote,ip=127.0.0.1 --topo linear,2 --switch ovs,protocol=OpenFlow13
2 OpenDaylight 流表操作
http://192.168.1.157:8181/restconf/operational/opendaylight-inventory:nodes

2.1 获取节点信息:
http://127.0.0.1:8181/restconf/operational/opendaylight-inventory:nodes/node/openflow:1
2.2 获取flow table 信息
2.2.1获取table统计信息
http://127.0.0.1:8181/restconf/operational/opendaylight-inventory:nodes/node/openflow:1/flow-node-inventory:table/0/opendaylight-flow-table-statistics:flow-table-statistics
2.2.2获取所有flow entry统计信息
http://127.0.0.1:8181/restconf/operational/opendaylight-inventory:nodes/node/openflow:1/flow-node-inventory:table/0/opendaylight-flow-statistics:aggregate-flow-statistics
2.2.3获取单条flow entry信息

2.5.1添加一条流表
在Postman中通过config方式下发flow entry的方法:
With XML:
首先输入Headers:
Content-Type: application/xml
Accept: application/xml
Authorization: Basic
在URL地址栏中输入以下命令:
http://127.0.0.1:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:3/table/0/flow/1
(注意:如果是下发多条flow entry每次下发需要更改flow id的值,相应的URL地址中的table/0/flow/1中的1就是所对应的flow id,也需要修改。)

Use Body:<?xml version="1.0" encoding="UTF-8" standalone="no"?><flow xmlns="urn:opendaylight:flow:inventory"> <match>        <ethernet-match>            <ethernet-type>                <type>2048</type>            </ethernet-type>        </ethernet-match>        <ipv4-destination>10.0.0.1/24</ipv4-destination>    </match>    <instructions>        <instruction>            <order>0</order>            <apply-actions>                <action>                    <order>0</order>                    <dec-nw-ttl/>                </action>            </apply-actions>        </instruction>    </instructions>    <table_id>0</table_id>    <id>1</id>    <hard-timeout>12</hard-timeout>    <cookie>1</cookie>    <idle-timeout>34</idle-timeout>    <flow-name>lihao</flow-name>    <priority>1</priority></flow>

提交方式:PUT

在OVS中查看添加的流表项:
sudo ovs-ofctl dump-flows s3

未看到添加的流表项。
With JSON:
首先输入Headers:
Content-Type: application/json
Accept: application/json
Authorization: [方法如上]
在URL地址栏中输入以下命令:
http://127.0.0.1:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:4/table/0/flow/1 (注意:如果是下发多条flow entry每次下发需要更改flow id的值,相应的URL地址中的table/0/flow/1中的1就是所对应的flow id,也需要修改。)
提交方式:PUT

ovs-ofctl dump-flows s1 -O OpenFlow13
在ovs中也看不到添加的流表项。
在Postman中通过RPC方式下发flow entry的方法:
与通过config操作流表不同的是,通过rpc方式操作流表,只需要交换机的id即可,即openflow:1。flow name和flow id都不需要。
With XML:
在URL地址栏中输入以下命令:
http://127.0.0.1:8181/restconf/operations/sal-flow:add-flow
提交方式: POST

Content:<?xml version="1.0" encoding="UTF-8" standalone="no"?><input xmlns="urn:opendaylight:flow:service">   <node xmlns:inv="urn:opendaylight:inventory">/inv:nodes/inv:node[inv:id="openflow:1"]</node>   <cookie>1</cookie>   <flags>SEND_FLOW_REM</flags>   <hard-timeout>0</hard-timeout>   <idle-timeout>0</idle-timeout>   <installHw>false</installHw>   <match>    <ethernet-match>     <ethernet-type>       <type>2048</type>     </ethernet-type>    </ethernet-match>    <ipv4-destination>10.0.0.1/24</ipv4-destination>   </match>   <instructions>    <instruction>     <order>0</order>     <apply-actions>       <action>         <output-action>           <output-node-connector>openflow:1:2</output-node-connector>         </output-action>         <order>0</order>       </action>     </apply-actions>    </instruction>   </instructions>   <priority>1</priority>   <strict>false</strict>   <table_id>0</table_id></input>

以上下发的流表都为cookie为1,tableid为0,优先级为1,match字段为匹配目的IP地址10.0.0.1,action为output-action,即2口输出。

添加失败!
2.5.2修改一条流表

参考:
http://www.sdnlab.com/15173.html

0 0
原创粉丝点击