Skip to content

Commit

Permalink
Merge branch 'master' into network-july
Browse files Browse the repository at this point in the history
  • Loading branch information
VeryEarly authored Oct 13, 2020
2 parents 68a230e + 1fe49a6 commit f4cc694
Show file tree
Hide file tree
Showing 51 changed files with 7,765 additions and 4,400 deletions.
4 changes: 2 additions & 2 deletions src/Monitor/Monitor/help/Add-AzAutoscaleSetting.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ PS C:\> $Profile2 = New-AzAutoscaleProfile -DefaultCapacity "1" -MaximumCapacity
PS C:\> Add-AzAutoscaleSetting -Location "East US" -Name "MySetting" -ResourceGroupName "Default-Web-EastUS" -TargetResourceId "/subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/microsoft.web/serverFarms/DefaultServerFarm" -AutoscaleProfile $Profile1, $Profile2
```

The first two commands use New-AzAutoscaleRule to create two Autoscale rules, $Rule1 and $Rule2.
The third and fourth commands use New-AzAutoscaleProfile to create Autoscale profiles, $Profile1 and $Profile2, using $Rule1 and $Rule2.
The first two commands use [New-AzAutoscaleRule](https://docs.microsoft.com/en-us/powershell/module/az.monitor/new-azautoscalerule) to create two Autoscale rules, $Rule1 and $Rule2.
The third and fourth commands use [New-AzAutoscaleProfile](https://docs.microsoft.com/en-us/powershell/module/az.monitor/new-azautoscaleprofile) to create Autoscale profiles, $Profile1 and $Profile2, using $Rule1 and $Rule2.
The final command creates an Autoscale setting using the profiles in $Profile1 and $Profile2.

## PARAMETERS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Equals property value: OtherField
```

This command creates a new activity log alert condition object in memory.
**NOTE**: when this cmdlet is used with Set-AzActivityLogAlert at least one of these objects, passed as parameters, must have its Field equal to "Category". Otherwise, the backend responds with a 400 (BadRequest.)
**NOTE**: when this cmdlet is used with [Set-AzActivityLogAlert](https://docs.microsoft.com/en-us/powershell/module/az.monitor/set-azactivitylogalert) at least one of these objects, passed as parameters, must have its Field equal to "Category". Otherwise, the backend responds with a 400 (BadRequest.)

## PARAMETERS

Expand Down
31 changes: 18 additions & 13 deletions src/Network/Network.Test/ScenarioTests/AzureFirewallTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1224,8 +1224,8 @@ function Test-AzureFirewallVirtualHubCRUD {
$policyLocation = "westcentralus"
$location = Get-ProviderLocation $resourceTypeParent
$azureFirewallPolicyName = Get-ResourceName
$sku = "AZFW_Hub"
$tier = "Standard"
$skuName = "AZFW_Hub"
$skuTier = "Standard"

try {
# Create the resource group
Expand All @@ -1243,7 +1243,7 @@ function Test-AzureFirewallVirtualHubCRUD {

$azureFirewallPolicyId = $getazureFirewallPolicy.Id

New-AzFirewall Name $azureFirewallName -ResourceGroupName $rgname -Location $location -Sku $sku -FirewallPolicyId $azureFirewallPolicyId
New-AzFirewall -Name $azureFirewallName -ResourceGroupName $rgname -Location $location -SkuName $skuName -SkuTier $skuTier -FirewallPolicyId $azureFirewallPolicyId

# Get AzureFirewall
$getAzureFirewall = Get-AzFirewall -name $azureFirewallName -ResourceGroupName $rgname
Expand All @@ -1253,9 +1253,9 @@ function Test-AzureFirewallVirtualHubCRUD {
Assert-AreEqual $azureFirewallName $getAzureFirewall.Name
Assert-NotNull $getAzureFirewall.Location
Assert-AreEqual (Normalize-Location $location) $getAzureFirewall.Location
Assert-NotNull $sku $getAzureFirewall.Sku
Assert-AreEqual $sku $getAzureFirewall.Sku.Name
Assert-AreEqual $tier $getAzureFirewall.Sku.Tier
Assert-NotNull $getAzureFirewall.Sku
Assert-AreEqual $skuName $getAzureFirewall.Sku.Name
Assert-AreEqual $skuTier $getAzureFirewall.Sku.Tier
Assert-NotNull $getAzureFirewall.FirewallPolicy
Assert-AreEqual $azureFirewallPolicyId $getAzureFirewall.FirewallPolicy.Id
}
Expand Down Expand Up @@ -1404,6 +1404,9 @@ function Test-AzureFirewallWithDNSProxy {
$networkRule2Protocol3 = "ICMP"
$networkRule2DestinationPort1 = "80"

$skuName = "AZFW_VNet"
$skuTier = "Standard"

try {
# Create the resource group
$resourceGroup = New-AzResourceGroup -Name $rgname -Location $location -Tags @{ testtag = "testval" }
Expand Down Expand Up @@ -1437,14 +1440,16 @@ function Test-AzureFirewallWithDNSProxy {
$netRc.AddRule($networkRule2)

# Create AzureFirewall with DNSProxy enabled and DNS Servers provided
$azureFirewall = New-AzFirewall -Name $azureFirewallName -ResourceGroupName $rgname -Location $location -VirtualNetworkName $vnetName -PublicIpName $publicIpName -NetworkRuleCollection $netRc -EnableDnsProxy -DnsServer $dnsServers
$azureFirewall = New-AzFirewall -Name $azureFirewallName -ResourceGroupName $rgname -Location $location -VirtualNetworkName $vnetName -PublicIpName $publicIpName -NetworkRuleCollection $netRc -EnableDnsProxy -DnsServer $dnsServers -SkuName $skuName -SkuTier $skuTier

# Get AzureFirewall
$getAzureFirewall = Get-AzFirewall -name $azureFirewallName -ResourceGroupName $rgname

# Verification
Assert-AreEqual $rgName $getAzureFirewall.ResourceGroupName
Assert-AreEqual $azureFirewallName $getAzureFirewall.Name
Assert-AreEqual $skuName $getAzureFirewall.Sku.Name
Assert-AreEqual $skuTier $getAzureFirewall.Sku.Tier

# Check rule collections
Assert-AreEqual 1 @($getAzureFirewall.NetworkRuleCollections).Count
Expand Down Expand Up @@ -1485,16 +1490,16 @@ function Test-AzureFirewallVirtualHubMultiPublicIPCRUD {
$virtualHubName = Get-ResourceName
$virtualHubAddressPrefix = "10.0.0.0/16"
$firewallPIPCount = "2"
$sku = "AZFW_Hub"
$tier = "Standard"
$skuName = "AZFW_Hub"
$skuTier = "Standard"

try {
# Create the resource group
$resourceGroup = New-AzResourceGroup -Name $rgname -Location $location -Tags @{ testtag = "testval" }

$fwpips = New-AzFirewallHubPublicIpAddress -Count $firewallPIPCount
$hubIpAddresses = New-AzFirewallHubIpAddress -PublicIP $fwpips
$fw= New-AzFirewall -Name $azureFirewallName -ResourceGroupName $rgname -Location $location -Sku AZFW_Hub -HubIPAddress $hubIpAddresses
$fw= New-AzFirewall -Name $azureFirewallName -ResourceGroupName $rgname -Location $location -SkuName $skuName -SkuTier $skuTier -HubIPAddress $hubIpAddresses

# Get AzureFirewall
$getAzureFirewall = Get-AzFirewall -name $azureFirewallName -ResourceGroupName $rgname
Expand All @@ -1504,9 +1509,9 @@ function Test-AzureFirewallVirtualHubMultiPublicIPCRUD {
Assert-AreEqual $azureFirewallName $getAzureFirewall.Name
Assert-NotNull $getAzureFirewall.Location
Assert-AreEqual (Normalize-Location $location) $getAzureFirewall.Location
Assert-NotNull $sku $getAzureFirewall.Sku
Assert-AreEqual $sku $getAzureFirewall.Sku.Name
Assert-AreEqual $tier $getAzureFirewall.Sku.Tier
Assert-NotNull $getAzureFirewall.Sku
Assert-AreEqual $skuName $getAzureFirewall.Sku.Name
Assert-AreEqual $skuTier $getAzureFirewall.Sku.Tier
Assert-NotNull $getAzureFirewall.HubIPAddresses
Assert-NotNull $getAzureFirewall.HubIPAddresses.PublicIPs
Assert-AreEqual $firewallPIPCount $getAzureFirewall.HubIPAddresses.PublicIPs.Count
Expand Down
8 changes: 8 additions & 0 deletions src/Network/Network.Test/ScenarioTests/VirtualRouterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,13 @@ public void TestVirtualRouterPeerCRUD()
{
TestRunner.RunTestScript(string.Format("Test-VirtualRouterPeerCRUD"));
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(Category.Owner, NrpTeamAlias.pgtm)]
public void TestVirtualRouterPeerRoutes()
{
TestRunner.RunTestScript(string.Format("Test-VirtualRouterPeerRoutes"));
}
}
}
55 changes: 55 additions & 0 deletions src/Network/Network.Test/ScenarioTests/VirtualRouterTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,59 @@ function Test-VirtualRouterPeerCRUD
# Cleanup
Clean-ResourceGroup $rgname
}
}

<#
.SYNOPSIS
Test virtual router peer learned and advertiesd routes (bgp routes)
#>
function Test-VirtualRouterPeerRoutes
{
# 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
$subnet = Get-AzVirtualNetworkSubnetConfig -Name $subnetName -VirtualNetwork $vnet

# Create virtual router
$virtualRouter = New-AzVirtualRouter -ResourceGroupName $rgname -location $rglocation -Name $virtualRouterName -HostedSubnet $subnet.Id
$virtualRouter = Get-AzVirtualRouter -ResourceGroupName $rgname -RouterName $virtualRouterName

# Create virtual router peering
$peering = Add-AzVirtualRouterPeer -ResourceGroupName $rgname -VirtualRouterName $virtualRouterName -PeerName $peerName -PeerIp "192.168.1.5" -PeerAsn "20000"
$peering = Get-AzVirtualRouterPeer -ResourceGroupName $rgname -VirtualRouterName $virtualRouterName -PeerName $peerName

$learnedRoutes = Get-AzVirtualRouterPeerLearnedRoute -ResourceGroupName $rgname -VirtualRouterName $virtualRouterName -PeerName $peerName
$advertisedRoutes = Get-AzVirtualRouterPeerAdvertisedRoute -ResourceGroupName $rgname -VirtualRouterName $virtualRouterName -PeerName $peerName

#delete virtual router peering
$deletePeering = Remove-AzVirtualRouterPeer -ResourceGroupName $rgname -VirtualRouterName $virtualRouterName -PeerName $peerName -Force
Assert-AreEqual 0 @($deletePeering.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
}
}
Loading

0 comments on commit f4cc694

Please sign in to comment.