apiipv6ibm-cloud-infrastructurevirtual-server

Softlayer API: How do I add a condition to allocation an ipv6 address when buying a host?


I'm developing a project about softlayer API recently. Because the purchase of IPv6 alone must to pay. Now I wan't to allocation an free ipv6 address when buying a host. The current configuration of buy host is as follow:

vs_type = 'virtual_server'
vs_config = {
    'virtualGuests':[
        {
            'domain': 'a.com',
            'hostname': 'a-test-bandwidth-mouthly-pucharse',
        }
    ],
    'dataCenter': 'tok02',
    'hourlyBillingFlag': False,
    'imageType': 'public',
    'localDiskFlag': False,
    'maxMemory': 'RAM_1_GB',
    'networkComponents': 100,
    'operatingSystem': u'OS_CENTOS_5_X_MINIMAL_64_BIT',
    'privateNetworkOnlyFlag': False,
    'publicBandwidthCapacity': 'BANDWIDTH_250_GB',
    'quantity': 1,
    'startCpus': 'GUEST_CORE_1',
    'blockDevices': [
        {
            'capacity': 25,
            'device': 0
        }
    ]
}
result  = product_order_mgt.product_place_order(vs_type, vs_config)

regards~


Solution

  • You just need to specify the VLAN where you ipv6 has been created, take a look to the documetation of the method:

    http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/createObject

    you need to add this configuration to your payload

    { 
        "primaryNetworkComponent": { 
            "networkVlan": { 
                "id": 1 
            } 
        } 
    }
    

    The configuration is going to set the configuration for frontEnd network,make sure to use the VLAN id of your IPAddresV6.

    Also your server needs to have enable IPv6 Address enabled, when you ordered a server via control portal you can see that options

    enter image description here

    I am affraid that option cannot be set using the createObject Method you need to use the placeOrder method and specify the price for that option. I recommend you to read this article http://sldn.softlayer.com/blog/bpotter/Going-Further-SoftLayer-API-Python-Client-Part-3 in order to know more about the placeOrder method.

    In case you ordered a GLobal IP adddress please see this documentation about how to assing the IP to your server https://knowledgelayer.softlayer.com/learning/global-ip-addresses

    let me know if you have more questions

    Regards