From ea6c022a82602cc0a2fb91d43ed29814d723e044 Mon Sep 17 00:00:00 2001 From: songbaisen Date: Tue, 23 Apr 2019 10:05:37 +0800 Subject: [PATCH] add provider network segmentation raise Raise exception if provider attributes are present Signed-off-by: song baisen Change-Id: Iab1b71626435020577fab292dd9d454797c6d280 Co-Authored-By: tangzhuo , zhiyuan_cai --- lower-constraints.txt | 8 ++++---- requirements.txt | 2 +- tricircle/network/central_plugin.py | 10 ++++++++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/lower-constraints.txt b/lower-constraints.txt index dd2f6045..1633dd82 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -73,14 +73,14 @@ oslo.log==3.36.0 oslo.messaging==5.29.0 oslo.middleware==3.31.0 oslo.policy==1.30.0 -oslo.privsep==1.23.0 +oslo.privsep==1.32.0 oslo.reports==1.18.0 oslo.rootwrap==5.8.0 oslo.serialization==2.18.0 oslo.service==1.24.0 oslo.upgradecheck==0.1.1 oslo.utils==3.33.0 -oslo.versionedobjects==1.31.2 +oslo.versionedobjects==1.35.1 oslosphinx==4.7.0 oslotest==3.2.0 osprofiler==1.4.0 @@ -89,7 +89,7 @@ ovs==2.8.0 ovsdbapp==0.9.1 Paste==2.0.2 PasteDeploy==1.5.0 -pbr==2.0.0 +pbr==4.0.0 pecan==1.3.2 pep8==1.5.7 pika-pool==0.1.3 @@ -107,7 +107,7 @@ pylint==1.9.2 PyMySQL==0.7.6 pyparsing==2.1.0 pyperclip==1.5.27 -pyroute2==0.4.21 +pyroute2==0.5.3 python-cinderclient==3.3.0 python-dateutil==2.5.3 python-designateclient==2.7.0 diff --git a/requirements.txt b/requirements.txt index 207cbec4..09314eb2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ # The order of packages is significant, because pip processes them in the order # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -pbr!=2.1.0,>=2.0.0 # Apache-2.0 +pbr!=2.1.0,>=4.0.0 # Apache-2.0 Babel!=2.4.0,>=2.3.4 # BSD Paste>=2.0.2 # MIT diff --git a/tricircle/network/central_plugin.py b/tricircle/network/central_plugin.py index 7c17965f..4b3b7292 100644 --- a/tricircle/network/central_plugin.py +++ b/tricircle/network/central_plugin.py @@ -39,7 +39,6 @@ from neutron.db import l3_dvr_db from neutron.db import l3_hamode_db # noqa from neutron.db import models_v2 from neutron.db import portbindings_db -from neutron.extensions import providernet as provider from neutron.objects import ports as q_ports from neutron.objects.qos import policy as policy_object import neutron.objects.router as router_object @@ -406,6 +405,13 @@ class TricirclePlugin(db_base_plugin_v2.NeutronDbPluginV2, "router:external attribute") raise exceptions.InvalidInput(error_message=msg) + def _raise_if_updates_provider_attributes(self, attrs): + + if any(validators.is_attr_set(attrs.get(a)) + for a in provider_net.ATTRIBUTES): + msg = _("Plugin does not support updating provider attributes") + raise exceptions.InvalidInput(error_message=msg) + def update_network(self, context, network_id, network): """update top network @@ -418,7 +424,7 @@ class TricirclePlugin(db_base_plugin_v2.NeutronDbPluginV2, :return: updated network """ net_data = network[attributes.NETWORK] - provider._raise_if_updates_provider_attributes(net_data) + self._raise_if_updates_provider_attributes(net_data) self._raise_if_updates_external_attribute(net_data) with context.session.begin():