本文整理汇总了Python中f5_openstack_agent.lbaasv2.drivers.bigip.network_helper.NetworkHelper.delete_tunnel方法的典型用法代码示例。如果您正苦于以下问题:Python NetworkHelper.delete_tunnel方法的具体用法?Python NetworkHelper.delete_tunnel怎么用?Python NetworkHelper.delete_tunnel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类f5_openstack_agent.lbaasv2.drivers.bigip.network_helper.NetworkHelper
的用法示例。
在下文中一共展示了NetworkHelper.delete_tunnel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_add_remove_fdbs
# 需要导入模块: from f5_openstack_agent.lbaasv2.drivers.bigip.network_helper import NetworkHelper [as 别名]
# 或者: from f5_openstack_agent.lbaasv2.drivers.bigip.network_helper.NetworkHelper import delete_tunnel [as 别名]
def test_add_remove_fdbs(bigip, icontrol_driver):
""" Test simulating L2 pop events to add/remove fdb entries."""
net_helper = NetworkHelper()
tunnels = list()
fdb_entries = list()
seg_id_start = 167
seg_id_end = 176
n_records = 9
# create tunnels on BIG-IP, and fake fdb entries
for seg_id in range(seg_id_start, seg_id_end):
tunnel_name = 'tunnel-vxlan-{}'.format(seg_id)
model = {
'name': tunnel_name,
'key': seg_id,
'profile': 'vxlan_ovs',
'localAddress': '201.0.155.10'}
net_helper.create_multipoint_tunnel(bigip.bigip, model)
tunnels.append(tunnel_name)
# create a set of fdb entries that reference network seg ID
for _ in range(n_records):
entry = create_fdb_entry(seg_id)
fdb_entries.append(entry)
# add fdb entries
for fdb_entry in fdb_entries:
# mimic neutron L2 pop add_fdb_entries
icontrol_driver.fdb_add(fdb_entry)
for fdb_entry in fdb_entries:
# mimic neutron L2 pop add_fdb_entries
icontrol_driver.fdb_add(fdb_entry)
# check created
for tunnel_name in tunnels:
records = net_helper.get_fdb_entry(bigip.bigip, tunnel_name=tunnel_name)
assert records
# remove fdb entries
for fdb_entry in fdb_entries:
# mimic neutron L2 pop remove_fdb_entries
icontrol_driver.fdb_remove(fdb_entry)
# check removed
for tunnel_name in tunnels:
records = net_helper.get_fdb_entry(bigip.bigip, tunnel_name=tunnel_name)
assert not records
net_helper.delete_tunnel(bigip.bigip, tunnel_name)
示例2: purge_folder_contents
# 需要导入模块: from f5_openstack_agent.lbaasv2.drivers.bigip.network_helper import NetworkHelper [as 别名]
# 或者: from f5_openstack_agent.lbaasv2.drivers.bigip.network_helper.NetworkHelper import delete_tunnel [as 别名]
def purge_folder_contents(self, bigip, folder):
network_helper = NetworkHelper()
if folder not in self.exempt_folders:
# First remove all LTM resources.
ltm_types = [
ResourceType.virtual,
ResourceType.virtual_address,
ResourceType.pool,
ResourceType.http_monitor,
ResourceType.https_monitor,
ResourceType.tcp_monitor,
ResourceType.ping_monitor,
ResourceType.node,
ResourceType.snat,
ResourceType.snatpool,
ResourceType.snat_translation,
ResourceType.universal_persistence,
ResourceType.rule,
ResourceType.l7policy
]
for ltm_type in ltm_types:
resource = BigIPResourceHelper(ltm_type)
[r.delete() for r in resource.get_resources(bigip, folder)]
# Remove all net resources
net_types = [
ResourceType.arp,
ResourceType.selfip,
ResourceType.vlan,
ResourceType.route_domain
]
for net_type in net_types:
resource = BigIPResourceHelper(net_type)
[r.delete() for r in resource.get_resources(bigip, folder)]
# Tunnels and fdb's require some special attention.
resource = BigIPResourceHelper(ResourceType.tunnel)
tunnels = resource.get_resources(bigip, folder)
for tunnel in tunnels:
network_helper.delete_all_fdb_entries(
bigip, tunnel.name, folder)
network_helper.delete_tunnel(
bigip, tunnel.name, folder)
示例3: 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_tunnel [as 别名]
#.........这里部分代码省略.........
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)
def _delete_device_flat(self, bigip, network, network_folder):
# Delete untagged vlan on specific bigip
vlan_name = self.get_vlan_name(network,
bigip.hostname)
self.network_helper.delete_vlan(
bigip,
vlan_name,
partition=network_folder
)
self._delete_vcmp_device_network(bigip, vlan_name)
def _delete_device_vxlan(self, bigip, network, network_folder):
# Delete vxlan tunnel on specific bigip
tunnel_name = _get_tunnel_name(network)
self.network_helper.delete_all_fdb_entries(
bigip,
tunnel_name,
partition=network_folder)
self.network_helper.delete_tunnel(
bigip,
tunnel_name,
partition=network_folder)
if self.fdb_connector:
self.fdb_connector.notify_vtep_removed(network, bigip.local_ip)
def _delete_device_gre(self, bigip, network, network_folder):
# Delete gre tunnel on specific bigip
tunnel_name = _get_tunnel_name(network)
self.network_helper.delete_all_fdb_entries(
bigip,
tunnel_name,
partition=network_folder)
self.network_helper.delete_tunnel(
bigip,
tunnel_name,
partition=network_folder)
if self.fdb_connector:
self.fdb_connector.notify_vtep_removed(network, bigip.local_ip)
def _delete_vcmp_device_network(self, bigip, vlan_name):
# For vCMP Guests, disassociate VLAN from vCMP Guest and
# delete VLAN from vCMP Host.
if not self.vcmp_manager:
return
vcmp_host = self.vcmp_manager.get_vcmp_host(bigip)
示例4: 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_tunnel [as 别名]
#.........这里部分代码省略.........
interface=interface,
vlanid=vlanid
)
self._delete_vcmp_device_network(bigip, vlan_name)
def _delete_device_flat(self, bigip, network, network_folder):
# Delete untagged 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)
self._delete_vcmp_device_network(bigip, vlan_name)
def _delete_device_vxlan(self, bigip, network, network_folder):
# Delete vxlan tunnel on specific bigip
tunnel_name = _get_tunnel_name(network)
try:
self.network_helper.delete_all_fdb_entries(
bigip,
tunnel_name,
partition=network_folder)
self.network_helper.delete_tunnel(
bigip,
tunnel_name,
partition=network_folder)
except Exception as err:
# Just log the exception, we want to continue cleanup
LOG.exception(err)
LOG.error(
"Failed to delete vxlan tunnel: %s" % tunnel_name)
if self.fdb_connector:
self.fdb_connector.notify_vtep_removed(network, bigip.local_ip)
def _delete_device_gre(self, bigip, network, network_folder):
# Delete gre tunnel on specific bigip
tunnel_name = _get_tunnel_name(network)
try:
self.network_helper.delete_all_fdb_entries(
bigip,
tunnel_name,
partition=network_folder)
self.network_helper.delete_tunnel(
bigip,
tunnel_name,
partition=network_folder)
except Exception as err:
# Just log the exception, we want to continue cleanup
LOG.exception(err)
LOG.error(
"Failed to delete gre tunnel: %s" % tunnel_name)