def test_apply_template(self): template = { 'none': None, 'integer': 1, 'string': 'a string', 'tuple': ('a tuple', lambda x: x + 1, lambda x: x + 2), 'dict': { 'key': lambda x: x + 3 }, 'list': ['a list', lambda x: x + 4] } actual = resources.apply_template(template, 0) expected = { 'none': None, 'integer': 1, 'string': 'a string', 'tuple': ('a tuple', 1, 2), 'dict': { 'key': 3 }, 'list': ['a list', 4] } self.assertEqual(expected, actual)
def test_apply_template(self): template = { 'none': None, 'integer': 1, 'string': 'a string', 'tuple': ('a tuple', lambda x: x + 1, lambda x: x + 2), 'dict': {'key': lambda x: x + 3}, 'list': ['a list', lambda x: x + 4] } actual = resources.apply_template(template, 0) expected = { 'none': None, 'integer': 1, 'string': 'a string', 'tuple': ('a tuple', 1, 2), 'dict': {'key': 3}, 'list': ['a list', 4] } self.assertEqual(expected, actual)
from neutron.services.service_base import ServicePluginBase # noqa except (ImportError, AttributeError): pass try: # F811 (redefinition of ServicePluginBase) suppressed from neutron_lib.services.base import ServicePluginBase # noqa except (ImportError, AttributeError): pass from a10_neutron_lbaas.neutron_ext.common import attributes from a10_neutron_lbaas.neutron_ext.common import constants from a10_neutron_lbaas.neutron_ext.common import extensions from a10_neutron_lbaas.neutron_ext.common import resources RESOURCE_ATTRIBUTE_MAP = resources.apply_template( a10_certificate.RESOURCE_ATTRIBUTE_MAP, attributes) attributes.add_validators( resources.apply_template(a10_validators.VALIDATORS, attributes.validators)) LOG = logging.getLogger(__name__) class A10Certificate(extensions.ExtensionDescriptor): # if hasattr(nextensions, "register_custom_supported_check"): # nextensions.register_custom_supported_check( # constants.A10_CERTIFICATE_EXT, lambda: True, plugin_agnostic=True) @classmethod def get_name(cls): return "A10 LBaaS Certificate Management"
from neutron.services.service_base import ServicePluginBase # noqa except (ImportError, AttributeError): pass try: # F811 (redefinition of ServicePluginBase) suppressed from neutron_lib.services.base import ServicePluginBase # noqa except (ImportError, AttributeError): pass from a10_neutron_lbaas.neutron_ext.common import attributes from a10_neutron_lbaas.neutron_ext.common import constants from a10_neutron_lbaas.neutron_ext.common import extensions from a10_neutron_lbaas.neutron_ext.common import resources RESOURCE_ATTRIBUTE_MAP = resources.apply_template( a10_certificate.RESOURCE_ATTRIBUTE_MAP, attributes) attributes.add_validators(resources.apply_template( a10_validators.VALIDATORS, attributes.validators)) LOG = logging.getLogger(__name__) class A10Certificate(extensions.ExtensionDescriptor): nextensions.register_custom_supported_check( constants.A10_CERTIFICATE_EXT, lambda: True, plugin_agnostic=True) @classmethod def get_name(cls): return "A10 LBaaS Certificate Management"
except (ImportError, AttributeError): pass try: # F811 (redefinition of ServicePluginBase) suppressed from neutron_lib.services.base import ServicePluginBase # noqa except (ImportError, AttributeError): pass from a10_neutron_lbaas.neutron_ext.common import attributes from a10_neutron_lbaas.neutron_ext.common import constants from a10_neutron_lbaas.neutron_ext.common import exceptions from a10_neutron_lbaas.neutron_ext.common import extensions from a10_neutron_lbaas.neutron_ext.common import resources RESOURCE_ATTRIBUTE_MAP = resources.apply_template( a10_device_instance.RESOURCE_ATTRIBUTE_MAP, attributes) attributes.add_validators( resources.apply_template(a10_validators.VALIDATORS, attributes.validators)) _ALIAS = constants.A10_DEVICE_INSTANCE_EXT # TODO(rename this to *Extension to avoid config file confusion) class A10deviceinstance(extensions.ExtensionDescriptor): nextensions.register_custom_supported_check(_ALIAS, lambda: True, plugin_agnostic=True) def get_name(cls):
except (ImportError, AttributeError): pass try: # F811 (redefinition of ServicePluginBase) suppressed from neutron_lib.services.base import ServicePluginBase # noqa except (ImportError, AttributeError): pass from a10_neutron_lbaas.neutron_ext.common import attributes from a10_neutron_lbaas.neutron_ext.common import constants from a10_neutron_lbaas.neutron_ext.common import exceptions from a10_neutron_lbaas.neutron_ext.common import extensions from a10_neutron_lbaas.neutron_ext.common import resources RESOURCE_ATTRIBUTE_MAP = resources.apply_template(a10_device_instance.RESOURCE_ATTRIBUTE_MAP, attributes) attributes.add_validators(resources.apply_template( a10_validators.VALIDATORS, attributes.validators)) _ALIAS = constants.A10_DEVICE_INSTANCE_EXT # TODO(rename this to *Extension to avoid config file confusion) class A10deviceinstance(extensions.ExtensionDescriptor): nextensions.register_custom_supported_check( _ALIAS, lambda: True, plugin_agnostic=True) def get_name(cls): return "A10 Device Instances"
# under the License. import abc import six import a10_openstack_lib.resources.a10_device_instance as a10_device_instance from neutron.api import extensions from neutron.api.v2 import attributes from neutron.api.v2 import resource_helper from neutron.common import exceptions from neutron.services import service_base import a10_neutron_lbaas.neutron_ext.common.constants as constants from a10_neutron_lbaas.neutron_ext.common import resources RESOURCE_ATTRIBUTE_MAP = resources.apply_template(a10_device_instance.RESOURCE_ATTRIBUTE_MAP, attributes) # TODO(rename this to *Extension to avoid config file confusion) class A10DeviceInstance(extensions.ExtensionDescriptor): @classmethod def get_name(cls): return "A10 Device Instances" @classmethod def get_alias(cls): return constants.A10_DEVICE_INSTANCE_EXT @classmethod def get_namespace(cls):