group-based-policy/gbpservice/neutron/extensions/apic_allowed_vm_name.py
Anna Khmelnitsky 8284bf9b3a Ocata sync
* use neutron_lib.directory for plugin retrieval

* switch to neutron_lib for neutron constants, exceptions,
  extensions

* add neutron.plugins.ml2.ovo_rpc to OUT_OF_PROCESS_NOTIFICATIONS:
  neutron added ovo rpc callback mechanism for ovo objects, and aim
  notification manager needs to recognize those as out of process.
  Since neutron moved away from get_session API to get_reader_session
  and get_writer_session, override for these was added.
  Few bugs were fixed in the delayed notification area as well.

* new engine facade: make use of reader and writer to grab db engine

* remove _update_fip_assoc override (didn't find a reason for the
  override)

* aim driver: a fix in update_subnetpool_precommit - not to assume
  address_scope_id field is returned from neutron update call if it
  was not updated.

* extend_XXX_dict call was switched to receive ovo instead of db
  object. As a result, foreign keys are not part of the object
  anymore, and need to be retrieved from db.

* remove_router_interface - receive port dictinary rather than port
  object

* fix patched neutron functions to receive correct parameter types
  (like patched_get_locked_port_and_binding)

* use add_agent_status_check_worker instead of add_agent_status_check

* advertise_mtu configuration parameter was removed from neutron. It
  is used in aim driver, hence added to aim driver config.

* use of project_id instead of tenant_id where required

* use segments_db module for network segments

* test_aim_mapping_driver: the test used to override uuid generation
  in order to get predictable uuid results. New neutron code makes
  use of python uuid module where overrides are complicated. It was
  easire to remove all uuid-based values from dictionaries under test

* add filters parameter to get_address_scopes calls, otherwise the
  call fails (probably should be fixed in neutron)

* in routing tests, remove the assumption that routes are returned in
  specific order

Change-Id: I1943fd4196ea6199d825ae53f0e9f5b54d54a260
2017-07-05 15:25:25 -07:00

56 lines
1.7 KiB
Python

# 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.
from neutron_lib.api import converters
from neutron_lib.api import extensions
from gbpservice.neutron.extensions import group_policy as gp
CISCO_APIC_GBP_ALLOWED_VM_NAME_EXT = 'cisco_apic_gbp_allowed_vm_name'
EXTENDED_ATTRIBUTES_2_0 = {
gp.L3_POLICIES: {
'allowed_vm_names': {
'allow_post': True, 'allow_put': True, 'default': None,
'validate': {'type:list_of_unique_strings': None},
'convert_to': converters.convert_none_to_empty_list,
'is_visible': True},
},
}
class Apic_allowed_vm_name(extensions.ExtensionDescriptor):
@classmethod
def get_name(cls):
return "APIC GBP Allowed VM Name Extension"
@classmethod
def get_alias(cls):
return CISCO_APIC_GBP_ALLOWED_VM_NAME_EXT
@classmethod
def get_description(cls):
return _("This extension supports a list of allowed VM name regexes "
"that can be applied to the L3 policy resource.")
@classmethod
def get_updated(cls):
return "2016-10-10T10:00:00-00:00"
def get_extended_resources(self, version):
if version == "2.0":
return EXTENDED_ATTRIBUTES_2_0
else:
return {}