-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cmdlet for IpAllocation resource, and update Vnet/Subnet cmdlet f… (
#11585) * Add cmdlet for IpAllocation resource, and update Vnet/Subnet cmdlet for IpAllocation resource. Co-authored-by: Yunchi Wang <[email protected]>
- Loading branch information
1 parent
65b4ffc
commit 8efe01c
Showing
31 changed files
with
1,737 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 28 additions & 28 deletions
56
...e.Commands.CosmosDB.Test.ScenarioTests.ScenarioTest.AccountTests/TestPrivateEndpoint.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/Network/Network.Test/ScenarioTests/IpAllocationTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// ---------------------------------------------------------------------------------- | ||
// | ||
// Copyright Microsoft Corporation | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// ---------------------------------------------------------------------------------- | ||
|
||
using Microsoft.Azure.Commands.Network.Test.ScenarioTests; | ||
using Microsoft.WindowsAzure.Commands.ScenarioTest; | ||
using Xunit; | ||
|
||
namespace Commands.Network.Test.ScenarioTests | ||
{ | ||
public class IpAllocationTests : NetworkTestRunner | ||
{ | ||
public IpAllocationTests(Xunit.Abstractions.ITestOutputHelper output) | ||
: base(output) | ||
{ | ||
} | ||
|
||
[Fact(Skip = "IpAllocation need manually onboard.")] | ||
[Trait(Category.AcceptanceType, Category.CheckIn)] | ||
[Trait(Category.Owner, NrpTeamAlias.ipam)] | ||
public void TestIpAllocationBasicOperations() | ||
{ | ||
TestRunner.RunTestScript(string.Format("Test-IpAllocation")); | ||
} | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
src/Network/Network.Test/ScenarioTests/IpAllocationTests.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#---------------------------------------------------------------------------------- | ||
# | ||
# Copyright Microsoft Corporation | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# ---------------------------------------------------------------------------------- | ||
|
||
function Check-CmdletReturnType | ||
{ | ||
param($cmdletName, $cmdletReturn) | ||
|
||
$cmdletData = Get-Command $cmdletName | ||
Assert-NotNull $cmdletData | ||
[array]$cmdletReturnTypes = $cmdletData.OutputType.Name | Foreach-Object { return ($_ -replace "Microsoft.Azure.Commands.Network.Models.","") } | ||
[array]$cmdletReturnTypes = $cmdletReturnTypes | Foreach-Object { return ($_ -replace "System.","") } | ||
$realReturnType = $cmdletReturn.GetType().Name -replace "Microsoft.Azure.Commands.Network.Models.","" | ||
return $cmdletReturnTypes -contains $realReturnType | ||
} | ||
|
||
<# | ||
.SYNOPSIS | ||
Test creating new IpGroups | ||
#> | ||
function Test-IpAllocation | ||
{ | ||
# Setup | ||
$rgname = Get-ResourceGroupName | ||
$rglocation = Get-ProviderLocation ResourceManagement "westus" | ||
$location = Get-ProviderLocation ResourceManagement "westus" | ||
$IpGroupsName = Get-ResourceName | ||
|
||
try | ||
{ | ||
# IpAllocation resource need manually onboard by subscription | ||
$subId = Get-SubscriptionIdFromResourceGroup $rgname; | ||
$vnetId = '/subscriptions/' + $subId + '/resourceGroups/' + $rgname + '/providers/Microsoft.Network/virtualNetworks/HypernetVnet1'; | ||
|
||
$ipAllocationName = 'testIpAllocation' | ||
New-AzIpAllocation -ResourceName $ipAllocationName -ResourceGroupName $rgname -Location $rglocation -IpAllocationType Hypernet -PrefixLength 29 -PrefixType IPV4 -IpAllocationTag @{"VNetID"=$vnetId;"SubnetName"="HypernetSubnet1"} | ||
|
||
Set-AzIpAllocation -Name $ipAllocationName -ResourceGroupName $rgname -Tag @{'testtag'='tetsvalue'} | ||
|
||
Remove-AzIpAllocation -Name $ipAllocationName -ResourceGroupName $rgname | ||
} | ||
finally | ||
{ | ||
# Cleanup | ||
Clean-ResourceGroup $rgname | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.