本文整理汇总了Python中f5_openstack_agent.lbaasv2.drivers.bigip.network_helper.NetworkHelper.delete_vlan方法的典型用法代码示例。如果您正苦于以下问题:Python NetworkHelper.delete_vlan方法的具体用法?Python NetworkHelper.delete_vlan怎么用?Python NetworkHelper.delete_vlan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类f5_openstack_agent.lbaasv2.drivers.bigip.network_helper.NetworkHelper
的用法示例。
在下文中一共展示了NetworkHelper.delete_vlan方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: L2ServiceBuilder
# 需要导入模块: from f5_openstack_agent.lbaasv2.drivers.bigip.network_helper import NetworkHelper [as 别名]
# 或者: from f5_openstack_agent.lbaasv2.drivers.bigip.network_helper.NetworkHelper import delete_vlan [as 别名]
#.........这里部分代码省略.........
LOG.error(
('Exception deleting VLAN %s from vCMP Guest %s: %s' %
(full_path_vlan_name, vcmp_guest['mgmt_addr'], exc)))
def delete_bigip_network(self, bigip, network):
# Delete network on bigip
if network['id'] in self.conf.common_network_ids:
LOG.debug('skipping delete of common network %s'
% network['id'])
return
if self.is_common_network(network):
network_folder = 'Common'
else:
network_folder = self.service_adapter.get_folder_name(
network['tenant_id'])
if network['provider:network_type'] == 'vlan':
self._delete_device_vlan(bigip, network, network_folder)
elif network['provider:network_type'] == 'flat':
self._delete_device_flat(bigip, network, network_folder)
elif network['provider:network_type'] == 'vxlan':
self._delete_device_vxlan(bigip, network, network_folder)
elif network['provider:network_type'] == 'gre':
self._delete_device_gre(bigip, network, network_folder)
else:
LOG.error('Unsupported network type %s. Can not delete.'
% network['provider:network_type'])
if network['id'] in bigip.assured_networks:
bigip.assured_networks.remove(network['id'])
def _delete_device_vlan(self, bigip, network, network_folder):
# Delete tagged vlan on specific bigip
vlan_name = self.get_vlan_name(network,
bigip.hostname)
self.network_helper.delete_vlan(
bigip,
vlan_name,
partition=network_folder
)
if self.vlan_binding:
interface = self.interface_mapping['default']
tagged = self.tagging_mapping['default']
vlanid = 0
# Do we have host specific mappings?
net_key = network['provider:physical_network']
if net_key + ':' + bigip.hostname in \
self.interface_mapping:
interface = self.interface_mapping[
net_key + ':' + bigip.hostname]
tagged = self.tagging_mapping[
net_key + ':' + bigip.hostname]
# Do we have a mapping for this network
elif net_key in self.interface_mapping:
interface = self.interface_mapping[net_key]
tagged = self.tagging_mapping[net_key]
if tagged:
vlanid = network['provider:segmentation_id']
else:
vlanid = 0
self.vlan_binding.prune_vlan(
device_name=bigip.device_name,
interface=interface,
vlanid=vlanid
)
self._delete_vcmp_device_network(bigip, vlan_name)
示例2: L2ServiceBuilder
# 需要导入模块: from f5_openstack_agent.lbaasv2.drivers.bigip.network_helper import NetworkHelper [as 别名]
# 或者: from f5_openstack_agent.lbaasv2.drivers.bigip.network_helper.NetworkHelper import delete_vlan [as 别名]
#.........这里部分代码省略.........
def delete_bigip_network(self, bigip, network):
# Delete network on bigip
if network['id'] in self.conf.common_network_ids:
LOG.debug('skipping delete of common network %s'
% network['id'])
return
if self.is_common_network(network):
network_folder = 'Common'
else:
network_folder = self.service_adapter.get_folder_name(
network['tenant_id'])
if network['provider:network_type'] == 'vlan':
self._delete_device_vlan(bigip, network, network_folder)
elif network['provider:network_type'] == 'flat':
self._delete_device_flat(bigip, network, network_folder)
elif network['provider:network_type'] == 'vxlan':
self._delete_device_vxlan(bigip, network, network_folder)
elif network['provider:network_type'] == 'gre':
self._delete_device_gre(bigip, network, network_folder)
elif network['provider:network_type'] == 'opflex':
raise f5_ex.NetworkNotReady(
"Opflex network segment definition required")
else:
LOG.error('Unsupported network type %s. Can not delete.'
% network['provider:network_type'])
if network['id'] in bigip.assured_networks:
del bigip.assured_networks[network['id']]
def _delete_device_vlan(self, bigip, network, network_folder):
# Delete tagged vlan on specific bigip
vlan_name = self.get_vlan_name(network,
bigip.hostname)
try:
self.network_helper.delete_vlan(
bigip,
vlan_name,
partition=network_folder
)
except Exception as err:
LOG.exception(err)
LOG.error(
"Failed to delete vlan: %s" % vlan_name)
if self.vlan_binding:
interface = self.interface_mapping['default']
tagged = self.tagging_mapping['default']
vlanid = 0
# Do we have host specific mappings?
net_key = network['provider:physical_network']
if net_key and net_key + ':' + bigip.hostname in \
self.interface_mapping:
interface = self.interface_mapping[
net_key + ':' + bigip.hostname]
tagged = self.tagging_mapping[
net_key + ':' + bigip.hostname]
# Do we have a mapping for this network
elif net_key and net_key in self.interface_mapping:
interface = self.interface_mapping[net_key]
tagged = self.tagging_mapping[net_key]
if tagged:
vlanid = network['provider:segmentation_id']
else:
vlanid = 0
self.vlan_binding.prune_vlan(
device_name=bigip.device_name,