Merge "[AIM][SFC]Avoid setting same provider contract twice on chain creation"

This commit is contained in:
Zuul 2018-06-20 16:54:10 +00:00 committed by Gerrit Code Review
commit ee4052c505
2 changed files with 20 additions and 2 deletions

View File

@ -589,8 +589,10 @@ class SfcAIMDriver(SfcAIMDriverBase):
contract = self._get_flc_contract(prov_group, sg)
# TODO(ivar): if provider/consumer are in different tenants, export
# the contract
cons_group.consumed_contract_names.append(contract.name)
prov_group.provided_contract_names.append(contract.name)
if contract.name not in cons_group.consumed_contract_names:
cons_group.consumed_contract_names.append(contract.name)
if contract.name not in prov_group.provided_contract_names:
prov_group.provided_contract_names.append(contract.name)
self.aim.create(aim_ctx, cons_group, overwrite=True)
self.aim.create(aim_ctx, prov_group, overwrite=True)

View File

@ -1389,6 +1389,22 @@ class TestPortChain(TestAIMServiceFunctionChainingBase):
self._verify_pc_mapping(pc)
self._verify_pc_delete(pc)
def test_same_provider_subnet(self):
fc = self._create_simple_flowc(src_svi=self.src_svi,
dst_svi=self.dst_svi)
fcs = [fc]
for i in range(3):
fcs.append(self.create_flow_classifier(
l7_parameters=fc['l7_parameters'],
source_ip_prefix='192.198.%s.0/24' % (i + 3),
destination_ip_prefix=fc['destination_ip_prefix'],
expected_res_status=201)['flow_classifier'])
# We have four FCs
ppg1 = self._create_simple_ppg(pairs=1)
self.create_port_chain(port_pair_groups=[ppg1['id']],
flow_classifiers=[fc['id'] for fc in fcs],
expected_res_status=201)
class TestPortChainSVI(TestPortChain):