首页 文章

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

提问于
浏览
0

我正在尝试创建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行,在receipt = ProdcutOrderService.verifyOrder(orderData)文件"/usr/local/lib/python2.7/dist-packages/SoftLayer/API.py",第373行,在call_handler中返回self(name,* args,** kwargs )文件"/usr/local/lib/python2.7/dist-packages/SoftLayer/API.py",第341行,在调用返回self.client.call(self.name,name,* args,** kwargs)文件"/usr/local/lib/python2.7/dist-packages/SoftLayer/API.py",第237行,在调用返回self.transport(请求)文件"/usr/local/lib/python2.7/dist-packages/SoftLayer/transports.py",第187行,在 call 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

    显然,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)
    

相关问题