Skip to content

Commit 65f71f2

Browse files
author
Bhavana Kalivemula
committed
vwan failover and resiliency commands added
1 parent 57b94dd commit 65f71f2

8 files changed

Lines changed: 1510 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from azure.cli.core.aaz import *
12+
13+
14+
@register_command_group(
15+
"network express-route-gateway",
16+
)
17+
class __CMDGroup(AAZCommandGroup):
18+
"""Manage Express Route Gateway
19+
"""
20+
pass
21+
22+
23+
__all__ = ["__CMDGroup"]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from .__cmd_group import *
12+
from ._get_failover_all_tests_detail import *
13+
from ._get_failover_single_test_detail import *
14+
from ._get_resiliency_information import *
15+
from ._get_routes_information import *
16+
from ._start_site_failover_test import *
17+
from ._stop_site_failover_test import *
Lines changed: 267 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,267 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from azure.cli.core.aaz import *
12+
13+
14+
@register_command(
15+
"network express-route-gateway get-failover-all-tests-detail",
16+
)
17+
class GetFailoverAllTestsDetail(AAZCommand):
18+
"""This operation retrieves the details of all the failover tests performed on the Virtual Wan ExpressRoute gateways for different peering locations
19+
20+
:example: VwanExpressRouteGatewayFailoverAllTestsDetails
21+
az network express-route-gateway get-failover-all-tests-detail --resource-group ExpressRouteVWan_ResiliencyValidation_Playwright_Tests --express-route-gateway-name b982dc4450f5406ba6d4344e15575138-eastus-er-gw --type SingleSiteFailover --fetch-latest True
22+
"""
23+
24+
_aaz_info = {
25+
"version": "2025-07-01",
26+
"resources": [
27+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/expressroutegateways/{}/getfailoveralltestsdetails", "2025-07-01"],
28+
]
29+
}
30+
31+
AZ_SUPPORT_NO_WAIT = True
32+
33+
def _handler(self, command_args):
34+
super()._handler(command_args)
35+
return self.build_lro_poller(self._execute_operations, self._output)
36+
37+
_args_schema = None
38+
39+
@classmethod
40+
def _build_arguments_schema(cls, *args, **kwargs):
41+
if cls._args_schema is not None:
42+
return cls._args_schema
43+
cls._args_schema = super()._build_arguments_schema(*args, **kwargs)
44+
45+
# define Arg Group ""
46+
47+
_args_schema = cls._args_schema
48+
_args_schema.express_route_gateway_name = AAZStrArg(
49+
options=["--express-route-gateway-name"],
50+
help="The name of the vwan express route gateway.",
51+
required=True,
52+
id_part="name",
53+
fmt=AAZStrArgFormat(
54+
pattern="^[A-Za-z0-9_]+",
55+
),
56+
)
57+
_args_schema.resource_group = AAZResourceGroupNameArg(
58+
required=True,
59+
)
60+
_args_schema.fetch_latest = AAZBoolArg(
61+
options=["--fetch-latest"],
62+
help="Fetch only the latest tests for each peering location",
63+
required=True,
64+
)
65+
_args_schema.type = AAZStrArg(
66+
options=["--type"],
67+
help="The type of failover test",
68+
required=True,
69+
enum={"All": "All", "LinkFailover": "LinkFailover", "MultiSiteFailover": "MultiSiteFailover", "SingleSiteFailover": "SingleSiteFailover"},
70+
)
71+
return cls._args_schema
72+
73+
def _execute_operations(self):
74+
self.pre_operations()
75+
yield self.ExpressRouteGatewaysGetFailoverAllTestsDetails(ctx=self.ctx)()
76+
self.post_operations()
77+
78+
@register_callback
79+
def pre_operations(self):
80+
pass
81+
82+
@register_callback
83+
def post_operations(self):
84+
pass
85+
86+
def _output(self, *args, **kwargs):
87+
result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True)
88+
return result
89+
90+
class ExpressRouteGatewaysGetFailoverAllTestsDetails(AAZHttpOperation):
91+
CLIENT_TYPE = "MgmtClient"
92+
93+
def __call__(self, *args, **kwargs):
94+
request = self.make_request()
95+
session = self.client.send_request(request=request, stream=False, **kwargs)
96+
if session.http_response.status_code in [202]:
97+
return self.client.build_lro_polling(
98+
self.ctx.args.no_wait,
99+
session,
100+
self.on_200,
101+
self.on_error,
102+
lro_options={"final-state-via": "location"},
103+
path_format_arguments=self.url_parameters,
104+
)
105+
if session.http_response.status_code in [200]:
106+
return self.client.build_lro_polling(
107+
self.ctx.args.no_wait,
108+
session,
109+
self.on_200,
110+
self.on_error,
111+
lro_options={"final-state-via": "location"},
112+
path_format_arguments=self.url_parameters,
113+
)
114+
115+
return self.on_error(session.http_response)
116+
117+
@property
118+
def url(self):
119+
return self.client.format_url(
120+
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}/getFailoverAllTestsDetails",
121+
**self.url_parameters
122+
)
123+
124+
@property
125+
def method(self):
126+
return "POST"
127+
128+
@property
129+
def error_format(self):
130+
return "ODataV4Format"
131+
132+
@property
133+
def url_parameters(self):
134+
parameters = {
135+
**self.serialize_url_param(
136+
"expressRouteGatewayName", self.ctx.args.express_route_gateway_name,
137+
required=True,
138+
),
139+
**self.serialize_url_param(
140+
"resourceGroupName", self.ctx.args.resource_group,
141+
required=True,
142+
),
143+
**self.serialize_url_param(
144+
"subscriptionId", self.ctx.subscription_id,
145+
required=True,
146+
),
147+
}
148+
return parameters
149+
150+
@property
151+
def query_parameters(self):
152+
parameters = {
153+
**self.serialize_query_param(
154+
"fetchLatest", self.ctx.args.fetch_latest,
155+
required=True,
156+
),
157+
**self.serialize_query_param(
158+
"type", self.ctx.args.type,
159+
required=True,
160+
),
161+
**self.serialize_query_param(
162+
"api-version", "2025-07-01",
163+
required=True,
164+
),
165+
}
166+
return parameters
167+
168+
@property
169+
def header_parameters(self):
170+
parameters = {
171+
**self.serialize_header_param(
172+
"Accept", "application/json",
173+
),
174+
}
175+
return parameters
176+
177+
def on_200(self, session):
178+
data = self.deserialize_http_content(session)
179+
self.ctx.set_var(
180+
"instance",
181+
data,
182+
schema_builder=self._build_schema_on_200
183+
)
184+
185+
_schema_on_200 = None
186+
187+
@classmethod
188+
def _build_schema_on_200(cls):
189+
if cls._schema_on_200 is not None:
190+
return cls._schema_on_200
191+
192+
cls._schema_on_200 = AAZListType()
193+
194+
_schema_on_200 = cls._schema_on_200
195+
_schema_on_200.Element = AAZObjectType()
196+
197+
_element = cls._schema_on_200.Element
198+
_element.circuits = AAZListType(
199+
flags={"read_only": True},
200+
)
201+
_element.connections = AAZListType(
202+
flags={"read_only": True},
203+
)
204+
_element.end_time = AAZStrType(
205+
serialized_name="endTime",
206+
flags={"read_only": True},
207+
)
208+
_element.issues = AAZListType(
209+
flags={"read_only": True},
210+
)
211+
_element.peering_location = AAZStrType(
212+
serialized_name="peeringLocation",
213+
flags={"read_only": True},
214+
)
215+
_element.start_time = AAZStrType(
216+
serialized_name="startTime",
217+
flags={"read_only": True},
218+
)
219+
_element.status = AAZStrType(
220+
flags={"read_only": True},
221+
)
222+
_element.test_guid = AAZStrType(
223+
serialized_name="testGuid",
224+
flags={"read_only": True},
225+
)
226+
_element.test_type = AAZStrType(
227+
serialized_name="testType",
228+
flags={"read_only": True},
229+
)
230+
231+
circuits = cls._schema_on_200.Element.circuits
232+
circuits.Element = AAZObjectType()
233+
234+
_element = cls._schema_on_200.Element.circuits.Element
235+
_element.connection_name = AAZStrType(
236+
serialized_name="connectionName",
237+
)
238+
_element.name = AAZStrType()
239+
_element.nrp_resource_uri = AAZStrType(
240+
serialized_name="nrpResourceUri",
241+
)
242+
243+
connections = cls._schema_on_200.Element.connections
244+
connections.Element = AAZObjectType()
245+
246+
_element = cls._schema_on_200.Element.connections.Element
247+
_element.last_updated_time = AAZStrType(
248+
serialized_name="lastUpdatedTime",
249+
flags={"read_only": True},
250+
)
251+
_element.name = AAZStrType()
252+
_element.nrp_resource_uri = AAZStrType(
253+
serialized_name="nrpResourceUri",
254+
)
255+
_element.status = AAZStrType()
256+
257+
issues = cls._schema_on_200.Element.issues
258+
issues.Element = AAZStrType()
259+
260+
return cls._schema_on_200
261+
262+
263+
class _GetFailoverAllTestsDetailHelper:
264+
"""Helper class for GetFailoverAllTestsDetail"""
265+
266+
267+
__all__ = ["GetFailoverAllTestsDetail"]

0 commit comments

Comments
 (0)