Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jonathanhe/workload network #3910

Merged
merged 33 commits into from
Oct 12, 2021
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
722f956
added commands for workload-network dhcp
jonathanhe-msft Sep 8, 2021
b37281e
set limit of 3 on server_addresses and updated moved specific argumen…
jonathanhe-msft Sep 8, 2021
b1bbc2e
removed comments
jonathanhe-msft Sep 8, 2021
775dbb0
updated error type for server_messages validation
jonathanhe-msft Sep 9, 2021
38f86c9
removed comments and styling
jonathanhe-msft Sep 9, 2021
957199d
Merge branch 'main' into jonathanhe/workload-network
jonathanhe-msft Sep 10, 2021
31d213c
added dns-server commands
jonathanhe-msft Sep 10, 2021
abdeca0
added dns-zone commands
jonathanhe-msft Sep 14, 2021
834d297
allow dhcp server and relay calls with None parameters
jonathanhe-msft Sep 14, 2021
339bd77
Merge branch 'jonathanhe/workload-network' into jonathanhe/workload-n…
jonathanhe-msft Sep 14, 2021
99b4574
added workload_network dns-zone commands
jonathanhe-msft Sep 14, 2021
3c30cc1
Update src/vmware/CHANGELOG.md
zhoxing-ms Sep 15, 2021
9b2dec6
renamed dhcp test files to workload-network
jonathanhe-msft Sep 15, 2021
42bc120
merged with main
jonathanhe-msft Sep 15, 2021
0afef5f
Merge branch 'jonathanhe/workload-network' of https://github.com/jona…
jonathanhe-msft Sep 15, 2021
39708dc
added port-mirroring and renamed dhcp test file to workloadnetwork
jonathanhe-msft Sep 16, 2021
11f2334
updated changelog
jonathanhe-msft Sep 16, 2021
1b795ff
updated help and param text based on comments
jonathanhe-msft Sep 16, 2021
33c2876
fixed parameter typo
jonathanhe-msft Sep 21, 2021
c4616eb
workload-network segment public-ip and vm-group commands
jonathanhe-msft Sep 23, 2021
45baa66
merged with main
jonathanhe-msft Sep 23, 2021
9e84d8d
fixed merge issue
jonathanhe-msft Sep 23, 2021
4e13b13
updated merge
jonathanhe-msft Sep 23, 2021
d09f570
added workload-network vm and gateway commands'
jonathanhe-msft Sep 23, 2021
0813139
updated changelog
jonathanhe-msft Sep 23, 2021
37350bd
styling updates
jonathanhe-msft Sep 23, 2021
b566758
updated help texts
jonathanhe-msft Sep 23, 2021
18f8f64
Merge branch 'main' into jonathanhe/workload-network
jonathanhe-msft Sep 29, 2021
946973e
updated parameter name
jonathanhe-msft Sep 29, 2021
b71ae50
removed '-id' from parameters
jonathanhe-msft Oct 7, 2021
0a91334
Merge remote-tracking branch 'upstream/main' into jonathanhe/workload…
jonathanhe-msft Oct 7, 2021
f1ad9d3
fixed unit tests
jonathanhe-msft Oct 8, 2021
f4e0077
Merge branch 'main' into jonathanhe/workload-network
jonathanhe-msft Oct 8, 2021
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
5 changes: 5 additions & 0 deletions src/vmware/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
- Add `az vmware workload-network dns-service` command group
- Add `az vmware workload-network dns-zone` command group
- Add `az vmware workload-network port-mirroring` command group
- Add `az vmware workload-network segment` command group
- Add `az vmware workload-network public-ip` command group
- Add `az vmware workload-network vm-group` command group
- Add `az vmware workload-network vm` command group
- Add `az vmware workload-network gateway` command group

## 3.1.0 (2021-08)

Expand Down
169 changes: 169 additions & 0 deletions src/vmware/azext_vmware/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,3 +712,172 @@
- name: Delete a port mirroring profile by ID in a workload network.
text: az vmware workload-network port-mirroring delete --resource-group group1 --private-cloud cloud1 --port-mirroring-id portMirroring1
"""

helps['vmware workload-network segment'] = """
type: group
short-summary: Commands to manage a Segment workload network.
"""

helps['vmware workload-network segment list'] = """
type: command
short-summary: List of segments in a private cloud workload network.
examples:
- name: List of segments in a workload network.
text: az vmware workload-network segment list --resource-group group1 --private-cloud cloud1
"""

helps['vmware workload-network segment show'] = """
type: command
short-summary: Get a segment by ID in a private cloud workload network.
examples:
- name: Get a segment by ID in a workload network.
text: az vmware workload-network segment show --resource-group group1 --private-cloud cloud1 --segment-id segment1
"""

helps['vmware workload-network segment create'] = """
type: command
short-summary: Create a segment by ID in a private cloud workload network.
examples:
- name: Create a segment by ID in a workload network.
text: az vmware workload-network segment create --resource-group group1 --private-cloud cloud1 --segment-id segment1 --display-name segment1 --connected-gateway /infra/tier-1s/gateway --revision 1 --dhcp-ranges 40.20.0.0 40.20.0.1 --gateway-address 40.20.20.20/16
"""

helps['vmware workload-network segment update'] = """
type: command
short-summary: Update a segment by ID in a private cloud workload network.
examples:
- name: Update a segment by ID in a workload network.
text: az vmware workload-network segment update --resource-group group1 --private-cloud cloud1 --segment-id segment1 --display-name segment1 --connected-gateway /infra/tier-1s/gateway --revision 1 --dhcp-ranges 40.20.0.0 40.20.0.1 --gateway-address 40.20.20.20/16
"""

helps['vmware workload-network segment delete'] = """
type: command
short-summary: Delete a segment by ID in a private cloud workload network.
examples:
- name: Delete a segment by ID in a workload network.
text: az vmware workload-network segment delete --resource-group group1 --private-cloud cloud1 --segment-id segment1
"""

helps['vmware workload-network public-ip'] = """
type: group
short-summary: Commands to manage a Public-IP workload network.
"""

helps['vmware workload-network public-ip list'] = """
type: command
short-summary: List of Public IP Blocks in a private cloud workload network.
examples:
- name: List of Public IP Blocks in a workload network.
text: az vmware workload-network public-ip list --resource-group group1 --private-cloud cloud1
"""

helps['vmware workload-network public-ip show'] = """
type: command
short-summary: Get a Public IP Block by ID in a private cloud workload network.
examples:
- name: Get a Public IP Block by ID in a workload network.
text: az vmware workload-network public-ip show --resource-group group1 --private-cloud cloud1 --public-ip-id publicIP1
"""

helps['vmware workload-network public-ip create'] = """
type: command
short-summary: Create a Public IP Block by ID in a private cloud workload network.
examples:
- name: Create a Public IP Block by ID in a workload network.
text: az vmware workload-network public-ip create --resource-group group1 --private-cloud cloud1 --public-ip-id publicIP1 --display-name publicIP1 --number-of-public-ips 32
"""

helps['vmware workload-network public-ip delete'] = """
type: command
short-summary: Delete a Public IP Block by ID in a private cloud workload network.
examples:
- name: Delete a Public IP Block by ID in a workload network.
text: az vmware workload-network public-ip delete --resource-group group1 --private-cloud cloud1 --public-ip-id publicIP1
"""

helps['vmware workload-network vm-group'] = """
type: group
short-summary: Commands to manage a VM Group workload network.
"""

helps['vmware workload-network vm-group list'] = """
type: command
short-summary: List of VM Groups in a private cloud workload network.
examples:
- name: List of VM Groups in a workload network.
text: az vmware workload-network vm-group list --resource-group group1 --private-cloud cloud1
"""

helps['vmware workload-network vm-group show'] = """
type: command
short-summary: Get a VM Group by ID in a private cloud workload network.
examples:
- name: Get a VM Group by ID in a workload network.
text: az vmware workload-network vm-group show --resource-group group1 --private-cloud cloud1 --vm-group-id vmGroup1
"""

helps['vmware workload-network vm-group create'] = """
type: command
short-summary: Create a VM Group by ID in a private cloud workload network.
examples:
- name: Create a VM Group by ID in a workload network.
text: az vmware workload-network vm-group create --resource-group group1 --private-cloud cloud1 --vm-group-id vmGroup1 --display-name vmGroup1 --members 564d43da-fefc-2a3b-1d92-42855622fa50 --revision 1
"""

helps['vmware workload-network vm-group update'] = """
type: command
short-summary: Update a VM Group by ID in a private cloud workload network.
examples:
- name: Update a VM Group by ID in a workload network.
text: az vmware workload-network vm-group update --resource-group group1 --private-cloud cloud1 --vm-group-id vmGroup1 --display-name vmGroup1 --members 564d43da-fefc-2a3b-1d92-42855622fa50 --revision 1
"""

helps['vmware workload-network vm-group delete'] = """
type: command
short-summary: Delete a VM Group by ID in a private cloud workload network.
examples:
- name: Delete a VM Group by ID in a private cloud workload network.
text: az vmware workload-network vm-group delete --resource-group group1 --private-cloud cloud1 --vm-group-id vmGroup1
"""

helps['vmware workload-network vm'] = """
type: group
short-summary: Commands to manage a Virtual Machine workload network.
"""

helps['vmware workload-network vm list'] = """
type: command
short-summary: List of Virtual Machines in a private cloud workload network.
examples:
- name: List of Virtual Machines in a workload network.
text: az vmware workload-network vm list --resource-group group1 --private-cloud cloud1
"""

helps['vmware workload-network vm show'] = """
type: command
short-summary: Get a Virtual Machines by ID in a private cloud workload network.
examples:
- name: Get a Virtual Machines by ID in a workload network.
text: az vmware workload-network vm show --resource-group group1 --private-cloud cloud1 --virtual-machine-id vm1
"""

helps['vmware workload-network gateway'] = """
type: group
short-summary: Commands to manage a Gateway workload network.
"""

helps['vmware workload-network gateway list'] = """
type: command
short-summary: List of Gateways in a private cloud workload network.
examples:
- name: List of Gateways in a workload network.
text: az vmware workload-network gateway list --resource-group group1 --private-cloud cloud1
"""

helps['vmware workload-network gateway show'] = """
type: command
short-summary: Get a Gateway by ID in a private cloud workload network.
examples:
- name: Get a Gateway by ID in a workload network.
text: az vmware workload-network gateway show --resource-group group1 --private-cloud cloud1 --gateway-id gateway1
"""
25 changes: 25 additions & 0 deletions src/vmware/azext_vmware/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,28 @@ def load_arguments(self, _):
c.argument('source', help='Source VM Group.')
c.argument('destination', help='Destination VM Group.')
c.argument('revision', help='NSX revision number.')

with self.argument_context('vmware workload-network segment') as c:
c.argument('segment_id', help="NSX Segment identifier. Generally the same as the Segment's display name.")
c.argument('display_name', help='Display name of the segment.')
c.argument('connected_gateway', help='Gateway which to connect segment to.')
c.argument('revision', help='NSX revision number.')
c.argument('dhcp_ranges', nargs='+', help='DHCP Range assigned for subnet.')
c.argument('gateway_address', help='Gateway address.')

with self.argument_context('vmware workload-network public-ip') as c:
c.argument('public_ip_id', help="NSX Public IP Block identifier. Generally the same as the Public IP.")
c.argument('display_name', help='Display name of the Public IP Block.')
c.argument('number_of_public_ips', help='Number of Public IPs requested.')

with self.argument_context('vmware workload-network vm-group') as c:
c.argument('vm_group_id', help="NSX VM Group identifier. Generally the same as the VM Group's display name.")
c.argument('display_name', help='Display name of the VM group.')
c.argument('members', nargs='+', help='Virtual machine members of this group.')
c.argument('revision', help='NSX revision number.')

with self.argument_context('vmware workload-network vm') as c:
c.argument('virtual_machine_id', help="Virtual Machine identifier.")

with self.argument_context('vmware workload-network gateway') as c:
c.argument('gateway_id', help="NSX Gateway identifier. Generally the same as the Gateway's display name.")
28 changes: 28 additions & 0 deletions src/vmware/azext_vmware/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,31 @@ def load_command_table(self, _):
g.custom_command('create', 'workload_network_port_mirroring_create')
g.custom_command('update', 'workload_network_port_mirroring_update')
g.custom_command('delete', 'workload_network_port_mirroring_delete')

with self.command_group('vmware workload-network segment', vmware_sdk, client_factory=cf_vmware) as g:
g.custom_command('list', 'workload_network_segment_list')
g.custom_show_command('show', 'workload_network_segment_get')
g.custom_command('create', 'workload_network_segment_create')
g.custom_command('update', 'workload_network_segment_update')
g.custom_command('delete', 'workload_network_segment_delete')

with self.command_group('vmware workload-network public-ip', vmware_sdk, client_factory=cf_vmware) as g:
g.custom_command('list', 'workload_network_public_ip_list')
g.custom_show_command('show', 'workload_network_public_ip_get')
g.custom_command('create', 'workload_network_public_ip_create')
g.custom_command('delete', 'workload_network_public_ip_delete')

with self.command_group('vmware workload-network vm-group', vmware_sdk, client_factory=cf_vmware) as g:
g.custom_command('list', 'workload_network_vm_group_list')
g.custom_show_command('show', 'workload_network_vm_group_get')
g.custom_command('create', 'workload_network_vm_group_create')
g.custom_command('update', 'workload_network_vm_group_update')
g.custom_command('delete', 'workload_network_vm_group_delete')

with self.command_group('vmware workload-network vm', vmware_sdk, client_factory=cf_vmware) as g:
g.custom_command('list', 'workload_network_vm_list')
g.custom_show_command('show', 'workload_network_vm_get')

with self.command_group('vmware workload-network gateway', vmware_sdk, client_factory=cf_vmware) as g:
g.custom_command('list', 'workload_network_gateway_list')
g.custom_show_command('show', 'workload_network_gateway_get')
84 changes: 84 additions & 0 deletions src/vmware/azext_vmware/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,3 +437,87 @@ def workload_network_port_mirroring_update(client: AVSClient, resource_group_nam

def workload_network_port_mirroring_delete(client: AVSClient, resource_group_name, private_cloud, port_mirroring_id):
return client.workload_networks.begin_delete_port_mirroring(resource_group_name=resource_group_name, private_cloud_name=private_cloud, port_mirroring_id=port_mirroring_id)


def workload_network_segment_list(client: AVSClient, resource_group_name, private_cloud):
return client.workload_networks.list_segments(resource_group_name=resource_group_name, private_cloud_name=private_cloud)


def workload_network_segment_get(client: AVSClient, resource_group_name, private_cloud, segment_id):
return client.workload_networks.get_segment(resource_group_name=resource_group_name, private_cloud_name=private_cloud, segment_id=segment_id)


def workload_network_segment_create(client: AVSClient, resource_group_name, private_cloud, segment_id, display_name=None, connected_gateway=None, revision=None, dhcp_ranges=None, gateway_address=None):
from azext_vmware.vendored_sdks.avs_client.models import WorkloadNetworkSegmentSubnet
from azext_vmware.vendored_sdks.avs_client.models import WorkloadNetworkSegment
subnet = WorkloadNetworkSegmentSubnet(dhcp_ranges=dhcp_ranges, gateway_address=gateway_address)
segment = WorkloadNetworkSegment(display_name=display_name, connected_gateway=connected_gateway, subnet=subnet, revision=revision)
return client.workload_networks.begin_create_segments(resource_group_name=resource_group_name, private_cloud_name=private_cloud, segment_id=segment_id, workload_network_segment=segment)


def workload_network_segment_update(client: AVSClient, resource_group_name, private_cloud, segment_id, display_name=None, connected_gateway=None, revision=None, dhcp_ranges=None, gateway_address=None):
from azext_vmware.vendored_sdks.avs_client.models import WorkloadNetworkSegmentSubnet
from azext_vmware.vendored_sdks.avs_client.models import WorkloadNetworkSegment
subnet = WorkloadNetworkSegmentSubnet(dhcp_ranges=dhcp_ranges, gateway_address=gateway_address)
segment = WorkloadNetworkSegment(display_name=display_name, connected_gateway=connected_gateway, subnet=subnet, revision=revision)
return client.workload_networks.begin_update_segments(resource_group_name=resource_group_name, private_cloud_name=private_cloud, segment_id=segment_id, workload_network_segment=segment)


def workload_network_segment_delete(client: AVSClient, resource_group_name, private_cloud, segment_id):
return client.workload_networks.begin_delete_segment(resource_group_name=resource_group_name, private_cloud_name=private_cloud, segment_id=segment_id)


def workload_network_public_ip_list(client: AVSClient, resource_group_name, private_cloud):
return client.workload_networks.list_public_i_ps(resource_group_name=resource_group_name, private_cloud_name=private_cloud)


def workload_network_public_ip_get(client: AVSClient, resource_group_name, private_cloud, public_ip_id):
return client.workload_networks.get_public_ip(resource_group_name=resource_group_name, private_cloud_name=private_cloud, public_ip_id=public_ip_id)


def workload_network_public_ip_create(client: AVSClient, resource_group_name, private_cloud, public_ip_id, display_name=None, number_of_public_ips=None):
return client.workload_networks.begin_create_public_ip(resource_group_name=resource_group_name, private_cloud_name=private_cloud, public_ip_id=public_ip_id, display_name=display_name, number_of_public_i_ps=number_of_public_ips)


def workload_network_public_ip_delete(client: AVSClient, resource_group_name, private_cloud, public_ip_id):
return client.workload_networks.begin_delete_public_ip(resource_group_name=resource_group_name, private_cloud_name=private_cloud, public_ip_id=public_ip_id)


def workload_network_vm_group_list(client: AVSClient, resource_group_name, private_cloud):
return client.workload_networks.list_vm_groups(resource_group_name=resource_group_name, private_cloud_name=private_cloud)


def workload_network_vm_group_get(client: AVSClient, resource_group_name, private_cloud, vm_group_id):
return client.workload_networks.get_vm_group(resource_group_name=resource_group_name, private_cloud_name=private_cloud, vm_group_id=vm_group_id)


def workload_network_vm_group_create(client: AVSClient, resource_group_name, private_cloud, vm_group_id, display_name=None, members=None, revision=None):
from azext_vmware.vendored_sdks.avs_client.models import WorkloadNetworkVMGroup
vmGroup = WorkloadNetworkVMGroup(display_name=display_name, members=members, revision=revision)
return client.workload_networks.begin_create_vm_group(resource_group_name=resource_group_name, private_cloud_name=private_cloud, vm_group_id=vm_group_id, workload_network_vm_group=vmGroup)


def workload_network_vm_group_update(client: AVSClient, resource_group_name, private_cloud, vm_group_id, display_name=None, members=None, revision=None):
from azext_vmware.vendored_sdks.avs_client.models import WorkloadNetworkVMGroup
vmGroup = WorkloadNetworkVMGroup(display_name=display_name, members=members, revision=revision)
return client.workload_networks.begin_update_vm_group(resource_group_name=resource_group_name, private_cloud_name=private_cloud, vm_group_id=vm_group_id, workload_network_vm_group=vmGroup)


def workload_network_vm_group_delete(client: AVSClient, resource_group_name, private_cloud, vm_group_id):
return client.workload_networks.begin_delete_vm_group(resource_group_name=resource_group_name, private_cloud_name=private_cloud, vm_group_id=vm_group_id)


def workload_network_vm_list(client: AVSClient, resource_group_name, private_cloud):
return client.workload_networks.list_virtual_machines(resource_group_name=resource_group_name, private_cloud_name=private_cloud)


def workload_network_vm_get(client: AVSClient, resource_group_name, private_cloud, virtual_machine_id):
return client.workload_networks.get_virtual_machine(resource_group_name=resource_group_name, private_cloud_name=private_cloud, virtual_machine_id=virtual_machine_id)


def workload_network_gateway_list(client: AVSClient, resource_group_name, private_cloud):
return client.workload_networks.list_gateways(resource_group_name=resource_group_name, private_cloud_name=private_cloud)


def workload_network_gateway_get(client: AVSClient, resource_group_name, private_cloud, gateway_id):
return client.workload_networks.get_gateway(resource_group_name=resource_group_name, private_cloud_name=private_cloud, gateway_id=gateway_id)
Loading