Changing extension name and namespace to csvmware

This commit is contained in:
Shivam Mittal 2020-02-21 16:57:01 +05:30
Родитель 3cf59ba07a
Коммит ead065215e
49 изменённых файлов: 175 добавлений и 175 удалений

Просмотреть файл

@ -10,12 +10,12 @@ You can also use the extension from Azure Cloud Shell.
[![](https://shell.azure.com/images/launchcloudshell.png "Launch Azure Cloud Shell")](https://shell.azure.com) [![](https://shell.azure.com/images/launchcloudshell.png "Launch Azure Cloud Shell")](https://shell.azure.com)
## Installing vmware-cs extension ## Installing csvmware extension
Install by the CLI command: Install by the CLI command:
``` ```
az extension add -n vmware-cs az extension add -n csvmware
``` ```
## Quick start ## Quick start
@ -49,10 +49,10 @@ az [group] [subgroup] [command] {parameters}
For usage and help content for any command, pass in the -h parameter, for example: For usage and help content for any command, pass in the -h parameter, for example:
``` ```
az cs-vmware -h az csvmware -h
Group Group
az cs-vmware : Manage Azure VMware Solution. az csvmware : Manage Azure VMware Solution.
This command group is in preview. It may be changed/removed in a future release. This command group is in preview. It may be changed/removed in a future release.
Subgroups: Subgroups:
private-cloud : Manage VMware private clouds. private-cloud : Manage VMware private clouds.
@ -62,7 +62,7 @@ Subgroups:
vm-template : Manage VMware virtual machine templates. vm-template : Manage VMware virtual machine templates.
``` ```
You can views the various commands and its usage here: [Microsoft docs](https://docs.microsoft.com/en-us/cli/azure/ext/vmware-cs/?view=azure-cli-latest). You can views the various commands and its usage here: [Microsoft docs](https://docs.microsoft.com/en-us/cli/azure/ext/csvmware/?view=azure-cli-latest).
This extension provides CLI commands to: This extension provides CLI commands to:
1. Create, list, show, update, delete, start, stop - VMware Virtual Machines by CloudSimple. You can update disks, nics, and the tags of a VM. More update capabilities would be supported in future releases. 1. Create, list, show, update, delete, start, stop - VMware Virtual Machines by CloudSimple. You can update disks, nics, and the tags of a VM. More update capabilities would be supported in future releases.
@ -74,7 +74,7 @@ This extension provides CLI commands to:
Extension can be removed using the following CLI command: Extension can be removed using the following CLI command:
``` ```
az extension remove -n vmware-cs az extension remove -n csvmware
``` ```

Просмотреть файл

@ -10,7 +10,7 @@ You can also use the extension from Azure Cloud Shell.
[![](https://shell.azure.com/images/launchcloudshell.png "Launch Azure Cloud Shell")](https://shell.azure.com) [![](https://shell.azure.com/images/launchcloudshell.png "Launch Azure Cloud Shell")](https://shell.azure.com)
## Installing vmware-cs extension ## Installing csvmware extension
Download the [whl file](https://github.com/Azure/az-vmware-cli/blob/no_provider_apis/azext_vmware_cs/vmware_cs-0.1.0-py2.py3-none-any.whl) for the extension. Download the [whl file](https://github.com/Azure/az-vmware-cli/blob/no_provider_apis/azext_vmware_cs/vmware_cs-0.1.0-py2.py3-none-any.whl) for the extension.
Install by the CLI command: Install by the CLI command:
@ -50,10 +50,10 @@ az [group] [subgroup] [command] {parameters}
For usage and help content for any command, pass in the -h parameter, for example: For usage and help content for any command, pass in the -h parameter, for example:
``` ```
az cs-vmware -h az csvmware -h
Group Group
az cs-vmware : Manage Azure VMware Solution. az csvmware : Manage Azure VMware Solution.
This command group is in preview. It may be changed/removed in a future release. This command group is in preview. It may be changed/removed in a future release.
Subgroups: Subgroups:
private-cloud : Manage VMware private clouds. private-cloud : Manage VMware private clouds.
@ -73,7 +73,7 @@ This extension provides CLI commands to:
Extension can be removed using the following CLI command: Extension can be removed using the following CLI command:
``` ```
az extension remove -n vmware-cs az extension remove -n csvmware
``` ```

Просмотреть файл

@ -6,7 +6,7 @@
from azure.cli.core import AzCommandsLoader from azure.cli.core import AzCommandsLoader
from azext_vmware_cs._help import helps # pylint: disable=unused-import from azext_csvmware._help import helps # pylint: disable=unused-import
class VmwareCsCommandsLoader(AzCommandsLoader): class VmwareCsCommandsLoader(AzCommandsLoader):
@ -16,17 +16,17 @@ class VmwareCsCommandsLoader(AzCommandsLoader):
def __init__(self, cli_ctx=None): def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType from azure.cli.core.commands import CliCommandType
vmware_cs_custom = CliCommandType(operations_tmpl='azext_vmware_cs.custom#{}') vmware_cs_custom = CliCommandType(operations_tmpl='azext_csvmware.custom#{}')
super(VmwareCsCommandsLoader, self).__init__(cli_ctx=cli_ctx, super(VmwareCsCommandsLoader, self).__init__(cli_ctx=cli_ctx,
custom_command_type=vmware_cs_custom) custom_command_type=vmware_cs_custom)
def load_command_table(self, args): def load_command_table(self, args):
from azext_vmware_cs.commands import load_command_table from azext_csvmware.commands import load_command_table
load_command_table(self, args) load_command_table(self, args)
return self.command_table return self.command_table
def load_arguments(self, command): def load_arguments(self, command):
from azext_vmware_cs._params import load_arguments from azext_csvmware._params import load_arguments
load_arguments(self, command) load_arguments(self, command)

Просмотреть файл

Просмотреть файл

@ -16,7 +16,7 @@ def cf_vmware_cs(cli_ctx, *_):
# This vendored_sdk import is temporary. Import should be from published SDK # This vendored_sdk import is temporary. Import should be from published SDK
# TODO: Change when production SDK published. # TODO: Change when production SDK published.
from azext_vmware_cs.vendored_sdks import VMwareCloudSimpleClient from azext_csvmware.vendored_sdks import VMwareCloudSimpleClient
from ._config import REFERER from ._config import REFERER
return get_mgmt_service_client(cli_ctx, return get_mgmt_service_client(cli_ctx,

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -9,17 +9,17 @@ This file contains the help strings (summaries and examples) for all commands an
from knack.help_files import helps # pylint: disable=unused-import from knack.help_files import helps # pylint: disable=unused-import
helps['cs-vmware'] = """ helps['csvmware'] = """
type: group type: group
short-summary: Manage Azure VMware Solution by CloudSimple. short-summary: Manage Azure VMware Solution by CloudSimple.
""" """
helps['cs-vmware vm'] = """ helps['csvmware vm'] = """
type: group type: group
short-summary: Manage VMware virtual machines. short-summary: Manage VMware virtual machines.
""" """
helps['cs-vmware vm create'] = """ helps['csvmware vm create'] = """
type: command type: command
short-summary: Create a VMware virtual machine. short-summary: Create a VMware virtual machine.
@ -47,278 +47,278 @@ helps['cs-vmware vm create'] = """
examples: examples:
- name: Creating a VM with default parameters from the vm template. - name: Creating a VM with default parameters from the vm template.
text: > text: >
az cs-vmware vm create -n MyVm -g MyResourceGroup -p MyPrivateCloud -r MyResourcePool --template MyVmTemplate az csvmware vm create -n MyVm -g MyResourceGroup -p MyPrivateCloud -r MyResourcePool --template MyVmTemplate
- name: Creating a VM and adding an extra nic to the VM with virtual network MyVirtualNetwork, adapter VMXNET3, that power ups on boot. - name: Creating a VM and adding an extra nic to the VM with virtual network MyVirtualNetwork, adapter VMXNET3, that power ups on boot.
The name entered in the nic is for identification purposes only, to see if such a nic name exists in the vm template, else a nic is created and a new name is assigned. The name entered in the nic is for identification purposes only, to see if such a nic name exists in the vm template, else a nic is created and a new name is assigned.
Lets say the vm template contains a nic with name "Network adapter 1". Lets say the vm template contains a nic with name "Network adapter 1".
text: > text: >
az cs-vmware vm create -n MyVm -g MyResourceGroup -p MyPrivateCloud -r MyResourcePool --template MyVmTemplate --nic name=NicNameWouldBeAssigned virtual-network=MyVirtualNetwork adapter=VMXNET3 power-on-boot=True az csvmware vm create -n MyVm -g MyResourceGroup -p MyPrivateCloud -r MyResourcePool --template MyVmTemplate --nic name=NicNameWouldBeAssigned virtual-network=MyVirtualNetwork adapter=VMXNET3 power-on-boot=True
- name: Customizing specific properties of a VM. Changing the number of cores to 2 and adapter of "Network adapter 1" nic to E1000E, from that specified in the template. All other properties would be defaulted from the template. - name: Customizing specific properties of a VM. Changing the number of cores to 2 and adapter of "Network adapter 1" nic to E1000E, from that specified in the template. All other properties would be defaulted from the template.
text: > text: >
az cs-vmware vm create -n MyVm -g MyResourceGroup -p MyPrivateCloud -r MyResourcePool --template MyVmTemplate --cores 2 --nic name="Network adapter 1" adapter=E1000E az csvmware vm create -n MyVm -g MyResourceGroup -p MyPrivateCloud -r MyResourcePool --template MyVmTemplate --cores 2 --nic name="Network adapter 1" adapter=E1000E
- name: Customizing specific properties of a VM. Changing the adapter of "Network adapter 1" nic to E1000E, from that specified in the template, and also adding another nic with virtual network MyVirtualNetwork, adapter VMXNET3, that power ups on boot. - name: Customizing specific properties of a VM. Changing the adapter of "Network adapter 1" nic to E1000E, from that specified in the template, and also adding another nic with virtual network MyVirtualNetwork, adapter VMXNET3, that power ups on boot.
text: > text: >
az cs-vmware vm create -n MyVm -g MyResourceGroup -p MyPrivateCloud -r MyResourcePool --template MyVmTemplate --nic name="Network adapter 1" adapter=E1000E --nic name=NicNameWouldBeAssigned virtual-network=MyVirtualNetwork adapter=VMXNET3 power-on-boot=True az csvmware vm create -n MyVm -g MyResourceGroup -p MyPrivateCloud -r MyResourcePool --template MyVmTemplate --nic name="Network adapter 1" adapter=E1000E --nic name=NicNameWouldBeAssigned virtual-network=MyVirtualNetwork adapter=VMXNET3 power-on-boot=True
- name: Creating a VM and adding an extra disk to the VM with SCSI controller 0, persistent mode, and 41943040 KB size. - name: Creating a VM and adding an extra disk to the VM with SCSI controller 0, persistent mode, and 41943040 KB size.
The name entered in the disk is for identification purposes only, to see if such a disk name exists in the vm template, else a disk is created and a new name is assigned. The name entered in the disk is for identification purposes only, to see if such a disk name exists in the vm template, else a disk is created and a new name is assigned.
Lets say the vm template contains a disk with name "Hard disk 1". Lets say the vm template contains a disk with name "Hard disk 1".
text: > text: >
az cs-vmware vm create -n MyVm -g MyResourceGroup -p MyPrivateCloud -r MyResourcePool --template MyVmTemplate --disk name=DiskNameWouldBeAssigned controller=1000 mode=persistent size=41943040 az csvmware vm create -n MyVm -g MyResourceGroup -p MyPrivateCloud -r MyResourcePool --template MyVmTemplate --disk name=DiskNameWouldBeAssigned controller=1000 mode=persistent size=41943040
- name: Customizing specific properties of a VM. Changing the size of "Hard disk 1" disk to 21943040 KB, from that specified in the template, and also adding another disk with SCSI controller 0, persistent mode, and 41943040 KB size. - name: Customizing specific properties of a VM. Changing the size of "Hard disk 1" disk to 21943040 KB, from that specified in the template, and also adding another disk with SCSI controller 0, persistent mode, and 41943040 KB size.
text: > text: >
az cs-vmware vm create -n MyVm -g MyResourceGroup -p MyPrivateCloud -r MyResourcePool --template MyVmTemplate --disk name="Hard disk 1" size=21943040 --disk name=DiskNameWouldBeAssigned controller=1000 mode=persistent size=41943040 az csvmware vm create -n MyVm -g MyResourceGroup -p MyPrivateCloud -r MyResourcePool --template MyVmTemplate --disk name="Hard disk 1" size=21943040 --disk name=DiskNameWouldBeAssigned controller=1000 mode=persistent size=41943040
""" """
helps['cs-vmware vm list'] = """ helps['csvmware vm list'] = """
type: command type: command
short-summary: List details of VMware virtual machines in the current subscription. If resource group is specified, only the details of virtual machines in that resource group would be listed. short-summary: List details of VMware virtual machines in the current subscription. If resource group is specified, only the details of virtual machines in that resource group would be listed.
examples: examples:
- name: List details of VMware VMs in the current subscription. - name: List details of VMware VMs in the current subscription.
text: > text: >
az cs-vmware vm list az csvmware vm list
- name: List details of VMware VMs in a particular resource group. - name: List details of VMware VMs in a particular resource group.
text: > text: >
az cs-vmware vm list -g MyResourceGroup az csvmware vm list -g MyResourceGroup
""" """
helps['cs-vmware vm delete'] = """ helps['csvmware vm delete'] = """
type: command type: command
short-summary: Delete a VMware virtual machine. short-summary: Delete a VMware virtual machine.
examples: examples:
- name: Delete a VMware VM. - name: Delete a VMware VM.
text: > text: >
az cs-vmware vm delete -n MyVm -g MyResourceGroup az csvmware vm delete -n MyVm -g MyResourceGroup
""" """
helps['cs-vmware vm show'] = """ helps['csvmware vm show'] = """
type: command type: command
short-summary: Get the details of a VMware virtual machine. short-summary: Get the details of a VMware virtual machine.
examples: examples:
- name: Get the details of a VMware VM. - name: Get the details of a VMware VM.
text: > text: >
az cs-vmware vm show -n MyVm -g MyResourceGroup az csvmware vm show -n MyVm -g MyResourceGroup
""" """
helps['cs-vmware vm start'] = """ helps['csvmware vm start'] = """
type: command type: command
short-summary: Start a VMware virtual machine. short-summary: Start a VMware virtual machine.
examples: examples:
- name: Start a VMware VM. - name: Start a VMware VM.
text: > text: >
az cs-vmware vm start -n MyVm -g MyResourceGroup az csvmware vm start -n MyVm -g MyResourceGroup
""" """
helps['cs-vmware vm stop'] = """ helps['csvmware vm stop'] = """
type: command type: command
short-summary: Stop/Reboot/Suspend a VMware virtual machine. short-summary: Stop/Reboot/Suspend a VMware virtual machine.
examples: examples:
- name: Power off a VMware VM. - name: Power off a VMware VM.
text: > text: >
az cs-vmware vm stop -n MyVm -g MyResourceGroup --mode poweroff az csvmware vm stop -n MyVm -g MyResourceGroup --mode poweroff
- name: Restart a VMware VM. - name: Restart a VMware VM.
text: > text: >
az cs-vmware vm stop -n MyVm -g MyResourceGroup --mode reboot az csvmware vm stop -n MyVm -g MyResourceGroup --mode reboot
""" """
helps['cs-vmware vm update'] = """ helps['csvmware vm update'] = """
type: command type: command
short-summary: Update the tags field of a VMware virtual machine. short-summary: Update the tags field of a VMware virtual machine.
examples: examples:
- name: Add or update a tag. - name: Add or update a tag.
text: > text: >
az cs-vmware vm update -n MyVm -g MyResourceGroup --set tags.tagName=tagValue az csvmware vm update -n MyVm -g MyResourceGroup --set tags.tagName=tagValue
- name: Remove a tag. - name: Remove a tag.
text: > text: >
az cs-vmware vm update -n MyVm -g MyResourceGroup --remove tags.tagName az csvmware vm update -n MyVm -g MyResourceGroup --remove tags.tagName
""" """
helps['cs-vmware vm nic'] = """ helps['csvmware vm nic'] = """
type: group type: group
short-summary: Manage VMware virtual machine's Network Interface Cards. short-summary: Manage VMware virtual machine's Network Interface Cards.
""" """
helps['cs-vmware vm nic add'] = """ helps['csvmware vm nic add'] = """
type: command type: command
short-summary: Add NIC to a VMware virtual machine. short-summary: Add NIC to a VMware virtual machine.
examples: examples:
- name: Add a NIC with default parameters in a VM. - name: Add a NIC with default parameters in a VM.
text: > text: >
az cs-vmware vm nic add --vm-name MyVm -g MyResourceGroup --virtual-network MyVirtualNetwork az csvmware vm nic add --vm-name MyVm -g MyResourceGroup --virtual-network MyVirtualNetwork
- name: Add a NIC with E1000E adapter that powers on boot in a VM. - name: Add a NIC with E1000E adapter that powers on boot in a VM.
text: > text: >
az cs-vmware vm nic add --vm-name MyVm -g MyResourceGroup --virtual-network MyVirtualNetwork --adapter E1000E --power-on-boot true az csvmware vm nic add --vm-name MyVm -g MyResourceGroup --virtual-network MyVirtualNetwork --adapter E1000E --power-on-boot true
""" """
helps['cs-vmware vm nic list'] = """ helps['csvmware vm nic list'] = """
type: command type: command
short-summary: List details of NICs available on a VMware virtual machine. short-summary: List details of NICs available on a VMware virtual machine.
examples: examples:
- name: List details of NICs in a VM. - name: List details of NICs in a VM.
text: > text: >
az cs-vmware vm nic list --vm-name MyVm -g MyResourceGroup az csvmware vm nic list --vm-name MyVm -g MyResourceGroup
""" """
helps['cs-vmware vm nic show'] = """ helps['csvmware vm nic show'] = """
type: command type: command
short-summary: Get the details of a VMware virtual machine's NIC. short-summary: Get the details of a VMware virtual machine's NIC.
examples: examples:
- name: Get the details of a NIC in a VM. - name: Get the details of a NIC in a VM.
text: > text: >
az cs-vmware vm nic show --vm-name MyVm -g MyResourceGroup -n "My NIC Name" az csvmware vm nic show --vm-name MyVm -g MyResourceGroup -n "My NIC Name"
""" """
helps['cs-vmware vm nic delete'] = """ helps['csvmware vm nic delete'] = """
type: command type: command
short-summary: Delete NICs from a VM. short-summary: Delete NICs from a VM.
examples: examples:
- name: Delete two NICs from a VM. - name: Delete two NICs from a VM.
text: > text: >
az cs-vmware vm nic delete --vm-name MyVm -g MyResourceGroup --nics "My NIC Name 1" "My NIC Name 2" az csvmware vm nic delete --vm-name MyVm -g MyResourceGroup --nics "My NIC Name 1" "My NIC Name 2"
""" """
helps['cs-vmware vm disk'] = """ helps['csvmware vm disk'] = """
type: group type: group
short-summary: Manage VMware virtual machine's disks. short-summary: Manage VMware virtual machine's disks.
""" """
helps['cs-vmware vm disk add'] = """ helps['csvmware vm disk add'] = """
type: command type: command
short-summary: Add disk to a VMware virtual machine. short-summary: Add disk to a VMware virtual machine.
examples: examples:
- name: Add a disk with default parameters in a VM. - name: Add a disk with default parameters in a VM.
text: > text: >
az cs-vmware vm disk add --vm-name MyVm -g MyResourceGroup az csvmware vm disk add --vm-name MyVm -g MyResourceGroup
- name: Add a disk with SATA controller 0 and 64 GB memory in a VM. - name: Add a disk with SATA controller 0 and 64 GB memory in a VM.
text: > text: >
az cs-vmware vm disk add --vm-name MyVm -g MyResourceGroup --controller 15000 --size 67108864 az csvmware vm disk add --vm-name MyVm -g MyResourceGroup --controller 15000 --size 67108864
""" """
helps['cs-vmware vm disk list'] = """ helps['csvmware vm disk list'] = """
type: command type: command
short-summary: List details of disks available on a VMware virtual machine. short-summary: List details of disks available on a VMware virtual machine.
examples: examples:
- name: List details of disks in a VM. - name: List details of disks in a VM.
text: > text: >
az cs-vmware vm disk list --vm-name MyVm -g MyResourceGroup az csvmware vm disk list --vm-name MyVm -g MyResourceGroup
""" """
helps['cs-vmware vm disk show'] = """ helps['csvmware vm disk show'] = """
type: command type: command
short-summary: Get the details of a VMware virtual machine's disk. short-summary: Get the details of a VMware virtual machine's disk.
examples: examples:
- name: Get the details of a disk in a VM. - name: Get the details of a disk in a VM.
text: > text: >
az cs-vmware vm disk show --vm-name MyVm -g MyResourceGroup -n "My Disk Name" az csvmware vm disk show --vm-name MyVm -g MyResourceGroup -n "My Disk Name"
""" """
helps['cs-vmware vm disk delete'] = """ helps['csvmware vm disk delete'] = """
type: command type: command
short-summary: Delete disks from a VM. short-summary: Delete disks from a VM.
examples: examples:
- name: Delete two disks from a VM. - name: Delete two disks from a VM.
text: > text: >
az cs-vmware vm disk delete --vm-name MyVm -g MyResourceGroup --disks "My Disk Name 1" "My Disk Name 2" az csvmware vm disk delete --vm-name MyVm -g MyResourceGroup --disks "My Disk Name 1" "My Disk Name 2"
""" """
helps['cs-vmware vm-template'] = """ helps['csvmware vm-template'] = """
type: group type: group
short-summary: Manage VMware virtual machine templates. short-summary: Manage VMware virtual machine templates.
""" """
helps['cs-vmware vm-template list'] = """ helps['csvmware vm-template list'] = """
type: command type: command
short-summary: List details of VMware virtual machines templates in a private cloud. short-summary: List details of VMware virtual machines templates in a private cloud.
examples: examples:
- name: List details of VM templates. - name: List details of VM templates.
text: > text: >
az cs-vmware vm-template list -p MyPrivateCloud -r MyResourcePool --location eastus az csvmware vm-template list -p MyPrivateCloud -r MyResourcePool --location eastus
""" """
helps['cs-vmware vm-template show'] = """ helps['csvmware vm-template show'] = """
type: command type: command
short-summary: Get the details of a VMware virtual machines template in a private cloud. short-summary: Get the details of a VMware virtual machines template in a private cloud.
examples: examples:
- name: Get the details of a VM template. - name: Get the details of a VM template.
text: > text: >
az cs-vmware vm-template show -n MyVmTemplate -p MyPrivateCloud --location eastus az csvmware vm-template show -n MyVmTemplate -p MyPrivateCloud --location eastus
""" """
helps['cs-vmware virtual-network'] = """ helps['csvmware virtual-network'] = """
type: group type: group
short-summary: Manage virtual networks. short-summary: Manage virtual networks.
""" """
helps['cs-vmware virtual-network list'] = """ helps['csvmware virtual-network list'] = """
type: command type: command
short-summary: List details of available virtual networks in a private cloud. short-summary: List details of available virtual networks in a private cloud.
examples: examples:
- name: List details of virtual networks. - name: List details of virtual networks.
text: > text: >
az cs-vmware virtual-network list -p MyPrivateCloud -r MyResourcePool --location eastus az csvmware virtual-network list -p MyPrivateCloud -r MyResourcePool --location eastus
""" """
helps['cs-vmware virtual-network show'] = """ helps['csvmware virtual-network show'] = """
type: command type: command
short-summary: Get the details of a virtual network in a private cloud. short-summary: Get the details of a virtual network in a private cloud.
examples: examples:
- name: Get the details of a virtual network. - name: Get the details of a virtual network.
text: > text: >
az cs-vmware virtual-network show -n MyVirtualNetwork -p MyPrivateCloud --location eastus az csvmware virtual-network show -n MyVirtualNetwork -p MyPrivateCloud --location eastus
""" """
helps['cs-vmware private-cloud'] = """ helps['csvmware private-cloud'] = """
type: group type: group
short-summary: Manage VMware private clouds. short-summary: Manage VMware private clouds.
""" """
helps['cs-vmware private-cloud list'] = """ helps['csvmware private-cloud list'] = """
type: command type: command
short-summary: List details of private clouds in a region. short-summary: List details of private clouds in a region.
examples: examples:
- name: List details of private clouds in East US. - name: List details of private clouds in East US.
text: > text: >
az cs-vmware private-cloud list --location eastus az csvmware private-cloud list --location eastus
""" """
helps['cs-vmware private-cloud show'] = """ helps['csvmware private-cloud show'] = """
type: command type: command
short-summary: Get the details of a private cloud in a region. short-summary: Get the details of a private cloud in a region.
examples: examples:
- name: Get the details of a private cloud which is in East US. - name: Get the details of a private cloud which is in East US.
text: > text: >
az cs-vmware private-cloud show -n MyPrivateCloud --location eastus az csvmware private-cloud show -n MyPrivateCloud --location eastus
""" """
helps['cs-vmware resource-pool'] = """ helps['csvmware resource-pool'] = """
type: group type: group
short-summary: Manage VMware resource pools. short-summary: Manage VMware resource pools.
""" """
helps['cs-vmware resource-pool list'] = """ helps['csvmware resource-pool list'] = """
type: command type: command
short-summary: List details of resource pools in a private cloud. short-summary: List details of resource pools in a private cloud.
examples: examples:
- name: List details of resource pools. - name: List details of resource pools.
text: > text: >
az cs-vmware resource-pool list -p MyPrivateCloud --location eastus az csvmware resource-pool list -p MyPrivateCloud --location eastus
""" """
helps['cs-vmware resource-pool show'] = """ helps['csvmware resource-pool show'] = """
type: command type: command
short-summary: Get the details of a resource pool in a private cloud. short-summary: Get the details of a resource pool in a private cloud.
examples: examples:
- name: Get the details of a resource pool. - name: Get the details of a resource pool.
text: > text: >
az cs-vmware resource-pool show -n MyResourcePool -p MyPrivateCloud --location eastus az csvmware resource-pool show -n MyResourcePool -p MyPrivateCloud --location eastus
""" """

Просмотреть файл

@ -13,7 +13,7 @@ from azure.cli.core.commands.parameters import (resource_group_name_type,
tags_type, tags_type,
get_enum_type, get_enum_type,
get_three_state_flag) get_three_state_flag)
from azext_vmware_cs.vendored_sdks.models import (StopMode, from azext_csvmware.vendored_sdks.models import (StopMode,
NICType, NICType,
DiskIndependenceMode) DiskIndependenceMode)
from ._validators import (private_cloud_name_or_id_validator, from ._validators import (private_cloud_name_or_id_validator,
@ -35,13 +35,13 @@ def load_arguments(self, _):
Load argument method of command loader. Load argument method of command loader.
""" """
with self.argument_context('cs-vmware') as c: with self.argument_context('csvmware') as c:
c.argument('resource_group_name', arg_type=resource_group_name_type) c.argument('resource_group_name', arg_type=resource_group_name_type)
c.argument('tags', arg_type=tags_type) c.argument('tags', arg_type=tags_type)
c.argument('location', get_location_type(self.cli_ctx), validator=location_validator, c.argument('location', get_location_type(self.cli_ctx), validator=location_validator,
help="Region in which the private cloud is present. If default location is not configured, will default to the resource group\'s location.") help="Region in which the private cloud is present. If default location is not configured, will default to the resource group\'s location.")
with self.argument_context('cs-vmware vm') as c: with self.argument_context('csvmware vm') as c:
c.argument('vm_name', options_list=['--name', '-n'], c.argument('vm_name', options_list=['--name', '-n'],
help="Name of the virtual machine.", help="Name of the virtual machine.",
validator=vm_name_validator, validator=vm_name_validator,
@ -74,7 +74,7 @@ def load_arguments(self, _):
c.argument('disks', options_list=['--disk'], action=AddDiskAction, arg_group='Storage', nargs='+') c.argument('disks', options_list=['--disk'], action=AddDiskAction, arg_group='Storage', nargs='+')
with self.argument_context('cs-vmware vm nic') as c: with self.argument_context('csvmware vm nic') as c:
c.argument('vm_name', options_list=['--vm-name'], c.argument('vm_name', options_list=['--vm-name'],
help="Name of the virtual machine.", help="Name of the virtual machine.",
validator=vm_name_validator, validator=vm_name_validator,
@ -92,7 +92,7 @@ def load_arguments(self, _):
c.argument('nic_names', options_list=['--nics'], nargs='+', arg_group='Network', c.argument('nic_names', options_list=['--nics'], nargs='+', arg_group='Network',
help="Names of NICs.") help="Names of NICs.")
with self.argument_context('cs-vmware vm disk') as c: with self.argument_context('csvmware vm disk') as c:
c.argument('vm_name', options_list=['--vm-name'], c.argument('vm_name', options_list=['--vm-name'],
help="Name of the virtual machine.", help="Name of the virtual machine.",
validator=vm_name_validator, validator=vm_name_validator,
@ -110,7 +110,7 @@ def load_arguments(self, _):
c.argument('disk_names', options_list=['--disks'], nargs='+', arg_group='Storage', c.argument('disk_names', options_list=['--disks'], nargs='+', arg_group='Storage',
help="Names of disks.") help="Names of disks.")
with self.argument_context('cs-vmware vm-template') as c: with self.argument_context('csvmware vm-template') as c:
c.argument('private_cloud', options_list=['--private-cloud', '-p'], c.argument('private_cloud', options_list=['--private-cloud', '-p'],
validator=private_cloud_only_name_validator, validator=private_cloud_only_name_validator,
completer=get_resource_name_completion_list('Microsoft.VMwareCloudSimple/privateClouds'), completer=get_resource_name_completion_list('Microsoft.VMwareCloudSimple/privateClouds'),
@ -126,7 +126,7 @@ def load_arguments(self, _):
c.argument('location', get_location_type(self.cli_ctx), c.argument('location', get_location_type(self.cli_ctx),
help="Region in which the private cloud is present.") help="Region in which the private cloud is present.")
with self.argument_context('cs-vmware virtual-network') as c: with self.argument_context('csvmware virtual-network') as c:
c.argument('private_cloud', options_list=['--private-cloud', '-p'], c.argument('private_cloud', options_list=['--private-cloud', '-p'],
validator=private_cloud_only_name_validator, validator=private_cloud_only_name_validator,
completer=get_resource_name_completion_list('Microsoft.VMwareCloudSimple/privateClouds'), completer=get_resource_name_completion_list('Microsoft.VMwareCloudSimple/privateClouds'),
@ -141,7 +141,7 @@ def load_arguments(self, _):
c.argument('location', get_location_type(self.cli_ctx), c.argument('location', get_location_type(self.cli_ctx),
help="Region in which the private cloud is present.") help="Region in which the private cloud is present.")
with self.argument_context('cs-vmware resource-pool') as c: with self.argument_context('csvmware resource-pool') as c:
c.argument('private_cloud', options_list=['--private-cloud', '-p'], c.argument('private_cloud', options_list=['--private-cloud', '-p'],
validator=private_cloud_only_name_validator, validator=private_cloud_only_name_validator,
completer=get_resource_name_completion_list('Microsoft.VMwareCloudSimple/privateClouds'), completer=get_resource_name_completion_list('Microsoft.VMwareCloudSimple/privateClouds'),
@ -153,7 +153,7 @@ def load_arguments(self, _):
c.argument('location', get_location_type(self.cli_ctx), c.argument('location', get_location_type(self.cli_ctx),
help="Region in which the private cloud is present.") help="Region in which the private cloud is present.")
with self.argument_context('cs-vmware private-cloud') as c: with self.argument_context('csvmware private-cloud') as c:
c.argument('private_cloud', options_list=['--name', '-n'], c.argument('private_cloud', options_list=['--name', '-n'],
validator=private_cloud_only_name_validator, validator=private_cloud_only_name_validator,
completer=get_resource_name_completion_list('Microsoft.VMwareCloudSimple/privateClouds'), completer=get_resource_name_completion_list('Microsoft.VMwareCloudSimple/privateClouds'),

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -9,7 +9,7 @@ Here the commands are registered so that they can used in the CLI.
""" """
from azure.cli.core.commands import CliCommandType from azure.cli.core.commands import CliCommandType
from azext_vmware_cs._client_factory import (cf_vmware_cs, from azext_csvmware._client_factory import (cf_vmware_cs,
cf_virtual_machine, cf_virtual_machine,
cf_private_cloud, cf_private_cloud,
cf_resource_pool, cf_resource_pool,
@ -24,13 +24,13 @@ def load_command_table(self, _):
Load command table method of command loader. Load command table method of command loader.
""" """
custom_tmpl = 'azext_vmware_cs.custom#{}' custom_tmpl = 'azext_csvmware.custom#{}'
custom_type = CliCommandType(operations_tmpl=custom_tmpl) custom_type = CliCommandType(operations_tmpl=custom_tmpl)
with self.command_group('cs-vmware vm', client_factory=cf_vmware_cs) as g: with self.command_group('csvmware vm', client_factory=cf_vmware_cs) as g:
g.custom_command('create', 'create_vm', table_transformer=transform_vm_table_output, validator=vm_create_namespace_validator) g.custom_command('create', 'create_vm', table_transformer=transform_vm_table_output, validator=vm_create_namespace_validator)
with self.command_group('cs-vmware vm', client_factory=cf_virtual_machine) as g: with self.command_group('csvmware vm', client_factory=cf_virtual_machine) as g:
g.custom_command('list', 'list_vm', table_transformer=transform_vm_table_list) g.custom_command('list', 'list_vm', table_transformer=transform_vm_table_list)
g.custom_command('show', 'get_vm', table_transformer=transform_vm_table_output) g.custom_command('show', 'get_vm', table_transformer=transform_vm_table_output)
g.generic_update_command('update', getter_name='get_vm', setter_name='update_vm', g.generic_update_command('update', getter_name='get_vm', setter_name='update_vm',
@ -39,33 +39,33 @@ def load_command_table(self, _):
g.custom_command('start', 'start_vm') g.custom_command('start', 'start_vm')
g.custom_command('stop', 'stop_vm') g.custom_command('stop', 'stop_vm')
with self.command_group('cs-vmware vm disk', client_factory=cf_virtual_machine) as g: with self.command_group('csvmware vm disk', client_factory=cf_virtual_machine) as g:
g.custom_command('add', 'add_vdisk') g.custom_command('add', 'add_vdisk')
g.custom_command('show', 'show_vdisk') g.custom_command('show', 'show_vdisk')
g.custom_command('list', 'list_vdisks') g.custom_command('list', 'list_vdisks')
g.custom_command('delete', 'delete_vdisks') g.custom_command('delete', 'delete_vdisks')
with self.command_group('cs-vmware vm nic', client_factory=cf_virtual_machine) as g: with self.command_group('csvmware vm nic', client_factory=cf_virtual_machine) as g:
g.custom_command('add', 'add_vnic') g.custom_command('add', 'add_vnic')
g.custom_command('show', 'show_vnic') g.custom_command('show', 'show_vnic')
g.custom_command('list', 'list_vnics') g.custom_command('list', 'list_vnics')
g.custom_command('delete', 'delete_vnics') g.custom_command('delete', 'delete_vnics')
with self.command_group('cs-vmware vm-template', client_factory=cf_virtual_machine_template) as g: with self.command_group('csvmware vm-template', client_factory=cf_virtual_machine_template) as g:
g.custom_command('show', 'show_vm_template') g.custom_command('show', 'show_vm_template')
g.custom_command('list', 'list_vm_template') g.custom_command('list', 'list_vm_template')
with self.command_group('cs-vmware virtual-network', client_factory=cf_virtual_network) as g: with self.command_group('csvmware virtual-network', client_factory=cf_virtual_network) as g:
g.custom_command('show', 'show_virtual_network') g.custom_command('show', 'show_virtual_network')
g.custom_command('list', 'list_virtual_networks') g.custom_command('list', 'list_virtual_networks')
with self.command_group('cs-vmware resource-pool', client_factory=cf_resource_pool) as g: with self.command_group('csvmware resource-pool', client_factory=cf_resource_pool) as g:
g.custom_command('show', 'show_resource_pool') g.custom_command('show', 'show_resource_pool')
g.custom_command('list', 'list_resource_pool') g.custom_command('list', 'list_resource_pool')
with self.command_group('cs-vmware private-cloud', client_factory=cf_private_cloud) as g: with self.command_group('csvmware private-cloud', client_factory=cf_private_cloud) as g:
g.custom_command('list', 'list_private_cloud') g.custom_command('list', 'list_private_cloud')
g.custom_command('show', 'show_private_cloud') g.custom_command('show', 'show_private_cloud')
with self.command_group('cs-vmware', is_preview=True): with self.command_group('csvmware', is_preview=True):
pass pass

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -19,7 +19,7 @@ class VmwareCsScenarioTest(ScenarioTest):
""" """
Test for AVS by CloudSimple CLI commands. Test for AVS by CloudSimple CLI commands.
This tests various command exposed by CloudSimple CLI. This tests various command exposed by CloudSimple CLI.
To run the tests, run 'azdev test vmware-cs --discover --live' To run the tests, run 'azdev test csvmware --discover --live'
The prerequisites for the tests are that you should be logged in to a subscription in the CLI. The prerequisites for the tests are that you should be logged in to a subscription in the CLI.
That subscription should contain: That subscription should contain:
@ -50,43 +50,43 @@ class VmwareCsScenarioTest(ScenarioTest):
# Checking that invalid vm_name causes error # Checking that invalid vm_name causes error
with self.assertRaisesRegexp(CLIError, "Virtual machine name should only contain letters, numbers, or hyphen."): with self.assertRaisesRegexp(CLIError, "Virtual machine name should only contain letters, numbers, or hyphen."):
self.cmd('az vmware vm create -g {rg} -n invalid_name# --location {loc} --ram {ram} \ self.cmd('az csvmware vm create -g {rg} -n invalid_name# --location {loc} --ram {ram} \
--cores {cores} --private-cloud {pc} --template {vm_template} \ --cores {cores} --private-cloud {pc} --template {vm_template} \
--resource-pool {rp}') --resource-pool {rp}')
# Checking that if entered value for ram is float, it causes error # Checking that if entered value for ram is float, it causes error
with self.assertRaisesRegexp(CLIError, "RAM should be a postive integer value."): with self.assertRaisesRegexp(CLIError, "RAM should be a postive integer value."):
self.cmd('az vmware vm create -g {rg} -n {name} --location {loc} --ram 1024.5 \ self.cmd('az csvmware vm create -g {rg} -n {name} --location {loc} --ram 1024.5 \
--cores {cores} --private-cloud {pc} --template {vm_template} \ --cores {cores} --private-cloud {pc} --template {vm_template} \
--resource-pool {rp}') --resource-pool {rp}')
# Checking that if entered value for ram is 0, it causes error # Checking that if entered value for ram is 0, it causes error
with self.assertRaisesRegexp(CLIError, "RAM should be a postive integer value."): with self.assertRaisesRegexp(CLIError, "RAM should be a postive integer value."):
self.cmd('az vmware vm create -g {rg} -n {name} --location {loc} --ram 0 \ self.cmd('az csvmware vm create -g {rg} -n {name} --location {loc} --ram 0 \
--cores {cores} --private-cloud {pc} --template {vm_template} \ --cores {cores} --private-cloud {pc} --template {vm_template} \
--resource-pool {rp}') --resource-pool {rp}')
# Checking that if entered value for ram is negative, it causes error # Checking that if entered value for ram is negative, it causes error
with self.assertRaisesRegexp(CLIError, "RAM should be a postive integer value."): with self.assertRaisesRegexp(CLIError, "RAM should be a postive integer value."):
self.cmd('az vmware vm create -g {rg} -n {name} --location {loc} --ram -1024 \ self.cmd('az csvmware vm create -g {rg} -n {name} --location {loc} --ram -1024 \
--cores {cores} --private-cloud {pc} --template {vm_template} \ --cores {cores} --private-cloud {pc} --template {vm_template} \
--resource-pool {rp}') --resource-pool {rp}')
# Checking that if entered value for cores is float, it causes error # Checking that if entered value for cores is float, it causes error
with self.assertRaisesRegexp(CLIError, "Cores should be a postive integer value."): with self.assertRaisesRegexp(CLIError, "Cores should be a postive integer value."):
self.cmd('az vmware vm create -g {rg} -n {name} --location {loc} --ram {ram} \ self.cmd('az csvmware vm create -g {rg} -n {name} --location {loc} --ram {ram} \
--cores 1.5 --private-cloud {pc} --template {vm_template} \ --cores 1.5 --private-cloud {pc} --template {vm_template} \
--resource-pool {rp}') --resource-pool {rp}')
# Checking that if entered value for cores is 0, it causes error # Checking that if entered value for cores is 0, it causes error
with self.assertRaisesRegexp(CLIError, "Cores should be a postive integer value."): with self.assertRaisesRegexp(CLIError, "Cores should be a postive integer value."):
self.cmd('az vmware vm create -g {rg} -n {name} --location {loc} --ram {ram} \ self.cmd('az csvmware vm create -g {rg} -n {name} --location {loc} --ram {ram} \
--cores 0 --private-cloud {pc} --template {vm_template} \ --cores 0 --private-cloud {pc} --template {vm_template} \
--resource-pool {rp}') --resource-pool {rp}')
# Checking that if entered value for cores is negative, it causes error # Checking that if entered value for cores is negative, it causes error
with self.assertRaisesRegexp(CLIError, "Cores should be a postive integer value."): with self.assertRaisesRegexp(CLIError, "Cores should be a postive integer value."):
self.cmd('az vmware vm create -g {rg} -n {name} --location {loc} --ram {ram} \ self.cmd('az csvmware vm create -g {rg} -n {name} --location {loc} --ram {ram} \
--cores -1 --private-cloud {pc} --template {vm_template} \ --cores -1 --private-cloud {pc} --template {vm_template} \
--resource-pool {rp}') --resource-pool {rp}')
@ -107,11 +107,11 @@ class VmwareCsScenarioTest(ScenarioTest):
}) })
# Checking that the number of VM in our rg (used for testing) is 0. # Checking that the number of VM in our rg (used for testing) is 0.
count = len(self.cmd('az vmware vm list -g {rg}').get_output_in_json()) count = len(self.cmd('az csvmware vm list -g {rg}').get_output_in_json())
self.assertEqual(count, 0) self.assertEqual(count, 0)
# Creating a VM. Checking json to see if the operation succeeded. # Creating a VM. Checking json to see if the operation succeeded.
self.cmd('az vmware vm create -g {rg} -n {name} --location {loc} --ram {ram} \ self.cmd('az csvmware vm create -g {rg} -n {name} --location {loc} --ram {ram} \
--cores {cores} --private-cloud {pc} --template {vm_template} \ --cores {cores} --private-cloud {pc} --template {vm_template} \
--resource-pool {rp}', --resource-pool {rp}',
checks=[ checks=[
@ -123,11 +123,11 @@ class VmwareCsScenarioTest(ScenarioTest):
]) ])
# Checking that the number of VM in our rg (used for testing) is 1 now. # Checking that the number of VM in our rg (used for testing) is 1 now.
count = len(self.cmd('az vmware vm list -g {rg}').get_output_in_json()) count = len(self.cmd('az csvmware vm list -g {rg}').get_output_in_json())
self.assertEqual(count, 1) self.assertEqual(count, 1)
# Testing show command # Testing show command
self.cmd('az vmware vm show -g {rg} -n {name}', self.cmd('az csvmware vm show -g {rg} -n {name}',
checks=[ checks=[
self.check('provisioningState', 'Succeeded'), self.check('provisioningState', 'Succeeded'),
self.check('resourceGroup', '{rg}'), self.check('resourceGroup', '{rg}'),
@ -137,21 +137,21 @@ class VmwareCsScenarioTest(ScenarioTest):
]) ])
# Show as table # Show as table
self.cmd('az vmware vm show -g {rg} -n {name} -o table') self.cmd('az csvmware vm show -g {rg} -n {name} -o table')
# List as table # List as table
self.cmd('az vmware vm list -g {rg} -o table') self.cmd('az csvmware vm list -g {rg} -o table')
# Testing update command # Testing update command
self.cmd('az vmware vm update -g {rg} -n {name} --set tags.foo=boo', checks=[ self.cmd('az csvmware vm update -g {rg} -n {name} --set tags.foo=boo', checks=[
self.check('tags.foo', 'boo') self.check('tags.foo', 'boo')
]) ])
# Deleting a VM. # Deleting a VM.
self.cmd('az vmware vm delete -g {rg} -n {name}') self.cmd('az csvmware vm delete -g {rg} -n {name}')
# Checking that the number of VM in our rg is 0 now. # Checking that the number of VM in our rg is 0 now.
count = len(self.cmd('az vmware vm list -g {rg}').get_output_in_json()) count = len(self.cmd('az csvmware vm list -g {rg}').get_output_in_json())
self.assertEqual(count, 0) self.assertEqual(count, 0)
def test_vmware_cs_vm_create(self): def test_vmware_cs_vm_create(self):
@ -174,7 +174,7 @@ class VmwareCsScenarioTest(ScenarioTest):
}) })
# Creating a VM with default parameters from the vm template # Creating a VM with default parameters from the vm template
self.cmd('az vmware vm create -g {rg} -n {name1} -p {pc} --template {vm_template} -r {rp}', self.cmd('az csvmware vm create -g {rg} -n {name1} -p {pc} --template {vm_template} -r {rp}',
checks=[ checks=[
self.check('provisioningState', 'Succeeded'), self.check('provisioningState', 'Succeeded'),
self.check('resourceGroup', '{rg}'), self.check('resourceGroup', '{rg}'),
@ -189,7 +189,7 @@ class VmwareCsScenarioTest(ScenarioTest):
]) ])
# Creating a VM with default parameters from the vm template and adding a nic # Creating a VM with default parameters from the vm template and adding a nic
self.cmd('az vmware vm create -g {rg} -n {name2} \ self.cmd('az csvmware vm create -g {rg} -n {name2} \
-p {pc} --template {vm_template} -r {rp} \ -p {pc} --template {vm_template} -r {rp} \
--nic name=NicNameWouldBeReassigned virtual-network={vnet} \ --nic name=NicNameWouldBeReassigned virtual-network={vnet} \
adapter=VMXNET3 power-on-boot=True', adapter=VMXNET3 power-on-boot=True',
@ -212,7 +212,7 @@ class VmwareCsScenarioTest(ScenarioTest):
# Customizing specific properties of a VM. Changing the number of cores to 2 and adapter of # Customizing specific properties of a VM. Changing the number of cores to 2 and adapter of
# "Network adapter 1" nic to E1000E, from that specified in the template. # "Network adapter 1" nic to E1000E, from that specified in the template.
self.cmd('az vmware vm create -n {name3} -g {rg} -p {pc} -r {rp} --template {vm_template} \ self.cmd('az csvmware vm create -n {name3} -g {rg} -p {pc} -r {rp} --template {vm_template} \
--cores 2 --nic name="Network adapter 1" adapter=E1000E', --cores 2 --nic name="Network adapter 1" adapter=E1000E',
checks=[ checks=[
self.check('provisioningState', 'Succeeded'), self.check('provisioningState', 'Succeeded'),
@ -232,7 +232,7 @@ class VmwareCsScenarioTest(ScenarioTest):
# "Network adapter 1" nic to E1000E, from that specified in the # "Network adapter 1" nic to E1000E, from that specified in the
# template, and also adding another nic with virtual network # template, and also adding another nic with virtual network
# MyVirtualNetwork, adapter VMXNET3, that power ups on boot. # MyVirtualNetwork, adapter VMXNET3, that power ups on boot.
self.cmd('az vmware vm create -g {rg} -n {name4} \ self.cmd('az csvmware vm create -g {rg} -n {name4} \
-p {pc} --template {vm_template} -r {rp} \ -p {pc} --template {vm_template} -r {rp} \
--nic name="Network adapter 1" adapter=E1000E --nic \ --nic name="Network adapter 1" adapter=E1000E --nic \
name=NicNameWouldBeReassigned virtual-network={vnet} \ name=NicNameWouldBeReassigned virtual-network={vnet} \
@ -258,7 +258,7 @@ class VmwareCsScenarioTest(ScenarioTest):
# Creating a virtual machine and adding an extra disk # Creating a virtual machine and adding an extra disk
# to the VM with SCSI controller 0, persistent # to the VM with SCSI controller 0, persistent
# mode, and 41943040 KB size. # mode, and 41943040 KB size.
self.cmd('az vmware vm create -n {name5} -g {rg} -p {pc} -r {rp} --template {vm_template} \ self.cmd('az csvmware vm create -n {name5} -g {rg} -p {pc} -r {rp} --template {vm_template} \
--disk name=DiskNameWouldBeReassigned controller=1000 \ --disk name=DiskNameWouldBeReassigned controller=1000 \
mode=persistent size=41943040', mode=persistent size=41943040',
checks=[ checks=[
@ -282,7 +282,7 @@ class VmwareCsScenarioTest(ScenarioTest):
# from that specified in the template, and also adding # from that specified in the template, and also adding
# another disk with SCSI controller 0, # another disk with SCSI controller 0,
# persistent mode, and 41943040 KB size. # persistent mode, and 41943040 KB size.
self.cmd('az vmware vm create -g {rg} -n {name6} \ self.cmd('az csvmware vm create -g {rg} -n {name6} \
-p {pc} --template {vm_template} -r {rp} \ -p {pc} --template {vm_template} -r {rp} \
--disk name="Hard disk 1" size=21943040 --disk \ --disk name="Hard disk 1" size=21943040 --disk \
name=DiskNameWouldBeReassigned controller=1000 \ name=DiskNameWouldBeReassigned controller=1000 \
@ -305,12 +305,12 @@ class VmwareCsScenarioTest(ScenarioTest):
]) ])
# Deleting the VMs. # Deleting the VMs.
self.cmd('az vmware vm delete -g {rg} -n {name1}') self.cmd('az csvmware vm delete -g {rg} -n {name1}')
self.cmd('az vmware vm delete -g {rg} -n {name2}') self.cmd('az csvmware vm delete -g {rg} -n {name2}')
self.cmd('az vmware vm delete -g {rg} -n {name3}') self.cmd('az csvmware vm delete -g {rg} -n {name3}')
self.cmd('az vmware vm delete -g {rg} -n {name4}') self.cmd('az csvmware vm delete -g {rg} -n {name4}')
self.cmd('az vmware vm delete -g {rg} -n {name5}') self.cmd('az csvmware vm delete -g {rg} -n {name5}')
self.cmd('az vmware vm delete -g {rg} -n {name6}') self.cmd('az csvmware vm delete -g {rg} -n {name6}')
@ResourceGroupPreparer(name_prefix='cli_test_vmware_cs', parameter_name_for_location='eastus') @ResourceGroupPreparer(name_prefix='cli_test_vmware_cs', parameter_name_for_location='eastus')
def test_vmware_cs_vm_start_stop(self, resource_group): def test_vmware_cs_vm_start_stop(self, resource_group):
@ -329,58 +329,58 @@ class VmwareCsScenarioTest(ScenarioTest):
}) })
# Creating a VM. # Creating a VM.
self.cmd('az vmware vm create -g {rg} -n {name} --location {loc} --ram {ram} \ self.cmd('az csvmware vm create -g {rg} -n {name} --location {loc} --ram {ram} \
--cores {cores} --private-cloud {pc} --template {vm_template} \ --cores {cores} --private-cloud {pc} --template {vm_template} \
--resource-pool {rp}') --resource-pool {rp}')
# Testing that VM is in running state # Testing that VM is in running state
self.cmd('az vmware vm show -g {rg} -n {name}', self.cmd('az csvmware vm show -g {rg} -n {name}',
checks=[self.check('status', 'running')]) checks=[self.check('status', 'running')])
# Power off the VM # Power off the VM
self.cmd('az vmware vm stop -g {rg} -n {name} --mode poweroff') self.cmd('az csvmware vm stop -g {rg} -n {name} --mode poweroff')
# Testing that VM is in powered off state # Testing that VM is in powered off state
self.cmd('az vmware vm show -g {rg} -n {name}', self.cmd('az csvmware vm show -g {rg} -n {name}',
checks=[self.check('status', 'poweredoff')]) checks=[self.check('status', 'poweredoff')])
# Start the VM # Start the VM
self.cmd('az vmware vm start -g {rg} -n {name}') self.cmd('az csvmware vm start -g {rg} -n {name}')
# Testing that VM is in running state # Testing that VM is in running state
self.cmd('az vmware vm show -g {rg} -n {name}', self.cmd('az csvmware vm show -g {rg} -n {name}',
checks=[self.check('status', 'running')]) checks=[self.check('status', 'running')])
# Shut down the VM # Shut down the VM
self.cmd('az vmware vm stop -g {rg} -n {name} --mode shutdown') self.cmd('az csvmware vm stop -g {rg} -n {name} --mode shutdown')
# Testing that VM is in powered off state # Testing that VM is in powered off state
self.cmd('az vmware vm show -g {rg} -n {name}', self.cmd('az csvmware vm show -g {rg} -n {name}',
checks=[self.check('status', 'poweredoff')]) checks=[self.check('status', 'poweredoff')])
# Start the VM # Start the VM
self.cmd('az vmware vm start -g {rg} -n {name}') self.cmd('az csvmware vm start -g {rg} -n {name}')
# Testing that VM is in running state # Testing that VM is in running state
self.cmd('az vmware vm show -g {rg} -n {name}', self.cmd('az csvmware vm show -g {rg} -n {name}',
checks=[self.check('status', 'running')]) checks=[self.check('status', 'running')])
# Reboot the VM # Reboot the VM
self.cmd('az vmware vm stop -g {rg} -n {name} --mode reboot') self.cmd('az csvmware vm stop -g {rg} -n {name} --mode reboot')
# Testing that VM is in running state # Testing that VM is in running state
self.cmd('az vmware vm show -g {rg} -n {name}', self.cmd('az csvmware vm show -g {rg} -n {name}',
checks=[self.check('status', 'running')]) checks=[self.check('status', 'running')])
# Suspend the VM # Suspend the VM
self.cmd('az vmware vm stop -g {rg} -n {name} --mode suspend') self.cmd('az csvmware vm stop -g {rg} -n {name} --mode suspend')
# Testing that VM is in suspended state # Testing that VM is in suspended state
self.cmd('az vmware vm show -g {rg} -n {name}', self.cmd('az csvmware vm show -g {rg} -n {name}',
checks=[self.check('status', 'suspended')]) checks=[self.check('status', 'suspended')])
# Deleting the VM. # Deleting the VM.
self.cmd('az vmware vm delete -g {rg} -n {name}') self.cmd('az csvmware vm delete -g {rg} -n {name}')
@ResourceGroupPreparer(name_prefix='cli_test_vmware_cs', parameter_name_for_location='eastus') @ResourceGroupPreparer(name_prefix='cli_test_vmware_cs', parameter_name_for_location='eastus')
def test_vmware_vm_template_list_and_show(self, resource_group): def test_vmware_vm_template_list_and_show(self, resource_group):
@ -394,9 +394,9 @@ class VmwareCsScenarioTest(ScenarioTest):
'loc': 'eastus' 'loc': 'eastus'
}) })
self.cmd('az vmware vm-template list -p {pc} -r {rp} --location {loc}') self.cmd('az csvmware vm-template list -p {pc} -r {rp} --location {loc}')
self.cmd('az vmware vm-template show -p {pc} -n {vmtemplate} --location {loc}', self.cmd('az csvmware vm-template show -p {pc} -n {vmtemplate} --location {loc}',
checks=[ checks=[
self.check('guestOsType', 'linux'), self.check('guestOsType', 'linux'),
self.check('guestOs', 'Ubuntu Linux (64-bit)'), self.check('guestOs', 'Ubuntu Linux (64-bit)'),
@ -415,9 +415,9 @@ class VmwareCsScenarioTest(ScenarioTest):
'loc': 'eastus' 'loc': 'eastus'
}) })
self.cmd('az vmware virtual-network list -p {pc} -r {rp} --location {loc}') self.cmd('az csvmware virtual-network list -p {pc} -r {rp} --location {loc}')
self.cmd('az vmware virtual-network show -p {pc} -n {vnet} --location {loc}', self.cmd('az csvmware virtual-network show -p {pc} -n {vnet} --location {loc}',
checks=[ checks=[
self.check('name', 'Datacenter/Workload01'), self.check('name', 'Datacenter/Workload01'),
self.check('type', 'Microsoft.VMwareCloudSimple/virtualNetworks') self.check('type', 'Microsoft.VMwareCloudSimple/virtualNetworks')
@ -434,9 +434,9 @@ class VmwareCsScenarioTest(ScenarioTest):
'loc': 'eastus' 'loc': 'eastus'
}) })
self.cmd('az vmware resource-pool list -p {pc} --location {loc}') self.cmd('az csvmware resource-pool list -p {pc} --location {loc}')
self.cmd('az vmware resource-pool show -p {pc} -n {rp} --location {loc}', self.cmd('az csvmware resource-pool show -p {pc} -n {rp} --location {loc}',
checks=[ checks=[
self.check('location', 'eastus'), self.check('location', 'eastus'),
self.check('name', 'AzCLITest'), self.check('name', 'AzCLITest'),
@ -452,9 +452,9 @@ class VmwareCsScenarioTest(ScenarioTest):
'pc': 'avs-test-eastus', 'pc': 'avs-test-eastus',
'loc': 'eastus' 'loc': 'eastus'
}) })
self.cmd('az vmware private-cloud list --location {loc}') self.cmd('az csvmware private-cloud list --location {loc}')
self.cmd('az vmware private-cloud show -n {pc} --location {loc}', self.cmd('az csvmware private-cloud show -n {pc} --location {loc}',
checks=[ checks=[
self.check('location', 'eastus'), self.check('location', 'eastus'),
self.check('name', '{pc}') self.check('name', '{pc}')
@ -472,11 +472,11 @@ class VmwareCsScenarioTest(ScenarioTest):
}) })
# Creating a VM. # Creating a VM.
self.cmd('az vmware vm create -g {rg} -n {name} --location {loc} \ self.cmd('az csvmware vm create -g {rg} -n {name} --location {loc} \
--private-cloud {pc} --template {vm_template} --resource-pool {rp}') --private-cloud {pc} --template {vm_template} --resource-pool {rp}')
# Add a disk with the default values # Add a disk with the default values
self.cmd('az vmware vm disk add -g {rg} --vm-name {name}', self.cmd('az csvmware vm disk add -g {rg} --vm-name {name}',
checks=[ checks=[
self.check('disks | [1].controllerId', '1000'), self.check('disks | [1].controllerId', '1000'),
self.check('disks | [1].independenceMode', "persistent"), self.check('disks | [1].independenceMode', "persistent"),
@ -484,7 +484,7 @@ class VmwareCsScenarioTest(ScenarioTest):
]) ])
# Add a custom disk # Add a custom disk
self.cmd('az vmware vm disk add -g {rg} --vm-name {name} \ self.cmd('az csvmware vm disk add -g {rg} --vm-name {name} \
--mode independent_nonpersistent --size 8388608', --mode independent_nonpersistent --size 8388608',
checks=[ checks=[
self.check('disks | [2].controllerId', '1000'), self.check('disks | [2].controllerId', '1000'),
@ -493,7 +493,7 @@ class VmwareCsScenarioTest(ScenarioTest):
]) ])
# Show a disk # Show a disk
self.cmd('az vmware vm disk show -g {rg} --vm-name {name} -n "Hard disk 1"', self.cmd('az csvmware vm disk show -g {rg} --vm-name {name} -n "Hard disk 1"',
checks=[ checks=[
self.check('controllerId', '1000'), self.check('controllerId', '1000'),
self.check('independenceMode', "persistent"), self.check('independenceMode', "persistent"),
@ -502,24 +502,24 @@ class VmwareCsScenarioTest(ScenarioTest):
]) ])
# Checking that the number of disk in the VM is 3 now. # Checking that the number of disk in the VM is 3 now.
count = len(self.cmd('az vmware vm disk list -g {rg} \ count = len(self.cmd('az csvmware vm disk list -g {rg} \
--vm-name {name}').get_output_in_json()) --vm-name {name}').get_output_in_json())
self.assertEqual(count, 3) self.assertEqual(count, 3)
# Delete disks. Among the given disks, two disk are present in VM and one disk is absent. # Delete disks. Among the given disks, two disk are present in VM and one disk is absent.
# The present disk should be deleted, and an error for the absent disk should be displayed. # The present disk should be deleted, and an error for the absent disk should be displayed.
with self.assertRaisesRegexp(CLIError, "Hard disk 4 not present in the given virtual machine."): with self.assertRaisesRegexp(CLIError, "Hard disk 4 not present in the given virtual machine."):
self.cmd('az vmware vm disk delete -g {rg} --vm-name {name} \ self.cmd('az csvmware vm disk delete -g {rg} --vm-name {name} \
--disks "Hard disk 1" "Hard disk 2" "Hard disk 4"') --disks "Hard disk 1" "Hard disk 2" "Hard disk 4"')
# Polling till update operation is complete # Polling till update operation is complete
vm_status = self.cmd('az vmware vm show -g {rg} -n \ vm_status = self.cmd('az csvmware vm show -g {rg} -n \
{name}').get_output_in_json()["status"] {name}').get_output_in_json()["status"]
while vm_status == "updating": while vm_status == "updating":
vm_status = self.cmd('az vmware vm show -g {rg} -n \ vm_status = self.cmd('az csvmware vm show -g {rg} -n \
{name}').get_output_in_json()["status"] {name}').get_output_in_json()["status"]
self.cmd('az vmware vm disk add -g {rg} --vm-name {name} \ self.cmd('az csvmware vm disk add -g {rg} --vm-name {name} \
--mode independent_nonpersistent --size 8388608', --mode independent_nonpersistent --size 8388608',
checks=[ checks=[
self.check('disks | [1].controllerId', '1000'), self.check('disks | [1].controllerId', '1000'),
@ -528,12 +528,12 @@ class VmwareCsScenarioTest(ScenarioTest):
]) ])
# Checking that the number of disk in the VM is 2 now. # Checking that the number of disk in the VM is 2 now.
count = len(self.cmd('az vmware vm disk list -g {rg} \ count = len(self.cmd('az csvmware vm disk list -g {rg} \
--vm-name {name}').get_output_in_json()) --vm-name {name}').get_output_in_json())
self.assertEqual(count, 2) self.assertEqual(count, 2)
# Deleting the VM. # Deleting the VM.
self.cmd('az vmware vm delete -g {rg} -n {name}') self.cmd('az csvmware vm delete -g {rg} -n {name}')
def test_vmware_cs_vm_nic_apis(self): def test_vmware_cs_vm_nic_apis(self):
@ -548,11 +548,11 @@ class VmwareCsScenarioTest(ScenarioTest):
}) })
# Creating a VM. # Creating a VM.
self.cmd('az vmware vm create -g {rg} -n {name} --location {loc} \ self.cmd('az csvmware vm create -g {rg} -n {name} --location {loc} \
--private-cloud {pc} --template {vm_template} --resource-pool {rp}') --private-cloud {pc} --template {vm_template} --resource-pool {rp}')
# Add a nic with the default values # Add a nic with the default values
self.cmd('az vmware vm nic add -g {rg} --vm-name {name} --virtual-network {vnet}', self.cmd('az csvmware vm nic add -g {rg} --vm-name {name} --virtual-network {vnet}',
checks=[ checks=[
self.check('nics | [1].nicType', 'VMXNET3'), self.check('nics | [1].nicType', 'VMXNET3'),
self.check('nics | [1].powerOnBoot', None), self.check('nics | [1].powerOnBoot', None),
@ -560,7 +560,7 @@ class VmwareCsScenarioTest(ScenarioTest):
]) ])
# Add a custom nic # Add a custom nic
self.cmd('az vmware vm nic add -g {rg} --vm-name {name} \ self.cmd('az csvmware vm nic add -g {rg} --vm-name {name} \
--virtual-network {vnet} --adapter E1000 --power-on-boot false', --virtual-network {vnet} --adapter E1000 --power-on-boot false',
checks=[ checks=[
self.check('nics | [2].nicType', 'E1000'), self.check('nics | [2].nicType', 'E1000'),
@ -569,7 +569,7 @@ class VmwareCsScenarioTest(ScenarioTest):
]) ])
# Show a nic # Show a nic
self.cmd('az vmware vm nic show -g {rg} --vm-name {name} -n "Network adapter 1"', self.cmd('az csvmware vm nic show -g {rg} --vm-name {name} -n "Network adapter 1"',
checks=[ checks=[
self.check('nicType', 'VMXNET3'), self.check('nicType', 'VMXNET3'),
self.check('powerOnBoot', True), self.check('powerOnBoot', True),
@ -578,24 +578,24 @@ class VmwareCsScenarioTest(ScenarioTest):
]) ])
# Checking that the number of nics in the VM is 3 now. # Checking that the number of nics in the VM is 3 now.
count = len(self.cmd('az vmware vm nic list -g {rg} --vm-name {name}').get_output_in_json()) count = len(self.cmd('az csvmware vm nic list -g {rg} --vm-name {name}').get_output_in_json())
self.assertEqual(count, 3) self.assertEqual(count, 3)
# Delete nics. Among the given nics, two nics are present in VM and one nic is absent. # Delete nics. Among the given nics, two nics are present in VM and one nic is absent.
# The present nics should be deleted, and an error for the absent nic should be displayed. # The present nics should be deleted, and an error for the absent nic should be displayed.
with self.assertRaisesRegexp(CLIError, 'Network adapter 4 not present in the given virtual machine.'): with self.assertRaisesRegexp(CLIError, 'Network adapter 4 not present in the given virtual machine.'):
self.cmd('az vmware vm nic delete -g {rg} --vm-name {name} \ self.cmd('az csvmware vm nic delete -g {rg} --vm-name {name} \
--nics "Network adapter 1" "Network adapter 2" "Network adapter 4"') --nics "Network adapter 1" "Network adapter 2" "Network adapter 4"')
# Polling till update operation is complete # Polling till update operation is complete
vm_status = self.cmd('az vmware vm show -g {rg} -n \ vm_status = self.cmd('az csvmware vm show -g {rg} -n \
{name}').get_output_in_json()["status"] {name}').get_output_in_json()["status"]
while vm_status == "updating": while vm_status == "updating":
vm_status = self.cmd('az vmware vm show -g {rg} -n \ vm_status = self.cmd('az csvmware vm show -g {rg} -n \
{name}').get_output_in_json()["status"] {name}').get_output_in_json()["status"]
# Add a nic with the default values # Add a nic with the default values
self.cmd('az vmware vm nic add -g {rg} --vm-name {name} --virtual-network {vnet}', self.cmd('az csvmware vm nic add -g {rg} --vm-name {name} --virtual-network {vnet}',
checks=[ checks=[
self.check('nics | [1].nicType', 'VMXNET3'), self.check('nics | [1].nicType', 'VMXNET3'),
self.check('nics | [1].powerOnBoot', None), self.check('nics | [1].powerOnBoot', None),
@ -603,8 +603,8 @@ class VmwareCsScenarioTest(ScenarioTest):
]) ])
# Checking that the number of nics in the VM is 2 now. # Checking that the number of nics in the VM is 2 now.
count = len(self.cmd('az vmware vm nic list -g {rg} --vm-name {name}').get_output_in_json()) count = len(self.cmd('az csvmware vm nic list -g {rg} --vm-name {name}').get_output_in_json())
self.assertEqual(count, 2) self.assertEqual(count, 2)
# Deleting the VM. # Deleting the VM.
self.cmd('az vmware vm delete -g {rg} -n {name}') self.cmd('az csvmware vm delete -g {rg} -n {name}')

Просмотреть файл

@ -38,7 +38,7 @@ with open('HISTORY.rst', 'r', encoding='utf-8') as f:
HISTORY = f.read() HISTORY = f.read()
setup( setup(
name='vmware-cs', name='csvmware',
version=VERSION, version=VERSION,
description='Manage Azure VMware Solution by CloudSimple.', description='Manage Azure VMware Solution by CloudSimple.',
author='Shivam Mittal', author='Shivam Mittal',
@ -49,5 +49,5 @@ setup(
classifiers=CLASSIFIERS, classifiers=CLASSIFIERS,
packages=find_packages(), packages=find_packages(),
install_requires=DEPENDENCIES, install_requires=DEPENDENCIES,
package_data={'azext_vmware_cs': ['azext_metadata.json']}, package_data={'azext_csvmware': ['azext_metadata.json']},
) )