Flow descriptors are not cleared when using delete all flows RPC

Description

The following RPC is used to delete all flows in the switch:
POST http://controller:8181/restconf/operations/sal-flow:remove-flow

{ "input": { "opendaylight-flow-service:node":"/opendaylight-inventory:nodes/opendaylight-inventory:node[opendaylight-inventory:id='openflow:1']", "table_id": 255 } }

The RPC works fine, however the flow descriptors for the deleted flows are NOT cleared from the flow registry after RPC success because there is no code support for this "special" RPC, only for individual flows as shown here:

https://git.opendaylight.org/gerrit/gitweb?p=openflowplugin.git;a=blob;f=openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/sal/SalFlowServiceImpl.java;h=ff1f3c8ea2b4bd6fe613ca80d0a79f49266a74a2;hb=HEAD#l247

Because of this code gap, any further attempt to re-program a flow with same ID generates an alien ID:

2020-08-04T02:26:10,125 | TRACE | epollEventLoopGroup-9-1 | DeviceFlowRegistryImpl | 362 - org.opendaylight.openflowplugin.impl - 0.8.3 | Removing flow descriptor for flow hash : FlowRegistryKeyDto{tableId=255, priority=32768, cookie=0, match=Match{augmentation=[]}} 2020-08-04T02:27:15,999 | TRACE | epollEventLoopGroup-9-1 | DeviceFlowRegistryImpl | 362 - org.opendaylight.openflowplugin.impl - 0.8.3 | Storing flowDescriptor with table ID : 0 and flow ID : ArpProbe{Link{DC3-FB2-P1-V100-POD-A3-R2-100},host=169.254.1.6} for flow hash : FlowRegistryKeyDto{tableId=0, priority=432, cookie=3, match=Match{_ethernetMatch=EthernetMatch{_ethernetType=EthernetType{getType=EtherType{_value=2054}, augmentations={}}, augmentation=[]}, _inPort=Uri{_value=1}, _vlanMatch=VlanMatch{getVlanId=VlanId{getVlanId=VlanId{_value=101}, isVlanIdPresent=true, augmentations={}}, augmentations={}}, augmentation=[]}} 2020-08-04T02:27:16,000 | WARN | epollEventLoopGroup-9-1 | DeviceFlowRegistryImpl | 362 - org.opendaylight.openflowplugin.impl - 0.8.3 | Flow with flow ID ArpProbe{Link{DC3-FB2-P1-V100-POD-A3-R2-100},host=169.254.1.6} already exists in table 0, generating alien flow ID 2020-08-04T02:27:16,000 | DEBUG | epollEventLoopGroup-9-1 | DeviceFlowRegistryImpl | 362 - org.opendaylight.openflowplugin.impl - 0.8.3 | Created alien flow id #UF$TABLE*0-2 for table id 0

To reproduce:

1) Start controller with odl-openflowplugin-flow-services-rest feature.
2) Connect mininet: sudo mn --switch=ovsk,protocols=OpenFlow13 --controller=remote,ip=10.1.75.100
3) Add flow1 via RPC:
POST http://controller:8181/restconf/operations/sal-flow:add-flow

{ "input": { "opendaylight-flow-service:node":"/opendaylight-inventory:nodes/opendaylight-inventory:node[opendaylight-inventory:id='openflow:1']", "flow-ref": "/opendaylight-inventory:nodes/opendaylight-inventory:node[opendaylight-inventory:id='openflow:1']/flow-node-inventory:table[flow-node-inventory:id='0']/flow-node-inventory:flow[flow-node-inventory:id='flow1']", "priority": 432, "table_id": 0, "buffer_id": 4294967295, "hard-timeout": 0, "match": { "ethernet-match": { "ethernet-type": { "type": 2054 } }, "in-port": "openflow:1:1", "vlan-match": { "vlan-id": { "vlan-id": 101, "vlan-id-present": true } } }, "cookie": 1, "flags": "", "instructions": { "instruction": [ { "order": 0, "apply-actions": { "action": [ { "order": 1, "output-action": { "max-length": 65535, "output-node-connector": "CONTROLLER" } } ] } } ] }, "idle-timeout": 0 } }

4) Check flow has correct ID flow1 in operational:

GET http://controller:8181/restconf/operational/opendaylight-inventory:nodes/node/openflow:1/table/0
5) Use delete all flows RPC
6) Re-push same flow changing the cookie=2
7) Check alien ID is generated in operational:
GET http://controller:8181/restconf/operational/opendaylight-inventory:nodes/node/openflow:1/table/0

NOTE: same steps above work fine if instead of using delete all flows RPC, we just delete the individual flow with:
POST http://controller:8181/restconf/operations/sal-flow:remove-flow using the flow1 body.

Environment

None

Activity

Show:

Luis Gomez Palacios September 3, 2020 at 1:12 AM

Cherry-pick created, please merge.

Done

Details

Assignee

Reporter

Fix versions

Priority

Created August 7, 2020 at 4:09 AM
Updated September 4, 2020 at 9:15 PM
Resolved September 4, 2020 at 9:15 PM