Skip to content

Commit ebff8b3

Browse files
authored
Merge pull request #26609 from sssharma24/sssharma/ps-bugbash
ipam vnv bug fix
2 parents bf6e734 + 8b27fc7 commit ebff8b3

17 files changed

+855
-932
lines changed

src/Network/Network.Test/ScenarioTests/NetworkManagerTests.ps1

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,16 +1528,16 @@ function Test-NetworkManagerIpamPoolStaticCidrCRUD
15281528
New-AzNetworkManagerIpamPool -ResourceGroupName $rgName -NetworkManagerName $networkManagerName -Name $ipamPoolName -Location $rglocation -AddressPrefix $addressPrefixes
15291529

15301530
# Create static cidr
1531-
New-AzNetworkManagerIpamPoolStaticCidr -ResourceGroupName $rgName -NetworkManagerName $networkManagerName -PoolName $ipamPoolName -Name $staticCidrName -AddressPrefix $addressPrefixes
1531+
New-AzNetworkManagerIpamPoolStaticCidr -ResourceGroupName $rgName -NetworkManagerName $networkManagerName -IpamPoolName $ipamPoolName -Name $staticCidrName -AddressPrefix $addressPrefixes
15321532

15331533
# Get static cidr
1534-
$staticCidr = Get-AzNetworkManagerIpamPoolStaticCidr -ResourceGroupName $rgName -NetworkManagerName $networkManagerName -PoolName $ipamPoolName -Name $staticCidrName
1534+
$staticCidr = Get-AzNetworkManagerIpamPoolStaticCidr -ResourceGroupName $rgName -NetworkManagerName $networkManagerName -IpamPoolName $ipamPoolName -Name $staticCidrName
15351535
Assert-NotNull $staticCidr;
15361536
Assert-AreEqual $staticCidrName $staticCidr.Name;
15371537
Assert-AreEqual $staticCidr.Properties.AddressPrefixes[0] $addressPrefixes[0];
15381538

15391539
# Remove static cidr
1540-
$job = Remove-AzNetworkManagerIpamPoolStaticCidr -ResourceGroupName $rgName -NetworkManagerName $networkManagerName -PoolName $ipamPoolName -Name $staticCidrName -PassThru -Force -AsJob;
1540+
$job = Remove-AzNetworkManagerIpamPoolStaticCidr -ResourceGroupName $rgName -NetworkManagerName $networkManagerName -IpamPoolName $ipamPoolName -Name $staticCidrName -PassThru -Force -AsJob;
15411541
$job | Wait-Job;
15421542
$removeResult = $job | Receive-Job;
15431543
}
@@ -1629,27 +1629,32 @@ function Test-NetworkManagerVerifierWorkspaceReachabilityAnalysisRunCRUD
16291629
Assert-NotNull $reachabilityAnalysisRun
16301630
Assert-AreEqual $reachabilityAnalysisRunName $reachabilityAnalysisRun.Name
16311631

1632-
# Get analysis run list
1632+
# Get analysis run list
16331633
$reachabilityAnalysisRunList = Get-AzNetworkManagerVerifierWorkspaceReachabilityAnalysisRun -ResourceGroupName $rgName -NetworkManagerName $networkManagerName -VerifierWorkspaceName $verifierWorkspaceName
16341634
Assert-NotNull $reachabilityAnalysisRunList;
16351635
Assert-AreEqual $reachabilityAnalysisRunList.Count 1
16361636

1637-
Start-TestSleep -Seconds 300
1638-
Assert-NotNull $reachabilityAnalysisRun
1639-
Assert-AreEqual "DESCription" $reachabilityAnalysisRun.Properties.Description;
1640-
Assert-AreEqual $intentId $reachabilityAnalysisRun.Properties.IntentId;
1637+
Start-TestSleep -Seconds 300
1638+
Assert-NotNull $reachabilityAnalysisRun
1639+
1640+
# Output the value of AnalysisResult for debugging
1641+
Write-Output "AnalysisResult: $($reachabilityAnalysisRun.Properties.AnalysisResult)"
1642+
1643+
Assert-NotNull $reachabilityAnalysisRun.Properties.AnalysisResult
1644+
Assert-AreEqual "DESCription" $reachabilityAnalysisRun.Properties.Description;
1645+
Assert-AreEqual $intentId $reachabilityAnalysisRun.Properties.IntentId;
16411646

16421647
# Delete analysis run
16431648
$job = Remove-AzNetworkManagerVerifierWorkspaceReachabilityAnalysisRun -ResourceGroupName $rgName -NetworkManagerName $networkManagerName -Name $reachabilityAnalysisRunName -VerifierWorkspaceName $verifierWorkspaceName -PassThru -Force -AsJob;
16441649
$job | Wait-Job;
16451650
$removeResult = $job | Receive-Job;
16461651

1647-
# Delete analysis intent
1652+
# Delete analysis intent
16481653
$job = Remove-AzNetworkManagerVerifierWorkspaceReachabilityAnalysisIntent -ResourceGroupName $rgName -NetworkManagerName $networkManagerName -VerifierWorkspaceName $verifierWorkspaceName -Name $reachabilityAnalysisIntentName -PassThru -Force -AsJob;
16491654
$job | Wait-Job;
16501655
$removeResult = $job | Receive-Job;
16511656

1652-
# Delete verifier workspace
1657+
# Delete verifier workspace
16531658
$job = Remove-AzNetworkManagerVerifierWorkspace -ResourceGroupName $rgName -NetworkManagerName $networkManagerName -Name $verifierWorkspaceName -PassThru -Force -AsJob;
16541659
$job | Wait-Job;
16551660
$removeResult = $job | Receive-Job;

src/Network/Network.Test/SessionRecords/Commands.Network.Test.ScenarioTests.NetworkManagerTests/NetworkManagerIpamPoolStaticCidrCRUD.json

Lines changed: 186 additions & 255 deletions
Large diffs are not rendered by default.

src/Network/Network.Test/SessionRecords/Commands.Network.Test.ScenarioTests.NetworkManagerTests/NetworkManagerVerifierWorkspaceReachabilityAnalysisRunCRUD.json

Lines changed: 319 additions & 583 deletions
Large diffs are not rendered by default.

src/Network/Network/Models/NetworkManager/PSIntentContent.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ namespace Microsoft.Azure.Commands.Network.Models.NetworkManager
1919
{
2020
public class PSIntentContent
2121
{
22-
public string SourceResourceId { get; }
23-
public string DestinationResourceId { get; }
24-
public PSIPTraffic IpTraffic { get; }
22+
public string SourceResourceId { get; set; }
23+
public string DestinationResourceId { get; set; }
24+
public PSIPTraffic IpTraffic { get; set; }
2525

2626
[JsonIgnore]
2727
public string IntentContentText

src/Network/Network/Models/NetworkManager/PSReachabilityAnalysisRunProperties.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ public class PSReachabilityAnalysisRunProperties
2323
public string Description { get; set; }
2424

2525
public string IntentId { get; set; }
26-
public PSIntentContent IntentContent { get; }
27-
public string AnalysisResult { get; }
28-
public string ErrorMessage { get; }
26+
public PSIntentContent IntentContent { get; set; }
27+
public string AnalysisResult { get; set; }
28+
public string ErrorMessage { get; set; }
2929

3030
}
3131
}

src/Network/Network/Models/NetworkManager/PSVerifierWorkspaceProperties.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ public class PSVerifierWorkspaceProperties
2222

2323
public string Description { get; set; }
2424

25-
public string DisplayName { get; set; }
26-
2725
public string VerifierWorkspaceName { get; set; }
2826
}
2927
}

src/Network/Network/NetworkManager/IpamPool/GetAzNetworkManagerIpamPoolStaticCidrCommand.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,22 +67,22 @@ public class GetAzNetworkManagerIpamPoolStaticCidrCommand : IpamPoolStaticCidrBa
6767
[ResourceGroupCompleter]
6868
[ValidateNotNullOrEmpty]
6969
[SupportsWildcards]
70-
public virtual string PoolName { get; set; }
70+
public virtual string IpamPoolName { get; set; }
7171

7272
public override void Execute()
7373
{
7474
base.Execute();
7575
if (this.Name != null)
7676
{
77-
var staticCidr = this.GetStaticCidr(this.ResourceGroupName, this.NetworkManagerName, this.PoolName, this.Name);
77+
var staticCidr = this.GetStaticCidr(this.ResourceGroupName, this.NetworkManagerName, this.IpamPoolName, this.Name);
7878
staticCidr.ResourceGroupName = this.ResourceGroupName;
7979
staticCidr.NetworkManagerName = this.NetworkManagerName;
8080
WriteObject(staticCidr);
8181
}
8282
else
8383
{
8484
IPage<StaticCidr> staticCidrPage;
85-
staticCidrPage = this.StaticCidrClient.List(this.ResourceGroupName, this.NetworkManagerName, this.PoolName);
85+
staticCidrPage = this.StaticCidrClient.List(this.ResourceGroupName, this.NetworkManagerName, this.IpamPoolName);
8686

8787
// Get all resources by polling on next page link
8888
var staticCidrList = ListNextLink<StaticCidr>.GetAllResourcesByPollingNextLink(staticCidrPage, this.StaticCidrClient.ListNext);

src/Network/Network/NetworkManager/IpamPool/IpamPoolStaticCidrBaseCmdlet.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ public IStaticCidrsOperations StaticCidrClient
2929
}
3030
}
3131

32-
public bool IsStaticCidrPresent(string resourceGroupName, string networkManagerName, string poolName, string staticCidrName)
32+
public bool IsStaticCidrPresent(string resourceGroupName, string networkManagerName, string ipamPoolName, string staticCidrName)
3333
{
3434
try
3535
{
36-
GetStaticCidr(resourceGroupName, networkManagerName, poolName, staticCidrName);
36+
GetStaticCidr(resourceGroupName, networkManagerName, ipamPoolName, staticCidrName);
3737
}
3838
catch (Microsoft.Azure.Management.Network.Models.CommonErrorResponseException exception)
3939
{
@@ -49,13 +49,13 @@ public bool IsStaticCidrPresent(string resourceGroupName, string networkManagerN
4949
return true;
5050
}
5151

52-
public PSStaticCidr GetStaticCidr(string resourceGroupName, string networkManagerName, string poolName, string staticCidrName)
52+
public PSStaticCidr GetStaticCidr(string resourceGroupName, string networkManagerName, string ipamPoolName, string staticCidrName)
5353
{
54-
var staticCidr = this.StaticCidrClient.Get(resourceGroupName, networkManagerName, poolName, staticCidrName);
54+
var staticCidr = this.StaticCidrClient.Get(resourceGroupName, networkManagerName, ipamPoolName, staticCidrName);
5555
var psStaticCidr = ToPsStaticCidr(staticCidr);
5656
psStaticCidr.ResourceGroupName = resourceGroupName;
5757
psStaticCidr.NetworkManagerName = networkManagerName;
58-
psStaticCidr.PoolName = poolName;
58+
psStaticCidr.PoolName = ipamPoolName;
5959
psStaticCidr.Name = staticCidrName;
6060
return psStaticCidr;
6161
}

src/Network/Network/NetworkManager/IpamPool/NewAzNetworkManagerIpamPoolStaticCidrCommand.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public class NewAzNetworkManagerIpamPoolStaticCidrCommand : IpamPoolStaticCidrBa
6161
ValueFromPipelineByPropertyName = true,
6262
HelpMessage = "IP Address Manager Pool resource name.")]
6363
[ValidateNotNullOrEmpty]
64-
public virtual string PoolName { get; set; }
64+
public virtual string IpamPoolName { get; set; }
6565

6666
[Parameter(
6767
Mandatory = false,
@@ -70,7 +70,7 @@ public class NewAzNetworkManagerIpamPoolStaticCidrCommand : IpamPoolStaticCidrBa
7070
public virtual string NumberOfIPAddressesToAllocate { get; set; }
7171

7272
[Parameter(
73-
Mandatory = true,
73+
Mandatory = false,
7474
ValueFromPipelineByPropertyName = true,
7575
HelpMessage = "List of IP address prefixes of the resource.")]
7676
public virtual List<string> AddressPrefix { get; set; }
@@ -91,7 +91,7 @@ public class NewAzNetworkManagerIpamPoolStaticCidrCommand : IpamPoolStaticCidrBa
9191
public override void Execute()
9292
{
9393
base.Execute();
94-
var present = this.IsStaticCidrPresent(this.ResourceGroupName, this.NetworkManagerName, this.PoolName, this.Name);
94+
var present = this.IsStaticCidrPresent(this.ResourceGroupName, this.NetworkManagerName, this.IpamPoolName, this.Name);
9595
ConfirmAction(
9696
Force.IsPresent,
9797
string.Format(Properties.Resources.OverwritingResource, Name),
@@ -128,9 +128,9 @@ private PSStaticCidr CreateStaticCidr()
128128
// Map to the sdk object
129129
var staticCidrModel = NetworkResourceManagerProfile.Mapper.Map<MNM.StaticCidr>(staticCidr);
130130

131-
// Execute the Create Network call string resourceGroupName, string networkManagerName, string poolName, string staticCidrName
132-
this.StaticCidrClient.Create(this.ResourceGroupName, this.NetworkManagerName, this.PoolName, this.Name, staticCidrModel);
133-
var psStaticCidr = this.GetStaticCidr(this.ResourceGroupName, this.NetworkManagerName, this.PoolName, this.Name);
131+
// Execute the Create Network call string resourceGroupName, string networkManagerName, string IpamPoolName, string staticCidrName
132+
this.StaticCidrClient.Create(this.ResourceGroupName, this.NetworkManagerName, this.IpamPoolName, this.Name, staticCidrModel);
133+
var psStaticCidr = this.GetStaticCidr(this.ResourceGroupName, this.NetworkManagerName, this.IpamPoolName, this.Name);
134134
return psStaticCidr;
135135
}
136136
}

src/Network/Network/NetworkManager/IpamPool/RemoveAzNetworkManagerIpamPoolStaticCidrCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public class RemoveAzNetworkManagerIpamPoolStaticCidrCommand : IpamPoolStaticCid
5353
[ResourceGroupCompleter]
5454
[ValidateNotNullOrEmpty]
5555
[SupportsWildcards]
56-
public virtual string PoolName { get; set; }
56+
public virtual string IpamPoolName { get; set; }
5757

5858
[Parameter(
5959
Mandatory = false,
@@ -76,7 +76,7 @@ public override void Execute()
7676
Name,
7777
() =>
7878
{
79-
this.StaticCidrClient.Delete(this.ResourceGroupName, this.NetworkManagerName, this.PoolName, this.Name);
79+
this.StaticCidrClient.Delete(this.ResourceGroupName, this.NetworkManagerName, this.IpamPoolName, this.Name);
8080
if (PassThru.IsPresent)
8181
{
8282
WriteObject(true);

0 commit comments

Comments
 (0)