Skip to content

Commit

Permalink
[Network| Fix SDK breaking change. (#6028)
Browse files Browse the repository at this point in the history
* Fix SDK breaking change.

* Fixes for Stack compatibility
  • Loading branch information
tjprescott authored Apr 6, 2018
1 parent c3fa6fb commit 712fd04
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,23 @@ def load_arguments(self, _):

(Access, ApplicationGatewayFirewallMode, ApplicationGatewayProtocol, ApplicationGatewayRedirectType,
ApplicationGatewayRequestRoutingRuleType, ApplicationGatewaySkuName, AuthenticationMethod, Direction,
ExpressRouteCircuitPeeringType, ExpressRouteCircuitSkuFamily, ExpressRouteCircuitSkuTier, IPAllocationMethod,
ExpressRouteCircuitSkuFamily, ExpressRouteCircuitSkuTier, IPAllocationMethod,
IPVersion, LoadBalancerSkuName, LoadDistribution, ProbeProtocol, ProcessorArchitecture, Protocol, PublicIPAddressSkuName,
RouteNextHopType, SecurityRuleAccess, SecurityRuleProtocol, SecurityRuleDirection, TransportProtocol,
VirtualNetworkGatewaySkuName, VirtualNetworkGatewayType, VpnClientProtocol, VpnType, ZoneType) = self.get_models(
'Access', 'ApplicationGatewayFirewallMode', 'ApplicationGatewayProtocol', 'ApplicationGatewayRedirectType',
'ApplicationGatewayRequestRoutingRuleType', 'ApplicationGatewaySkuName', 'AuthenticationMethod', 'Direction',
'ExpressRouteCircuitPeeringType', 'ExpressRouteCircuitSkuFamily', 'ExpressRouteCircuitSkuTier', 'IPAllocationMethod',
'ExpressRouteCircuitSkuFamily', 'ExpressRouteCircuitSkuTier', 'IPAllocationMethod',
'IPVersion', 'LoadBalancerSkuName', 'LoadDistribution', 'ProbeProtocol', 'ProcessorArchitecture', 'Protocol', 'PublicIPAddressSkuName',
'RouteNextHopType', 'SecurityRuleAccess', 'SecurityRuleProtocol', 'SecurityRuleDirection', 'TransportProtocol',
'VirtualNetworkGatewaySkuName', 'VirtualNetworkGatewayType', 'VpnClientProtocol', 'VpnType', 'ZoneType')

if self.supported_api_version(min_api='2018-02-01'):
ExpressRoutePeeringType = self.get_models('ExpressRoutePeeringType')
else:
# for Stack compatibility
ExpressRoutePeeringType = self.get_models('ExpressRouteCircuitPeeringType')

default_existing = 'If only one exists, omit to use as default.'

# taken from Xplat. No enums in SDK
Expand Down Expand Up @@ -436,7 +442,7 @@ def load_arguments(self, _):
c.argument('vlan_id', help='Identifier used to identify the customer.')
c.argument('circuit_name', circuit_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(ExpressRouteCircuitPeeringType), help='BGP peering type for the circuit.')
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.')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1468,18 +1468,21 @@ def create_express_route_peering(
primary_peer_address_prefix, secondary_peer_address_prefix, shared_key=None,
advertised_public_prefixes=None, customer_asn=None, routing_registry_name=None,
route_filter=None):
(ExpressRouteCircuitPeering, ExpressRouteCircuitPeeringConfig, ExpressRouteCircuitPeeringType,
RouteFilter) = cmd.get_models(
'ExpressRouteCircuitPeering', 'ExpressRouteCircuitPeeringConfig', 'ExpressRouteCircuitPeeringType',
'RouteFilter')
(ExpressRouteCircuitPeering, ExpressRouteCircuitPeeringConfig, RouteFilter) = \
cmd.get_models('ExpressRouteCircuitPeering', 'ExpressRouteCircuitPeeringConfig', 'RouteFilter')

if cmd.supported_api_version(min_api='2018-02-01'):
ExpressRoutePeeringType = cmd.get_models('ExpressRoutePeeringType')
else:
ExpressRoutePeeringType = cmd.get_models('ExpressRouteCircuitPeeringType')

peering = ExpressRouteCircuitPeering(
peering_type=peering_type, peer_asn=peer_asn, vlan_id=vlan_id,
primary_peer_address_prefix=primary_peer_address_prefix,
secondary_peer_address_prefix=secondary_peer_address_prefix,
shared_key=shared_key)

if peering_type == ExpressRouteCircuitPeeringType.microsoft_peering.value:
if peering_type == ExpressRoutePeeringType.microsoft_peering.value:
peering.microsoft_peering_config = ExpressRouteCircuitPeeringConfig(
advertised_public_prefixes=advertised_public_prefixes,
customer_asn=customer_asn,
Expand Down

0 comments on commit 712fd04

Please sign in to comment.