How can I filter the list of VLANs to just get ones valid for virtual guest orders?

别等时光非礼了梦想. 提交于 2019-12-25 09:42:45

问题


I would like to filter the list of VLANs on an account so that I only list the VLANs which can be used to order a Virtual Guest. I am using Softlayer_Account_Service.getNetworkVlans().

What do I need to filter by? It is just filtering for networkVlans.type.keyName = STANDARD?

I’m trying to avoid being able to hit this error when I select a VLAN from my list: SoftLayer_Exception_Public: The frontend VLAN #xxxxxxx is not a standard VLAN. (HTTP 500)

Thanks.


回答1:


In order to get available vlans for ordering, see Retrieve Vlans - Subnets available based on Package and Location section on the below link:

  • REST: use SoftLayer_Hardware::createObject instead of SoftLayer_Product_Order::placeOrder

For Vsi's, should be:

https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Product_Order/getVlans

Method: Post

{
  "parameters": 
   [
       448994, 46
   ]
}

Replace: $user, $apiKey and 448994 with the location identifier that you would like to order

To get datacenter identifiers:

https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Location/getDatacenters

Method: Get

To get STANDARD vlans from specific location

https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Account/getNetworkVlans?objectMask=mask[type,primaryRouter[datacenter]]&objectFilter={"networkVlans":{"type":{"keyName":{"operation":"STANDARD"}}, "primaryRouter":{"datacenter":{"name":{"operation":"wdc01"}}}}}

Method: Get

Replace: $user, $apiKey and wdc01 with the location that you would like to get the vlans



来源:https://stackoverflow.com/questions/44146080/how-can-i-filter-the-list-of-vlans-to-just-get-ones-valid-for-virtual-guest-orde

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!