本文整理汇总了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