Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions src/virtual-wan/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

Release History
===============
0.2.6
++++++
* `az network vhub get-effective-routes` support `-o table` outputs.

0.2.5
++++++
* Migrate to Track2 SDK.
Expand Down
18 changes: 18 additions & 0 deletions src/virtual-wan/azext_vwan/_format.py
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.
# --------------------------------------------------------------------------------------------

from collections import OrderedDict


def transform_effective_route_table(result):
transformed = []
for item in result.get('value', []):
transformed.append(OrderedDict([
('Address Prefix', ' '.join(item['addressPrefixes'] or [])),
('Next Hop Type', item['nextHopType']),
('Next Hop', ' '.join(item['nextHops'] or [])),
('Route Origin', item['routeOrigin'])
]))
return transformed
3 changes: 2 additions & 1 deletion src/virtual-wan/azext_vwan/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
list_network_resource_property,
get_network_resource_property_entry
)
from ._format import transform_effective_route_table

ROUTE_TABLE_DEPRECATION_INFO = 'network vhub route-table'

Expand Down Expand Up @@ -109,7 +110,7 @@ def load_command_table(self, _):
g.show_command('show')
g.custom_command('list', 'list_virtual_hubs')
g.generic_update_command('update', custom_func_name='update_virtual_hub', setter_name="begin_create_or_update", setter_arg_name='virtual_hub_parameters', supports_no_wait=True)
g.custom_command('get-effective-routes', 'get_effective_virtual_hub_routes', supports_no_wait=True)
g.custom_command('get-effective-routes', 'get_effective_virtual_hub_routes', supports_no_wait=True, table_transformer=transform_effective_route_table)

with self.command_group('network vhub connection', network_vhub_connection_sdk) as g:
g.custom_command('create', 'create_hub_vnet_connection', supports_no_wait=True)
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interactions:
Content-Type:
- application/json; charset=utf-8
ParameterSetName:
- -g -n --resource-type --resource-id
- -g -n --resource-type --resource-id -o
User-Agent:
- python/3.7.5 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2
azure-mgmt-network/10.2.0 Azure-SDK-For-Python AZURECLI/2.7.0
Expand Down Expand Up @@ -70,7 +70,7 @@ interactions:
Connection:
- keep-alive
ParameterSetName:
- -g -n --resource-type --resource-id
- -g -n --resource-type --resource-id -o
User-Agent:
- python/3.7.5 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2
azure-mgmt-network/10.2.0 Azure-SDK-For-Python AZURECLI/2.7.0
Expand Down Expand Up @@ -139,7 +139,7 @@ interactions:
Connection:
- keep-alive
ParameterSetName:
- -g -n --resource-type --resource-id
- -g -n --resource-type --resource-id -o
User-Agent:
- python/3.7.5 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2
azure-mgmt-network/10.2.0 Azure-SDK-For-Python AZURECLI/2.7.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import os

from azure.cli.testsdk import (ScenarioTest, ResourceGroupPreparer, record_only)

from azure.cli.testsdk.checkers import StringContainCheck
from .credential_replacer import VpnClientGeneratedURLReplacer

TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..'))
Expand Down Expand Up @@ -516,14 +516,14 @@ def test_azure_vwan_vhub_get_effective_routes(self):
})

# You need to create a virtual hub and a P2S VPN gateway with connection, then connect them together before running the following command.
self.cmd('network vhub get-effective-routes '
result = self.cmd('network vhub get-effective-routes '
'-g {rg} '
'-n {vhub} '
'--resource-type {resource_type} '
'--resource-id {resource_id}',
checks=[
self.check('length(value)', 5)
])
'--resource-id {resource_id} '
'-o table')
lines = result.output.strip().split('\n')
self.assertTrue(len(lines) == 7)


class P2SVpnGatewayVpnClientTestScenario(ScenarioTest):
Expand Down
2 changes: 1 addition & 1 deletion src/virtual-wan/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from codecs import open
from setuptools import setup, find_packages

VERSION = "0.2.5"
VERSION = "0.2.6"

CLASSIFIERS = [
'Development Status :: 4 - Beta',
Expand Down