Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new properties a new commandlet to support the address space update in peered vNets #14730

Merged
merged 19 commits into from
May 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
d848bb2
Changes for adding new commandlet for sync operation
Apr 12, 2021
749d654
Reverting the unintended change related to flow timeout
Apr 12, 2021
193d832
Updating with the SDK that has the newer fields
Apr 14, 2021
c050976
Updating the networking SDK for all references
Apr 14, 2021
49e4723
Merge branch 'network-february' into network-february
harics24 Apr 15, 2021
0c037e8
Added Parameter Set & Updated Changelog.md & Recorded PS Test
Satya-anshu May 13, 2021
e6aa9c0
Minor update to changelog.md file and removed comment from VirtualNet…
Satya-anshu May 13, 2021
1c1c737
Merge branch 'network-february' into network-february
Satya-anshu May 13, 2021
007ed52
Added default parameter set and ShouldSupportProcess=false
Satya-anshu May 14, 2021
c5a6b32
Added default parameter set and ShouldSupportProcess=false
Satya-anshu May 14, 2021
736ec89
Merge branch 'network-february' of https://github.com/harics24/azure-…
Satya-anshu May 14, 2021
458f71e
Sync-AzVirtualNetworkPeering.md Help file
Satya-anshu May 16, 2021
ced482f
Updated links in help files
Satya-anshu May 17, 2021
a03c8f3
Minor spacing issue in help files hyperlink
Satya-anshu May 17, 2021
2731a84
Changed synopsis and description from comment to actual string
Satya-anshu May 17, 2021
2c8ab11
Added Sync-AzVirtualNetworkPeering to StaticAnalysis exception to ign…
Satya-anshu May 17, 2021
2a581ec
Updating build steps
Satya-anshu May 17, 2021
4d34cef
Setting supportsshouldprocess = true in sync-azvnetpeering
Satya-anshu May 18, 2021
3a52594
Reverting the Signature Issues
Satya-anshu May 18, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .azure-pipelines/util/analyze-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ steps:
parameters:
osName: ${{ parameters.osName }}

- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
packageType: sdk
version: 2.1.x

- pwsh: 'Install-Module platyPS -Force -Confirm:$false -Scope CurrentUser'
displayName: 'Install platyPS'

Expand Down
6 changes: 6 additions & 0 deletions .azure-pipelines/util/build-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ steps:
inputs:
filePath: tools/CheckIgnoredFile.ps1

- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
packageType: sdk
version: 2.1.x

- task: DotNetCoreCLI@2
displayName: Build
inputs:
Expand Down
2 changes: 1 addition & 1 deletion src/Batch/Batch.Test/Batch.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<PackageReference Include="Microsoft.Azure.Batch" Version="13.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Batch" Version="11.0.0" />
<PackageReference Include="WindowsAzure.Storage" Version="9.3.0" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="330.2247.36274" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="413.1856.57282" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.CognitiveServices" Version="7.4.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="330.2247.36274" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="413.1856.57282" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/Compute/Compute.Test/Compute.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<PackageReference Include="Microsoft.Azure.Graph.RBAC" Version="3.4.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="44.0.0" />
<PackageReference Include="Microsoft.Azure.Management.KeyVault" Version="3.1.0-preview.2" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="330.2247.36274" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="413.1856.57282" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.ContainerRegistry" Version="4.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="330.2247.36274" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="413.1856.57282" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="5.6.0" />
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="5.6.0">
<NoWarn>NU1608</NoWarn>
Expand Down
2 changes: 1 addition & 1 deletion src/CosmosDB/CosmosDB.Test/CosmosDB.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)..\..\Az.Test.props" />
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.Network" Version="330.2247.36274" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="413.1856.57282" />
<PackageReference Include="Microsoft.Azure.Management.CosmosDB" Version="2.0.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.DataLake.Store" Version="2.4.2-preview" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="330.2247.36274" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="413.1856.57282" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Dns/Dns.Test/Dns.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.Dns" Version="3.0.1" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="330.2247.36274" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="413.1856.57282" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/HDInsight/HDInsight.Test/HDInsight.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PackageReference Include="Microsoft.Azure.Management.HDInsight.Job" Version="2.0.7" />
<PackageReference Include="Microsoft.Azure.Management.KeyVault" Version="3.1.0-preview.2" />
<PackageReference Include="Microsoft.Azure.Management.ManagedServiceIdentity" Version="0.11.0" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="330.2247.36274" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="413.1856.57282" />
<PackageReference Include="Microsoft.Azure.Management.OperationalInsights" Version="0.21.0-preview" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/HPCCache/HPCCache.Test/HPCCache.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.Authorization" Version="2.11.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="14.5.0" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="330.2247.36274" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="413.1856.57282" />
<PackageReference Include="WindowsAzure.Storage" Version="9.3.0" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/KeyVault/KeyVault.Test/KeyVault.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<PackageReference Include="Microsoft.Azure.KeyVault" Version="3.0.1" />
<PackageReference Include="Microsoft.Azure.KeyVault.WebKey" Version="3.0.1" />
<PackageReference Include="Microsoft.Azure.Management.KeyVault" Version="3.1.0-preview.2" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="330.2247.36274" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="413.1856.57282" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Monitor/Monitor.Test/Monitor.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.Monitor" Version="0.25.3-preview" />
<PackageReference Include="Microsoft.Azure.Management.ApplicationInsights" Version="0.3.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="330.2247.36274" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="413.1856.57282" />
<PackageReference Include="Microsoft.Azure.Management.OperationalInsights" Version="0.21.0-preview" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/NetAppFiles/NetAppFiles.Test/NetAppFiles.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.NetApp" Version="1.10.0" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="330.2247.36274" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="413.1856.57282" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/Network/Network.Test/Network.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Graph.RBAC" Version="3.4.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="330.2247.36274" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="413.1856.57282" />
<PackageReference Include="Microsoft.Azure.KeyVault" Version="3.0.5" />
<PackageReference Include="Microsoft.Azure.Management.KeyVault" Version="3.1.0-preview.2" />
<PackageReference Include="Microsoft.Azure.Insights" Version="0.16.0-preview" />
Expand Down
8 changes: 8 additions & 0 deletions src/Network/Network.Test/ScenarioTests/VirtualNetworkTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,13 @@ public void TestVirtualNetworkCRUDFlowTimeout()
{
TestRunner.RunTestScript("Test-VirtualNetworkCRUD-FlowTimeout");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(Category.Owner, NrpTeamAlias.sdnnrp)]
public void TestVirtualNetworkPeeringSyncCRUD()
{
TestRunner.RunTestScript("Test-SyncVirtualNetworkPeeringCRUD");
}
}
}
124 changes: 123 additions & 1 deletion src/Network/Network.Test/ScenarioTests/VirtualNetworkTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1342,4 +1342,126 @@ function Test-VirtualNetworkCRUD-FlowTimeout
# Cleanup
Clean-ResourceGroup $rgname
}
}
}

<#
.SYNOPSIS
Tests on CRUD for Sync on VirtualNetworkpeering.
#>
function Test-SyncVirtualNetworkPeeringCRUD
{
# Setup
$rgname = Get-ResourceGroupName
$peerName = Get-ResourceName
$peerName2 = Get-ResourceName
$vnet1Name = Get-ResourceName
$vnet2Name = Get-ResourceName
$subnet1Name = Get-ResourceName
$subnet2Name = Get-ResourceName
$rglocation = "eastus2euap"
$resourceTypeParent = "Microsoft.Network/virtualNetworks"
$location = "eastus2euap"

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

# Create the Virtual Network1
$subnet1 = New-AzVirtualNetworkSubnetConfig -Name $subnet1Name -AddressPrefix 10.1.1.0/24
$vnet1 = New-AzVirtualNetwork -Name $vnet1Name -ResourceGroupName $rgname -Location $location -AddressPrefix 10.1.0.0/16 -Subnet $subnet1


Assert-AreEqual $vnet1.ResourceGroupName $rgname
Assert-AreEqual $vnet1.Name $vnet1Name
Assert-AreEqual $vnet1.Location $rglocation
Assert-AreEqual "Succeeded" $vnet1.ProvisioningState
Assert-AreEqual $vnet1.Subnets[0].Name $subnet1.Name

# Create the Virtual Network2
$subnet2 = New-AzVirtualNetworkSubnetConfig -Name $subnet2Name -AddressPrefix 10.2.1.0/24
$vnet2 = New-AzVirtualNetwork -Name $vnet2Name -ResourceGroupName $rgname -Location $location -AddressPrefix 10.2.0.0/16 -Subnet $subnet2

Assert-AreEqual $vnet2.ResourceGroupName $rgname
Assert-AreEqual $vnet2.Name $vnet2Name
Assert-AreEqual $vnet2.Location $rglocation
Assert-AreEqual "Succeeded" $vnet2.ProvisioningState

# Add Peering to vnet1
$job = $vnet1 | Add-AzVirtualNetworkPeering -name $peerName -RemoteVirtualNetworkId $vnet2.Id -AllowForwardedTraffic -AsJob
$job | Wait-Job
$peer1 = $job | Receive-Job

# Add Peering to VNet2
$job = $vnet2 | Add-AzVirtualNetworkPeering -name $peerName2 -RemoteVirtualNetworkId $vnet1.Id -AllowForwardedTraffic -AsJob
$job | Wait-Job
$peer2 = $job | Receive-Job

Assert-AreEqual $peer1.ResourceGroupName $rgname
Assert-AreEqual $peer1.Name $peerName
Assert-AreEqual $peer1.VirtualNetworkName $vnet1Name
Assert-AreEqual "Succeeded" $peer1.ProvisioningState
Assert-AreEqual $peer1.RemoteVirtualNetwork.Id $vnet2.Id
Assert-AreEqual $peer1.AllowVirtualNetworkAccess True
Assert-AreEqual $peer1.AllowForwardedTraffic True

Assert-AreEqual $peer2.ResourceGroupName $rgname
Assert-AreEqual $peer2.Name $peerName2
Assert-AreEqual $peer2.VirtualNetworkName $vnet2Name
Assert-AreEqual "Succeeded" $peer2.ProvisioningState
Assert-AreEqual $peer2.RemoteVirtualNetwork.Id $vnet1.Id
Assert-AreEqual $peer2.AllowVirtualNetworkAccess True
Assert-AreEqual $peer2.AllowForwardedTraffic True

# Check if Address Spaces are same
Assert-AreEqual $peer1.RemoteVirtualNetworkAddressSpace.AddressPrefixesText $vnet2.AddressSpace.AddressPrefixesText

# Update Address Space of vnet1
$vnet1.AddressSpace.AddressPrefixes.Add("10.99.0.0/16")
$vnet1 | Set-AzVirtualNetwork

# Get and Check Peering Sync Levels of Vnet1 and Vnet2
$peer1 = Get-AzVirtualNetworkPeering -VirtualNetworkName $vnet1Name -Name $peerName -ResourceGroupName $rgname
$peer2 = Get-AzVirtualNetworkPeering -VirtualNetworkName $vnet2Name -Name $peerName2 -ResourceGroupName $rgname

Assert-AreEqual $peer1.PeeringSyncLevel "RemoteNotInSync"
Assert-AreEqual $peer2.PeeringSyncLevel "LocalNotInSync"

# Call Sync on VNet2
$syncVnet2 = Sync-AzVirtualNetworkPeering -Name $peerName2 -VirtualNetworkName $vnet2Name -ResourceGroupName $rgname

# Get and Check Peering Sync Levels of Vnet1 and Vnet2 after updating address space of Vnet1 and syncing them
$peer1 = Get-AzVirtualNetworkPeering -VirtualNetworkName $vnet1Name -Name $peerName -ResourceGroupName $rgname
$peer2 = Get-AzVirtualNetworkPeering -VirtualNetworkName $vnet2Name -Name $peerName2 -ResourceGroupName $rgname

Assert-AreEqual $peer1.PeeringSyncLevel "FullyInSync"
Assert-AreEqual $peer2.PeeringSyncLevel "FullyInSync"

$vnet1 = Get-AzVirtualNetwork -Name $vnet1Name -ResourceGroupName $rgname

Assert-AreEqual $peer2.RemoteVirtualNetworkAddressSpace.AddressPrefixesText $vnet1.AddressSpace.AddressPrefixesText

# Delete Peer1 and Peer2
$job = Remove-AzVirtualNetworkPeering -name $peerName -VirtualNetworkName $vnet1Name -ResourceGroupName $rgname -Force -PassThru -AsJob
$job | Wait-Job
$delete = $job | Receive-Job
Assert-AreEqual true $delete

$job = Remove-AzVirtualNetworkPeering -name $peerName2 -VirtualNetworkName $vnet2Name -ResourceGroupName $rgname -Force -PassThru -AsJob
$job | Wait-Job
$delete = $job | Receive-Job
Assert-AreEqual true $delete

# Delete VirtualNetwork
$delete = Remove-AzVirtualNetwork -ResourceGroupName $rgname -name $vnet1Name -PassThru -Force
Assert-AreEqual true $delete

$delete = Remove-AzVirtualNetwork -ResourceGroupName $rgname -name $vnet2Name -PassThru -Force
Assert-AreEqual true $delete
}
finally
{
# Cleanup
Clean-ResourceGroup $rgname
}
}
Loading