1
votes

I'm trying to do a dry-run for ordering a bare metal server using the Softlayer python API following the instructions here: http://sldn.softlayer.com/blog/bpotter/ordering-bare-metal-servers-using-softlayer-api and leveraging the sample code provided (https://gist.github.com/bmpotter/27913e92e9ff7b6b0c54). However, I keep getting this exception when doing a orderVerify():

SoftLayer_Exception_Public: The price for 64 GB RAM (#154399) is not valid for location dal10.

Here is price array I use for package 253:

prices = [
{'id': getItemPriceId(items, 'server', 'INTEL_XEON_2620_2_40')},
{'id': getItemPriceId(items, 'os', 'OS_UBUNTU_14_04_LTS_TRUSTY_TAHR_64_BIT')},
{'id': getItemPriceId(items, 'ram', 'RAM_64_GB_DDR3_1333_REG_2')},
{'id': getItemPriceId(items, 'disk_controller', 'DISK_CONTROLLER_RAID_1')},
{'id': getItemPriceId(items, 'disk0', 'HARD_DRIVE_1_00_TB_SATA_2')},
{'id': getItemPriceId(items, 'disk1', 'HARD_DRIVE_1_00_TB_SATA_2')},
{'id': getItemPriceId(items, 'disk2', 'HARD_DRIVE_1_00_TB_SATA_2')},
{'id': getItemPriceId(items, 'disk3', 'HARD_DRIVE_1_00_TB_SATA_2')},
{'id': getItemPriceId(items, 'port_speed', '10_GBPS_REDUNDANT_PRIVATE_NETWORK_UPLINKS')},
{'id': getItemPriceId(items, 'power_supply', 'REDUNDANT_POWER_SUPPLY')},
{'id': getItemPriceId(items, 'bandwidth', 'BANDWIDTH_0_GB')},
{'id': getItemPriceId(items, 'pri_ip_addresses', '1_IP_ADDRESS')},
{'id': getItemPriceId(items, 'remote_management', 'REBOOT_KVM_OVER_IP')},
{'id': getItemPriceId(items, 'vpn_management', 'UNLIMITED_SSL_VPN_USERS_1_PPTP_VPN_USER_PER_ACCOUNT')},
{'id': getItemPriceId(items, 'monitoring', 'MONITORING_HOST_PING_AND_TCP_SERVICE')},
{'id': getItemPriceId(items, 'notification', 'NOTIFICATION_EMAIL_AND_TICKET')},
{'id': getItemPriceId(items, 'response', 'AUTOMATED_NOTIFICATION')},
{'id': getItemPriceId(items, 'vulnerability_scanner', 'NESSUS_VULNERABILITY_ASSESSMENT_REPORTING')},
]

And the order info:

{'hardware': [{'domain': 'my.domain.com',
           'hostname': 'myHost'}],
 'location': 1441195,
 'packageId': 253,
 'prices': [{'id': 50635},
        {'id': 37652},
        {'id': 154399},
        {'id': 141957},
        {'id': 49811},
        {'id': 49811},
        {'id': 49811},
        {'id': 49811},
        {'id': 35685},
        {'id': 50223},
        {'id': 35963},
        {'id': 34807},
        {'id': 25014},
        {'id': 33483},
        {'id': 34241},
        {'id': 32500},
        {'id': 32627},
        {'id': 35310}],
 'quantity': 1}

I checked and RAM_64_GB_DDR3_1333_REG_2 is in the output of getOrderItemsDict(). Any ideas?

1

1 Answers

0
votes

There is a mistake with price: 154399, it is not valid for Dallas 10 datacenter (1441195), to get more information you can review the below link:

Location-based Pricing and You

You can try changing this price 49427(is a standard price which is valid for any datacenter) instead of 154399 in the order, for RAM_64_GB_DDR3_1333_REG_2


Retrieve packages (prices and locations) which contain specific items

"""
This script searches packages with its prices and locations according 
to items sent (it's necessary to send the item's keyName, it's possible 
to send more than one item to search)

Important links:
http://sldn.softlayer.com/reference/services/SoftLayer_Account/getActivePackages
http://sldn.softlayer.com/reference/services/SoftLayer_Product_Package/getItemPrices

License: http://sldn.softlayer.com/article/License
Author: SoftLayer Technologies, Inc. <[email protected]>
"""
import SoftLayer
from prettytable import PrettyTable

# Define your username and apiKey
USERNAME = 'set me'
API_KEY = 'set me'

# Items to search
items = ['INTEL_XEON_2620_2_40',
         'OS_UBUNTU_14_04_LTS_TRUSTY_TAHR_64_BIT',
         'RAM_64_GB_DDR3_1333_REG_2',
         'DISK_CONTROLLER_RAID_1',
         'HARD_DRIVE_1_00_TB_SATA_2',
         'HARD_DRIVE_1_00_TB_SATA_2',
         'HARD_DRIVE_1_00_TB_SATA_2',
         'HARD_DRIVE_1_00_TB_SATA_2',
         '10_GBPS_REDUNDANT_PRIVATE_NETWORK_UPLINKS',
         'REDUNDANT_POWER_SUPPLY',
         'BANDWIDTH_0_GB',
         '1_IP_ADDRESS',
         'REBOOT_KVM_OVER_IP',
         'UNLIMITED_SSL_VPN_USERS_1_PPTP_VPN_USER_PER_ACCOUNT',
         'MONITORING_HOST_PING_AND_TCP_SERVICE',
         'NOTIFICATION_EMAIL_AND_TICKET',
         'AUTOMATED_NOTIFICATION',
         'NESSUS_VULNERABILITY_ASSESSMENT_REPORTING']

# Declaring the API client
client = SoftLayer.Client(username=USERNAME, api_key=API_KEY)

# Declaring Account and Package services
accountService = client['SoftLayer_Account']
packageService = client['SoftLayer_Product_Package']

# objectFilter to get standard prices
objectFilter = {"itemPrices":{"locationGroupId":{"operation":"is null"}}}

# Counting the items
countItems = len(items)

try:
    packages = accountService.getActivePackages()
    for package in packages:
        itemsDisplay = ''
        pricesDisplay = ''
        prices = packageService.getItemPrices(id=package['id'], filter=objectFilter)
        count = 0
        for item in items:
            for price in prices:
                if price['item']['keyName'] == item:
                    itemsDisplay += str("%s\n" % price['item']['keyName'])
                    pricesDisplay += str("%s\n" % price['id'])
                    count = count + 1
        if count == countItems:
            table = PrettyTable(["PackageId", "Item(s)", "Price(s)", "Location(s)"])
            locations = packageService.getRegions(id=package['id'])
            locationDisplay = ''
            for location in locations:
                locationDisplay += str("Id: %s (%s)\n" % (location['location']['location']['id'], location['location']['location']['longName']))
            table.add_row([package['id'], itemsDisplay, pricesDisplay, locationDisplay])
            print(table)

except SoftLayer.SoftLayerAPIError as e:
    print(('Error faultCode=%s, faultString=%s'
    % (e.faultCode, e.faultString)))

Setting VLANS

"hardware": [  
   {  
      "hostname":"testhost",
      "domain":"softlayer.com",
      "primaryBackendNetworkComponent":{  
         "networkVlanId":971077
      },
      "primaryNetworkComponent":{  
         "networkVlanId":971075
      }
   }
]