简体   繁体   English

Softlayer API:如何识别两个VLAN匹配VLAN路由器对?

[英]Softlayer api: How to identify two vlans are matching VLAN router pair?

background 背景

I get a exception when I order a VSI with specified the fronted and backend vlans. 订购带有指定前端和后端VLAN的VSI时,出现异常。

The place order para of vlans are marked as vlan的下单顺序标记为

order_template = {...
'virtualGuests': [{'primaryBackendNetworkComponent': {'networkVlan': {'id': 2058375}}, 'domain': 'xxx', 'hostname': 'xxx', 'primaryNetworkComponent': {'networkVlan': {'id': 1698647}}
...}

The Exception as flow: 流程异常:

SoftLayer.exceptions.SoftLayerAPIError: SoftLayerAPIError(SoftLayer_Exception_Public): When specifying frontend and backend VLANs, they must be on the appropriate router pair. The specified backend VLAN is on router `bcr02a.hkg02`, so the specified frontend VLAN should be on router `fcr02a.hkg02`. However, the specified frontend VLAN is on router `fcr01a.hkg02`. Please specify a matching VLAN router pair.

I known that fcr01a must match to bcr01a . 我知道fcr01a必须与bcr01a匹配。

#get vlan info
object_mask = 'mask[id,name,primarySubnetId,vlanNumber,networkSpace,primaryRouter[id,datacenter[id,name]]]'
account.getNetworkVlans(mask=object_mask)

result: 结果:

vlans = [
                {'primaryRouter': {'datacenter': {'id': 352494, 'name': 'hkg02'}, 'id': 212460}, 'primarySubnetId': 987829, 'vlanNumber': 1461, 'id': 1698651},...]

question

How can I get the more information to check the frontend and bakcend are are matching VLAN router pair or not ? 如何获取更多信息以检查前端和bakcend是否匹配VLAN路由器对?

Or, How can I set the mask to get fcr01a.hkg02 when I call account.getNetworkVlans? 或者,当我调用account.getNetworkVlans时,如何设置掩码以获取fcr01a.hkg02?

Or, Is there any other item of vlan info to identity the pair relationship? 或者,是否存在其他任何VLAN信息项来标识配对关系?

In order To obtain more information about the vlan pair routing the Product_Order::getVlans will help you as it retrieves the available private and public vlans during ordering, you may use the locationId you provided as value (352494) to narrow the result, don´t forget that this value should match the datacenter you are using along the placeOrder method. 为了获得有关路由选择的VLAN对的更多信息,Product_Order :: getVlans将在订购过程中检索可用的私有和公共VLAN时为您提供帮助,您可以使用您提供的locationId作为值(352494)来缩小结果范围,别忘了该值应该与您在placeOrder方法中使用的数据中心匹配。 For example use this on your python script: 例如,在您的python脚本上使用此命令:

locationId = 352494 #location id for Hong Kong 02 datacenter 
packageId = 46 #package for VSI.

result = client['Product_Order'].getVlans(locationId, packageId)

Or you may review the following url for a better script using Account::getNetworkVlans Ordering Softlayer Vlan pairs 或者,您可以使用Account :: getNetworkVlans 订购Softlayer Vlan对查看以下URL,以获得更好的脚本。

You may improve your code by adding the property “hostname” to your mask and using Object Filters to search for required value, you may try the following improvement of your code: 您可以通过将属性“主机名”添加到掩码并使用对象过滤器搜索所需的值来改进代码,可以尝试对代码进行以下改进:

objectMask=mask[id,name,primarySubnetId,vlanNumber,networkSpace,primaryRouter[id,hostname, datacenter[id,name]]]
objectFilter={"networkVlans":{"primaryRouter":{"hostname":{"operation":"fcr01a.hkg02"}}}}

account.getNetworkVlans(mask=object_mask, filter=objectFilter)

For more information please see below: https://sldn.softlayer.com/reference/services/SoftLayer_Product_Order/getVlans 有关更多信息,请参见下面: https : //sldn.softlayer.com/reference/services/SoftLayer_Product_Order/getVlans

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM