Skip to content

Commit 1f408c3

Browse files
aytripathiaytripathi
andauthored
Added extension support for NNF 4.2 release (#7095)
* Added extension support for NNF 4.2 release * added whitespaces in around arithmetic operator * Added new line at end of file * Fixed flake8 linting issues * Removed test_managednetworkfabric.py file as it was not in use --------- Co-authored-by: aytripathi <aytripathi@DESKTOP-DN8JFGH>
1 parent d350180 commit 1f408c3

File tree

79 files changed

+11147
-4093
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+11147
-4093
lines changed

src/managednetworkfabric/HISTORY.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
33
Release History
44
===============
5+
4.2.0
6+
++++++
7+
* Added support for upgrading Device and Network Fabric resource.
8+
* Added support for validate configuration in Network Fabric resources.
59

610
4.1.1
711
++++++
@@ -40,4 +44,4 @@ Release History
4044

4145
1.0.0b1
4246
++++++
43-
* Initial release.
47+
* Initial release.

src/managednetworkfabric/azext_managednetworkfabric/aaz/latest/networkfabric/device/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@
1212
from ._list import *
1313
from ._show import *
1414
from ._update import *
15+
from ._upgrade import *
1516
from ._wait import *
Lines changed: 273 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,273 @@
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+
"networkfabric device upgrade",
16+
)
17+
class Upgrade(AAZCommand):
18+
"""Upgrades the version of the Network Device.
19+
"""
20+
21+
_aaz_info = {
22+
"version": "2023-06-15",
23+
"resources": [
24+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.managednetworkfabric/networkdevices/{}/upgrade", "2023-06-15"],
25+
]
26+
}
27+
28+
AZ_SUPPORT_NO_WAIT = True
29+
30+
def _handler(self, command_args):
31+
super()._handler(command_args)
32+
return self.build_lro_poller(self._execute_operations, self._output)
33+
34+
_args_schema = None
35+
36+
@classmethod
37+
def _build_arguments_schema(cls, *args, **kwargs):
38+
if cls._args_schema is not None:
39+
return cls._args_schema
40+
cls._args_schema = super()._build_arguments_schema(*args, **kwargs)
41+
42+
# define Arg Group ""
43+
44+
_args_schema = cls._args_schema
45+
_args_schema.resource_name = AAZStrArg(
46+
options=["--resource-name"],
47+
help="Name of the Network Device.",
48+
required=True,
49+
id_part="name",
50+
)
51+
_args_schema.resource_group = AAZResourceGroupNameArg(
52+
help="Name of the resource group",
53+
required=True,
54+
)
55+
56+
# define Arg Group "Body"
57+
58+
_args_schema = cls._args_schema
59+
_args_schema.version = AAZStrArg(
60+
options=["--version"],
61+
arg_group="Body",
62+
help="Specify the version.",
63+
)
64+
return cls._args_schema
65+
66+
def _execute_operations(self):
67+
self.pre_operations()
68+
yield self.NetworkDevicesUpgrade(ctx=self.ctx)()
69+
self.post_operations()
70+
71+
@register_callback
72+
def pre_operations(self):
73+
pass
74+
75+
@register_callback
76+
def post_operations(self):
77+
pass
78+
79+
def _output(self, *args, **kwargs):
80+
result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True)
81+
return result
82+
83+
class NetworkDevicesUpgrade(AAZHttpOperation):
84+
CLIENT_TYPE = "MgmtClient"
85+
86+
def __call__(self, *args, **kwargs):
87+
request = self.make_request()
88+
session = self.client.send_request(request=request, stream=False, **kwargs)
89+
if session.http_response.status_code in [202]:
90+
return self.client.build_lro_polling(
91+
self.ctx.args.no_wait,
92+
session,
93+
self.on_200,
94+
self.on_error,
95+
lro_options={"final-state-via": "location"},
96+
path_format_arguments=self.url_parameters,
97+
)
98+
if session.http_response.status_code in [200]:
99+
return self.client.build_lro_polling(
100+
self.ctx.args.no_wait,
101+
session,
102+
self.on_200,
103+
self.on_error,
104+
lro_options={"final-state-via": "location"},
105+
path_format_arguments=self.url_parameters,
106+
)
107+
108+
return self.on_error(session.http_response)
109+
110+
@property
111+
def url(self):
112+
return self.client.format_url(
113+
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/upgrade",
114+
**self.url_parameters
115+
)
116+
117+
@property
118+
def method(self):
119+
return "POST"
120+
121+
@property
122+
def error_format(self):
123+
return "MgmtErrorFormat"
124+
125+
@property
126+
def url_parameters(self):
127+
parameters = {
128+
**self.serialize_url_param(
129+
"networkDeviceName", self.ctx.args.resource_name,
130+
required=True,
131+
),
132+
**self.serialize_url_param(
133+
"resourceGroupName", self.ctx.args.resource_group,
134+
required=True,
135+
),
136+
**self.serialize_url_param(
137+
"subscriptionId", self.ctx.subscription_id,
138+
required=True,
139+
),
140+
}
141+
return parameters
142+
143+
@property
144+
def query_parameters(self):
145+
parameters = {
146+
**self.serialize_query_param(
147+
"api-version", "2023-06-15",
148+
required=True,
149+
),
150+
}
151+
return parameters
152+
153+
@property
154+
def header_parameters(self):
155+
parameters = {
156+
**self.serialize_header_param(
157+
"Content-Type", "application/json",
158+
),
159+
**self.serialize_header_param(
160+
"Accept", "application/json",
161+
),
162+
}
163+
return parameters
164+
165+
@property
166+
def content(self):
167+
_content_value, _builder = self.new_content_builder(
168+
self.ctx.args,
169+
typ=AAZObjectType,
170+
typ_kwargs={"flags": {"required": True, "client_flatten": True}}
171+
)
172+
_builder.set_prop("version", AAZStrType, ".version")
173+
174+
return self.serialize_content(_content_value)
175+
176+
def on_200(self, session):
177+
data = self.deserialize_http_content(session)
178+
self.ctx.set_var(
179+
"instance",
180+
data,
181+
schema_builder=self._build_schema_on_200
182+
)
183+
184+
_schema_on_200 = None
185+
186+
@classmethod
187+
def _build_schema_on_200(cls):
188+
if cls._schema_on_200 is not None:
189+
return cls._schema_on_200
190+
191+
cls._schema_on_200 = AAZObjectType()
192+
_UpgradeHelper._build_schema_common_post_action_response_for_state_update_read(cls._schema_on_200)
193+
194+
return cls._schema_on_200
195+
196+
197+
class _UpgradeHelper:
198+
"""Helper class for Upgrade"""
199+
200+
_schema_common_post_action_response_for_state_update_read = None
201+
202+
@classmethod
203+
def _build_schema_common_post_action_response_for_state_update_read(cls, _schema):
204+
if cls._schema_common_post_action_response_for_state_update_read is not None:
205+
_schema.configuration_state = cls._schema_common_post_action_response_for_state_update_read.configuration_state
206+
_schema.error = cls._schema_common_post_action_response_for_state_update_read.error
207+
return
208+
209+
cls._schema_common_post_action_response_for_state_update_read = _schema_common_post_action_response_for_state_update_read = AAZObjectType()
210+
211+
common_post_action_response_for_state_update_read = _schema_common_post_action_response_for_state_update_read
212+
common_post_action_response_for_state_update_read.configuration_state = AAZStrType(
213+
serialized_name="configurationState",
214+
flags={"read_only": True},
215+
)
216+
common_post_action_response_for_state_update_read.error = AAZObjectType()
217+
cls._build_schema_error_detail_read(common_post_action_response_for_state_update_read.error)
218+
219+
_schema.configuration_state = cls._schema_common_post_action_response_for_state_update_read.configuration_state
220+
_schema.error = cls._schema_common_post_action_response_for_state_update_read.error
221+
222+
_schema_error_detail_read = None
223+
224+
@classmethod
225+
def _build_schema_error_detail_read(cls, _schema):
226+
if cls._schema_error_detail_read is not None:
227+
_schema.additional_info = cls._schema_error_detail_read.additional_info
228+
_schema.code = cls._schema_error_detail_read.code
229+
_schema.details = cls._schema_error_detail_read.details
230+
_schema.message = cls._schema_error_detail_read.message
231+
_schema.target = cls._schema_error_detail_read.target
232+
return
233+
234+
cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType()
235+
236+
error_detail_read = _schema_error_detail_read
237+
error_detail_read.additional_info = AAZListType(
238+
serialized_name="additionalInfo",
239+
flags={"read_only": True},
240+
)
241+
error_detail_read.code = AAZStrType(
242+
flags={"read_only": True},
243+
)
244+
error_detail_read.details = AAZListType(
245+
flags={"read_only": True},
246+
)
247+
error_detail_read.message = AAZStrType(
248+
flags={"read_only": True},
249+
)
250+
error_detail_read.target = AAZStrType(
251+
flags={"read_only": True},
252+
)
253+
254+
additional_info = _schema_error_detail_read.additional_info
255+
additional_info.Element = AAZObjectType()
256+
257+
_element = _schema_error_detail_read.additional_info.Element
258+
_element.type = AAZStrType(
259+
flags={"read_only": True},
260+
)
261+
262+
details = _schema_error_detail_read.details
263+
details.Element = AAZObjectType()
264+
cls._build_schema_error_detail_read(details.Element)
265+
266+
_schema.additional_info = cls._schema_error_detail_read.additional_info
267+
_schema.code = cls._schema_error_detail_read.code
268+
_schema.details = cls._schema_error_detail_read.details
269+
_schema.message = cls._schema_error_detail_read.message
270+
_schema.target = cls._schema_error_detail_read.target
271+
272+
273+
__all__ = ["Upgrade"]

src/managednetworkfabric/azext_managednetworkfabric/aaz/latest/networkfabric/externalnetwork/_create.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
169169
option_a_properties.primary_ipv6_prefix = AAZStrArg(
170170
options=["primary-ipv6-prefix"],
171171
help="IPv6 Address Prefix. Example: 3FFE:FFFF:0:CD30::a1/127",
172+
nullable=True,
172173
)
173174
option_a_properties.secondary_ipv4_prefix = AAZStrArg(
174175
options=["secondary-ipv4-prefix"],
@@ -177,6 +178,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
177178
option_a_properties.secondary_ipv6_prefix = AAZStrArg(
178179
options=["secondary-ipv6-prefix"],
179180
help="Secondary IPv6 Address Prefix. Example: 3FFE:FFFF:0:CD30::a4/127",
181+
nullable=True,
180182
)
181183
option_a_properties.vlan_id = AAZIntArg(
182184
options=["vlan-id"],
@@ -406,9 +408,9 @@ def content(self):
406408
option_a_properties.set_prop("mtu", AAZIntType, ".mtu")
407409
option_a_properties.set_prop("peerASN", AAZIntType, ".peer_asn", typ_kwargs={"flags": {"required": True}})
408410
option_a_properties.set_prop("primaryIpv4Prefix", AAZStrType, ".primary_ipv4_prefix")
409-
option_a_properties.set_prop("primaryIpv6Prefix", AAZStrType, ".primary_ipv6_prefix")
411+
option_a_properties.set_prop("primaryIpv6Prefix", AAZStrType, ".primary_ipv6_prefix", typ_kwargs={"nullable": True})
410412
option_a_properties.set_prop("secondaryIpv4Prefix", AAZStrType, ".secondary_ipv4_prefix")
411-
option_a_properties.set_prop("secondaryIpv6Prefix", AAZStrType, ".secondary_ipv6_prefix")
413+
option_a_properties.set_prop("secondaryIpv6Prefix", AAZStrType, ".secondary_ipv6_prefix", typ_kwargs={"nullable": True})
412414
option_a_properties.set_prop("vlanId", AAZIntType, ".vlan_id", typ_kwargs={"flags": {"required": True}})
413415

414416
bfd_configuration = _builder.get(".properties.optionAProperties.bfdConfiguration")
@@ -571,12 +573,14 @@ def _build_schema_on_200_201(cls):
571573
)
572574
option_a_properties.primary_ipv6_prefix = AAZStrType(
573575
serialized_name="primaryIpv6Prefix",
576+
nullable=True,
574577
)
575578
option_a_properties.secondary_ipv4_prefix = AAZStrType(
576579
serialized_name="secondaryIpv4Prefix",
577580
)
578581
option_a_properties.secondary_ipv6_prefix = AAZStrType(
579582
serialized_name="secondaryIpv6Prefix",
583+
nullable=True,
580584
)
581585
option_a_properties.vlan_id = AAZIntType(
582586
serialized_name="vlanId",

src/managednetworkfabric/azext_managednetworkfabric/aaz/latest/networkfabric/externalnetwork/_list.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,12 +260,14 @@ def _build_schema_on_200(cls):
260260
)
261261
option_a_properties.primary_ipv6_prefix = AAZStrType(
262262
serialized_name="primaryIpv6Prefix",
263+
nullable=True,
263264
)
264265
option_a_properties.secondary_ipv4_prefix = AAZStrType(
265266
serialized_name="secondaryIpv4Prefix",
266267
)
267268
option_a_properties.secondary_ipv6_prefix = AAZStrType(
268269
serialized_name="secondaryIpv6Prefix",
270+
nullable=True,
269271
)
270272
option_a_properties.vlan_id = AAZIntType(
271273
serialized_name="vlanId",

src/managednetworkfabric/azext_managednetworkfabric/aaz/latest/networkfabric/externalnetwork/_show.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,12 +262,14 @@ def _build_schema_on_200(cls):
262262
)
263263
option_a_properties.primary_ipv6_prefix = AAZStrType(
264264
serialized_name="primaryIpv6Prefix",
265+
nullable=True,
265266
)
266267
option_a_properties.secondary_ipv4_prefix = AAZStrType(
267268
serialized_name="secondaryIpv4Prefix",
268269
)
269270
option_a_properties.secondary_ipv6_prefix = AAZStrType(
270271
serialized_name="secondaryIpv6Prefix",
272+
nullable=True,
271273
)
272274
option_a_properties.vlan_id = AAZIntType(
273275
serialized_name="vlanId",

0 commit comments

Comments
 (0)