Skip to content

Commit b1ea0ae

Browse files
committed
merging with october-release
2 parents 53ee742 + c39c2e4 commit b1ea0ae

File tree

52 files changed

+26276
-191
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+26276
-191
lines changed

src/Network/Network.Test/ScenarioTests/CortexTests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,4 +481,4 @@ function Test-CortexExpressRouteCRUD
481481
{
482482
Clean-ResourceGroup $rgname
483483
}
484-
}
484+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.Azure.Commands.Network.Test.ScenarioTests;
16+
17+
namespace Commands.Network.Test.ScenarioTests
18+
{
19+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
20+
using Xunit;
21+
using Xunit.Abstractions;
22+
23+
public class VirtualHubRouteTableTests : NetworkTestRunner
24+
{
25+
public VirtualHubRouteTableTests(ITestOutputHelper output)
26+
: base(output)
27+
{
28+
}
29+
30+
[Fact]
31+
[Trait(Category.AcceptanceType, Category.CheckIn)]
32+
[Trait(Category.Owner, NrpTeamAlias.pgtm)]
33+
public void TestVirtualHubRouteTableCRUD()
34+
{
35+
TestRunner.RunTestScript("Test-VirtualHubRouteTableCRUD");
36+
}
37+
38+
}
39+
}
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# ----------------------------------------------------------------------------------
2+
#
3+
# Copyright Microsoft Corporation
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
# ----------------------------------------------------------------------------------
14+
15+
<#
16+
.SYNOPSIS
17+
VirtualHubRouteTableCRUD
18+
#>
19+
function Test-VirtualHubRouteTableCRUD
20+
{
21+
# Setup
22+
$rgName = Get-ResourceGroupName
23+
$rglocation = Get-ProviderLocation "ResourceManagement" "westcentralus"
24+
25+
$virtualWanName = Get-ResourceName
26+
$virtualHubName = Get-ResourceName
27+
$expressRouteGatewayName = Get-ResourceName
28+
$routeTable1Name = Get-ResourceName
29+
$remoteVirtualNetworkName = Get-ResourceName
30+
31+
try
32+
{
33+
# Create the resource group
34+
$resourceGroup = New-AzureRmResourceGroup -Name $rgName -Location $rglocation
35+
36+
# Create the Virtual Wan
37+
$createdVirtualWan = New-AzureRmVirtualWan -ResourceGroupName $rgName -Name $virtualWanName -Location $rglocation -AllowVnetToVnetTraffic -AllowBranchToBranchTraffic
38+
$virtualWan = Get-AzureRmVirtualWan -ResourceGroupName $rgName -Name $virtualWanName
39+
Write-Debug "Created Virtual WAN $virtualWan.Name successfully"
40+
41+
# Create the Virtual Hub
42+
$createdVirtualHub = New-AzureRmVirtualHub -ResourceGroupName $rgName -Name $virtualHubName -Location $rglocation -AddressPrefix "10.8.0.0/24" -VirtualWan $virtualWan
43+
$virtualHub = Get-AzureRmVirtualHub -ResourceGroupName $rgName -Name $virtualHubName
44+
Write-Debug "Created Virtual Hub virtualHub.Name successfully"
45+
46+
# Create the ExpressRouteGateway
47+
$createdExpressRouteGateway = New-AzureRmExpressRouteGateway -ResourceGroupName $rgName -Name $expressRouteGatewayName -VirtualHub $virtualHub -MinScaleUnits 2
48+
Write-Debug "Created ExpressRoute Gateway $expressRouteGatewayName successfully"
49+
$expressRouteGateway = Get-AzureRmExpressRouteGateway -ResourceGroupName $rgName -Name $expressRouteGatewayName
50+
Assert-NotNull $expressRouteGateway
51+
Write-Debug "Retrieved ExpressRoute Gateway $expressRouteGatewayName successfully"
52+
53+
# Create a RouteTable child Resource
54+
$route1 = Add-AzVirtualHubRoute -DestinationType "CIDR" -Destination @("10.4.0.0/16", "10.5.0.0/16"-NextHopType "IPAddress" -NextHop @("10.0.0.68")
55+
$route2 = Add-AzVirtualHubRoute -DestinationType "CIDR" -Destination @("0.0.0.0/0"-NextHopType "IPAddress" -NextHop @("10.0.0.68")
56+
     $routeTable1 = Add-AzVirtualHubRouteTable -Route @($route1, $route2-Connection @("All_Vnets"-Name $routeTable1Name
57+
Set-AzVirtualHub -ResourceGroupName $rgName -Name $virtualHubName -RouteTable @($routeTable1)
58+
$virtualHub = Get-AzVirtualHub -ResourceGroupName $rgName -Name $virtualHubName
59+
Assert-AreEqual $virtualHubName $virtualHub.Name
60+
$routeTables = $virtualHub.RouteTables
61+
Assert-AreEqual 1 @($routeTables).Count
62+
$routes1 = $routeTables[0].Routes
63+
Assert-AreEqual 2 @($routes1).Count
64+
65+
# Update a RouteTable child resource
66+
$routeTable1 = Get-AzVirtualHubRouteTable -ResourceGroupName $rgName -HubName $virtualHubName -Name $routeTable1Name
67+
$routeTable1.Routes.RemoveAt(1)
68+
$routeTable1.Routes[0].NextHops = @("10.0.0.67")
69+
$routeTable1.Connections = @("All_Branches")
70+
Set-AzVirtualHub -ResourceGroupName $rgName -Name $virtualHubName -RouteTable @($routeTable1)
71+
$virtualHub = Get-AzVirtualHub -ResourceGroupName $rgName -Name $virtualHubName
72+
Assert-AreEqual $virtualHubName $virtualHub.Name
73+
$routeTables = $virtualHub.RouteTables
74+
Assert-AreEqual 1 @($routeTables).Count
75+
$routes1 = $routeTables[0].Routes
76+
Assert-AreEqual 1 @($routes1).Count
77+
78+
# Delete a RouteTable child resource
79+
Remove-AzVirtualHubRouteTable -ResourceGroupName $rgName -HubName $virtualHubName -Name $routeTable1Name -Force
80+
$virtualHub = Get-AzVirtualHub -ResourceGroupName $rgName -Name $virtualHubName
81+
Assert-AreEqual $virtualHubName $virtualHub.Name
82+
$routeTables = $virtualHub.RouteTables
83+
Assert-AreEqual 0 @($routeTables).Count
84+
85+
# Clean up
86+
Remove-AzureRmExpressRouteGateway -ResourceGroupName $rgName -Name $expressRouteGatewayName -Force
87+
Assert-ThrowsLike { Get-AzureRmExpressRouteGateway -ResourceGroupName $rgName -Name $expressRouteGatewayName } "*Not*Found*"
88+
89+
Remove-AzureRmVirtualHub -ResourceGroupName $rgName -Name $virtualHubName -Force
90+
91+
Remove-AzureRmVirtualWan -ResourceGroupName $rgName -Name $virtualWanName -Force
92+
Assert-ThrowsLike { Get-AzureRmVirtualWan -ResourceGroupName $rgName -Name $virtualWanName } "*Not*Found*"
93+
}
94+
finally
95+
{
96+
Clean-ResourceGroup $rgname
97+
}
98+
}

0 commit comments

Comments
 (0)