[SFC][AIM] Safe access to keys in the port pair groups extension

Change-Id: I3842998b719fc348c5cc42e33b525a4da994b863
This commit is contained in:
Ivar Lazzaro 2018-06-01 10:43:26 -07:00
parent 6e187d3885
commit a9f93eb6ca
No known key found for this signature in database
GPG Key ID: ACEEC8CB558DC3CF
2 changed files with 23 additions and 1 deletions

View File

@ -714,7 +714,7 @@ class SfcAIMDriver(SfcAIMDriverBase):
param_curr = context.current['port_pair_group_parameters']
param_orig = context.original['port_pair_group_parameters']
return (any(context.current[a] != context.original[a] for a in attrs)
or any(param_curr[x] != param_orig[x] for x in
or any(param_curr.get(x) != param_orig.get(x) for x in
sfc_cts.AIM_PPG_PARAMS.keys()))
def _should_regenerate_pc(self, context):

View File

@ -723,6 +723,28 @@ class TestPortPairGroup(TestAIMServiceFunctionChainingBase):
ppg2['id'], port_pairs=[pp3['id'], pp1['id']],
expected_res_status=500)
def test_ppg_update(self):
# Correct creation
net1 = self._make_network(self.fmt, 'net1', True)
self._make_subnet(self.fmt, net1, '192.168.0.1', '192.168.0.0/24')
net2 = self._make_network(self.fmt, 'net2', True)
self._make_subnet(self.fmt, net2, '192.168.1.1', '192.168.1.0/24')
# Service 1
p11 = self._make_port(self.fmt, net1['network']['id'])['port']
self._bind_port_to_host(p11['id'], 'h1')
p12 = self._make_port(self.fmt, net2['network']['id'])['port']
self._bind_port_to_host(p12['id'], 'h1')
pp1 = self.create_port_pair(ingress=p11['id'], egress=p12['id'],
expected_res_status=201)['port_pair']
# This goes through
ppg1 = self.create_port_pair_group(
port_pairs=[pp1['id']],
expected_res_status=201)['port_pair_group']
# Same ID update works
self.update_port_pair_group(ppg1['id'], port_pairs=[pp1['id']],
expected_res_status=200)
def test_healthcheck_group(self):
# Correct creation
net1 = self._make_network(self.fmt, 'net1', True)