本文整理匯總了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,