Skip to content

Commit 6a7b920

Browse files
Merge pull request #692 from softlayer/issues690
Added an example of how to convert a portal order to cli order
2 parents eba25e7 + 65a9a47 commit 6a7b920

File tree

3 files changed

+78
-4
lines changed

3 files changed

+78
-4
lines changed

content/article/understanding-ordering.md

Lines changed: 77 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ In version 5.4.0 of [softlayer-python](https://github.com/softlayer/softlayer-py
2222
* Place an order programmatically using Python.
2323

2424

25-
## Build an order
25+
## [Build an order](#build_order) {#build_order .anchor-link}
2626

2727
### Step 1: Understand the order structure
2828

@@ -352,7 +352,7 @@ This action will incur charges on your account. Continue? [y/N]: y
352352
We now have ordered a bare metal server!
353353

354354

355-
## Place an order programmatically with Python
355+
## [Place an order programmatically with Python](#with_python) {#with_python .anchor-link}
356356

357357
Now that we have used the CLI to build an order with the package and items that we want, we can convert this order to Python code and programmatically place the order.
358358

@@ -615,7 +615,7 @@ curl -u $SL_USER:$SL_APIKEY -X POST -H "Accept: */*" -H "Accept-Encoding: gzip,
615615
```
616616

617617

618-
## Step by Step Example with ibmcloud CLI
618+
## [Step by Step Example with ibmcloud CLI](#step_by_step) {#step_by_step .anchor-link}
619619
These commands will use the `ibmcloud sl` command, but it works the same way as `slcli`. The only big difference is `ibmcloud` requires Items be a comma seperated list, where `slcli` requires them be space seperated.
620620

621621
Here we want to order a Cascade Lake Dual Xeon server.
@@ -696,4 +696,78 @@ ibmcloud sl order place DUAL_INTEL_XEON_PROCESSOR_CASCADE_LAKE_SCALABLE_FAMILY_4
696696

697697
```
698698
slcli order place DUAL_INTEL_XEON_PROCESSOR_CASCADE_LAKE_SCALABLE_FAMILY_4_DRIVES DALLAS13 INTEL_XEON_4210_2_20 RAM_32_GB_DDR4_2133_ECC_NON_REG OS_DEBIAN_10_X_BUSTER_MINIMAL_64_BIT 1_GBPS_REDUNDANT_PUBLIC_PRIVATE_NETWORK_UPLINKS DISK_CONTROLLER_RAID HARD_DRIVE_2_00_TB_SATA_2 HARD_DRIVE_2_00_TB_SATA_2 BANDWIDTH_1000_GB REBOOT_KVM_OVER_IP 1_IP_ADDRESS UNLIMITED_SSL_VPN_USERS_1_PPTP_VPN_USER_PER_ACCOUNT NOTIFICATION_EMAIL_AND_TICKET MONITORING_HOST_PING AUTOMATED_NOTIFICATION --complex-type SoftLayer_Container_Product_Order_Hardware_Server --extras '{"hardware":[{"hostname":"cgallo-test","domain":"cgallo.com","primaryBackendNetworkComponent": {"networkVlan": {"primarySubnet":{"id": 1942931}}},"primaryNetworkComponent": {"networkVlan": {"id": 2848660}}}],"storageGroups":[{"arrayTypeId": 2,"arraySize": 2000,"hardDrives": [0,1],"partitionTemplateId": 1}],"sshKeys": [{"sshKeyIds":[87634,92868]}],"provisionScripts": ["https://pastebin.com/raw/SCp607Tm"]}' --billing monthly --verify
699+
```
700+
701+
702+
## [Portal to CLI](#portal_to_cli) {#portal_to_cli .anchor-link}
703+
704+
705+
Lets say you are ordering a server, and want to automate it. For this example, we will build a server that looks like this:
706+
![2U_QUAD_XEON_PROCESSOR_CASCADE_LAKE_SCALABLE_FAMILY_24_DRIVES](/img/articles/orderExampleCascadeLake.png)
707+
708+
Most of the information you need to build an API order is on the order form already. The only thing you need to know is that the [Intel Xeon 8260](https://www.intel.com/content/www/us/en/products/sku/192474/intel-xeon-platinum-8260-processor-35-75m-cache-2-40-ghz/specifications.html?wapkw=8260) is a Cascade Lake class of processor, so when you look for packages, that is the keyword you will search for.
709+
710+
1. Find the package:
711+
```bash
712+
$> slcli order package-list | grep -i cascade
713+
1105 Dual Intel Xeon Processor Cascade Lake Scalable Family (4 Drives) DUAL_INTEL_XEON_PROCESSOR_CASCADE_LAKE_SCALABLE_FAMILY_4_DRIVES BARE_METAL_CPU
714+
1107 Dual Intel Xeon Processor Cascade Lake Scalable Family (12 Drives) DUAL_INTEL_XEON_PROC_CASCADE_LAKE_SCALABLE_FAMILY_12_DRIVES BARE_METAL_CPU
715+
1111 Cascade Lake for VMware vSAN QualifiedNode (12 Drives) 2U_CASCADE_LAKE_FOR_VMWARE_VSAN_QUALIFIEDNODE BARE_METAL_CPU
716+
1113 Quad Xeon Processor Cascade Lake Scalable Family (24 Drives) 2U_QUAD_XEON_PROCESSOR_CASCADE_LAKE_SCALABLE_FAMILY_24_DRIVES BARE_METAL_CPU
717+
2670 Cascade Lake for VMware vSAN QualifiedNode (24 Drives) 2U_VMWARE_VSAN_QUALIFIEDNODE BARE_METAL_CPU
718+
2692 Dual Xeon Proc Cascade Lake Multi-GPU Family (24 Drives) 4U_DUAL_XEON_PROC_CASCADE_LAKE_MULTIGPU_FAMILY_24_DRIVES BARE_METAL_CPU
719+
2708 CVAD Dual Intel Xeon Processor Cascade Lake Scalable Family (12 Drives) CVAD_DUAL_INTEL_XEON_PROCESSOR_CASCADE_LAKE_SCALABLE_12_DRIVES BARE_METAL_CPU
720+
2710 CVAD Dual Intel Xeon Processor Cascade Lake Scalable Family (4 Drives) CVAD_DUAL_INTEL_XEON_PROCESSOR_CASCADE_LAKE_SCALABLE_4_DRIVES BARE_METAL_CPU
721+
2796 Cascade Lake for VMware vSAN QualifiedNode (4 Drives) 1U_CASCADE_LAKE_FOR_VMWARE_VSAN_QUALIFIEDNODE BARE_METAL_CPU
722+
2866 Oracle Application Cluster Cascade Lake Scalable Family (4 Drives) ORACLE_APPLICATION_CLUSTER_CASCADE_LAKE_SCALABLE_FAMILY_4_DRIVES BARE_METAL_CPU
723+
3110 Cascade Lake VMW PMEM Enabled 1.5TB-3TB (12 Drives) 2U_CASCADE_LAKE_VMW_PMEM_ENABLED_1_5TB_3TB_12_DRIVES BARE_METAL_CPU
724+
3116 Cascade Lake VMW PMEM Enabled 3TB-6TB (24 Drives) CASCADE_LAKE_VMW_PMEM_ENABLED_3TB6TB_24_DRIVES BARE_METAL_CPU
725+
```
726+
727+
We want the `2U_QUAD_XEON_PROCESSOR_CASCADE_LAKE_SCALABLE_FAMILY_24_DRIVES` package here since it has the `Quad Processor` and `Up to 24 Drives` mentioned on the order form.
728+
729+
2. Find all the items you need.
730+
```bash
731+
$> slcli order item-list 2U_QUAD_XEON_PROCESSOR_CASCADE_LAKE_SCALABLE_FAMILY_24_DRIVES
732+
```
733+
734+
We will need the following to match the order:
735+
736+
| Category | KeyName |
737+
| -------- | ------- |
738+
| bandwidth | BANDWIDTH_20000_GB |
739+
| disk0 | HARD_DRIVE_960GB_SSD_SED_5DWPD |
740+
| disk_controller | DISK_CONTROLLER_NONRAID |
741+
| monitoring | MONITORING_HOST_PING |
742+
| notification | NOTIFICATION_EMAIL_AND_TICKET |
743+
| os | OS_CENTOS_STREAM_9_X_64_BIT |
744+
| port_speed | 100_MBPS_REDUNDANT_PUBLIC_PRIVATE_NETWORK_UPLINKS |
745+
| power_supply | REDUNDANT_POWER_SUPPLY |
746+
| pri_ip_addresses | 1_IP_ADDRESS |
747+
| ram | RAM_384_GB_DDR4_2133_ECC_REG |
748+
| remote_management | REBOOT_KVM_OVER_IP |
749+
| response | AUTOMATED_NOTIFICATION |
750+
| server | INTEL_XEON_8260_2_4_96 |
751+
| vpn_management | UNLIMITED_SSL_VPN_USERS_1_PPTP_VPN_USER_PER_ACCOUNT |
752+
753+
3. Add it all and verify the order
754+
755+
(use `slcli -vvv order place` to see actual API calls this makes)
756+
```bash
757+
$> slcli order place 2U_QUAD_XEON_PROCESSOR_CASCADE_LAKE_SCALABLE_FAMILY_24_DRIVES DALLAS10 BANDWIDTH_20000_GB \
758+
HARD_DRIVE_960GB_SSD_SED_5DWPD DISK_CONTROLLER_NONRAID MONITORING_HOST_PING NOTIFICATION_EMAIL_AND_TICKET \
759+
OS_CENTOS_STREAM_9_X_64_BIT 100_MBPS_REDUNDANT_PUBLIC_PRIVATE_NETWORK_UPLINKS REDUNDANT_POWER_SUPPLY 1_IP_ADDRESS \
760+
RAM_384_GB_DDR4_2133_ECC_REG REBOOT_KVM_OVER_IP AUTOMATED_NOTIFICATION INTEL_XEON_8260_2_4_96 \
761+
UNLIMITED_SSL_VPN_USERS_1_PPTP_VPN_USER_PER_ACCOUNT \
762+
--verify --quantity 1 --billing monthly --complex-type SoftLayer_Container_Product_Order_Hardware_Server \
763+
--extras '{"hardware": [{"hostname": "baremetal01", "domain": "ibmcloud.private"}]}'
764+
```
765+
766+
To make this into a pure API call, use the output of `slcli -vvv order place` and the slcli will convert the item keynames into the required priceIds needed for [SoftLayer_Product_Order::placeOrder()](https://sldn.softlayer.com/reference/services/SoftLayer_Product_Order/placeOrder/)
767+
768+
```bash
769+
$> curl -u $SL_USER:$SL_APIKEY -X POST -H "Accept: */*" -H "Accept-Encoding: gzip, deflate, compress" -d '{"parameters": [{"orderContainers": [{"hardware": [{"hostname": "baremetal01", "domain":
770+
"ibmcloud.private"}], "packageId": 1113, "quantity": 1, "location": 1441195, "useHourlyPricing": false, "complexType": "SoftLayer_Container_Product_Order_Hardware_Server", "prices": [{"id": 342}, {"id":
771+
230475}, {"id": 876}, {"id": 55}, {"id": 57}, {"id": 307539}, {"id": 21513}, {"id": 50221}, {"id": 21}, {"id": 165785}, {"id": 906}, {"id": 58}, {"id": 254988}, {"id": 420}]}]}]}'
772+
'https://api.softlayer.com/rest/v3.1/SoftLayer_Product_Order/placeOrder.json'
699773
```

content/go/goroutines.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Goroutines, Pagination and the SoftLayer API"
33
description: "Describes some ways to implement concurrency in your golang applications when interacting with the SoftLayer API. A few examples and explanation of softlayer-go's features."
4-
date: "2024-0216"
4+
date: "2024-02-16"
55
tags:
66
- "cli"
77
- "sdk"
Loading

0 commit comments

Comments
 (0)