问题
I have written a python + XML code that pushes flow in to mininet switch (s2) through ODL controller. code is been executed perfectly as it responding <Respone 200>
XML code response after running
but when I check the mininet switch it doesn't show the specific tables where as other tables flow (0 & 3) are showing, the highlighted once.
flow display of mininet switch
The purpose of this XML code is to check destination IPV4 address, than change the destination and source MAC address and than go to table 3.
odl_url = "http://10.1.1.129:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:2/table/2/flow/1"
print(odl_url)
headers = {'content-type': 'application/xml', 'accept': 'application/xml'}
dataXML="""<flow xmlns="urn:opendaylight:flow:inventory">
<id>1</id>
<instructions>
<instruction>
<order>0</order>
<apply-actions>
<action>
<order>0</order>
<set-field>
<ethernet-match>
<ethernet-destination>
<address>00:00:00:00:02:02</address>
</ethernet-destination>
<ethernet-source>
<address>00:00:00:00:02:10</address>
</ethernet-source>
</ethernet-match>
</set-field>
</action>
</apply-actions>
</instruction>
<instruction>
<order>1</order>
<go-to-table>
<table_id>3</table_id>
</go-to-table>
</instruction>
</instructions>
<match>
<ethernet-match>
<ethernet-type>
<type>2048</type>
</ethernet-type>
</ethernet-match>
<ipv4-destination>192.168.2.2/24</ipv4-destination>
</match>
<idle-timeout>0</idle-timeout>
<installHw>false</installHw>
<hard-timeout>0</hard-timeout>
<flow-name>PushFlow</flow-name>
<table_id>2</table_id>
<priority>5000</priority>
<strict>false</strict>
</flow>"""
add_flow_response = requests.put(odl_url, data=dataXML, headers=headers, auth=auth)
print(add_flow_response)
Can anyone please check my code and notify me the issue in the code because of which S2 is not displaying the table 2 flows.
回答1:
Nothing wrong with the code but you have to make sure the switch supports the flow (e.g. tail OVS log at /var/log/openvswitch/ovs-vswitchd.log) as ODL will not return any REST failure for just writing a flow in the config DS.
回答2:
googling the ovs error messages you have in the other post made me wonder if you are running mininet in openflow 1.0 or 1.3?
来源:https://stackoverflow.com/questions/63095820/odl-xml-code-mininet-switch-flow-not-showing-up