Search code examples
ibm-cloud-infrastructure

how to create softlayer citrix load balancer from SL-API


i am trying to create a Citrix load balancer my code is :

#
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)
#

but i am getting the following error: Traceback (most recent call last): File "/home/abcd/Downloads/25-05-2016/28-05-2016-test.py", line 84, in receipt = ProdcutOrderService.verifyOrder(orderData) File "/usr/local/lib/python2.7/dist-packages/SoftLayer/API.py", line 373, in call_handler return self(name, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/SoftLayer/API.py", line 341, in call return self.client.call(self.name, name, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/SoftLayer/API.py", line 237, in call return self.transport(request) File "/usr/local/lib/python2.7/dist-packages/SoftLayer/transports.py", line 187, in 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.

#

please guide thanks


Solution

  • Apparently, the SoftLayer_Product_Order::placeOrder method doesn't identify the type of container that you are sending, try to add a complexType property, try this please:

    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)