本文整理汇总了Python中networking_odl.common.utils.try_del函数的典型用法代码示例。如果您正苦于以下问题:Python try_del函数的具体用法?Python try_del怎么用?Python try_del使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了try_del函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: filter_create_attributes
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'])
示例2: filter_create_port_attributes
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: filter_update_attributes
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: filter_create_attributes
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']
示例5: filter_create_port_attributes
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']
示例6: _filter_unmapped_null
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)
示例7: filter_update_port_attributes
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: _filter_port_update
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)
示例9: _filter_network_update
def _filter_network_update(network):
odl_utils.try_del(network, ['id', 'status', 'subnets', 'tenant_id'])
示例10: filter_create_attributes
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'])
示例11: filter_update_attributes
def filter_update_attributes(network):
"""Filter out network attributes for an update operation."""
odl_utils.try_del(network, ['id', 'status', 'subnets', 'tenant_id'])
示例12: filter_create_network_attributes
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'])
示例13: filter_update_network_attributes
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'])
示例14: _filter_port_create
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'])
示例15: _filter_network_create
def _filter_network_create(network):
odl_utils.try_del(network, ['status', 'subnets'])
_filter_unmapped_null(network, _NETWORK_UNMAPPED_KEYS)