From 65f71f24db0773d696c18a1be126a179142fba48 Mon Sep 17 00:00:00 2001 From: Bhavana Kalivemula Date: Mon, 9 Mar 2026 17:40:46 +0530 Subject: [PATCH] vwan failover and resiliency commands added --- .../express_route_gateway/__cmd_group.py | 23 ++ .../network/express_route_gateway/__init__.py | 17 ++ .../_get_failover_all_tests_detail.py | 267 +++++++++++++++++ .../_get_failover_single_test_detail.py | 271 ++++++++++++++++++ .../_get_resiliency_information.py | 253 ++++++++++++++++ .../_get_routes_information.py | 241 ++++++++++++++++ .../_start_site_failover_test.py | 191 ++++++++++++ .../_stop_site_failover_test.py | 247 ++++++++++++++++ 8 files changed, 1510 insertions(+) create mode 100644 src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route_gateway/__cmd_group.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route_gateway/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route_gateway/_get_failover_all_tests_detail.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route_gateway/_get_failover_single_test_detail.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route_gateway/_get_resiliency_information.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route_gateway/_get_routes_information.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route_gateway/_start_site_failover_test.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route_gateway/_stop_site_failover_test.py diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route_gateway/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route_gateway/__cmd_group.py new file mode 100644 index 00000000000..0ee958b1ebf --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route_gateway/__cmd_group.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "network express-route-gateway", +) +class __CMDGroup(AAZCommandGroup): + """Manage Express Route Gateway + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route_gateway/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route_gateway/__init__.py new file mode 100644 index 00000000000..b2d3b30d925 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route_gateway/__init__.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._get_failover_all_tests_detail import * +from ._get_failover_single_test_detail import * +from ._get_resiliency_information import * +from ._get_routes_information import * +from ._start_site_failover_test import * +from ._stop_site_failover_test import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route_gateway/_get_failover_all_tests_detail.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route_gateway/_get_failover_all_tests_detail.py new file mode 100644 index 00000000000..8afb705abcc --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route_gateway/_get_failover_all_tests_detail.py @@ -0,0 +1,267 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "network express-route-gateway get-failover-all-tests-detail", +) +class GetFailoverAllTestsDetail(AAZCommand): + """This operation retrieves the details of all the failover tests performed on the Virtual Wan ExpressRoute gateways for different peering locations + + :example: VwanExpressRouteGatewayFailoverAllTestsDetails + 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 + """ + + _aaz_info = { + "version": "2025-07-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/expressroutegateways/{}/getfailoveralltestsdetails", "2025-07-01"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.express_route_gateway_name = AAZStrArg( + options=["--express-route-gateway-name"], + help="The name of the vwan express route gateway.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[A-Za-z0-9_]+", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.fetch_latest = AAZBoolArg( + options=["--fetch-latest"], + help="Fetch only the latest tests for each peering location", + required=True, + ) + _args_schema.type = AAZStrArg( + options=["--type"], + help="The type of failover test", + required=True, + enum={"All": "All", "LinkFailover": "LinkFailover", "MultiSiteFailover": "MultiSiteFailover", "SingleSiteFailover": "SingleSiteFailover"}, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.ExpressRouteGatewaysGetFailoverAllTestsDetails(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class ExpressRouteGatewaysGetFailoverAllTestsDetails(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}/getFailoverAllTestsDetails", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "expressRouteGatewayName", self.ctx.args.express_route_gateway_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "fetchLatest", self.ctx.args.fetch_latest, + required=True, + ), + **self.serialize_query_param( + "type", self.ctx.args.type, + required=True, + ), + **self.serialize_query_param( + "api-version", "2025-07-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZListType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.Element = AAZObjectType() + + _element = cls._schema_on_200.Element + _element.circuits = AAZListType( + flags={"read_only": True}, + ) + _element.connections = AAZListType( + flags={"read_only": True}, + ) + _element.end_time = AAZStrType( + serialized_name="endTime", + flags={"read_only": True}, + ) + _element.issues = AAZListType( + flags={"read_only": True}, + ) + _element.peering_location = AAZStrType( + serialized_name="peeringLocation", + flags={"read_only": True}, + ) + _element.start_time = AAZStrType( + serialized_name="startTime", + flags={"read_only": True}, + ) + _element.status = AAZStrType( + flags={"read_only": True}, + ) + _element.test_guid = AAZStrType( + serialized_name="testGuid", + flags={"read_only": True}, + ) + _element.test_type = AAZStrType( + serialized_name="testType", + flags={"read_only": True}, + ) + + circuits = cls._schema_on_200.Element.circuits + circuits.Element = AAZObjectType() + + _element = cls._schema_on_200.Element.circuits.Element + _element.connection_name = AAZStrType( + serialized_name="connectionName", + ) + _element.name = AAZStrType() + _element.nrp_resource_uri = AAZStrType( + serialized_name="nrpResourceUri", + ) + + connections = cls._schema_on_200.Element.connections + connections.Element = AAZObjectType() + + _element = cls._schema_on_200.Element.connections.Element + _element.last_updated_time = AAZStrType( + serialized_name="lastUpdatedTime", + flags={"read_only": True}, + ) + _element.name = AAZStrType() + _element.nrp_resource_uri = AAZStrType( + serialized_name="nrpResourceUri", + ) + _element.status = AAZStrType() + + issues = cls._schema_on_200.Element.issues + issues.Element = AAZStrType() + + return cls._schema_on_200 + + +class _GetFailoverAllTestsDetailHelper: + """Helper class for GetFailoverAllTestsDetail""" + + +__all__ = ["GetFailoverAllTestsDetail"] diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route_gateway/_get_failover_single_test_detail.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route_gateway/_get_failover_single_test_detail.py new file mode 100644 index 00000000000..c14f03a38a2 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route_gateway/_get_failover_single_test_detail.py @@ -0,0 +1,271 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "network express-route-gateway get-failover-single-test-detail", +) +class GetFailoverSingleTestDetail(AAZCommand): + """This operation retrieves the details of a particular failover test performed on the vwan expressRouteGateway based on the test Guid + + :example: VwanExpressRouteGatewayFailoverSingleTestDetails + az network express-route-gateway get-failover-single-test-detail --resource-group rg1 --express-route-gateway-name ergw --peering-location Vancouver --failover-test-id fe458ae8-d2ae-4520-a104-44bc233bde7e + """ + + _aaz_info = { + "version": "2025-07-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/expressroutegateways/{}/getfailoversingletestdetails", "2025-07-01"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.express_route_gateway_name = AAZStrArg( + options=["--express-route-gateway-name"], + help="The name of the vwan express route gateway.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[A-Za-z0-9_]+", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.failover_test_id = AAZStrArg( + options=["--failover-test-id"], + help="The unique Guid value which identifies the test", + required=True, + ) + _args_schema.peering_location = AAZStrArg( + options=["--peering-location"], + help="Peering location of the test", + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.ExpressRouteGatewaysGetFailoverSingleTestDetails(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class ExpressRouteGatewaysGetFailoverSingleTestDetails(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}/getFailoverSingleTestDetails", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "expressRouteGatewayName", self.ctx.args.express_route_gateway_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "failoverTestId", self.ctx.args.failover_test_id, + required=True, + ), + **self.serialize_query_param( + "peeringLocation", self.ctx.args.peering_location, + required=True, + ), + **self.serialize_query_param( + "api-version", "2025-07-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZListType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.Element = AAZObjectType() + + _element = cls._schema_on_200.Element + _element.attestation = AAZBoolType( + flags={"read_only": True}, + ) + _element.end_time = AAZStrType( + serialized_name="endTime", + flags={"read_only": True}, + ) + _element.failover_connection_details = AAZListType( + serialized_name="failoverConnectionDetails", + flags={"read_only": True}, + ) + _element.non_redundant_routes = AAZListType( + serialized_name="nonRedundantRoutes", + flags={"read_only": True}, + ) + _element.peering_location = AAZStrType( + serialized_name="peeringLocation", + flags={"read_only": True}, + ) + _element.redundant_routes = AAZListType( + serialized_name="redundantRoutes", + flags={"read_only": True}, + ) + _element.start_time = AAZStrType( + serialized_name="startTime", + flags={"read_only": True}, + ) + _element.status = AAZStrType( + flags={"read_only": True}, + ) + _element.was_simulation_successful = AAZBoolType( + serialized_name="wasSimulationSuccessful", + flags={"read_only": True}, + ) + + failover_connection_details = cls._schema_on_200.Element.failover_connection_details + failover_connection_details.Element = AAZObjectType() + + _element = cls._schema_on_200.Element.failover_connection_details.Element + _element.failover_connection_name = AAZStrType( + serialized_name="failoverConnectionName", + ) + _element.failover_location = AAZStrType( + serialized_name="failoverLocation", + ) + _element.is_verified = AAZBoolType( + serialized_name="isVerified", + ) + + non_redundant_routes = cls._schema_on_200.Element.non_redundant_routes + non_redundant_routes.Element = AAZStrType() + + redundant_routes = cls._schema_on_200.Element.redundant_routes + redundant_routes.Element = AAZObjectType() + + _element = cls._schema_on_200.Element.redundant_routes.Element + _element.peering_locations = AAZListType( + serialized_name="peeringLocations", + ) + _element.routes = AAZListType() + + peering_locations = cls._schema_on_200.Element.redundant_routes.Element.peering_locations + peering_locations.Element = AAZStrType() + + routes = cls._schema_on_200.Element.redundant_routes.Element.routes + routes.Element = AAZStrType() + + return cls._schema_on_200 + + +class _GetFailoverSingleTestDetailHelper: + """Helper class for GetFailoverSingleTestDetail""" + + +__all__ = ["GetFailoverSingleTestDetail"] diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route_gateway/_get_resiliency_information.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route_gateway/_get_resiliency_information.py new file mode 100644 index 00000000000..ac79442e358 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route_gateway/_get_resiliency_information.py @@ -0,0 +1,253 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "network express-route-gateway get-resiliency-information", +) +class GetResiliencyInformation(AAZCommand): + """This operation retrieves the resiliency information for VWAN ExpressRoute Gateway, including the gateway's current resiliency score and recommendations to further improve the score + + :example: VwanExpressRouteGatewayGetResiliencyInformation + az network express-route-gateway get-resiliency-information --resource-group rg1 --express-route-gateway-name ergw --attempt-refresh True + """ + + _aaz_info = { + "version": "2025-07-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/expressroutegateways/{}/getresiliencyinformation", "2025-07-01"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.express_route_gateway_name = AAZStrArg( + options=["--express-route-gateway-name"], + help="The name of the vwan express route gateway.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[A-Za-z0-9_]+", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.attempt_refresh = AAZBoolArg( + options=["--attempt-refresh"], + help="Attempt to recalculate the Resiliency Information for the gateway", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.ExpressRouteGatewaysGetResiliencyInformation(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class ExpressRouteGatewaysGetResiliencyInformation(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}/getResiliencyInformation", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "expressRouteGatewayName", self.ctx.args.express_route_gateway_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "attemptRefresh", self.ctx.args.attempt_refresh, + ), + **self.serialize_query_param( + "api-version", "2025-07-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.components = AAZListType( + flags={"read_only": True}, + ) + _schema_on_200.last_computed_time = AAZStrType( + serialized_name="lastComputedTime", + flags={"read_only": True}, + ) + _schema_on_200.max_score_from_recommendations = AAZStrType( + serialized_name="maxScoreFromRecommendations", + flags={"read_only": True}, + ) + _schema_on_200.min_score_from_recommendations = AAZStrType( + serialized_name="minScoreFromRecommendations", + flags={"read_only": True}, + ) + _schema_on_200.next_eligible_compute_time = AAZStrType( + serialized_name="nextEligibleComputeTime", + flags={"read_only": True}, + ) + _schema_on_200.overall_score = AAZStrType( + serialized_name="overallScore", + flags={"read_only": True}, + ) + _schema_on_200.score_change = AAZStrType( + serialized_name="scoreChange", + flags={"read_only": True}, + ) + + components = cls._schema_on_200.components + components.Element = AAZObjectType() + + _element = cls._schema_on_200.components.Element + _element.current_score = AAZStrType( + serialized_name="currentScore", + ) + _element.max_score = AAZStrType( + serialized_name="maxScore", + ) + _element.name = AAZStrType() + _element.recommendations = AAZListType() + + recommendations = cls._schema_on_200.components.Element.recommendations + recommendations.Element = AAZObjectType() + + _element = cls._schema_on_200.components.Element.recommendations.Element + _element.call_to_action_link = AAZStrType( + serialized_name="callToActionLink", + ) + _element.call_to_action_text = AAZStrType( + serialized_name="callToActionText", + ) + _element.details = AAZStrType() + _element.recommendation_id = AAZStrType( + serialized_name="recommendationId", + ) + _element.recommendation_text = AAZStrType( + serialized_name="recommendationText", + ) + _element.recommendation_title = AAZStrType( + serialized_name="recommendationTitle", + ) + _element.severity = AAZStrType() + + return cls._schema_on_200 + + +class _GetResiliencyInformationHelper: + """Helper class for GetResiliencyInformation""" + + +__all__ = ["GetResiliencyInformation"] diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route_gateway/_get_routes_information.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route_gateway/_get_routes_information.py new file mode 100644 index 00000000000..dff3facc1b3 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route_gateway/_get_routes_information.py @@ -0,0 +1,241 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "network express-route-gateway get-routes-information", +) +class GetRoutesInformation(AAZCommand): + """This operation retrieves the route set information for Vwan Express Route Gateway based on their resiliency + + :example: VwanExpressRouteGatewayGetRoutesInformation + az network express-route-gateway get-routes-information --resource-group rg1 --express-route-gateway-name ergw --attempt-refresh False + """ + + _aaz_info = { + "version": "2025-07-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/expressroutegateways/{}/getroutesinformation", "2025-07-01"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.express_route_gateway_name = AAZStrArg( + options=["--express-route-gateway-name"], + help="The name of the vwan express route gateway.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[A-Za-z0-9_]+", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.attempt_refresh = AAZBoolArg( + options=["--attempt-refresh"], + help="Attempt to recalculate the Route Sets Information for the gateway", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.ExpressRouteGatewaysGetRoutesInformation(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class ExpressRouteGatewaysGetRoutesInformation(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}/getRoutesInformation", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "expressRouteGatewayName", self.ctx.args.express_route_gateway_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "attemptRefresh", self.ctx.args.attempt_refresh, + ), + **self.serialize_query_param( + "api-version", "2025-07-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.circuits_metadata_map = AAZDictType( + serialized_name="circuitsMetadataMap", + flags={"read_only": True}, + ) + _schema_on_200.last_computed_time = AAZStrType( + serialized_name="lastComputedTime", + flags={"read_only": True}, + ) + _schema_on_200.next_eligible_compute_time = AAZStrType( + serialized_name="nextEligibleComputeTime", + flags={"read_only": True}, + ) + _schema_on_200.route_set_version = AAZStrType( + serialized_name="routeSetVersion", + flags={"read_only": True}, + ) + _schema_on_200.route_sets = AAZListType( + serialized_name="routeSets", + flags={"read_only": True}, + ) + + circuits_metadata_map = cls._schema_on_200.circuits_metadata_map + circuits_metadata_map.Element = AAZObjectType() + + _element = cls._schema_on_200.circuits_metadata_map.Element + _element.link = AAZStrType() + _element.location = AAZStrType() + _element.name = AAZStrType() + + route_sets = cls._schema_on_200.route_sets + route_sets.Element = AAZObjectType() + + _element = cls._schema_on_200.route_sets.Element + _element.details = AAZDictType() + _element.locations = AAZListType() + _element.name = AAZStrType() + + details = cls._schema_on_200.route_sets.Element.details + details.Element = AAZListType() + + _element = cls._schema_on_200.route_sets.Element.details.Element + _element.Element = AAZObjectType() + + _element = cls._schema_on_200.route_sets.Element.details.Element.Element + _element.circuit = AAZStrType() + _element.pri = AAZStrType() + _element.sec = AAZStrType() + + locations = cls._schema_on_200.route_sets.Element.locations + locations.Element = AAZStrType() + + return cls._schema_on_200 + + +class _GetRoutesInformationHelper: + """Helper class for GetRoutesInformation""" + + +__all__ = ["GetRoutesInformation"] diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route_gateway/_start_site_failover_test.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route_gateway/_start_site_failover_test.py new file mode 100644 index 00000000000..6cbbf0009d9 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route_gateway/_start_site_failover_test.py @@ -0,0 +1,191 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "network express-route-gateway start-site-failover-test", +) +class StartSiteFailoverTest(AAZCommand): + """This operation starts failover simulation on the vwan expressRouteGateway for the specified peering location + + :example: VwanExpressRouteGatewayStartSiteFailoverSimulation + az network express-route-gateway start-site-failover-test --resource-group rg1 --express-route-gateway-name ergw --peering-location Vancouver + """ + + _aaz_info = { + "version": "2025-07-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/expressroutegateways/{}/startsitefailovertest", "2025-07-01"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.express_route_gateway_name = AAZStrArg( + options=["--express-route-gateway-name"], + help="The name of the express route gateway.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[A-Za-z0-9_]+", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.peering_location = AAZStrArg( + options=["--peering-location"], + help="Peering location of the test", + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.ExpressRouteGatewaysStartSiteFailoverTest(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=False) + return result + + class ExpressRouteGatewaysStartSiteFailoverTest(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}/startSiteFailoverTest", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "expressRouteGatewayName", self.ctx.args.express_route_gateway_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "peeringLocation", self.ctx.args.peering_location, + required=True, + ), + **self.serialize_query_param( + "api-version", "2025-07-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZStrType() + + return cls._schema_on_200 + + +class _StartSiteFailoverTestHelper: + """Helper class for StartSiteFailoverTest""" + + +__all__ = ["StartSiteFailoverTest"] diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route_gateway/_stop_site_failover_test.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route_gateway/_stop_site_failover_test.py new file mode 100644 index 00000000000..19b2d68dcfb --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route_gateway/_stop_site_failover_test.py @@ -0,0 +1,247 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "network express-route-gateway stop-site-failover-test", +) +class StopSiteFailoverTest(AAZCommand): + """This operation stops an ongoing failover simulation on the vwan expressRouteGateway for the specified peering location + + :example: VwanExpressRouteGatewayStopSiteFailoverSimulation + az network express-route-gateway stop-site-failover-test --resource-group rg1 --express-route-gateway-name ergw --peering-location Vancouver --was-simulation-successful True --details "[{failover-connection-name:conn1,failover-location:Denver,is-verified:False},{failover-connection-name:conn2,failover-location:Amsterdam,is-verified:True}]" + """ + + _aaz_info = { + "version": "2025-07-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/expressroutegateways/{}/stopsitefailovertest", "2025-07-01"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.express_route_gateway_name = AAZStrArg( + options=["--express-route-gateway-name"], + help="The name of the express route gateway.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[A-Za-z0-9_]+", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "StopParameters" + + _args_schema = cls._args_schema + _args_schema.details = AAZListArg( + options=["--details"], + arg_group="StopParameters", + help="List of all the failover connections for this peering location", + required=True, + ) + _args_schema.peering_location = AAZStrArg( + options=["--peering-location"], + arg_group="StopParameters", + help="Peering location of the test", + required=True, + ) + _args_schema.was_simulation_successful = AAZBoolArg( + options=["--was-simulation-successful"], + arg_group="StopParameters", + help="Whether the failover simulation was successful or not", + required=True, + ) + + details = cls._args_schema.details + details.Element = AAZObjectArg() + + _element = cls._args_schema.details.Element + _element.failover_connection_name = AAZStrArg( + options=["failover-connection-name"], + help="Name of the failover connection", + ) + _element.failover_location = AAZStrArg( + options=["failover-location"], + help="Location of the failover connection", + ) + _element.is_verified = AAZBoolArg( + options=["is-verified"], + help="Whether the customer was able to establish connectivity through this failover connection or not", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.ExpressRouteGatewaysStopSiteFailoverTest(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=False) + return result + + class ExpressRouteGatewaysStopSiteFailoverTest(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}/stopSiteFailoverTest", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "expressRouteGatewayName", self.ctx.args.express_route_gateway_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2025-07-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("details", AAZListType, ".details", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("peeringLocation", AAZStrType, ".peering_location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("wasSimulationSuccessful", AAZBoolType, ".was_simulation_successful", typ_kwargs={"flags": {"required": True}}) + + details = _builder.get(".details") + if details is not None: + details.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".details[]") + if _elements is not None: + _elements.set_prop("failoverConnectionName", AAZStrType, ".failover_connection_name") + _elements.set_prop("failoverLocation", AAZStrType, ".failover_location") + _elements.set_prop("isVerified", AAZBoolType, ".is_verified") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZStrType() + + return cls._schema_on_200 + + +class _StopSiteFailoverTestHelper: + """Helper class for StopSiteFailoverTest""" + + +__all__ = ["StopSiteFailoverTest"]