Skip to content

Commit 7e014f1

Browse files
pr-workPrachi Pravin Bhavsarisra-fel
authored
Adding AuxiliaryMode property to New-AzNetworkInterface cmdlet (#17866)
* Adding auxiliaryMode to NetworkInterface * removing accidental file * Update src/Network/Network/ChangeLog.md Co-authored-by: Prachi Pravin Bhavsar <prbhavsar@microsoft.com> Co-authored-by: Yeming Liu <11371776+isra-fel@users.noreply.github.com>
1 parent 33a4fcc commit 7e014f1

File tree

6 files changed

+453
-661
lines changed

6 files changed

+453
-661
lines changed

src/Network/Network.Test/ScenarioTests/NetworkInterfaceTests.ps1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ function Test-NetworkInterfaceCRUD
118118
$publicIpName = Get-ResourceName
119119
$nicName = Get-ResourceName
120120
$domainNameLabel = Get-ResourceName
121-
$rglocation = Get-ProviderLocation ResourceManagement
121+
$rglocation = Get-ProviderLocation ResourceManagement "East US 2 EUAP"
122122
$resourceTypeParent = "Microsoft.Network/networkInterfaces"
123-
$location = Get-ProviderLocation $resourceTypeParent
123+
$location = Get-ProviderLocation $resourceTypeParent "East US 2 EUAP"
124124

125125
try
126126
{
@@ -135,7 +135,7 @@ function Test-NetworkInterfaceCRUD
135135
$publicip = New-AzPublicIpAddress -ResourceGroupName $rgname -name $publicIpName -location $location -AllocationMethod Dynamic -DomainNameLabel $domainNameLabel
136136

137137
# Create NetworkInterface
138-
$actualNic = New-AzNetworkInterface -Name $nicName -ResourceGroupName $rgname -Location $location -Subnet $vnet.Subnets[0] -PublicIpAddress $publicip
138+
$actualNic = New-AzNetworkInterface -Name $nicName -ResourceGroupName $rgname -Location $location -Subnet $vnet.Subnets[0] -PublicIpAddress $publicip -EnableAcceleratedNetworking -AuxiliaryMode MaxConnections -Tag @{ fastpathenabled = "true"}
139139
$expectedNic = Get-AzNetworkInterface -Name $nicName -ResourceGroupName $rgname
140140

141141
Assert-AreEqual $expectedNic.ResourceGroupName $actualNic.ResourceGroupName
@@ -148,6 +148,7 @@ function Test-NetworkInterfaceCRUD
148148
Assert-AreEqual $expectedNic.IpConfigurations[0].Subnet.Id $actualNic.IpConfigurations[0].Subnet.Id
149149
Assert-NotNull $expectedNic.IpConfigurations[0].PrivateIpAddress
150150
Assert-AreEqual "Dynamic" $expectedNic.IpConfigurations[0].PrivateIpAllocationMethod
151+
Assert-AreEqual "MaxConnections" $expectedNic.AuxiliaryMode
151152

152153
$expectedNic = Get-AzNetworkInterface -ResourceId $actualNic.Id
153154

src/Network/Network.Test/SessionRecords/Commands.Network.Test.ScenarioTests.NetworkInterfaceTests/TestNetworkInterfaceCRUD.json

Lines changed: 427 additions & 658 deletions
Large diffs are not rendered by default.

src/Network/Network/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
* Updated cmdlets to add new property of `HubRoutingPreference` in VirtualHub and set property of `PreferredRoutingGateway` deprecated .
3030
- `New-AzVirtualHub`
3131
- `Update-AzVirtualHub`
32+
* Added optional parameter `AuxiliaryMode` to cmdlet `New-AzNetworkInterface` to enable this network interface as Sirius enabled. Allowed values are None(default) and MaxConnections.
3233

3334
## Version 4.16.0
3435
* Added support for retrieving the state of packet capture even when the provisioning state of the packet capture was failure

src/Network/Network/Models/PSNetworkInterface.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ public class PSNetworkInterface : PSTopLevelResource, INetworkInterfaceReference
5555
[Ps1Xml(Target = ViewControl.Table)]
5656
public bool VnetEncryptionSupported { get; set; }
5757

58+
[Ps1Xml(Target = ViewControl.Table)]
59+
public string AuxiliaryMode { get; set; }
60+
5861
[JsonIgnore]
5962
public string VirtualMachineText
6063
{

src/Network/Network/Network.format.ps1xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1856,6 +1856,10 @@
18561856
<Label>VnetEncryptionSupported</Label>
18571857
<PropertyName>VnetEncryptionSupported</PropertyName>
18581858
</ListItem>
1859+
<ListItem>
1860+
<Label>AuxiliaryMode</Label>
1861+
<PropertyName>AuxiliaryMode</PropertyName>
1862+
</ListItem>
18591863
<ListItem>
18601864
<Label>NetworkSecurityGroup</Label>
18611865
<PropertyName>NetworkSecurityGroupText</PropertyName>

src/Network/Network/NetworkInterface/NewAzureNetworkInterfaceCommand.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,15 @@ public class NewAzureNetworkInterfaceCommand : NetworkInterfaceBaseCmdlet
233233
HelpMessage = "EnableAcceleratedNetworking")]
234234
public SwitchParameter EnableAcceleratedNetworking { get; set; }
235235

236+
[Parameter(
237+
Mandatory = false,
238+
HelpMessage = "The auxiliary mode of the Network Interface ")]
239+
[ValidateSet(
240+
MNM.NetworkInterfaceAuxiliaryMode.None,
241+
MNM.NetworkInterfaceAuxiliaryMode.MaxConnections,
242+
IgnoreCase = true)]
243+
public string AuxiliaryMode { get; set; }
244+
236245
[Parameter(
237246
Mandatory = false,
238247
ValueFromPipelineByPropertyName = true,
@@ -438,6 +447,11 @@ private PSNetworkInterface CreateNetworkInterface()
438447
networkInterface.NetworkSecurityGroup.Id = this.NetworkSecurityGroupId;
439448
}
440449

450+
if (!string.IsNullOrEmpty(this.AuxiliaryMode))
451+
{
452+
networkInterface.AuxiliaryMode = this.AuxiliaryMode;
453+
}
454+
441455
List<string> resourceIdsRequiringAuthToken = new List<string>();
442456
Dictionary<string, List<string>> auxAuthHeader = null;
443457

0 commit comments

Comments
 (0)