ovs-fw: Don't modify passed rules to update

When rules are passed to update() method of firewall, it translates
protocol in case it was passed as a string to integer. This can cause a
side-effect in testing when same set of rules is passed multiple times.
Securiry group rules always have a string in protocol field.

Change-Id: I0d95c6c41ad3c4b52986307449d90f13bbd412ac
This commit is contained in:
Jakub Libosvar 2018-02-06 10:12:03 +00:00
parent c7e144e9b4
commit 37aba76275

View File

@ -14,6 +14,7 @@
# under the License.
import collections
import copy
import netaddr
from neutron_lib import constants as lib_const
@ -91,7 +92,7 @@ class SecurityGroup(object):
"""
self.raw_rules = []
self.remote_rules = []
for rule in rules:
for rule in copy.deepcopy(rules):
protocol = rule.get('protocol')
if protocol is not None:
if protocol.isdigit():