本文整理匯總了Python中f5_openstack_agent.lbaasv2.drivers.bigip.network_helper.NetworkHelper.create_vlan方法的典型用法代碼示例。如果您正苦於以下問題:Python NetworkHelper.create_vlan方法的具體用法?Python NetworkHelper.create_vlan怎麽用?Python NetworkHelper.create_vlan使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類f5_openstack_agent.lbaasv2.drivers.bigip.network_helper.NetworkHelper
的用法示例。
在下文中一共展示了NetworkHelper.create_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 create_vlan [as 別名]
#.........這裏部分代碼省略.........
# Ensure bigip has configured flat vlan (untagged)
interface = self.interface_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]
# Do we have a mapping for this network
elif net_key in self.interface_mapping:
interface = self.interface_mapping[net_key]
vlan_name = self.get_vlan_name(network,
bigip.hostname)
# TODO(Rich Browne): Implementation with VCMP
self._assure_vcmp_device_network(bigip,
vlan={'name': vlan_name,
'folder': network_folder,
'id': vlanid,
'interface': interface,
'network': network})
if self.vcmp_manager and self.vcmp_manager.get_vcmp_host(bigip):
interface = None
model = {'name': vlan_name,
'interface': interface,
'partition': network_folder,
'description': network['id'],
'route_domain_id': network['route_domain_id']}
self.network_helper.create_vlan(bigip, model)
def _assure_device_network_vlan(self, network, bigip, network_folder):
# Ensure bigip has configured tagged vlan
# VLAN names are limited to 64 characters including
# the folder name, so we name them foolish things.
interface = self.interface_mapping['default']
tagged = self.tagging_mapping['default']
# 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
vlan_name = self.get_vlan_name(network,
bigip.hostname)
self._assure_vcmp_device_network(bigip,
vlan={'name': vlan_name,
'folder': network_folder,
示例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 create_vlan [as 別名]
#.........這裏部分代碼省略.........
# Ensure bigip has configured flat vlan (untagged)
vlan_name = ""
interface = self.interface_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]
# Do we have a mapping for this network
elif net_key and net_key in self.interface_mapping:
interface = self.interface_mapping[net_key]
vlan_name = self.get_vlan_name(network,
bigip.hostname)
self._assure_vcmp_device_network(bigip,
vlan={'name': vlan_name,
'folder': network_folder,
'id': vlanid,
'interface': interface,
'network': network})
if self.vcmp_manager and self.vcmp_manager.get_vcmp_host(bigip):
interface = None
try:
model = {'name': vlan_name,
'interface': interface,
'partition': network_folder,
'description': network['id'],
'route_domain_id': network['route_domain_id']}
self.network_helper.create_vlan(bigip, model)
except Exception as err:
LOG.exception("%s", err.message)
raise f5_ex.VLANCreationException("Failed to create flat network")
return vlan_name
def _assure_device_network_vlan(self, network, bigip, network_folder):
# Ensure bigip has configured tagged vlan
# VLAN names are limited to 64 characters including
# the folder name, so we name them foolish things.
vlan_name = ""
interface = self.interface_mapping['default']
tagged = self.tagging_mapping['default']
# 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