Skip to content

Commit

Permalink
Code review fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
tjprescott committed Jul 20, 2018
1 parent 54cd850 commit 09e1271
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,12 @@

helps['network cross-connection'] = """
type: group
short-summary: Manage customers' dedicated private network fiber connections to Azure.
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 get-stats'] = """
type: command
short-summary: Get the statistics of an ExpressRoute circuit.
examples:
- name: Get the statistics of an ExpressRoute circuit.
text: >
az network cross-connection get-stats -g MyResourceGroup -n MyCircuit
"""

helps['network cross-connection list'] = """
type: command
short-summary: List all ExpressRoute circuits for the current subscription.
Expand All @@ -34,7 +25,7 @@

helps['network cross-connection list-arp-tables'] = """
type: command
short-summary: Show the current Address Resolution Protocol (ARP) table of an ExpressRoute circuit.
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: |
Expand Down Expand Up @@ -70,14 +61,6 @@
az network cross-connection update -n MyCircuit -g MyResourceGroup --sku-tier Premium
"""

helps['network cross-connection list-service-providers'] = """
type: command
short-summary: List available ExpressRoute service providers.
examples:
- name: List available ExpressRoute service providers.
text: az network cross-connection list-service-providers
"""

helps['network cross-connection wait'] = """
type: command
short-summary: Place the CLI in a waiting state until a condition of the ExpressRoute is met.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,51 +8,34 @@

from knack.arguments import CLIArgumentType

from azure.cli.core.commands.parameters import (get_location_type, get_resource_name_completion_list, get_enum_type)
from azure.cli.core.commands.validators import get_default_location_from_resource_group
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, _):

(ExpressRouteCircuitSkuFamily, ExpressRouteCircuitSkuTier, ExpressRoutePeeringType) = self.get_models(
'ExpressRouteCircuitSkuFamily', 'ExpressRouteCircuitSkuTier', 'ExpressRoutePeeringType')
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'))
sku_family_type = CLIArgumentType(help='Chosen SKU family of ExpressRoute circuit.', arg_type=get_enum_type(ExpressRouteCircuitSkuFamily), default=ExpressRouteCircuitSkuFamily.metered_data.value)
sku_tier_type = CLIArgumentType(help='SKU Tier of ExpressRoute circuit.', arg_type=get_enum_type(ExpressRouteCircuitSkuTier), default=ExpressRouteCircuitSkuTier.standard.value)

device_path_values = ['primary', 'secondary']
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'))
c.argument('sku_family', sku_family_type)
c.argument('sku_tier', sku_tier_type)
c.argument('bandwidth_in_mbps', options_list=('--bandwidth',), help="Bandwidth in Mbps of the circuit.")
c.argument('service_provider_name', options_list=('--provider',), help="Name of the ExpressRoute Service Provider.")
c.argument('peering_location', help="Name of the peering location.")
c.argument('device_path', options_list=('--path',), arg_type=get_enum_type(device_path_values))
c.argument('vlan_id', type=int)
c.argument('location', get_location_type(self.cli_ctx), validator=get_default_location_from_resource_group)

with self.argument_context('network cross-connection update') as c:
c.argument('sku_family', sku_family_type, default=None)
c.argument('sku_tier', sku_tier_type, default=None)
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.')
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('sku_family', arg_type=get_enum_type(ExpressRouteCircuitSkuFamily))
c.argument('sku_tier', arg_type=get_enum_type(ExpressRouteCircuitSkuTier))
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.')
Expand Down
2 changes: 1 addition & 1 deletion src/express-route-cross-connection/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
version=VERSION,
description='Manage customer ExpressRoute circuits using an ExpressRoute cross-connection.',
long_description='These commands give ISPs limited ability to manage the ExpressRoute circuits of ' \
'their customers through an ExpressRoute cross-connection resource.'
'their customers through an ExpressRoute cross-connection resource.',
license='MIT',
author='Microsoft Corporation',
author_email='azpycli@microsoft.com',
Expand Down

0 comments on commit 09e1271

Please sign in to comment.