-
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 HubIpConfiguration and HubBgpConnections (#12565)
* Add HubIpConfiguration and HubBgpConnections * Fix bug in test record and static analysis * Modify info in breaking changes * Change format of csv file * Change output type of AzVirtualRouterPeer cmdlets * Add back AllowActivaFTP * Add back RemoteBgpCommunitiesText * Update Network.format.ps1xml * Update Network.format.ps1xml * Update HubBgpConnectionTests.ps1 * Update VirtualRouterTests.ps1 * Modify output types * Update BreakingChangeIssues.csv * Update ChangeLog.md * Update New-AzVirtualWan.md * Update New-AzVirtualRouter.md * Update New-AzVirtualRouter.md * Update New-AzVirtualRouter.md Co-authored-by: Yabo Hu <[email protected]>
- Loading branch information
1 parent
3aa7d78
commit 13eab56
Showing
32 changed files
with
5,879 additions
and
17,295 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
src/Network/Network.Test/ScenarioTests/HubBgpConnectionTests.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,22 @@ | ||
using Microsoft.Azure.Commands.Network.Test.ScenarioTests; | ||
using Microsoft.WindowsAzure.Commands.ScenarioTest; | ||
using Xunit; | ||
|
||
namespace Commands.Network.Test.ScenarioTests | ||
{ | ||
public class HubBgpConnectionTests : NetworkTestRunner | ||
{ | ||
public HubBgpConnectionTests(Xunit.Abstractions.ITestOutputHelper output) | ||
: base(output) | ||
{ | ||
} | ||
|
||
[Fact] | ||
[Trait(Category.AcceptanceType, Category.CheckIn)] | ||
[Trait(Category.Owner, NrpTeamAlias.pgtm)] | ||
public void TestHubBgpConnectionCRUDMinimalParameters() | ||
{ | ||
TestRunner.RunTestScript(string.Format("Test-HubBgpConnectionCRUD")); | ||
} | ||
} | ||
} |
80 changes: 80 additions & 0 deletions
80
src/Network/Network.Test/ScenarioTests/HubBgpConnectionTests.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,80 @@ | ||
# ---------------------------------------------------------------------------------- | ||
# | ||
# 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 HubBgpConnection | ||
#> | ||
function Test-HubBgpConnectionCRUD | ||
{ | ||
# Setup | ||
$rgname = Get-ResourceGroupName | ||
$vnetName = Get-ResourceName | ||
$rglocation = Get-ProviderLocation ResourceManagement "centraluseuap" | ||
$virtualRouterName = Get-ResourceName | ||
$virtualWanName = Get-ResourceName | ||
$subnetName = Get-ResourceName | ||
$peerName = Get-ResourceName | ||
|
||
try | ||
{ | ||
# Create resource group | ||
$resourceGroup = New-AzResourceGroup -Name $rgname -Location $rglocation -Tags @{ testtag = "testval" } | ||
|
||
# Create virtual network and subnet | ||
$subnet = New-AzVirtualNetworkSubnetConfig -Name $subnetName -AddressPrefix 10.0.0.0/24 | ||
$vnet = New-AzVirtualNetwork -Name $vnetName -ResourceGroupName $rgname -Location $rglocation -AddressPrefix 10.0.0.0/16 -Subnet $subnet | ||
$vnet = Get-AzVirtualNetwork -Name $vnetName -ResourceGroupName $rgname | ||
$hostedSubnet = Get-AzVirtualNetworkSubnetConfig -Name $subnetName -VirtualNetwork $vnet | ||
|
||
# Create virtual router | ||
$virtualRouter = New-AzVirtualRouter -ResourceGroupName $rgname -location $rglocation -Name $virtualRouterName -HostedSubnet $hostedsubnet.Id | ||
$virtualRouter = Get-AzVirtualRouter -ResourceGroupName $rgname -RouterName $virtualRouterName | ||
|
||
# Create hub bgp connection | ||
$actualBgpConnection = Add-AzVirtualRouterPeer -ResourceGroupName $rgname -VirtualRouterName $virtualRouterName -PeerName $peerName -PeerIp "192.168.1.5" -PeerAsn "20000" | ||
$expectedBgpConnection = Get-AzVirtualRouterPeer -ResourceGroupName $rgname -VirtualRouterName $virtualRouterName -PeerName $peerName | ||
Assert-AreEqual $expectedBgpConnection.Peerings.PeerName $actualBgpConnection.PeerName | ||
Assert-AreEqual $expectedBgpConnection.PeerIp "192.168.1.5" | ||
Assert-AreEqual $expectedBgpConnection.PeerAsn "20000" | ||
|
||
#delete hub bgp connection | ||
$deleteBgpConnection = Remove-AzVirtualRouterPeer -ResourceGroupName $rgname -VirtualRouterName $virtualRouterName -PeerName $peerName -Force | ||
Assert-AreEqual 0 @($deleteBgpConnection.Peerings).Count | ||
|
||
# Delete virtual router | ||
$deleteVirtualRouter = Remove-AzVirtualRouter -ResourceGroupName $rgname -RouterName $virtualRouterName -PassThru -Force | ||
Assert-AreEqual true $deleteVirtualRouter | ||
|
||
$list = Get-AzVirtualRouter -ResourceGroupName $rgname | ||
Assert-AreEqual 0 @($list).Count | ||
} | ||
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
Oops, something went wrong.