Пример #1
0
 def filter_create_port_attributes(cls, port, context):
     """Filter out port attributes not required for a create."""
     cls.add_security_groups(port, context)
     # TODO(kmestery): Converting to uppercase due to ODL bug
     # https://bugs.opendaylight.org/show_bug.cgi?id=477
     port['mac_address'] = port['mac_address'].upper()
     odl_utils.try_del(port, ['status'])
Пример #2
0
 def filter_create_port_attributes(cls, port, context):
     """Filter out port attributes not required for a create."""
     cls.add_security_groups(port, context)
     # TODO(kmestery): Converting to uppercase due to ODL bug
     # https://bugs.opendaylight.org/show_bug.cgi?id=477
     port['mac_address'] = port['mac_address'].upper()
     odl_utils.try_del(port, ['status'])
Пример #3
0
 def filter_update_attributes(cls, port, context):
     """Filter out port attributes for an update operation."""
     cls._add_security_groups(port, context)
     cls._fixup_mac_address(port)
     cls._fixup_allowed_ipaddress_pairs(port[addr_pair.ADDRESS_PAIRS])
     odl_utils.try_del(port, ['network_id', 'id', 'status', 'mac_address',
                       'tenant_id', 'fixed_ips'])
Пример #4
0
 def filter_create_attributes(cls, port):
     """Filter out port attributes not required for a create."""
     # TODO(kmestery): Converting to uppercase due to ODL bug
     # https://bugs.opendaylight.org/show_bug.cgi?id=477
     port['mac_address'] = port['mac_address'].upper()
     cls._filter_unmapped_null(port)
     odl_utils.try_del(port, ['status'])
Пример #5
0
 def _filter_unmapped_null(port):
     # NOTE(yamahata): bug work around
     # https://bugs.eclipse.org/bugs/show_bug.cgi?id=475475
     #   Null-value for an unmapped element causes next mapped
     #   collection to contain a null value
     #   JSON: { "unmappedField": null, "mappedCollection": [ "a" ] }
     #
     #   Java Object:
     #   class Root {
     #     Collection<String> mappedCollection = new ArrayList<String>;
     #   }
     #
     #   Result:
     #   Field B contains one element; null
     #
     # TODO(yamahata): update along side with neutron and ODL
     #   add when neutron adds more extensions
     #   delete when ODL neutron northbound supports it
     # TODO(yamahata): do same thing for other resources
     unmapped_keys = [
         'dns_name', 'port_security_enabled', 'binding:profile'
     ]
     keys_to_del = [key for key in unmapped_keys if port.get(key) is None]
     if keys_to_del:
         odl_utils.try_del(port, keys_to_del)
Пример #6
0
 def filter_update_attributes(cls, subnet, context):
     """Filter out subnet attributes for an update operation."""
     odl_utils.try_del(subnet, [
         'id', 'network_id', 'ip_version', 'cidr', 'allocation_pools',
         'tenant_id'
     ])
     cls._filter_unmapped_null(subnet, cls._UNMAPPED_KEYS)
Пример #7
0
 def filter_update_port_attributes(cls, port, context):
     """Filter out port attributes for an update operation."""
     cls.add_security_groups(port, context)
     odl_utils.try_del(port, [
         'network_id', 'id', 'status', 'mac_address', 'tenant_id',
         'fixed_ips'
     ])
Пример #8
0
 def filter_update_attributes(cls, port, context):
     """Filter out port attributes for an update operation."""
     cls._add_security_groups(port, context)
     cls._fixup_mac_address(port)
     cls._fixup_allowed_ipaddress_pairs(port[addr_pair.ADDRESS_PAIRS])
     odl_utils.try_del(port, [
         'network_id', 'id', 'status', 'mac_address', 'tenant_id',
         'fixed_ips'
     ])
Пример #9
0
    def filter_create_attributes(cls, port, context):
        """Filter out port attributes not required for a create."""
        cls._add_security_groups(port, context)
        cls._fixup_mac_address(port)
        cls._fixup_allowed_ipaddress_pairs(port[addr_pair.ADDRESS_PAIRS])
        odl_utils.try_del(port, ['status'])

        # NOTE(yamahata): work around for port creation for router
        # tenant_id=''(empty string) is passed when port is created
        # by l3 plugin internally for router.
        # On the other hand, ODL doesn't accept empty string for tenant_id.
        # In that case, deduce tenant_id from network_id for now.
        # Right fix: modify Neutron so that don't allow empty string
        # for tenant_id even for port for internal use.
        # TODO(yamahata): eliminate this work around when neutron side
        # is fixed
        # assert port['tenant_id'] != ''
        if port['tenant_id'] == '':
            LOG.debug('empty string was passed for tenant_id: %s(port)', port)
            port['tenant_id'] = context._network_context._network['tenant_id']
Пример #10
0
    def filter_create_attributes(cls, port, context):
        """Filter out port attributes not required for a create."""
        cls._add_security_groups(port, context)
        cls._fixup_allowed_ipaddress_pairs(port[addr_pair.ADDRESS_PAIRS])
        cls._filter_unmapped_null(port, cls._UNMAPPED_KEYS)
        odl_utils.try_del(port, ['status'])

        # NOTE(yamahata): work around for port creation for router
        # tenant_id=''(empty string) is passed when port is created
        # by l3 plugin internally for router.
        # On the other hand, ODL doesn't accept empty string for tenant_id.
        # In that case, deduce tenant_id from network_id for now.
        # Right fix: modify Neutron so that don't allow empty string
        # for tenant_id even for port for internal use.
        # TODO(yamahata): eliminate this work around when neutron side
        # is fixed
        # assert port['tenant_id'] != ''
        if port['tenant_id'] == '':
            LOG.debug('empty string was passed for tenant_id: %s(port)', port)
            port['tenant_id'] = context._network_context._network['tenant_id']
Пример #11
0
    def filter_create_port_attributes(cls, port, context):
        """Filter out port attributes not required for a create."""
        cls.add_security_groups(port, context)
        # TODO(kmestery): Converting to uppercase due to ODL bug
        # https://bugs.opendaylight.org/show_bug.cgi?id=477
        port['mac_address'] = port['mac_address'].upper()
        odl_utils.try_del(port, ['status'])

        # NOTE(yamahata): work around for port creation for router
        # tenant_id=''(empty string) is passed when port is created
        # by l3 plugin internally for router.
        # On the other hand, ODL doesn't accept empty string for tenant_id.
        # In that case, deduce tenant_id from network_id for now.
        # Right fix: modify Neutron so that don't allow empty string
        # for tenant_id even for port for internal use.
        # TODO(yamahata): eliminate this work around when neutron side
        # is fixed
        # assert port['tenant_id'] != ''
        if port['tenant_id'] == '':
            LOG.debug('empty string was passed for tenant_id: %s(port)', port)
            port['tenant_id'] = context._network_context._network['tenant_id']
Пример #12
0
    def filter_create_port_attributes(cls, port, context):
        """Filter out port attributes not required for a create."""
        cls.add_security_groups(port, context)
        # TODO(kmestery): Converting to uppercase due to ODL bug
        # https://bugs.opendaylight.org/show_bug.cgi?id=477
        port['mac_address'] = port['mac_address'].upper()
        odl_utils.try_del(port, ['status'])

        # NOTE(yamahata): work around for port creation for router
        # tenant_id=''(empty string) is passed when port is created
        # by l3 plugin internally for router.
        # On the other hand, ODL doesn't accept empty string for tenant_id.
        # In that case, deduce tenant_id from network_id for now.
        # Right fix: modify Neutron so that don't allow empty string
        # for tenant_id even for port for internal use.
        # TODO(yamahata): eliminate this work around when neutron side
        # is fixed
        # assert port['tenant_id'] != ''
        if port['tenant_id'] == '':
            LOG.debug('empty string was passed for tenant_id: %s(port)', port)
            port['tenant_id'] = context._network_context._network['tenant_id']
Пример #13
0
def _filter_unmapped_null(resource_dict, unmapped_keys):
    # NOTE(yamahata): bug work around
    # https://bugs.eclipse.org/bugs/show_bug.cgi?id=475475
    #   Null-value for an unmapped element causes next mapped
    #   collection to contain a null value
    #   JSON: { "unmappedField": null, "mappedCollection": [ "a" ] }
    #
    #   Java Object:
    #   class Root {
    #     Collection<String> mappedCollection = new ArrayList<String>;
    #   }
    #
    #   Result:
    #   Field B contains one element; null
    #
    # TODO(yamahata): update along side with neutron and ODL
    #   add when neutron adds more extensions
    #   delete when ODL neutron northbound supports it
    # TODO(yamahata): do same thing for other resources
    keys_to_del = [key for key in unmapped_keys
                   if resource_dict.get(key) is None]
    if keys_to_del:
        odl_utils.try_del(resource_dict, keys_to_del)
Пример #14
0
def _filter_network_update(network):
    odl_utils.try_del(network, ['id', 'status', 'subnets', 'tenant_id'])
Пример #15
0
 def filter_update_attributes(router):
     """Filter out attributes for an update operation."""
     odl_utils.try_del(router, ['id', 'tenant_id', 'status'])
Пример #16
0
def _filter_port(port, attributes):
    odl_utils.try_del(port, attributes)
    _filter_unmapped_null(port, _PORT_UNMAPPED_KEYS)
    # ODL excpects binding:profile to be a string, not a dict
    _convert_value_to_str(port, key='binding:profile')
Пример #17
0
def _filter_network_update(network):
    odl_utils.try_del(network,
                      ['id', 'status', 'subnets', 'tenant_id', 'project_id'])
    _filter_unmapped_null(network, _NETWORK_UNMAPPED_KEYS)
Пример #18
0
 def filter_create_attributes(cls, network, context):
     """Filter out network attributes not required for a create."""
     odl_utils.try_del(network, ['status', 'subnets'])
     cls._filter_unmapped_null(network, cls._UNMAPPED_KEYS)
Пример #19
0
def _filter_network_update(network):
    odl_utils.try_del(network, ['id', 'status', 'subnets', 'tenant_id'])
Пример #20
0
def _filter_port_create(port):
    """Filter out port attributes not required for a create."""
    odl_utils.try_del(port, ['status'])
    _filter_unmapped_null(port, _PORT_UNMAPPED_KEYS)
Пример #21
0
 def filter_update_attributes(network):
     """Filter out network attributes for an update operation."""
     odl_utils.try_del(network, ['id', 'status', 'subnets', 'tenant_id'])
Пример #22
0
def _filter_port_create(port):
    """Filter out port attributes not required for a create."""
    odl_utils.try_del(port, ['status'])
    _filter_unmapped_null(port, _PORT_UNMAPPED_KEYS)
Пример #23
0
def _filter_port_update(port):
    """Filter out port attributes for an update operation."""
    odl_utils.try_del(port, ['network_id', 'id', 'status', 'mac_address',
                      'tenant_id', 'fixed_ips'])
    _filter_unmapped_null(port, _PORT_UNMAPPED_KEYS)
Пример #24
0
def _filter_subnet_update(subnet):
    odl_utils.try_del(subnet, ['id', 'network_id', 'ip_version', 'cidr',
                      'allocation_pools', 'tenant_id'])
Пример #25
0
def _filter_network_update(network):
    odl_utils.try_del(network, ['id', 'status', 'subnets', 'tenant_id'])
    _filter_unmapped_null(network, _NETWORK_UNMAPPED_KEYS)
Пример #26
0
def _filter_network_create(network):
    odl_utils.try_del(network, ['status', 'subnets'])
    _filter_unmapped_null(network, _NETWORK_UNMAPPED_KEYS)
Пример #27
0
def _filter_subnet_update(subnet):
    odl_utils.try_del(subnet, [
        'id', 'network_id', 'ip_version', 'cidr', 'allocation_pools',
        'tenant_id'
    ])
Пример #28
0
 def filter_create_attributes(cls, port):
     """Filter out port attributes not required for a create."""
     cls._filter_unmapped_null(port)
     odl_utils.try_del(port, ['status'])
Пример #29
0
def _filter_port_create(port):
    """Filter out port attributes not required for a create."""
    _filter_port_unmapped_null(port)
    odl_utils.try_del(port, ['status'])
Пример #30
0
 def filter_create_network_attributes(network, context):
     """Filter out network attributes not required for a create."""
     odl_utils.try_del(network, ['status', 'subnets', 'vlan_transparent',
                       'mtu'])
Пример #31
0
 def filter_update_attributes(cls, network, context):
     """Filter out network attributes for an update operation."""
     odl_utils.try_del(network, ['id', 'status', 'subnets', 'tenant_id'])
     cls._filter_unmapped_null(network, cls._UNMAPPED_KEYS)
Пример #32
0
 def filter_update_network_attributes(network, context):
     """Filter out network attributes for an update operation."""
     odl_utils.try_del(network, ['id', 'status', 'subnets', 'tenant_id',
                       'vlan_transparent', 'mtu'])
Пример #33
0
def _filter_network_create(network):
    odl_utils.try_del(network, ['status', 'subnets'])
Пример #34
0
 def filter_update_attributes(cls, port, context):
     """Filter out port attributes for an update operation."""
     cls._add_security_groups(port, context)
     cls._fixup_allowed_ipaddress_pairs(port[addr_apidef.ADDRESS_PAIRS])
     cls._filter_unmapped_null(port, cls._UNMAPPED_KEYS)
     odl_utils.try_del(port, ['network_id', 'id', 'status', 'tenant_id'])
Пример #35
0
def _filter_network_create(network):
    odl_utils.try_del(network, ['status', 'subnets'])
    _filter_unmapped_null(network, _NETWORK_UNMAPPED_KEYS)
Пример #36
0
def _filter_port_create(port):
    """Filter out port attributes not required for a create."""
    _filter_port_unmapped_null(port)
    odl_utils.try_del(port, ['status'])
Пример #37
0
def _filter_subnet_update(subnet):
    odl_utils.try_del(
        subnet,
        ['id', 'network_id', 'ip_version', 'cidr', 'tenant_id', 'project_id'])
    _filter_unmapped_null(subnet, _SUBNET_UNMAPPED_KEYS)
Пример #38
0
def _filter_network_create(network):
    odl_utils.try_del(network, ['status', 'subnets'])
Пример #39
0
 def filter_create_attributes(network):
     """Filter out network attributes not required for a create."""
     odl_utils.try_del(network, ['status', 'subnets'])
Пример #40
0
def _filter_port_update(port):
    """Filter out port attributes for an update operation."""
    odl_utils.try_del(
        port, ['network_id', 'id', 'status', 'tenant_id', 'project_id'])
    _filter_unmapped_null(port, _PORT_UNMAPPED_KEYS)
Пример #41
0
 def filter_update_attributes(subnet):
     """Filter out subnet attributes for an update operation."""
     odl_utils.try_del(subnet, ['id', 'network_id', 'ip_version', 'cidr',
                       'allocation_pools', 'tenant_id'])
Пример #42
0
 def filter_update_port_attributes(cls, port, context):
     """Filter out port attributes for an update operation."""
     cls.add_security_groups(port, context)
     odl_utils.try_del(port, ['network_id', 'id', 'status', 'mac_address',
                       'tenant_id', 'fixed_ips'])
Пример #43
0
 def filter_update_attributes(cls, port):
     """Filter out port attributes for an update operation."""
     cls._filter_unmapped_null(port)
     odl_utils.try_del(port, ['network_id', 'id', 'status', 'mac_address',
                       'tenant_id', 'fixed_ips'])
def _filter_network_create(network):
    odl_utils.try_del(network, ['status', 'subnets'])
    _network_attribute_compatibility(network)
    _filter_unmapped_null(network, _NETWORK_UNMAPPED_KEYS)