如何从SL-API创建softlayer citrix负载均衡器

时间:2016-06-10 16:03:52

标签: ibm-cloud-infrastructure

我正在尝试创建Citrix负载均衡器,我的代码是:

LocationForNetscaler = 168642
Netscaler=44958
staticIPAddress=27569
package = 192
ProdcutOrderService = client['SoftLayer_Product_Order']
orderContainers ={
                    "quantity": 1,
                    "location": LocationForNetscaler ,
                    "packageId": package,
                    "prices": [
                        {"id": Netscaler,
                         "complexType":"SoftLayer_Product_Item_Price"
                         },
                        {
                         "id":staticIPAddress,
                         "complexType":"SoftLayer_Product_Item_Price"
                         }

                    ]

                }
orderData = {
               'orderContainers' : [orderContainers ]
            }

receipt = ProdcutOrderService.verifyOrder(orderData)
print "Order Verification"
pprint(receipt)

但是我收到以下错误: Traceback(最近一次调用最后一次):   文件“/home/abcd/Downloads/25-05-2016/28-05-2016-test.py”,第84行,in     receipt = ProdcutOrderService.verifyOrder(orderData)   在call_handler中输入文件“/usr/local/lib/python2.7/dist-packages/SoftLayer/API.py”,第373行     返回自我(姓名,* args,** kwargs)   文件“/usr/local/lib/python2.7/dist-packages/SoftLayer/API.py”,第341行,正在通话中     return self.client.call(self.name,name,* args,** kwargs)   文件“/usr/local/lib/python2.7/dist-packages/SoftLayer/API.py”,第237行,正在通话中     return self.transport(request)   在电话中输入文件“/usr/local/lib/python2.7/dist-packages/SoftLayer/transports.py”,第187行     raise _ex(ex.faultCode,ex.faultString)     SoftLayer.exceptions.SoftLayerAPIError:SoftLayerAPIError(SoftLayer_Exception_Order_Item_Invalid): Invalid price Citrix NetScaler VPX 10.5 10Mbps Standard (44958) provided on the order container.

请指导 感谢

1 个答案:

答案 0 :(得分:0)

显然,SoftLayer_Product_Order::placeOrder方法无法识别您要发送的容器类型,请尝试添加 complexType 属性,请尝试此操作:

LocationForNetscaler = 168642
Netscaler=44958
staticIPAddress=27569
package = 192
productService = client['SoftLayer_Product_Order']
orderContainers ={
                    "complexType": "SoftLayer_Container_Product_Order_Network_Application_Delivery_Controller",
                    "quantity": 1,
                    "location": LocationForNetscaler,
                    "packageId": package,
                    "prices": [
                        {
                         "complexType": "SoftLayer_Product_Item_Price", 
                         "id": Netscaler
                         },
                        {
                         "complexType": "SoftLayer_Product_Item_Price", 
                         "id": staticIPAddress
                         }

                    ]

                }


receipt = productService.verifyOrder(orderContainers)
print(receipt)