]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Enforce specific order for firewall.(un)filtered_ports and devices
authorIhar Hrachyshka <ihrachys@redhat.com>
Fri, 10 Jul 2015 12:07:09 +0000 (14:07 +0200)
committerIhar Hrachyshka <ihrachys@redhat.com>
Fri, 10 Jul 2015 22:33:31 +0000 (00:33 +0200)
commit5b066a237ec0918d882ef2455aef4f2f9cb0606c
tree8174b394c8e819ab10465571cf1287838bd619f0
parent2d5d634f6c568968d184d188f589855435102cb6
Enforce specific order for firewall.(un)filtered_ports and devices

Lots of tests in the file rely on specific order of devices and ports
with which they are iterated thru inside firewall implementation. This
is needed to match a regexp against iptables output generated by the
firewall driver.

In production code, those .(un)filtered_ports dictionaries are
unordered, and it would be not wise to enforce the order for them just
for the sake of those unit tests.

Instead, we 'patch' the agent firewall with ordered versions of dict for
those attributes.

Also enforce specific order for device_info dictionaries we pass into
firewall.

The failure was easily reproducible with PYTHONHASHSEED=111, and after
the fix, it's gone.

While at it, stop making assumptions about stable order of dict.values()
between multiple dictionaries with the same keys. It may actually work
for now, but it seems fragile. Overall simplified regex construction
code a bit, f.e. killing some dead or redundant code.

Closes-Bug: #1473413
Change-Id: I170087426bc961592b4c4923c64a5fea30d51c21
neutron/tests/unit/agent/test_securitygroups_rpc.py