journal: partially implement sg/sgrule dependency

https://bugs.opendaylight.org/show_bug.cgi?id=8069

Change-Id: I8e44d8ba4eb096f1c969561d5f2873754ca636a9
Partial-bug: #1660911
This commit is contained in:
Isaku Yamahata
2017-03-24 09:46:12 -07:00
committed by Isaku Yamahata
parent a4c9ca2b1c
commit c13c4f99ef
2 changed files with 11 additions and 0 deletions

View File

@@ -96,6 +96,10 @@ def _generate_network_deps(data):
return data.get('qos_policy_id')
def _generate_sg_rule_deps(data):
return data['security_group_id']
def _generate_router_deps(data):
return data['gw_port_id']
@@ -182,6 +186,8 @@ _CREATE_OR_UPDATE_DEP_GENERATOR = {
odl_const.ODL_NETWORK: _generate_network_deps,
odl_const.ODL_SUBNET: _generate_subnet_deps,
odl_const.ODL_PORT: _generate_port_deps,
# TODO(yamahata): dependency between SG and PORT
odl_const.ODL_SG_RULE: _generate_sg_rule_deps,
odl_const.ODL_ROUTER: _generate_router_deps,
odl_const.ODL_FLOATINGIP: _generate_floatingip_deps,
odl_const.ODL_TRUNK: _generate_trunk_deps,
@@ -202,6 +208,8 @@ _DELETE_DEPENDENCIES = {
odl_const.ODL_ROUTER: (odl_const.ODL_PORT, odl_const.ODL_FLOATINGIP,
odl_const.ODL_BGPVPN),
odl_const.ODL_PORT: (odl_const.ODL_TRUNK,),
# TODO(yamahata): dependency between SG and PORT
odl_const.ODL_SG: (odl_const.ODL_SG_RULE,),
odl_const.ODL_L2GATEWAY: (odl_const.ODL_L2GATEWAY_CONNECTION,),
odl_const.ODL_SFC_FLOW_CLASSIFIER: (odl_const.ODL_SFC_PORT_CHAIN,),
odl_const.ODL_SFC_PORT_PAIR: (odl_const.ODL_SFC_PORT_PAIR_GROUP,),

View File

@@ -248,6 +248,9 @@ class OpenDaylightMechanismDriverTestCase(base_v2.OpenDaylightConfigBase):
def _get_mock_security_group_rule_operation_context():
context = {odl_const.ODL_SG_RULE: {'security_group_id': SG_FAKE_ID,
'id': SG_RULE_FAKE_ID}}
_plugin = directory.get_plugin()
_plugin._get_security_group_rule = mock.Mock(
return_value=AttributeDict(context[odl_const.ODL_SG_RULE]))
return context
@classmethod