Merge "[AIM] Non SFC modules should not import sfc constants"
This commit is contained in:
commit
2d5aa2661f
|
@ -0,0 +1,17 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
GBP_FLOW_CLASSIFIER = 'gbp_flowclassifier'
|
||||
GBP_PORT = 'gbp_port'
|
||||
GBP_NETWORK_VRF = 'gbp_network_vrf'
|
||||
GBP_NETWORK_EPG = 'gbp_network_epg'
|
||||
GBP_NETWORK_LINK = 'gbp_network_link'
|
|
@ -66,6 +66,8 @@ from gbpservice.network.neutronv2 import local_api
|
|||
from gbpservice.neutron.extensions import cisco_apic
|
||||
from gbpservice.neutron.extensions import cisco_apic_l3 as a_l3
|
||||
from gbpservice.neutron.plugins.ml2plus import driver_api as api_plus
|
||||
from gbpservice.neutron.plugins.ml2plus.drivers.apic_aim import (
|
||||
constants as aim_cst)
|
||||
from gbpservice.neutron.plugins.ml2plus.drivers.apic_aim import apic_mapper
|
||||
from gbpservice.neutron.plugins.ml2plus.drivers.apic_aim import cache
|
||||
from gbpservice.neutron.plugins.ml2plus.drivers.apic_aim import config # noqa
|
||||
|
@ -73,7 +75,6 @@ from gbpservice.neutron.plugins.ml2plus.drivers.apic_aim import db
|
|||
from gbpservice.neutron.plugins.ml2plus.drivers.apic_aim import exceptions
|
||||
from gbpservice.neutron.plugins.ml2plus.drivers.apic_aim import extension_db
|
||||
from gbpservice.neutron.plugins.ml2plus.drivers.apic_aim import trunk_driver
|
||||
from gbpservice.neutron.services.sfc.aim import constants as sfc_cts
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
DEVICE_OWNER_SNAT_PORT = 'apic:snat-pool'
|
||||
|
@ -1853,7 +1854,7 @@ class ApicMechanismDriver(api_plus.MechanismDriver,
|
|||
self._associate_domain(context, is_vmm=True)
|
||||
self._update_sg_rule_with_remote_group_set(context, port)
|
||||
self._insert_provisioning_block(context)
|
||||
registry.notify(sfc_cts.GBP_PORT, events.PRECOMMIT_UPDATE,
|
||||
registry.notify(aim_cst.GBP_PORT, events.PRECOMMIT_UPDATE,
|
||||
self, driver_context=context)
|
||||
|
||||
def update_port_postcommit(self, context):
|
||||
|
@ -2119,7 +2120,7 @@ class ApicMechanismDriver(api_plus.MechanismDriver,
|
|||
for net, seg in nets_segs:
|
||||
self._rebuild_host_path_for_network(context, net, seg, host,
|
||||
hlinks)
|
||||
registry.notify(sfc_cts.GBP_NETWORK_LINK,
|
||||
registry.notify(aim_cst.GBP_NETWORK_LINK,
|
||||
events.PRECOMMIT_UPDATE, self, context=context,
|
||||
networks_map=nets_segs, host_links=hlinks,
|
||||
host=host)
|
||||
|
@ -3917,19 +3918,19 @@ class ApicMechanismDriver(api_plus.MechanismDriver,
|
|||
with db_api.context_manager.writer.using(context):
|
||||
self._add_network_mapping(context.session, network_id, bd, epg,
|
||||
vrf)
|
||||
registry.notify(sfc_cts.GBP_NETWORK_VRF, events.PRECOMMIT_UPDATE,
|
||||
registry.notify(aim_cst.GBP_NETWORK_VRF, events.PRECOMMIT_UPDATE,
|
||||
self, context=context, network_id=network_id)
|
||||
|
||||
def _set_network_epg_and_notify(self, context, mapping, epg):
|
||||
with db_api.context_manager.writer.using(context):
|
||||
self._set_network_epg(mapping, epg)
|
||||
registry.notify(sfc_cts.GBP_NETWORK_EPG, events.PRECOMMIT_UPDATE,
|
||||
registry.notify(aim_cst.GBP_NETWORK_EPG, events.PRECOMMIT_UPDATE,
|
||||
self, context=context,
|
||||
network_id=mapping.network_id)
|
||||
|
||||
def _set_network_vrf_and_notify(self, context, mapping, vrf):
|
||||
with db_api.context_manager.writer.using(context):
|
||||
self._set_network_vrf(mapping, vrf)
|
||||
registry.notify(sfc_cts.GBP_NETWORK_VRF, events.PRECOMMIT_UPDATE,
|
||||
registry.notify(aim_cst.GBP_NETWORK_VRF, events.PRECOMMIT_UPDATE,
|
||||
self, context=context,
|
||||
network_id=mapping.network_id)
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
|
||||
from networking_sfc.extensions import flowclassifier
|
||||
|
||||
GBP_FLOW_CLASSIFIER = 'gbp_flowclassifier'
|
||||
GBP_PORT = 'gbp_port'
|
||||
LOGICAL_SRC_NET = 'logical_source_network'
|
||||
LOGICAL_DST_NET = 'logical_destination_network'
|
||||
HEALTHCHECK_POLICY = 'healthcheck_policy'
|
||||
|
@ -45,6 +43,3 @@ AIM_PPG_PARAMS = {
|
|||
},
|
||||
}
|
||||
AIM_FLC_PARAMS = ['source_ip_prefix', 'destination_ip_prefix']
|
||||
GBP_NETWORK_VRF = 'gbp_network_vrf'
|
||||
GBP_NETWORK_EPG = 'gbp_network_epg'
|
||||
GBP_NETWORK_LINK = 'gbp_network_link'
|
||||
|
|
|
@ -20,6 +20,7 @@ from neutron_lib.api import validators
|
|||
from neutron_lib.plugins import directory
|
||||
from oslo_log import log as logging
|
||||
|
||||
from gbpservice.neutron.plugins.ml2plus.drivers.apic_aim import constants
|
||||
from gbpservice.neutron.services.grouppolicy.common import exceptions as exc
|
||||
from gbpservice.neutron.services.sfc.aim import constants as sfc_cts
|
||||
from gbpservice.neutron.services.sfc.aim import exceptions as sfc_exc
|
||||
|
@ -61,16 +62,16 @@ class FlowclassifierAIMDriver(FlowclassifierAIMDriverBase):
|
|||
|
||||
def create_flow_classifier_precommit(self, context):
|
||||
self._validate_flow_classifier(context)
|
||||
registry.notify(sfc_cts.GBP_FLOW_CLASSIFIER, events.PRECOMMIT_CREATE,
|
||||
registry.notify(constants.GBP_FLOW_CLASSIFIER, events.PRECOMMIT_CREATE,
|
||||
self, driver_context=context)
|
||||
|
||||
def update_flow_classifier_precommit(self, context):
|
||||
self._validate_flow_classifier(context)
|
||||
registry.notify(sfc_cts.GBP_FLOW_CLASSIFIER, events.PRECOMMIT_UPDATE,
|
||||
registry.notify(constants.GBP_FLOW_CLASSIFIER, events.PRECOMMIT_UPDATE,
|
||||
self, driver_context=context)
|
||||
|
||||
def delete_flow_classifier_precommit(self, context):
|
||||
registry.notify(sfc_cts.GBP_FLOW_CLASSIFIER, events.PRECOMMIT_DELETE,
|
||||
registry.notify(constants.GBP_FLOW_CLASSIFIER, events.PRECOMMIT_DELETE,
|
||||
self, driver_context=context)
|
||||
|
||||
def _validate_flow_classifier(self, context):
|
||||
|
|
|
@ -31,6 +31,7 @@ from oslo_log import log as logging
|
|||
from sqlalchemy import or_
|
||||
|
||||
from gbpservice.neutron.plugins.ml2plus.drivers.apic_aim import apic_mapper
|
||||
from gbpservice.neutron.plugins.ml2plus.drivers.apic_aim import constants
|
||||
from gbpservice.neutron.services.grouppolicy.common import exceptions as exc
|
||||
from gbpservice.neutron.services.sfc.aim import constants as sfc_cts
|
||||
from gbpservice.neutron.services.sfc.aim import exceptions
|
||||
|
@ -93,15 +94,15 @@ class SfcAIMDriver(SfcAIMDriverBase):
|
|||
# (can't delete a flowclassifier if in use).
|
||||
for event in [events.PRECOMMIT_UPDATE, events.PRECOMMIT_CREATE]:
|
||||
registry.subscribe(self._handle_flow_classifier,
|
||||
sfc_cts.GBP_FLOW_CLASSIFIER, event)
|
||||
registry.subscribe(self._handle_port_bound, sfc_cts.GBP_PORT,
|
||||
constants.GBP_FLOW_CLASSIFIER, event)
|
||||
registry.subscribe(self._handle_port_bound, constants.GBP_PORT,
|
||||
events.PRECOMMIT_UPDATE)
|
||||
registry.subscribe(self._handle_net_gbp_change,
|
||||
sfc_cts.GBP_NETWORK_EPG, events.PRECOMMIT_UPDATE)
|
||||
constants.GBP_NETWORK_EPG, events.PRECOMMIT_UPDATE)
|
||||
registry.subscribe(self._handle_net_gbp_change,
|
||||
sfc_cts.GBP_NETWORK_VRF, events.PRECOMMIT_UPDATE)
|
||||
constants.GBP_NETWORK_VRF, events.PRECOMMIT_UPDATE)
|
||||
registry.subscribe(self._handle_net_link_change,
|
||||
sfc_cts.GBP_NETWORK_LINK, events.PRECOMMIT_UPDATE)
|
||||
constants.GBP_NETWORK_LINK, events.PRECOMMIT_UPDATE)
|
||||
|
||||
@property
|
||||
def plugin(self):
|
||||
|
@ -891,7 +892,7 @@ class SfcAIMDriver(SfcAIMDriverBase):
|
|||
for chain in self._get_chains_by_classifier_id(context,
|
||||
flowc_id):
|
||||
chains[chain['id']] = chain
|
||||
if rtype == sfc_cts.GBP_NETWORK_VRF:
|
||||
if rtype == constants.GBP_NETWORK_VRF:
|
||||
# Don't need to check PPGs if the EPG is changing
|
||||
for ppg_id in ppg_ids:
|
||||
for chain in self._get_chains_by_ppg_ids(context, [ppg_id]):
|
||||
|
|
Loading…
Reference in New Issue