Skip to content

Commit 2daa3b1

Browse files
VeryEarlyrutuja-sNoriZC
authored
[Network] Update partner managed resources in GET call (#27204)
* add support for PartnerManagedResource * add UT * update help and changeLog * add missing properties * Update ChangeLog for cmdlet property changes --------- Co-authored-by: Rutuja Kishor Saptarshi <[email protected]> Co-authored-by: NoriZC <[email protected]>
1 parent c3aa805 commit 2daa3b1

File tree

10 files changed

+520
-1
lines changed

10 files changed

+520
-1
lines changed

src/Network/Network.Test/ScenarioTests/NetworkVirtualApplianceTests.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ public void TestNetworkVirtualApplianceCRUD()
3333
TestRunner.RunTestScript(string.Format("Test-NetworkVirtualApplianceCRUD"));
3434
}
3535

36+
[Fact]
37+
[Trait(Category.AcceptanceType, Category.CheckIn)]
38+
[Trait(Category.Owner, NrpTeamAlias.nvadev)]
39+
public void TestSaasNetworkVirtualApplianceGet()
40+
{
41+
TestRunner.RunTestScript(string.Format("Test-SaasNetworkVirtualApplianceGet"));
42+
}
43+
3644
[Fact(Skip = "A bug is being fixed by Nfv-Rp team")]
3745
[Trait(Category.AcceptanceType, Category.CheckIn)]
3846
[Trait(Category.Owner, NrpTeamAlias.nvadev)]

src/Network/Network.Test/ScenarioTests/NetworkVirtualApplianceTests.ps1

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,32 @@ function Test-NetworkVirtualApplianceCRUD
8080
}
8181
}
8282

83+
<#
84+
.SYNOPSIS
85+
Test Get Saas NetworkVirtualAppliance
86+
#>
87+
function Test-SaasNetworkVirtualApplianceGet
88+
{
89+
$rgname = Get-ResourceGroupName
90+
91+
# The commands are not supported in all regions yet.
92+
$rgName = "rsapt-test"
93+
$location = "australiaeast"
94+
$nvaname = "test-nva5"
95+
$wanname = "wan-test"
96+
$hubname = "hubtest"
97+
$resourceTypeParent = "Microsoft.Network/networkVirtualAppliance"
98+
try{
99+
$hub = Get-AzVirtualHub -ResourceGroupName $rgName -Name $hubname
100+
$getnva = Get-AzNetworkVirtualAppliance -ResourceGroupName $rgName -Name $nvaname
101+
Assert-NotNull $getnva
102+
Assert-NotNull($getnva.PartnerManagedResource)
103+
}
104+
finally{
105+
# Clean up
106+
}
107+
}
108+
83109
<#
84110
.SYNOPSIS
85111
Test creating new VirtualApplianceSite
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
{
2+
"Entries": [
3+
{
4+
"RequestUri": "/subscriptions/842ac4e1-2109-4c15-aa01-97087aae9722/resourceGroups/rsapt-test/providers/Microsoft.Network/virtualHubs/hubtest?api-version=2024-01-01",
5+
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvODQyYWM0ZTEtMjEwOS00YzE1LWFhMDEtOTcwODdhYWU5NzIyL3Jlc291cmNlR3JvdXBzL3JzYXB0LXRlc3QvcHJvdmlkZXJzL01pY3Jvc29mdC5OZXR3b3JrL3ZpcnR1YWxIdWJzL2h1YnRlc3Q/YXBpLXZlcnNpb249MjAyNC0wMS0wMQ==",
6+
"RequestMethod": "GET",
7+
"RequestHeaders": {
8+
"x-ms-client-request-id": [
9+
"bab1544a-267a-45e1-80d6-f7834b82f899"
10+
],
11+
"Accept-Language": [
12+
"en-US"
13+
],
14+
"User-Agent": [
15+
"FxVersion/6.0.3624.51421",
16+
"OSName/Windows",
17+
"OSVersion/Microsoft.Windows.10.0.26100",
18+
"Microsoft.Azure.Management.Network.NetworkManagementClient/27.0.0.0"
19+
]
20+
},
21+
"RequestBody": "",
22+
"ResponseHeaders": {
23+
"Cache-Control": [
24+
"no-cache"
25+
],
26+
"Pragma": [
27+
"no-cache"
28+
],
29+
"x-ms-request-id": [
30+
"87a6df03-4561-46eb-ad32-000f08646153"
31+
],
32+
"x-ms-correlation-request-id": [
33+
"eb8d3443-729e-47b0-99aa-5c382e5eead8"
34+
],
35+
"x-ms-arm-service-request-id": [
36+
"bcce5f1c-38a5-442c-9ed6-d074c56cf291"
37+
],
38+
"Strict-Transport-Security": [
39+
"max-age=31536000; includeSubDomains"
40+
],
41+
"x-ms-ratelimit-remaining-subscription-reads": [
42+
"1099"
43+
],
44+
"x-ms-ratelimit-remaining-subscription-global-reads": [
45+
"16499"
46+
],
47+
"x-ms-routing-request-id": [
48+
"WESTUS2:20250221T014403Z:eb8d3443-729e-47b0-99aa-5c382e5eead8"
49+
],
50+
"X-Content-Type-Options": [
51+
"nosniff"
52+
],
53+
"X-Cache": [
54+
"CONFIG_NOCACHE"
55+
],
56+
"X-MSEdge-Ref": [
57+
"Ref A: 3521C6352E8648DDA02DB1EE9B953394 Ref B: CO6AA3150217023 Ref C: 2025-02-21T01:44:02Z"
58+
],
59+
"Date": [
60+
"Fri, 21 Feb 2025 01:44:02 GMT"
61+
],
62+
"Content-Length": [
63+
"1026"
64+
],
65+
"Content-Type": [
66+
"application/json; charset=utf-8"
67+
],
68+
"Expires": [
69+
"-1"
70+
]
71+
},
72+
"ResponseBody": "{\r\n \"name\": \"hubtest\",\r\n \"id\": \"/subscriptions/842ac4e1-2109-4c15-aa01-97087aae9722/resourceGroups/rsapt-test/providers/Microsoft.Network/virtualHubs/hubtest\",\r\n \"etag\": \"W/\\\"b46ada3c-c7df-4500-b37b-f61890d8e42b\\\"\",\r\n \"type\": \"Microsoft.Network/virtualHubs\",\r\n \"location\": \"australiaeast\",\r\n \"tags\": {\r\n \"\\\"AzSecPackAutoConfigReady\\\"\": \"\\\"true\\\"\"\r\n },\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"virtualHubRouteTableV2s\": [],\r\n \"addressPrefix\": \"10.4.0.0/16\",\r\n \"virtualRouterAsn\": 65515,\r\n \"virtualRouterIps\": [\r\n \"10.4.32.5\",\r\n \"10.4.32.6\"\r\n ],\r\n \"routeTable\": {\r\n \"routes\": []\r\n },\r\n \"virtualRouterAutoScaleConfiguration\": {\r\n \"minCapacity\": 2\r\n },\r\n \"virtualWan\": {\r\n \"id\": \"/subscriptions/842ac4e1-2109-4c15-aa01-97087aae9722/resourceGroups/rsapt-test/providers/Microsoft.Network/virtualWans/wan-test\"\r\n },\r\n \"networkVirtualAppliances\": [\r\n {\r\n \"id\": \"/subscriptions/842ac4e1-2109-4c15-aa01-97087aae9722/resourceGroups/rsapt-test/providers/Microsoft.Network/networkVirtualAppliances/test-nva5\"\r\n }\r\n ],\r\n \"sku\": \"Standard\",\r\n \"routingState\": \"Provisioned\",\r\n \"allowBranchToBranchTraffic\": false,\r\n \"hubRoutingPreference\": \"ExpressRoute\"\r\n }\r\n}",
73+
"StatusCode": 200
74+
},
75+
{
76+
"RequestUri": "/subscriptions/842ac4e1-2109-4c15-aa01-97087aae9722/resourceGroups/rsapt-test/providers/Microsoft.Network/virtualHubs/hubtest/hubVirtualNetworkConnections?api-version=2024-01-01",
77+
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvODQyYWM0ZTEtMjEwOS00YzE1LWFhMDEtOTcwODdhYWU5NzIyL3Jlc291cmNlR3JvdXBzL3JzYXB0LXRlc3QvcHJvdmlkZXJzL01pY3Jvc29mdC5OZXR3b3JrL3ZpcnR1YWxIdWJzL2h1YnRlc3QvaHViVmlydHVhbE5ldHdvcmtDb25uZWN0aW9ucz9hcGktdmVyc2lvbj0yMDI0LTAxLTAx",
78+
"RequestMethod": "GET",
79+
"RequestHeaders": {
80+
"x-ms-client-request-id": [
81+
"bab1544a-267a-45e1-80d6-f7834b82f899"
82+
],
83+
"Accept-Language": [
84+
"en-US"
85+
],
86+
"User-Agent": [
87+
"FxVersion/6.0.3624.51421",
88+
"OSName/Windows",
89+
"OSVersion/Microsoft.Windows.10.0.26100",
90+
"Microsoft.Azure.Management.Network.NetworkManagementClient/27.0.0.0"
91+
]
92+
},
93+
"RequestBody": "",
94+
"ResponseHeaders": {
95+
"Cache-Control": [
96+
"no-cache"
97+
],
98+
"Pragma": [
99+
"no-cache"
100+
],
101+
"x-ms-request-id": [
102+
"ee8cf330-a882-4557-b72a-43dc985ee235"
103+
],
104+
"x-ms-correlation-request-id": [
105+
"0a2497ed-771f-4110-8c96-80b9a8c0d10f"
106+
],
107+
"x-ms-arm-service-request-id": [
108+
"148628b3-8e7c-4ec8-9f87-57a69a330ee4"
109+
],
110+
"Strict-Transport-Security": [
111+
"max-age=31536000; includeSubDomains"
112+
],
113+
"x-ms-ratelimit-remaining-subscription-reads": [
114+
"1099"
115+
],
116+
"x-ms-ratelimit-remaining-subscription-global-reads": [
117+
"16499"
118+
],
119+
"x-ms-routing-request-id": [
120+
"WESTUS2:20250221T014405Z:0a2497ed-771f-4110-8c96-80b9a8c0d10f"
121+
],
122+
"X-Content-Type-Options": [
123+
"nosniff"
124+
],
125+
"X-Cache": [
126+
"CONFIG_NOCACHE"
127+
],
128+
"X-MSEdge-Ref": [
129+
"Ref A: C2580786CE4F4C64B1FD5551E2E40657 Ref B: CO6AA3150217029 Ref C: 2025-02-21T01:44:04Z"
130+
],
131+
"Date": [
132+
"Fri, 21 Feb 2025 01:44:04 GMT"
133+
],
134+
"Content-Length": [
135+
"12"
136+
],
137+
"Content-Type": [
138+
"application/json; charset=utf-8"
139+
],
140+
"Expires": [
141+
"-1"
142+
]
143+
},
144+
"ResponseBody": "{\r\n \"value\": []\r\n}",
145+
"StatusCode": 200
146+
},
147+
{
148+
"RequestUri": "/subscriptions/842ac4e1-2109-4c15-aa01-97087aae9722/resourceGroups/rsapt-test/providers/Microsoft.Network/networkVirtualAppliances/test-nva5?api-version=2024-01-01",
149+
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvODQyYWM0ZTEtMjEwOS00YzE1LWFhMDEtOTcwODdhYWU5NzIyL3Jlc291cmNlR3JvdXBzL3JzYXB0LXRlc3QvcHJvdmlkZXJzL01pY3Jvc29mdC5OZXR3b3JrL25ldHdvcmtWaXJ0dWFsQXBwbGlhbmNlcy90ZXN0LW52YTU/YXBpLXZlcnNpb249MjAyNC0wMS0wMQ==",
150+
"RequestMethod": "GET",
151+
"RequestHeaders": {
152+
"x-ms-client-request-id": [
153+
"9dd23a53-f089-4b10-90d9-3c8545d2a180"
154+
],
155+
"Accept-Language": [
156+
"en-US"
157+
],
158+
"User-Agent": [
159+
"FxVersion/6.0.3624.51421",
160+
"OSName/Windows",
161+
"OSVersion/Microsoft.Windows.10.0.26100",
162+
"Microsoft.Azure.Management.Network.NetworkManagementClient/27.0.0.0"
163+
]
164+
},
165+
"RequestBody": "",
166+
"ResponseHeaders": {
167+
"Cache-Control": [
168+
"no-cache"
169+
],
170+
"Pragma": [
171+
"no-cache"
172+
],
173+
"ETag": [
174+
"\"26eab9e3-6584-4fe9-bd52-a0b8c5cdf932\""
175+
],
176+
"x-ms-ratelimit-remaining-subscription-reads": [
177+
"1099"
178+
],
179+
"x-ms-ratelimit-remaining-subscription-global-reads": [
180+
"16499"
181+
],
182+
"x-ms-request-id": [
183+
"30419566-fb57-4a23-8b29-0cf075bb20ea"
184+
],
185+
"x-ms-correlation-request-id": [
186+
"30419566-fb57-4a23-8b29-0cf075bb20ea"
187+
],
188+
"x-ms-routing-request-id": [
189+
"WESTUS2:20250221T014406Z:30419566-fb57-4a23-8b29-0cf075bb20ea"
190+
],
191+
"Strict-Transport-Security": [
192+
"max-age=31536000; includeSubDomains"
193+
],
194+
"X-Content-Type-Options": [
195+
"nosniff"
196+
],
197+
"X-Cache": [
198+
"CONFIG_NOCACHE"
199+
],
200+
"X-MSEdge-Ref": [
201+
"Ref A: 97329B7C06524759898DF304BC3FE97E Ref B: CO6AA3150217049 Ref C: 2025-02-21T01:44:05Z"
202+
],
203+
"Date": [
204+
"Fri, 21 Feb 2025 01:44:06 GMT"
205+
],
206+
"Content-Length": [
207+
"1550"
208+
],
209+
"Content-Type": [
210+
"application/json; charset=utf-8"
211+
],
212+
"Expires": [
213+
"-1"
214+
]
215+
},
216+
"ResponseBody": "{\r\n \"properties\": {\r\n \"virtualHub\": {\r\n \"id\": \"/subscriptions/842ac4e1-2109-4c15-aa01-97087aae9722/resourceGroups/rsapt-test/providers/Microsoft.Network/virtualHubs/hubtest\"\r\n },\r\n \"cloudInitConfiguration\": \"\",\r\n \"addressPrefix\": \"\",\r\n \"virtualApplianceNics\": [],\r\n \"delegation\": {\r\n \"serviceName\": \"PaloAltoNetworks.Cloudngfw/firewalls\",\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"deploymentType\": \"PartnerManaged\",\r\n \"partnerManagedResource\": {\r\n \"id\": \"/subscriptions/842ac4e1-2109-4c15-aa01-97087aae9722/resourceGroups/rsapt_test/providers/PaloAltoNetworks.Cloudngfw/firewalls/testID\",\r\n \"internalLoadBalancerId\": \"/subscriptions/842ac4e1-2109-4c15-aa01-97087aae9722/resourceGroups/rg-name/providers/Microsoft.Network/loadBalancers/trustILB\",\r\n \"standardLoadBalancerId\": \"/subscriptions/842ac4e1-2109-4c15-aa01-97087aae9722/resourceGroups/rg-name/providers/Microsoft.Network/loadBalancers/unTrustSLB\"\r\n },\r\n \"isInternetIngressCompatible\": false,\r\n \"virtualApplianceSites\": [],\r\n \"inboundSecurityRules\": [],\r\n \"virtualApplianceConnections\": [],\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"id\": \"/subscriptions/842ac4e1-2109-4c15-aa01-97087aae9722/resourceGroups/rsapt-test/providers/Microsoft.Network/networkVirtualAppliances/test-nva5\",\r\n \"name\": \"test-nva5\",\r\n \"type\": \"Microsoft.Network/NetworkVirtualAppliances\",\r\n \"etag\": \"26eab9e3-6584-4fe9-bd52-a0b8c5cdf932\",\r\n \"location\": \"australiaeast\",\r\n \"tags\": {\r\n \"\\\"AzSecPackAutoConfigReady\\\"\": \"\\\"true\\\"\"\r\n }\r\n}",
217+
"StatusCode": 200
218+
}
219+
],
220+
"Names": {
221+
"Test-SaasNetworkVirtualApplianceGet": [
222+
"ps474"
223+
]
224+
},
225+
"Variables": {
226+
"SubscriptionId": "842ac4e1-2109-4c15-aa01-97087aae9722"
227+
}
228+
}

src/Network/Network/ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
--->
2020

2121
## Upcoming Release
22+
* Updated cmdlet to add the property of `PartnerManagedResource`, and updated corresponding cmdlets.
23+
- `Get-AzNetworkVirtualAppliance`
2224
* Added cmdlet to retrieve boot diagnostic logs for a given NetworkVirtualAppliance VM instance:
2325
- `Get-AzNetworkVirtualApplianceBootDiagnostics`
2426
* Onboarded ExpressRoute cmdlets to manage Microsoft Peering Advertised prefix validation:

src/Network/Network/Common/NetworkResourceManagerProfile.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2242,6 +2242,7 @@ private static void Initialize()
22422242
cfg.CreateMap<CNM.PSVirtualApplianceInternetIngressIpsProperties, MNM.InternetIngressPublicIpsProperties>();
22432243
cfg.CreateMap<CNM.PSVirtualApplianceNetworkProfile, MNM.NetworkVirtualAppliancePropertiesFormatNetworkProfile>();
22442244
cfg.CreateMap<CNM.PSNetworkVirtualApplianceDelegationProperties, MNM.DelegationProperties>();
2245+
cfg.CreateMap<CNM.PSNetworkVirtualAppliancePartnerManagedResourceProperties, MNM.PartnerManagedResourceProperties>();
22452246

22462247
// MNM to CNM
22472248
// Where CNM - models from Powershell

src/Network/Network/Models/PSNetworkVirtualAppliance.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,28 @@ public class PSNetworkVirtualAppliance : PSTopLevelResource
4949

5050
public PSNetworkVirtualApplianceDelegationProperties Delegation { get; set; }
5151

52+
public PSNetworkVirtualAppliancePartnerManagedResourceProperties PartnerManagedResource { get; set; }
53+
5254
public IList<PSVirtualApplianceInternetIngressIpsProperties> InternetIngressPublicIps { get; set; }
5355

5456
public PSVirtualApplianceNetworkProfile NetworkProfile { get; set; }
57+
58+
[JsonIgnore]
59+
public string VirtualHubText
60+
{
61+
get { return JsonConvert.SerializeObject(VirtualHub, Formatting.Indented, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }); }
62+
}
63+
64+
[JsonIgnore]
65+
public string DelegationText
66+
{
67+
get { return JsonConvert.SerializeObject(Delegation, Formatting.Indented, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }); }
68+
}
69+
70+
[JsonIgnore]
71+
public string PartnerManagedResourceText
72+
{
73+
get { return JsonConvert.SerializeObject(PartnerManagedResource, Formatting.Indented, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }); }
74+
}
5575
}
5676
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using Microsoft.Azure.Management.Network.Models;
2+
using Newtonsoft.Json;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Text;
6+
7+
namespace Microsoft.Azure.Commands.Network.Models
8+
{
9+
public class PSNetworkVirtualAppliancePartnerManagedResourceProperties
10+
{
11+
public string Id { get; set; }
12+
13+
public string InternalLoadBalancerId { get; set; }
14+
15+
public string StandardLoadBalancerId { get; set; }
16+
}
17+
}

0 commit comments

Comments
 (0)