add provider network segmentation raise

Raise exception if provider attributes are present

Signed-off-by: song baisen <songbaisen@szzt.com.cn>

Change-Id: Iab1b71626435020577fab292dd9d454797c6d280
Co-Authored-By: tangzhuo <ztang@hnu.edu.cn>, zhiyuan_cai <luckyvega.g@gmail.com>
This commit is contained in:
songbaisen 2019-04-23 10:05:37 +08:00
parent 3c9fd8c7ac
commit ea6c022a82
3 changed files with 13 additions and 7 deletions

View File

@ -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

View File

@ -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

View File

@ -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():