forked from Azure/azure-cli-extensions
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Express Routes Cross Connection (Azure#230)
* Initial work * Vendor SDK * Fix lint errors. * Code review comments. * Code review fixes. * Code review feedback.
- Loading branch information
1 parent
b24beb8
commit bbefbe7
Showing
528 changed files
with
51,025 additions
and
0 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,4 +32,6 @@ | |
|
||
/src/datamigration/ @temandr | ||
|
||
/src/express-route-cross-connection/ @tjprescott | ||
|
||
/src/mesh/ @linggengmsft |
34 changes: 34 additions & 0 deletions
34
src/express-route-cross-connection/azext_expressroutecrossconnection/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# -------------------------------------------------------------------------------------------- | ||
|
||
from azure.cli.core import AzCommandsLoader | ||
from azure.cli.core.profiles import register_resource_type | ||
|
||
import azext_expressroutecrossconnection._help # pylint: disable=unused-import | ||
|
||
|
||
class ExpressRouteCrossConnectionCommandsLoader(AzCommandsLoader): | ||
|
||
def __init__(self, cli_ctx=None): | ||
from azure.cli.core.commands import CliCommandType | ||
from .profiles import CUSTOM_ER_CC | ||
register_resource_type('latest', CUSTOM_ER_CC, '2018-04-01') | ||
super(ExpressRouteCrossConnectionCommandsLoader, self).__init__( | ||
cli_ctx=cli_ctx, | ||
custom_command_type=CliCommandType(operations_tmpl='azext_expressroutecrossconnection.custom#{}'), | ||
resource_type=CUSTOM_ER_CC | ||
) | ||
|
||
def load_command_table(self, args): | ||
from .commands import load_command_table | ||
load_command_table(self, args) | ||
return self.command_table | ||
|
||
def load_arguments(self, args): | ||
from ._params import load_arguments | ||
load_arguments(self, args) | ||
|
||
|
||
COMMAND_LOADER_CLS = ExpressRouteCrossConnectionCommandsLoader |
18 changes: 18 additions & 0 deletions
18
src/express-route-cross-connection/azext_expressroutecrossconnection/_client_factory.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# -------------------------------------------------------------------------------------------- | ||
|
||
|
||
def network_client_factory(cli_ctx, aux_subscriptions=None, **_): | ||
from azure.cli.core.commands.client_factory import get_mgmt_service_client | ||
from .profiles import CUSTOM_ER_CC | ||
return get_mgmt_service_client(cli_ctx, CUSTOM_ER_CC, aux_subscriptions=aux_subscriptions) | ||
|
||
|
||
def cf_express_route_cross_connection_peerings(cli_ctx, _): | ||
return network_client_factory(cli_ctx).express_route_cross_connection_peerings | ||
|
||
|
||
def cf_express_route_cross_connections(cli_ctx, _): | ||
return network_client_factory(cli_ctx).express_route_cross_connections |
132 changes: 132 additions & 0 deletions
132
src/express-route-cross-connection/azext_expressroutecrossconnection/_help.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# -------------------------------------------------------------------------------------------- | ||
|
||
from knack.help_files import helps | ||
|
||
|
||
helps['network cross-connection'] = """ | ||
type: group | ||
short-summary: Manage customers' ExpressRoute circuits. | ||
long-summary: > | ||
To learn more about ExpressRoute circuits visit | ||
https://docs.microsoft.com/en-us/azure/expressroute/howto-circuit-cli | ||
""" | ||
|
||
helps['network cross-connection list'] = """ | ||
type: command | ||
short-summary: List all ExpressRoute circuits for the current subscription. | ||
examples: | ||
- name: List all ExpressRoute circuits for the current subscription. | ||
text: > | ||
az network cross-connection list -g MyResourceGroup | ||
""" | ||
|
||
helps['network cross-connection list-arp-tables'] = """ | ||
type: command | ||
short-summary: Show the current Address Resolution Protocol (ARP) table of an ExpressRoute circuit peering. | ||
examples: | ||
- name: Show the current Address Resolution Protocol (ARP) table of an ExpressRoute circuit. | ||
text: | | ||
az network cross-connection list-arp-tables -g MyResourceGroup -n MyCircuit \\ | ||
--path primary --peering-name AzurePrivatePeering | ||
""" | ||
|
||
helps['network cross-connection list-route-tables'] = """ | ||
type: command | ||
short-summary: Show the current routing table of an ExpressRoute circuit peering. | ||
examples: | ||
- name: Show the current routing table of an ExpressRoute circuit peering. | ||
text: | | ||
az network cross-connection list-route-tables -g MyResourceGroup -n MyCircuit \\ | ||
--path primary --peering-name AzurePrivatePeering | ||
""" | ||
|
||
helps['network cross-connection show'] = """ | ||
type: command | ||
short-summary: Get the details of an ExpressRoute circuit. | ||
examples: | ||
- name: Get the details of an ExpressRoute circuit. | ||
text: > | ||
az network cross-connection show -n MyCircuit -g MyResourceGroup | ||
""" | ||
|
||
helps['network cross-connection update'] = """ | ||
type: command | ||
short-summary: Update settings of an ExpressRoute circuit. | ||
examples: | ||
- name: Change the SKU of an ExpressRoute circuit from Standard to Premium. | ||
text: > | ||
az network cross-connection update -n MyCircuit -g MyResourceGroup --sku-tier Premium | ||
""" | ||
|
||
helps['network cross-connection wait'] = """ | ||
type: command | ||
short-summary: Place the CLI in a waiting state until a condition of the ExpressRoute is met. | ||
examples: | ||
- name: Pause executing next line of CLI script until the ExpressRoute circuit is successfully provisioned. | ||
text: az network cross-connection wait -n MyCircuit --g MyResourceGroup --created | ||
""" | ||
|
||
helps['network cross-connection peering'] = """ | ||
type: group | ||
short-summary: Manage ExpressRoute peering of an ExpressRoute circuit. | ||
""" | ||
|
||
helps['network cross-connection peering create'] = """ | ||
type: command | ||
short-summary: Create peering settings for an ExpressRoute circuit. | ||
examples: | ||
- name: Create Microsoft Peering settings with IPv4 configuration. | ||
text: | | ||
az network cross-connection peering create -g MyResourceGroup --circuit-name MyCircuit \\ | ||
--peering-type MicrosoftPeering --peer-asn 10002 --vlan-id 103 \\ | ||
--primary-peer-subnet 101.0.0.0/30 --secondary-peer-subnet 102.0.0.0/30 \\ | ||
--advertised-public-prefixes 101.0.0.0/30 | ||
- name: Add IPv6 settings to existing IPv4 config for Microsoft peering. | ||
text: | | ||
az network cross-connection peering update -g MyResourceGroup --circuit-name MyCircuit \\ | ||
--peering-type MicrosoftPeering --ip-version ipv6 --primary-peer-subnet 2002:db00::/126 \\ | ||
--secondary-peer-subnet 2003:db00::/126 --advertised-public-prefixes 2002:db00::/126 | ||
""" | ||
|
||
helps['network cross-connection peering delete'] = """ | ||
type: command | ||
short-summary: Delete peering settings. | ||
examples: | ||
- name: Delete private peering. | ||
text: > | ||
az network cross-connection peering delete -g MyResourceGroup --circuit-name MyCircuit -n AzurePrivatePeering | ||
""" | ||
|
||
helps['network cross-connection peering list'] = """ | ||
type: command | ||
short-summary: List peering settings of an ExpressRoute circuit. | ||
examples: | ||
- name: List peering settings of an ExpressRoute circuit. | ||
text: > | ||
az network cross-connection peering list -g MyResourceGroup --circuit-name MyCircuit | ||
""" | ||
|
||
helps['network cross-connection peering show'] = """ | ||
type: command | ||
short-summary: Get the details of an express route peering. | ||
examples: | ||
- name: Get private peering details of an ExpressRoute circuit. | ||
text: > | ||
az network cross-connection peering show -g MyResourceGroup --circuit-name MyCircuit -n AzurePrivatePeering | ||
""" | ||
|
||
helps['network cross-connection peering update'] = """ | ||
type: command | ||
short-summary: Update peering settings of an ExpressRoute circuit. | ||
examples: | ||
- name: Add IPv6 Microsoft Peering settings to existing IPv4 config. | ||
text: | | ||
az network cross-connection peering update -g MyResourceGroup \\ | ||
--circuit-name MyCircuit --peering-type MicrosoftPeering --ip-version ipv6 \\ | ||
--primary-peer-subnet 2002:db00::/126 --secondary-peer-subnet 2003:db00::/126 \\ | ||
--advertised-public-prefixes 2002:db00::/126 | ||
min_profile: latest | ||
""" |
47 changes: 47 additions & 0 deletions
47
src/express-route-cross-connection/azext_expressroutecrossconnection/_params.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# -------------------------------------------------------------------------------------------- | ||
|
||
# pylint: disable=line-too-long | ||
import six | ||
|
||
from knack.arguments import CLIArgumentType | ||
|
||
from azure.cli.core.commands.parameters import (get_resource_name_completion_list, get_enum_type) | ||
from azure.cli.command_modules.network._validators import validate_peering_type | ||
|
||
|
||
# pylint: disable=too-many-locals, too-many-branches, too-many-statements | ||
def load_arguments(self, _): | ||
|
||
ExpressRoutePeeringType = self.get_models('ExpressRoutePeeringType') | ||
|
||
name_arg_type = CLIArgumentType(options_list=('--name', '-n'), metavar='NAME') | ||
cross_connection_name_type = CLIArgumentType(options_list=('--cross-connection-name',), metavar='NAME', help='ExpressRoute cross-connection name.', id_part='name', completer=get_resource_name_completion_list('Microsoft.Network/expressRouteCrossConnections')) | ||
routing_registry_values = ['ARIN', 'APNIC', 'AFRINIC', 'LACNIC', 'RIPENCC', 'RADB', 'ALTDB', 'LEVEL3'] | ||
|
||
with self.argument_context('network cross-connection') as c: | ||
c.argument('cross_connection_name', cross_connection_name_type, options_list=('--name', '-n')) | ||
|
||
with self.argument_context('network cross-connection update') as c: | ||
c.argument('notes', help='Service provider notes.') | ||
c.argument('provisioning_state', arg_type=get_enum_type(['Provisioning', 'Provisioned', 'NotProvisioned']), help='Provisioning state of the customer ExpressRoute circuit.') | ||
|
||
with self.argument_context('network cross-connection peering') as c: | ||
# Using six.integer_types so we get int for Py3 and long for Py2 | ||
c.argument('peer_asn', help='Autonomous system number of the customer/connectivity provider.', type=six.integer_types[-1]) | ||
c.argument('vlan_id', help='Identifier used to identify the customer.', type=int) | ||
c.argument('cross_connection_name', cross_connection_name_type) | ||
c.argument('peering_name', name_arg_type, id_part='child_name_1') | ||
c.argument('peering_type', validator=validate_peering_type, arg_type=get_enum_type(ExpressRoutePeeringType), help='BGP peering type for the circuit.') | ||
c.argument('primary_peer_address_prefix', options_list=['--primary-peer-subnet'], help='/30 subnet used to configure IP addresses for primary interface.') | ||
c.argument('secondary_peer_address_prefix', options_list=['--secondary-peer-subnet'], help='/30 subnet used to configure IP addresses for secondary interface.') | ||
c.argument('advertised_public_prefixes', arg_group='Microsoft Peering', nargs='+', help='Space-separated list of prefixes to be advertised through the BGP peering.') | ||
c.argument('customer_asn', arg_group='Microsoft Peering', help='Autonomous system number of the customer.') | ||
c.argument('routing_registry_name', arg_group='Microsoft Peering', arg_type=get_enum_type(routing_registry_values), help='Internet Routing Registry / Regional Internet Registry') | ||
c.argument('ip_version', min_api='2017-06-01', help='The IP version to update Microsoft Peering settings for.', arg_group='Microsoft Peering', arg_type=get_enum_type(['IPv4', 'IPv6'])) | ||
c.argument('shared_key', help='Key for generating an MD5 for the BGP session.') | ||
|
||
with self.argument_context('network cross-connection peering list') as c: | ||
c.argument('cross_connection_name', id_part=None) |
3 changes: 3 additions & 0 deletions
3
src/express-route-cross-connection/azext_expressroutecrossconnection/azext_metadata.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"azext.minCliCoreVersion": "2.0.41" | ||
} |
42 changes: 42 additions & 0 deletions
42
src/express-route-cross-connection/azext_expressroutecrossconnection/commands.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# -------------------------------------------------------------------------------------------- | ||
|
||
# pylint: disable=line-too-long | ||
from azure.cli.core.commands import CliCommandType | ||
|
||
from ._client_factory import ( | ||
cf_express_route_cross_connection_peerings, cf_express_route_cross_connections) | ||
|
||
|
||
# pylint: disable=too-many-locals, too-many-statements | ||
def load_command_table(self, _): | ||
|
||
network_er_cc_sdk = CliCommandType( | ||
operations_tmpl='azext_expressroutecrossconnection.vendored_sdks.operations.express_route_cross_connections_operations#ExpressRouteCrossConnectionsOperations.{}', | ||
client_factory=cf_express_route_cross_connections, | ||
min_api='2018-04-01' | ||
) | ||
|
||
network_er_cc_peering_sdk = CliCommandType( | ||
operations_tmpl='azext_expressroutecrossconnection.vendored_sdks.operations.express_route_cross_connection_peerings_operations#ExpressRouteCrossConnectionPeeringsOperations.{}', | ||
client_factory=cf_express_route_cross_connection_peerings, | ||
min_api='2018-04-01' | ||
) | ||
|
||
with self.command_group('network cross-connection', network_er_cc_sdk) as g: | ||
g.show_command('show', 'get') | ||
g.command('list-arp-tables', 'list_arp_table') | ||
g.command('list-route-tables', 'list_routes_table') | ||
g.command('summarize-route-table', 'list_routes_table_summary') | ||
g.custom_command('list', 'list_express_route_cross_connections') | ||
g.generic_update_command('update', custom_func_name='update_express_route_cross_connection', supports_no_wait=True) | ||
g.wait_command('wait') | ||
|
||
with self.command_group('network cross-connection peering', network_er_cc_peering_sdk) as g: | ||
g.custom_command('create', 'create_express_route_cross_connection_peering', client_factory=cf_express_route_cross_connection_peerings) | ||
g.command('delete', 'delete') | ||
g.show_command('show', 'get') | ||
g.command('list', 'list') | ||
g.generic_update_command('update', setter_arg_name='peering_parameters', custom_func_name='update_express_route_peering') |
Oops, something went wrong.