OVS Rules not cleaned

Bug #1533237 reported by Yuli
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
DragonFlow
Fix Released
Medium
Yuli

Bug Description

Hello !

Finally we traced real bug in new automated ovs tests !

After creating router interface and then removing it, Dragonflow leaves a number of flows not removed.
Here is a test code:

    def test_create_router_interface(self):
        flows1 = self.get_ovs_flows()
        router = objects.RouterTestWrapper(self.neutron, self.nb_api)
        network = objects.NetworkTestWrapper(self.neutron, self.nb_api)
        network_id = network.create()
        subnet = {'subnets': [{'cidr': '192.168.199.0/24',
                  'ip_version': 4, 'network_id': network_id}]}
        subnets = self.neutron.create_subnet(body=subnet)
        subnet = subnets['subnets'][0]
        router_id = router.create()
        self.assertTrue(router.exists())
        subnet_msg = {'subnet_id': subnet['id']}
        port = self.neutron.add_interface_router(router_id, body=subnet_msg)
        time.sleep(DEFAULT_CMD_TIMEOUT)
        flows2 = self.get_ovs_flows()
        diff = self._diff_flows(flows1, flows2)
        self.assertEqual(len(diff), 3)
        self.assertEqual([diff[0]['table'], diff[1]['table'], diff[2]['table']], ['9,','10,','20,'])
        self.assertIn('tp_src=68,tp_dst=67', diff[0]['match'])
        self.assertIn('arp', diff[1]['match'])
        self.assertIn('nw_dst=192.168.199.1', diff[2]['match'])
        self.assertEqual(['goto_table:11', 'goto_table:64'], [diff[0]['actions'], diff[2]['actions']])
        self.assertIn('IN_PORT', diff[1]['actions'])
        router.delete()
        network.delete()
        time.sleep(DEFAULT_CMD_TIMEOUT)
        flows3 = self.get_ovs_flows()
        diff = self._diff_flows(flows1, flows3)
        self.assertEqual(diff, [])

The code asserts on the last line:

    testtools.matchers._impl.MismatchError: !=:
    reference = [{'actions': u'set_field:2->arp_op,move:NXM_NX_ARP_SHA[]->NXM_NX_ARP_THA[],move:NXM_OF_ARP_SPA[]->NXM_OF_ARP_TPA[],set_field:fa:16:3e:7d:f7:a4->eth_src,set_field:fa:16:3e:7d:f7:a4->arp_sha,set_field:192.168.199.1->arp_spa,IN_PORT',
      'cookie': u'0x0,',
      'match': u'arp,metadata=0x9,arp_tpa=192.168.199.1,arp_op=1',
      'priority': u'100',
      'table': u'10,'},
     {'actions': u'goto_table:64',
      'cookie': u'0x0,',
      'match': u'ip,metadata=0x9,nw_dst=192.168.199.1',
      'priority': u'200',
      'table': u'20,'}]
    actual = []

Best regards,
Yuli

Li Ma (nick-ma-z)
Changed in dragonflow:
importance: Undecided → Medium
Revision history for this message
Yuli (stremovsky) wrote :

Adding neutron.add_interface_router() function fixed this bug.

Changed in dragonflow:
assignee: nobody → Yuli (stremovsky)
status: New → In Progress
Revision history for this message
Yuli (stremovsky) wrote :

Hello

This bug is fixed in master.

There was a problem with deleting of port when port belonged to router.
Instead of neutron.delete_interface_router() it was deleted with neutron.delete_port()

This bug report is related to:
https://bugs.launchpad.net/dragonflow/1451341
https://bugs.launchpad.net/dragonflow/1462771

Changed in dragonflow:
status: In Progress → Fix Committed
Yuli (stremovsky)
Changed in dragonflow:
status: Fix Committed → Confirmed
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.