87b14aee36
The gbpservice._i18n._ translation marker function is imported where needed, and use of the _ function for log messages is removed. This reduces the number of unique DeprecationWarning messages output during the master branch py27 tox job from 272 to 17. The remaining warnings are due to the use of deprecated keystone authentication APIs, the use of the deprecated tenant_id and username keys in API access policy files, and the use of tenant instead of project_id within this project, and due to various issues in other projects, including aci-integration-module, networking_sfc, and python-opflex-agent. Change-Id: I1cde26674ba368e239be299b2d130db98f2c0015
57 lines
1.8 KiB
Python
57 lines
1.8 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._i18n import _
|
|
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 {}
|