Skip to content

Commit d936e38

Browse files
committed
Ipam cmdlet bug fixes
1 parent d6dbd1f commit d936e38

9 files changed

+221
-290
lines changed

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

Lines changed: 3 additions & 3 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
}

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/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);

src/Network/Network/help/Get-AzNetworkManagerIpamPoolStaticCidr.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ Gets Static Cidr(s) in an IPAM pool.
1515
### NoExpand (Default)
1616
```
1717
Get-AzNetworkManagerIpamPoolStaticCidr [-Name <String>] -NetworkManagerName <String>
18-
-ResourceGroupName <String> -PoolName <String> [-DefaultProfile <IAzureContextContainer>]
18+
-ResourceGroupName <String> -IpamPoolName <String> [-DefaultProfile <IAzureContextContainer>]
1919
[-ProgressAction <ActionPreference>] [<CommonParameters>]
2020
```
2121

2222
### Expand
2323
```
2424
Get-AzNetworkManagerIpamPoolStaticCidr -Name <String> -NetworkManagerName <String> -ResourceGroupName <String>
25-
-PoolName <String> [-DefaultProfile <IAzureContextContainer>] [-ProgressAction <ActionPreference>]
25+
-IpamPoolName <String> [-DefaultProfile <IAzureContextContainer>] [-ProgressAction <ActionPreference>]
2626
[<CommonParameters>]
2727
```
2828

@@ -33,12 +33,12 @@ If given a Static Cidr name, the **Get-AzNetworkManagerIpamPoolStaticCidr** cmdl
3333

3434
### Example 1
3535
```powershell
36-
Get-AzNetworkManagerIpamPoolStaticCidr -Name testStaticCidr -NetworkManagerName testNM -ResourceGroupName testRG -PoolName testPool
36+
Get-AzNetworkManagerIpamPoolStaticCidr -Name testStaticCidr -NetworkManagerName testNM -ResourceGroupName testRG -IpamPoolName testPool
3737
```
3838

3939
```output
4040
Name : testStaticCidr
41-
PoolName : testPool
41+
IpamPoolName : testPool
4242
ResourceGroupName : testRG
4343
NetworkManagerName : testNM
4444
Properties : Microsoft.Azure.Commands.Network.Models.NetworkManager.PSStaticCidrProperties
@@ -54,12 +54,12 @@ Gets static Cidr with name 'testStaticCidr'
5454

5555
### Example 2
5656
```powershell
57-
Get-AzNetworkManagerIpamPoolStaticCidr -NetworkManagerName testNM -ResourceGroupName testRG -PoolName testPool
57+
Get-AzNetworkManagerIpamPoolStaticCidr -NetworkManagerName testNM -ResourceGroupName testRG -IpamPoolName testPool
5858
```
5959

6060
```output
6161
Name : New
62-
PoolName :
62+
IpamPoolName :
6363
ResourceGroupName : testRG
6464
NetworkManagerName : testNM
6565
Properties : Microsoft.Azure.Commands.Network.Models.NetworkManager.PSStaticCidrProperties
@@ -72,7 +72,7 @@ Id : /subscriptions/00000000-0000-0000-0000-000000000000/resourc
7272
/testPool/staticCidrs/New
7373
7474
Name : New2
75-
PoolName :
75+
IpamPoolName :
7676
ResourceGroupName : testRG
7777
NetworkManagerName : testNM
7878
Properties : Microsoft.Azure.Commands.Network.Models.NetworkManager.PSStaticCidrProperties
@@ -85,7 +85,7 @@ Id : /subscriptions/00000000-0000-0000-0000-000000000000/resourc
8585
/testPool/staticCidrs/New2
8686
8787
Name : On-Prem
88-
PoolName :
88+
IpamPoolName :
8989
ResourceGroupName : testRG
9090
NetworkManagerName : testNM
9191
Properties : Microsoft.Azure.Commands.Network.Models.NetworkManager.PSStaticCidrProperties
@@ -158,7 +158,7 @@ Accept pipeline input: True (ByPropertyName)
158158
Accept wildcard characters: True
159159
```
160160
161-
### -PoolName
161+
### -IpamPoolName
162162
The pool resource name.
163163
164164
```yaml

src/Network/Network/help/New-AzNetworkManagerIpamPoolStaticCidr.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Creates a new Static Cidr.
1313
## SYNTAX
1414

1515
```
16-
New-AzNetworkManagerIpamPoolStaticCidr -Name <String> -NetworkManagerName <String> -ResourceGroupName <String> -PoolName <String> -AddressPrefix <System.Collections.Generic.List`1[System.String]>
16+
New-AzNetworkManagerIpamPoolStaticCidr -Name <String> -NetworkManagerName <String> -ResourceGroupName <String> -IpamPoolName <String> -AddressPrefix <System.Collections.Generic.List`1[System.String]>
1717
[-NumberOfIPAddressesToAllocate <String>] [-Description <String>] [-Force]
1818
[-AsJob] [-DefaultProfile <IAzureContextContainer>] [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm]
1919
[<CommonParameters>]
@@ -26,14 +26,14 @@ The **New-AzNetworkManagerIpamPoolStaticCidr** cmdlet creates a new Static Cidr
2626

2727
### Example 1
2828
```powershell
29-
New-AzNetworkManagerIpamPoolStaticCidr -Name testStaticCidr -NetworkManagerName testNM -ResourceGroupName testRG -PoolName testCmdletPool -AddressPrefix @("10.0.0.0/28")
29+
New-AzNetworkManagerIpamPoolStaticCidr -Name testStaticCidr -NetworkManagerName testNM -ResourceGroupName testRG -IpamPoolName testCmdletPool -AddressPrefix @("10.0.0.0/28")
3030
```
3131

3232
```output
3333
3434
3535
Name : testStaticCidr
36-
PoolName : testCmdletPool
36+
IpamPoolName : testCmdletPool
3737
ResourceGroupName : testRG
3838
NetworkManagerName : testNM
3939
Properties : Microsoft.Azure.Commands.Network.Models.NetworkManager.PSStaticCidrProperties
@@ -171,7 +171,7 @@ Accept pipeline input: True (ByPropertyName)
171171
Accept wildcard characters: False
172172
```
173173
174-
### -PoolName
174+
### -IpamPoolName
175175
IP Address Manager Pool resource name.
176176
177177
```yaml

src/Network/Network/help/Remove-AzNetworkManagerIpamPoolStaticCidr.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Removes a Static Cidr.
1414

1515
```
1616
Remove-AzNetworkManagerIpamPoolStaticCidr -Name <String> -NetworkManagerName <String>
17-
-ResourceGroupName <String> -PoolName <String> [-Force] [-PassThru] [-AsJob]
17+
-ResourceGroupName <String> -IpamPoolName <String> [-Force] [-PassThru] [-AsJob]
1818
[-DefaultProfile <IAzureContextContainer>] [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm]
1919
[<CommonParameters>]
2020
```
@@ -26,7 +26,7 @@ The **Remove-AzNetworkManagerIpamPoolStaticCidr** cmdlet removes the given Stati
2626

2727
### Example 1
2828
```powershell
29-
Remove-AzNetworkManagerIpamPoolStaticCidr -Name testStaticCidr -NetworkManagerName testNM -ResourceGroupName testRG -PoolName testPool
29+
Remove-AzNetworkManagerIpamPoolStaticCidr -Name testStaticCidr -NetworkManagerName testNM -ResourceGroupName testRG -IpamPoolName testPool
3030
```
3131

3232
```output
@@ -128,7 +128,7 @@ Accept pipeline input: False
128128
Accept wildcard characters: False
129129
```
130130
131-
### -PoolName
131+
### -IpamPoolName
132132
The pool resource name.
133133
134134
```yaml

0 commit comments

Comments
 (0)