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
78 lines
2.5 KiB
Python
78 lines
2.5 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 as conv
|
|
from neutron_lib.api import extensions
|
|
|
|
from gbpservice._i18n import _
|
|
from gbpservice.neutron.extensions import cisco_apic
|
|
from gbpservice.neutron.extensions import group_policy as gp
|
|
|
|
ALIAS = 'cisco-apic-gbp'
|
|
|
|
FORWARD_FILTER_ENTRIES = 'Forward-FilterEntries'
|
|
REVERSE_FILTER_ENTRIES = 'Reverse-FilterEntries'
|
|
CONTRACT = 'Contract'
|
|
CONTRACT_SUBJECT = 'ContractSubject'
|
|
|
|
EXTENDED_ATTRIBUTES_2_0 = {
|
|
gp.POLICY_TARGET_GROUPS: {
|
|
cisco_apic.DIST_NAMES: {
|
|
'allow_post': False, 'allow_put': False, 'is_visible': True},
|
|
'intra_ptg_allow': {
|
|
'allow_post': True, 'allow_put': True, 'default': True,
|
|
'convert_to': conv.convert_to_boolean, 'is_visible': True},
|
|
'is_auto_ptg': {
|
|
'allow_post': False, 'allow_put': False,
|
|
'convert_to': conv.convert_to_boolean, 'is_visible': True,
|
|
'enforce_policy': True},
|
|
},
|
|
gp.POLICY_RULES: {
|
|
cisco_apic.DIST_NAMES: {
|
|
'allow_post': False, 'allow_put': False, 'is_visible': True},
|
|
},
|
|
gp.POLICY_RULE_SETS: {
|
|
cisco_apic.DIST_NAMES: {
|
|
'allow_post': False, 'allow_put': False, 'is_visible': True},
|
|
},
|
|
gp.APPLICATION_POLICY_GROUPS: {
|
|
cisco_apic.DIST_NAMES: {
|
|
'allow_post': False, 'allow_put': False, 'is_visible': True},
|
|
},
|
|
}
|
|
|
|
|
|
class Cisco_apic_gbp(extensions.ExtensionDescriptor):
|
|
|
|
@classmethod
|
|
def get_name(cls):
|
|
return "Cisco APIC GBP"
|
|
|
|
@classmethod
|
|
def get_alias(cls):
|
|
return ALIAS
|
|
|
|
@classmethod
|
|
def get_description(cls):
|
|
return _("Extension exposing mapping of GBP resources to Cisco "
|
|
"APIC constructs")
|
|
|
|
@classmethod
|
|
def get_updated(cls):
|
|
return "2016-07-11T10:00:00-00:00"
|
|
|
|
def get_extended_resources(self, version):
|
|
if version == "2.0":
|
|
return EXTENDED_ATTRIBUTES_2_0
|
|
else:
|
|
return {}
|