Softlayer api: 如何识别两个 vlan 是否匹配 VLAN 路由器对?
Softlayer api: How to identify two vlans are matching VLAN router pair?
背景
订购具有指定前端和后端 vlan 的 VSI 时出现异常。
vlans的place order para标记为
order_template = {...
'virtualGuests': [{'primaryBackendNetworkComponent': {'networkVlan': {'id': 2058375}}, 'domain': 'xxx', 'hostname': 'xxx', 'primaryNetworkComponent': {'networkVlan': {'id': 1698647}}
...}
异常流:
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.
我知道 fcr01a
必须匹配 bcr01a
。
#get vlan info
object_mask = 'mask[id,name,primarySubnetId,vlanNumber,networkSpace,primaryRouter[id,datacenter[id,name]]]'
account.getNetworkVlans(mask=object_mask)
结果:
vlans = [
{'primaryRouter': {'datacenter': {'id': 352494, 'name': 'hkg02'}, 'id': 212460}, 'primarySubnetId': 987829, 'vlanNumber': 1461, 'id': 1698651},...]
问题
如何获取更多信息来检查前端和后端是否匹配 VLAN 路由器对?
或者,如何设置掩码在调用account.getNetworkVlans时获取fcr01a.hkg02?
或者,是否有其他的vlan info项来标识pair关系?
为了获得有关 vlan 对路由的更多信息,Product_Order::getVlans 将在订购期间检索可用的私有和 public vlan 时帮助您,您可以使用您提供的 locationId 作为值(352494) 要缩小结果范围,请不要忘记此值应与您在 placeOrder 方法中使用的数据中心相匹配。例如,在您的 python 脚本中使用它:
locationId = 352494 #location id for Hong Kong 02 datacenter
packageId = 46 #package for VSI.
result = client['Product_Order'].getVlans(locationId, packageId)
或者您可以查看以下 url 以使用 Account::getNetworkVlans 获得更好的脚本
Ordering Softlayer Vlan pairs
您可以通过将 属性“主机名”添加到您的掩码并使用对象过滤器搜索所需的值来改进您的代码,您可以尝试对您的代码进行以下改进:
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)
更多信息请见下方:
https://sldn.softlayer.com/reference/services/SoftLayer_Product_Order/getVlans
背景
订购具有指定前端和后端 vlan 的 VSI 时出现异常。
vlans的place order para标记为
order_template = {...
'virtualGuests': [{'primaryBackendNetworkComponent': {'networkVlan': {'id': 2058375}}, 'domain': 'xxx', 'hostname': 'xxx', 'primaryNetworkComponent': {'networkVlan': {'id': 1698647}}
...}
异常流:
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.
我知道 fcr01a
必须匹配 bcr01a
。
#get vlan info
object_mask = 'mask[id,name,primarySubnetId,vlanNumber,networkSpace,primaryRouter[id,datacenter[id,name]]]'
account.getNetworkVlans(mask=object_mask)
结果:
vlans = [
{'primaryRouter': {'datacenter': {'id': 352494, 'name': 'hkg02'}, 'id': 212460}, 'primarySubnetId': 987829, 'vlanNumber': 1461, 'id': 1698651},...]
问题
如何获取更多信息来检查前端和后端是否匹配 VLAN 路由器对?
或者,如何设置掩码在调用account.getNetworkVlans时获取fcr01a.hkg02?
或者,是否有其他的vlan info项来标识pair关系?
为了获得有关 vlan 对路由的更多信息,Product_Order::getVlans 将在订购期间检索可用的私有和 public vlan 时帮助您,您可以使用您提供的 locationId 作为值(352494) 要缩小结果范围,请不要忘记此值应与您在 placeOrder 方法中使用的数据中心相匹配。例如,在您的 python 脚本中使用它:
locationId = 352494 #location id for Hong Kong 02 datacenter
packageId = 46 #package for VSI.
result = client['Product_Order'].getVlans(locationId, packageId)
或者您可以查看以下 url 以使用 Account::getNetworkVlans 获得更好的脚本 Ordering Softlayer Vlan pairs
您可以通过将 属性“主机名”添加到您的掩码并使用对象过滤器搜索所需的值来改进您的代码,您可以尝试对您的代码进行以下改进:
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)
更多信息请见下方: https://sldn.softlayer.com/reference/services/SoftLayer_Product_Order/getVlans