Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 17 additions & 31 deletions SoftLayer/CLI/order/place.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,40 +42,26 @@ def cli(env, package_keyname, location, preset, verify, billing, complex_type,
quantity, extras, order_items):
"""Place or verify an order.

This CLI command is used for placing/verifying an order of the specified package in
the given location (denoted by a datacenter's long name). Orders made via the CLI
can then be converted to be made programmatically by calling
SoftLayer.OrderingManager.place_order() with the same keynames.

Packages for ordering can be retrieved from `slcli order package-list`
Presets for ordering can be retrieved from `slcli order preset-list` (not all packages
have presets)

Items can be retrieved from `slcli order item-list`. In order to find required
items for the order, use `slcli order category-list`, and then provide the
--category option for each category code in `slcli order item-list`.

\b
1. Find the package keyName from `slcli order package-list`
2. Find the location from `slcli order package-locations PUBLIC_CLOUD_SERVER`
If the package does not require a location, use 'NONE' instead.
3. Find the needed items `slcli order item-list PUBLIC_CLOUD_SERVER`
Some packages, like PUBLIC_CLOUD_SERVER need presets, `slcli order preset-list PUBLIC_CLOUD_SERVER`
4. Find the complex type from https://sldn.softlayer.com/reference
5. Use that complex type to fill out any --extras

Example::

# Order an hourly VSI with 4 CPU, 16 GB RAM, 100 GB SAN disk,
# Ubuntu 16.04, and 1 Gbps public & private uplink in dal13
slcli order place --billing hourly CLOUD_SERVER DALLAS13 \\
GUEST_CORES_4 \\
RAM_16_GB \\
REBOOT_REMOTE_CONSOLE \\
1_GBPS_PUBLIC_PRIVATE_NETWORK_UPLINKS \\
BANDWIDTH_0_GB_2 \\
1_IP_ADDRESS \\
GUEST_DISK_100_GB_SAN \\
OS_UBUNTU_16_04_LTS_XENIAL_XERUS_MINIMAL_64_BIT_FOR_VSI \\
MONITORING_HOST_PING \\
NOTIFICATION_EMAIL_AND_TICKET \\
AUTOMATED_NOTIFICATION \\
UNLIMITED_SSL_VPN_USERS_1_PPTP_VPN_USER_PER_ACCOUNT \\
NESSUS_VULNERABILITY_ASSESSMENT_REPORTING \\
--extras '{"virtualGuests": [{"hostname": "test", "domain": "softlayer.com"}]}' \\
--complex-type SoftLayer_Container_Product_Order_Virtual_Guest
slcli order place --verify --preset B1_2X8X100 --billing hourly
--complex-type SoftLayer_Container_Product_Order_Virtual_Guest
--extras '{"virtualGuests": [{"hostname": "test", "domain": "ibm.com"}]}'
PUBLIC_CLOUD_SERVER DALLAS13
BANDWIDTH_0_GB_2 MONITORING_HOST_PING NOTIFICATION_EMAIL_AND_TICKET
OS_DEBIAN_9_X_STRETCH_LAMP_64_BIT 1_IP_ADDRESS 1_IPV6_ADDRESS
1_GBPS_PUBLIC_PRIVATE_NETWORK_UPLINKS REBOOT_REMOTE_CONSOLE
AUTOMATED_NOTIFICATION UNLIMITED_SSL_VPN_USERS_1_PPTP_VPN_USER_PER_ACCOUNT
NESSUS_VULNERABILITY_ASSESSMENT_REPORTING

"""
manager = ordering.OrderingManager(env.client)
Expand Down
9 changes: 4 additions & 5 deletions SoftLayer/CLI/ticket/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,18 @@
def cli(env, title, subject_id, body, hardware_identifier, virtual_identifier, priority):
"""Create a Infrastructure support ticket.

Example::

Will create the ticket with `Some text`.
Will create the ticket with `Some text`.::

slcli ticket create --body="Some text" --subject-id 1522 --hardware 12345 --title "My New Ticket"

Will create the ticket with text from STDIN
Will create the ticket with text from STDIN::

cat sometfile.txt | slcli ticket create --subject-id 1003 --virtual 111111 --title "Reboot Me"

Will open the default text editor, and once closed, use that text to create the ticket
Will open the default text editor, and once closed, use that text to create the ticket::

slcli ticket create --subject-id 1482 --title "Vyatta Questions..."

"""
ticket_mgr = SoftLayer.TicketManager(env.client)
if body is None:
Expand Down
8 changes: 3 additions & 5 deletions SoftLayer/CLI/ticket/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,15 @@
def cli(env, identifier, body):
"""Adds an update to an existing ticket.

Example::

Will update the ticket with `Some text`.
Will update the ticket with `Some text`.::

slcli ticket update 123456 --body="Some text"

Will update the ticket with text from STDIN
Will update the ticket with text from STDIN::

cat sometfile.txt | slcli ticket update 123456

Will open the default text editor, and once closed, use that text to update the ticket
Will open the default text editor, and once closed, use that text to update the ticket::

slcli ticket update 123456
"""
Expand Down
3 changes: 3 additions & 0 deletions SoftLayer/managers/ordering.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,9 @@ def get_location_id(self, location):

if isinstance(location, int):
return location
# Some orders dont require a location, just use 0
if location.upper() == "NONE":
return 0
mask = "mask[id,name,regions[keyname]]"
if match(r'[a-zA-Z]{3}[0-9]{2}', location) is not None:
search = {'name': {'operation': location}}
Expand Down
4 changes: 2 additions & 2 deletions docs/cli/block.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ Block Commands
:show-nested:

.. click:: SoftLayer.CLI.block.refresh:cli
:prog block volume-refresh
:prog: block volume-refresh
:show-nested:

.. click:: SoftLayer.CLI.block.convert:cli
:prog block volume-convert
:prog: block volume-convert
:show-nested:

.. click:: SoftLayer.CLI.block.subnets.list:cli
Expand Down
4 changes: 2 additions & 2 deletions docs/cli/file.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ File Commands
:show-nested:

.. click:: SoftLayer.CLI.file.refresh:cli
:prog file volume-refresh
:prog: file volume-refresh
:show-nested:

.. click:: SoftLayer.CLI.file.convert:cli
:prog file volume-convert
:prog: file volume-convert
:show-nested:

.. click:: SoftLayer.CLI.file.snapshot.schedule_list:cli
Expand Down
11 changes: 6 additions & 5 deletions docs/cli/tickets.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
.. _cli_tickets:

Support Tickets
===============
=================

The SoftLayer ticket API is used to create "classic" or Infrastructure Support cases.
These tickets will still show up in your web portal, but for the more unified case management API,
see the `Case Management API <https://cloud.ibm.com/apidocs/case-management#introduction>`_
The SoftLayer ticket API is used to create "classic" or Infrastructure Support cases. These tickets will still show up in your web portal, but for the more unified case management API, see the `Case Management API <https://cloud.ibm.com/apidocs/case-management#introduction>`_

.. note::

Windows Git-Bash users might run into issues with `ticket create` and `ticket update` if --body isn't used, as it doesn't report that it is a real TTY to python, so the default editor can not be launched.

.. note:: Windows Git-Bash users might run into issues with `ticket create` and `ticket update` if --body isn't used, as it doesn't report that it is a real TTY to python, so the default editor can not be launched.

.. click:: SoftLayer.CLI.ticket.create:cli
:prog: ticket create
Expand Down
4 changes: 4 additions & 0 deletions tests/managers/ordering_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,10 @@ def test_get_location_id_int(self):
dc_id = self.ordering.get_location_id(1234)
self.assertEqual(1234, dc_id)

def test_get_location_id_NONE(self):
dc_id = self.ordering.get_location_id("NONE")
self.assertEqual(0, dc_id)

def test_location_group_id_none(self):
# RestTransport uses None for empty locationGroupId
category1 = {'categoryCode': 'cat1'}
Expand Down