一、安裝Postman
OpenFlowplugin獲取當(dāng)前交換機(jī)的連接狀態(tài)以及下發(fā)流表都需要手動(dòng)發(fā)送HTTP的PUT/GET請(qǐng)求痘绎。使用的工具是Google的Chromium瀏覽器所提供的“Postman REST Client”插件弧腥。因此需要安裝Chromium瀏覽器本辐。
由于Google服務(wù)在大陸地區(qū)被禁宏侍,可能導(dǎo)致谷歌的插件市場(chǎng)無(wú)法訪(fǎng)問(wèn)赖淤,那么就只能下載第三方插件。
插件下載后解壓縮谅河,打開(kāi)Chromium瀏覽器咱旱,點(diǎn)擊右上角菜單按鈕→Tools→Extentions→Developer mode→Load unpacked extention,然后選擇剛剛下載的插件旧蛾,Open。添加后后面的Enabled復(fù)選框要選上蠕嫁。
需要使用時(shí)锨天,點(diǎn)擊左上角Apps→Postman。
二剃毒、使用ODL OpenFlow插件
1. 顯示節(jié)點(diǎn)信息
Basic Auth輸入用戶(hù)名和密碼病袄,Header中Accept設(shè)置為application/xml,方式選GET赘阀,URL為:
http://localhost:8181/restconf/operational/opendaylight-inventory:nodes/
也可以查看單個(gè)節(jié)點(diǎn)益缠,url替換為:
http://localhost:8181/restconf/operational/opendaylight-inventory:nodes/node/openflow:1
2. 添加流表
Header中Accept和Content-type都設(shè)置為application/xml,方式選PUT基公,URL為:
http://localhost:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/0/flow/1
Body部分示例:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<flow xmlns="urn:opendaylight:flow:inventory">
<strict>false</strict>
<instructions>
<instruction>
<order>0</order>
<apply-actions>
<action>
<order>0</order>
<dec-mpls-ttl/>
</action>
</apply-actions>
</instruction>
</instructions>
<table_id>0</table_id>
<id>1</id>
<cookie_mask>255</cookie_mask>
<installHw>false</installHw>
<match>
<ethernet-match>
<ethernet-type>
<type>0x8847</type>
</ethernet-type>
<ethernet-destination>
<address>f4:ce:46:bf:32:f3</address>
</ethernet-destination>
<ethernet-source>
<address>d8:d3:85:5b:ad:89</address>
</ethernet-source>
</ethernet-match>
</match>
<hard-timeout>12</hard-timeout>
<cookie>4</cookie>
<idle-timeout>34</idle-timeout>
<flow-name>MYMACFLOW</flow-name>
<priority>2</priority>
<barrier>false</barrier>
</flow>
3. 查看流表
GET方式幅慌,URL為:
http://localhost:8181/restconf/operational/opendaylight-inventory:nodes/node/openflow:1/table/0/