本文整理匯總了Python中f5_openstack_agent.lbaasv2.drivers.bigip.network_helper.NetworkHelper.add_fdb_entry方法的典型用法代碼示例。如果您正苦於以下問題:Python NetworkHelper.add_fdb_entry方法的具體用法?Python NetworkHelper.add_fdb_entry怎麽用?Python NetworkHelper.add_fdb_entry使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類f5_openstack_agent.lbaasv2.drivers.bigip.network_helper.NetworkHelper
的用法示例。
在下文中一共展示了NetworkHelper.add_fdb_entry方法的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 add_fdb_entry [as 別名]
#.........這裏部分代碼省略.........
self.network_helper.delete_vlan(
vcmp_host['bigip'],
vlan_name)
LOG.debug(('Deleted VLAN %s from vCMP Host %s' %
(vlan_name, vcmp_host['bigip'].hostname)))
except Exception as exc:
LOG.error(('Exception deleting VLAN %s from vCMP Host %s:%s' %
(vlan_name, vcmp_host['bigip'].icontrol.hostname, exc)))
def add_bigip_fdbs(self, bigip, net_folder, fdb_info, vteps_by_type):
# Add fdb records for a mac/ip with specified vteps
network = fdb_info['network']
net_type = network['provider:network_type']
vteps_key = net_type + '_vteps'
if vteps_key in vteps_by_type:
vteps = vteps_by_type[vteps_key]
if net_type == 'gre':
self.add_gre_fdbs(bigip, net_folder, fdb_info, vteps)
elif net_type == 'vxlan':
self.add_vxlan_fdbs(bigip, net_folder, fdb_info, vteps)
def add_gre_fdbs(self, bigip, net_folder, fdb_info, vteps):
# Add gre fdb records
network = fdb_info['network']
ip_address = fdb_info['ip_address']
mac_address = fdb_info['mac_address']
tunnel_name = _get_tunnel_name(network)
for vtep in vteps:
if mac_address:
mac_addr = mac_address
else:
mac_addr = _get_tunnel_fake_mac(network, vtep)
# REVISIT(Rich Browne) caller must provide folder and not tenant_id
self.network_helper.add_fdb_entry(
bigip,
tunnel_name=tunnel_name,
partition=net_folder,
mac_address=mac_addr,
vtep_ip_address=vtep,
arp_ip_address=ip_address)
def add_vxlan_fdbs(self, bigip, net_folder, fdb_info, vteps):
# Add vxlan fdb records
network = fdb_info['network']
ip_address = fdb_info['ip_address']
mac_address = fdb_info['mac_address']
tunnel_name = _get_tunnel_name(network)
for vtep in vteps:
if mac_address:
mac_addr = mac_address
else:
mac_addr = _get_tunnel_fake_mac(network, vtep)
# REVISIT caller must provide folder and not tenant_id
self.network_helper.add_fdb_entry(
bigip,
tunnel_name=tunnel_name,
partition=net_folder,
mac_address=mac_addr,
vtep_ip_address=vtep,
arp_ip_address=ip_address)
def delete_bigip_fdbs(self, bigip, net_folder, fdb_info, vteps_by_type):
# Delete fdb records for a mac/ip with specified vteps
network = fdb_info['network']
net_type = network['provider:network_type']
vteps_key = net_type + '_vteps'
示例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 add_fdb_entry [as 別名]
#.........這裏部分代碼省略.........
:param vlan_name: str -- name of vlan
'''
if not self.vcmp_manager:
return
vcmp_host = self.vcmp_manager.get_vcmp_host(bigip)
if not vcmp_host:
return
self.vcmp_manager.disassoc_vlan_with_vcmp_guest(bigip, vlan_name)
def add_bigip_fdbs(self, bigip, net_folder, fdb_info, vteps_by_type):
# Add fdb records for a mac/ip with specified vteps
network = fdb_info['network']
net_type = network['provider:network_type']
vteps_key = net_type + '_vteps'
if vteps_key in vteps_by_type:
vteps = vteps_by_type[vteps_key]
if net_type == 'gre':
self.add_gre_fdbs(bigip, net_folder, fdb_info, vteps)
elif net_type == 'vxlan':
self.add_vxlan_fdbs(bigip, net_folder, fdb_info, vteps)
def add_gre_fdbs(self, bigip, net_folder, fdb_info, vteps):
# Add gre fdb records
network = fdb_info['network']
ip_address = fdb_info['ip_address']
mac_address = fdb_info['mac_address']
tunnel_name = _get_tunnel_name(network)
for vtep in vteps:
if mac_address:
mac_addr = mac_address
else:
mac_addr = _get_tunnel_fake_mac(network, vtep)
self.network_helper.add_fdb_entry(
bigip,
tunnel_name=tunnel_name,
partition=net_folder,
mac_address=mac_addr,
vtep_ip_address=vtep,
arp_ip_address=ip_address)
def add_vxlan_fdbs(self, bigip, net_folder, fdb_info, vteps):
# Add vxlan fdb records
network = fdb_info['network']
ip_address = fdb_info['ip_address']
mac_address = fdb_info['mac_address']
tunnel_name = _get_tunnel_name(network)
for vtep in vteps:
if mac_address:
mac_addr = mac_address
else:
mac_addr = _get_tunnel_fake_mac(network, vtep)
self.network_helper.add_fdb_entry(
bigip,
tunnel_name=tunnel_name,
partition=net_folder,
mac_address=mac_addr,
vtep_ip_address=vtep,
arp_ip_address=ip_address)
def delete_bigip_fdbs(self, bigip, net_folder, fdb_info, vteps_by_type):
# Delete fdb records for a mac/ip with specified vteps
network = fdb_info['network']
net_type = network['provider:network_type']
vteps_key = net_type + '_vteps'