Search code examples
pythonibm-cloud-infrastructure

Softlayer API for ordering Virtual Server


I want to order a Virtual Server in Softlayer using their API. I want to order a Windows box with VCenter installed on it. I see the VCenter as a System Add-on when I order the VS directly from the Softlayer customer portal. I cannot figure out how to pass the parameter for VCenter in the order parameters by using the Softlayer API. I am using the Softlayer Python API. Does anyone know how to do it? My order template looks like:

order = {
'complexType': 'SoftLayer_Container_Product_Order_Virtual_Guest', 
'quantity': 1,
'virtualGuests': [
      {
        'hostname': 'test', 
        'domain': 'example.com',
      }
],
'location': 'sanjose',
'packageId': 46, 
'useHourlyPricing': True,
'prices': [
           {'id': 1640},  # 1 x 2.0 GHz Core
           {'id': 1644},  # 1 GB RAM
           {'id':  905},  # Reboot / Remote Console
           {'id':  272},  # 10 Mbps Public & Private Networks
           {'id':  613},  # 1000 GB Bandwidth
           {'id':   21},  # 1 IP Address
           {'id': 2202},  # 25 GB (SAN)
           {'id': 1684},  # CentOS 5 - Minimal Install (32 bit)
           {'id':   55},  # Host Ping Monitoring
           {'id':   57},  # Email and Ticket Notifications
           {'id':   58},  # Automated Notification Response
           {'id':  420},  # Unlimited SSL VPN Users & 1 PPTP VPN User per account
           {'id':  418}
]
}                                    client['Product_Order'].verifyOrder(order);

Solution

  • If you wish to add the add-on in your order you just need to add the price of that add-on in your request. To get all the prices you can call the SoftLayer_Product_Package::getItems method http://sldn.softlayer.com/reference/services/SoftLayer_Product_Package/getItems

    or the SoftLayer_Product_Package::getItemPrices method

    please take a look to this documentation

    http://sldn.softlayer.com/blog/bpotter/Going-Further-SoftLayer-API-Python-Client-Part-3

    I hope it helps

    Regards