Skip to content

Conversation

@evelyn-ys
Copy link
Member

@evelyn-ys evelyn-ys commented Dec 8, 2020

Description

CLI support for databoxedge
This PR covers databoxedge operations which not involving encryption flow, including:

  • az databoxedge list-sku|list-node|show-job
  • az databoxedge device create|list|show|update|delete
  • az databoxedge device scan-for-update|show-update-summary|download-update|install-update
  • az databoxedge alert list|show
  • az databoxedge order create|list|show|update|delete
  • az databoxedge bandwidth-schedule create|list|show|update|delete

Testing Guide

Commands which don't need the device to be registered

See test cases

Commands which need the device registered

Preparation: Finish tutorial on prepare, install and activate

az databoxedge device scan-for-update -n testdevice -g myresourcegroup
az databoxedge device show-update-summary -n testdevice -g myresourcegroup
az databoxedge device download-update -n testdevice -g myresourcegroup
az databoxedge device download-update -n testdevice -g myresourcegroup
az databoxedge alert list -d testdevice -g myresourcegroup
az databoxedge alert show -n xxxxxxxxx -d testdevice -g myresourcegroup
az databoxedge bandwidth-schedule create -n mybandwidth -d testdevice -g myresourcegroup --days "Sunday" "Monday" --rate-in-mbps 100 --start "0:0:0" --stop "13:59:0"
az databoxedge bandwidth-schedule list -d testdevice -g myresourcegroup
az databoxedge bandwidth-schedule update -n mybandwidth-d testdevice -g myresourcegroup --rate-in-mbps 250
az databoxedge bandwidth-schedule show -n mybandwidth -d testdevice -g myresourcegroup
az databoxedge bandwidth-schedule delete-n mybandwidth -d testdevice -g myresourcegroup
az databoxedge list-node -d testdevice -g myresourcegroup
az databoxedge show-job -n xxxxxxxxx -d testdevice -g myresourcegroup

@yonzhan
Copy link
Collaborator

yonzhan commented Dec 8, 2020

Databoxedge

@yonzhan yonzhan added this to the S180 milestone Dec 8, 2020
Copy link
Contributor

@haroldrandom haroldrandom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

core. LGTM.

BTW, would DataboxEdge be better?

@evelyn-ys evelyn-ys changed the title [Databoxedge] new command module: support for data-box-edge devices and management [DataBoxEdge] new command module: support for data-box-edge devices and management Dec 9, 2020
MGMT_CONSUMPTION = ('azure.mgmt.consumption', None)
MGMT_CONTAINERINSTANCE = ('azure.mgmt.containerinstance', None)
MGMT_COSMOSDB = ('azure.mgmt.cosmosdb', None)
MGMT_DATABOXEDGE = ('azure.mgmt.databoxedge', None)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could specify the client name here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modified


def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from .generated._client_factory import cf_databoxedge_cl
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you still want to use generated code, right?
and we should avoid to use relative import

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modified


helps['databoxedge device install-update'] = """
type: command
short-summary: "Installs the updates on the Data Box Edge/Data Box Gateway device."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Installs -> Install

Copy link
Member Author

@evelyn-ys evelyn-ys Dec 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have overwrite all helps under manual folder

Comment on lines +239 to +242
helps['databoxedge'] = """
type: group
short-summary: Manage node with databoxedge
"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

c.argument('tags', tags_type)
c.argument('sku', action=AddSku, nargs='+', help='The SKU type.')
c.argument('etag', type=str, help='The etag for the devices.')
c.argument('data_box_edge_device_status', options_list=['--status'], arg_type=get_enum_type(['ReadyToSetup',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we get the enum type from sdk

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have asked @qiaozha for support, guess developing?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is enum definition in SDK, you could rewrite it now.
Getting from SDK could adjust with api version update.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

type: command
short-summary: "Downloads the updates on a Data Box Edge/Data Box Gateway device."
examples:
- name: DownloadUpdatesPost
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

such example name is not friendly

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have overwrite all helps under manual folder


helps['databoxedge device download-update'] = """
type: command
short-summary: "Downloads the updates on a Data Box Edge/Data Box Gateway device."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curious about the download-update work. which kind of updates could be downloaded?

Copy link
Member Author

@evelyn-ys evelyn-ys Dec 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Databoxedge device has many installed pkgs, so CX can run scan-for-update first, and then show-update-summary to check how many pkgs they can update. After download according to the summary using download-update, they can run install-update to finish updating the whole device.
So for you question, they actually download the updated pkg.

c.argument('start', type=str, help='The start time of the schedule in UTC.')
c.argument('stop', type=str, help='The stop time of the schedule in UTC.')
c.argument('rate_in_mbps', type=int, help='The bandwidth rate in Mbps.')
c.argument('days', nargs='+', help='The days of the week when this schedule is applicable.')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the days parameter is list array?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Users can create same bandwidth rule for several days, for example, 10mbps between 09:00:00 and 18:00:00 for both 'Saturday' and 'Sunday'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have test to cover such scenario?

Copy link
Member Author

@evelyn-ys evelyn-ys Dec 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To test bandwidth-schedule, the device need to be registered which need a vm prepared and some manual work on web page. So it's hard to record tests. But I do test this scenario with the vm service team provided.

c.argument('shipping_address_city', options_list=['--city'], type=str, help='The city name.')
c.argument('shipping_address_state', options_list=['--state'], type=str, help='The state name.')
c.argument('shipping_address_country', options_list=['--country'], type=str, help='The country name.')
c.argument('contact_information_contact_person', options_list=['--contact-person'], type=str, help='The '
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

group contact related arguments, too

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

- name: --sku
short-summary: "The SKU type."
long-summary: |
Usage: --sku name=XX tier=XX
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider if we could specify sku with only one property.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sku name can be 'Gateway' or 'Edge', the tier can be 'Standard' or something else. How can we specify with only one property?

databoxedge_device = CliCommandType(
operations_tmpl='azure.mgmt.databoxedge.operations._devices_operations#DevicesOperations.{}',
client_factory=cf_device)
with self.command_group('databoxedge device', databoxedge_device, client_factory=cf_device) as g:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add resource type and min_api for commands or arguments to make sure unsupported commands hidden in unsupported environment

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modified

@evelyn-ys evelyn-ys requested a review from Juliehzl December 21, 2020 02:23
short-summary: "Gets all the Data Box Edge/Data Box Gateway devices in a resource group. And Gets all the Data Box \
Edge/Data Box Gateway devices in a subscription."
examples:
- name: DataBoxEdgeDeviceGetByResourceGroup
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we refine the example name to be more friendly?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same for all

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all refined under /manual/_help.py

Usage: --sku name=XX tier=XX
name: SKU name.
tier: The SKU tier. This is based on the SKU name.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sku issue, it seems the tier is based on name. So I am thinking if we could get sku type with name only.
With current design, it is a little complicated for customer to define their sku and they have no idea for allowed value.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modified

Copy link
Contributor

@Juliehzl Juliehzl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@evelyn-ys evelyn-ys merged commit 8001d4b into Azure:dev Dec 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants