tests: fix invalid `addr` mock values in ovs firewall suite

The tests were passing a string of IPv4 address where the actual code
was expecting a tuple of (IPv4 address, MAC address). The type of the
`addr` changed from a string to a tuple in:

I2e3aa7c400d7bb17cc117b65faaa160b41013dde

but the names of variables and the test cases were not.

Tests still didn't fail till recently because addr[0] resulted in the
first character of the IPv4 address string (e.g. `1`), and was then
interpreted by `netaddr` library as an address. This worked until
`netaddr>=1.0` started to enforce proper formats for passed IPv4
addresses - which broke the tests.

Closes-Bug: #2054435
Change-Id: Ib9594bc0611007efdbaf3219ccd44bbb37cfc627
This commit is contained in:
Ihar Hrachyshka 2024-04-26 22:50:10 -04:00
parent 22a3384194
commit ae704369b5
1 changed files with 5 additions and 4 deletions

View File

@ -485,7 +485,7 @@ class TestConjIPFlowManager(base.BaseTestCase):
constants.INGRESS_DIRECTION, constants.IPv4, 0)
self.manager.flow_state[self.vlan_tag][(
constants.INGRESS_DIRECTION, constants.IPv4)] = {
'10.22.3.4': [self.conj_id]}
('10.22.3.4', 'ff:ee:dd:cc:bb:aa'): [self.conj_id]}
self.manager.sg_removed(sg_name)
@ -493,7 +493,7 @@ class TestConjIPFlowManager(base.BaseTestCase):
self._sg_removed('sg')
self.driver._add_flow.assert_not_called()
self.driver.delete_flows_for_flow_state.assert_called_once_with(
{'10.22.3.4': [self.conj_id]}, {},
{('10.22.3.4', 'ff:ee:dd:cc:bb:aa'): [self.conj_id]}, {},
constants.INGRESS_DIRECTION, constants.IPv4, self.vlan_tag)
self.driver.delete_flow_for_ip.assert_not_called()
@ -501,12 +501,13 @@ class TestConjIPFlowManager(base.BaseTestCase):
self._sg_removed('remote_id')
self.driver._add_flow.assert_not_called()
self.driver.delete_flows_for_flow_state.assert_called_once_with(
{'10.22.3.4': [self.conj_id]}, {},
{('10.22.3.4', 'ff:ee:dd:cc:bb:aa'): [self.conj_id]}, {},
constants.INGRESS_DIRECTION, constants.IPv4, self.vlan_tag)
# "conj_id_to_remove" is populated with the remote_sg conj_id assigned,
# "_update_flows_for_vlan_subr" will call "delete_flow_for_ip".
self.driver.delete_flow_for_ip.assert_called_once_with(
'10.22.3.4', 'ingress', 'IPv4', 100, {self.conj_id})
('10.22.3.4', 'ff:ee:dd:cc:bb:aa'), 'ingress', 'IPv4', 100,
{self.conj_id})
class FakeOVSPort(object):