Neuron-lib constant should be used for provider attributes
1. What is the problem? Provider attributes have been already move to Neutron-lib, but we still have some hard-coded string: 'provider:network_type', 'provider:physical_network' and 'provider:segmentation_id'. 2. What is the solution to the problem? We can use the constants in neutron_lib instead 3. What features need to be implemented to the Tricircle to realize the solution? None Closes-Bug: #1691634 Change-Id: I4da0064d2ac78224698e62b8bd42935c6f8f25c9
This commit is contained in:
parent
c149f1d737
commit
14d8554247
|
@ -240,8 +240,7 @@ class TricirclePlugin(db_base_plugin_v2.NeutronDbPluginV2,
|
|||
|
||||
@staticmethod
|
||||
def _fill_provider_info(from_net, to_net):
|
||||
provider_attrs = ('provider:network_type', 'provider:segmentation_id',
|
||||
'provider:physical_network')
|
||||
provider_attrs = provider_net.ATTRIBUTES
|
||||
for provider_attr in provider_attrs:
|
||||
if validators.is_attr_set(from_net.get(provider_attr)):
|
||||
to_net[provider_attr] = from_net[provider_attr]
|
||||
|
|
|
@ -283,13 +283,13 @@ class NetworkHelper(object):
|
|||
'admin_state_up': True
|
||||
}
|
||||
}
|
||||
network_type = network.get('provider:network_type')
|
||||
network_type = network.get(provider_net.NETWORK_TYPE)
|
||||
if network_type == t_constants.NT_VLAN:
|
||||
body['network']['provider:network_type'] = 'vlan'
|
||||
body['network']['provider:physical_network'] = network[
|
||||
'provider:physical_network']
|
||||
body['network']['provider:segmentation_id'] = network[
|
||||
'provider:segmentation_id']
|
||||
body['network'][provider_net.NETWORK_TYPE] = 'vlan'
|
||||
body['network'][provider_net.PHYSICAL_NETWORK] = network[
|
||||
provider_net.PHYSICAL_NETWORK]
|
||||
body['network'][provider_net.SEGMENTATION_ID] = network[
|
||||
provider_net.SEGMENTATION_ID]
|
||||
return body
|
||||
|
||||
@staticmethod
|
||||
|
@ -471,7 +471,7 @@ class NetworkHelper(object):
|
|||
"""
|
||||
# network
|
||||
net_body = self.get_create_network_body(project_id, t_net)
|
||||
if net_body['network'].get('provider:network_type'):
|
||||
if net_body['network'].get(provider_net.NETWORK_TYPE):
|
||||
# if network type specified, we need to switch to admin account
|
||||
admin_context = t_context.get_admin_context()
|
||||
|
||||
|
|
Loading…
Reference in New Issue