[AIM][SFC]Avoid setting same provider contract twice on chain creation
Change-Id: I97ce379d20ccd2ca51784ca526ea1caed39b24c7
This commit is contained in:
parent
a571e0c553
commit
6b9139887c
@ -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)
|
||||
|
||||
|
@ -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):
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user