From 680751180c11a1dcc34ca5a5d740f4bfec384f8d Mon Sep 17 00:00:00 2001 From: sriramvu Date: Wed, 21 Jan 2015 10:20:30 +0530 Subject: [PATCH 1/2] E2A Network Mapping test --- .../ScenarioTests/RecoveryServicesTests.cs | 21 ++++ .../ScenarioTests/RecoveryServicesTests.ps1 | 106 +++++++++++++++++- .../lib/Microsoft.Azure.RecoveryServices.dll | Bin 485888 -> 485888 bytes 3 files changed, 126 insertions(+), 1 deletion(-) diff --git a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/ScenarioTests/RecoveryServicesTests.cs b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/ScenarioTests/RecoveryServicesTests.cs index d9dd3ec8b246..a14c74cb2341 100644 --- a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/ScenarioTests/RecoveryServicesTests.cs +++ b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/ScenarioTests/RecoveryServicesTests.cs @@ -54,6 +54,27 @@ public void RecoveryServicesNetworkMappingTest() this.RunPowerShellTest("Test-NetworkMapping -vaultSettingsFilePath \"" + vaultSettingsFilePath + "\""); } + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void RecoveryServicesNetworkUnMappingTest() + { + this.RunPowerShellTest("Test-NetworkUnMapping -vaultSettingsFilePath \"" + vaultSettingsFilePath + "\""); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void RecoveryServicesAzureNetworkMappingTest() + { + this.RunPowerShellTest("Test-AzureNetworkMapping -vaultSettingsFilePath \"" + vaultSettingsFilePath + "\""); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void RecoveryServicesAzureNetworkUnMappingTest() + { + this.RunPowerShellTest("Test-AzureNetworkUnMapping -vaultSettingsFilePath \"" + vaultSettingsFilePath + "\""); + } + [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void RecoveryServicesFailbackTest() diff --git a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/ScenarioTests/RecoveryServicesTests.ps1 b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/ScenarioTests/RecoveryServicesTests.ps1 index 8c0d8f9b523c..36edcbd3c686 100644 --- a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/ScenarioTests/RecoveryServicesTests.ps1 +++ b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/ScenarioTests/RecoveryServicesTests.ps1 @@ -253,6 +253,69 @@ function Test-NetworkMapping Assert-NotNull($networkMappings[0].RecoveryNetworkName) } +<# +.SYNOPSIS +Recovery Services Azure Network mapping tests and validation +#> +function Test-AzureNetworkMapping +{ + param([string] $vaultSettingsFilePath) + + # Import Azure Site Recovery Vault Settings + Import-AzureSiteRecoveryVaultSettingsFile $vaultSettingsFilePath + + # Enumerate Servers + $servers = Get-AzureSiteRecoveryServer + Assert-True { $servers.Count -gt 0 } + Assert-NotNull($servers) + foreach($server in $servers) + { + Assert-NotNull($server.Name) + Assert-NotNull($server.ID) + } + + # Enumerate Networks + $networks = Get-AzureSiteRecoveryNetwork -Server $servers[0] + Assert-NotNull($networks) + Assert-True { $networks.Count -gt 0 } + foreach($network in $networks) + { + Assert-NotNull($network.Name) + Assert-NotNull($network.ID) + } + + <# + # Enumerate Azure VM Networks + $azureVmNetworks = Get-AzureVNetSite + Assert-NotNull($azureVmNetworks) + Assert-True { $azureVmNetworks.Count -gt 0 } + #> + + # Enumerate AzureNetworkMappings + $networkMappings = Get-AzureSiteRecoveryNetworkMapping -PrimaryServer $servers[0] -Azure + Assert-True { $networkMappings.Count -eq 0 } + + # Create AzureNetworkMapping + # $subscription = Get-AzureSubscription -Current + + # TODO (sriramvu): There are few dependency issues on using Get-AzureVNetSite to get list of Azure VM Networks, will update the test. + # Should setup NetworkManagementClient along with our two mgmt clients in RecoveryServicesTestsBase.cs + # $job = New-AzureSiteRecoveryNetworkMapping -PrimaryNetwork $networks[0] -AzureSubscriptionId $subscription.SubscriptionId -AzureVMNetworkId $azureVmNetworks[0].Id + $job = New-AzureSiteRecoveryNetworkMapping -PrimaryNetwork $networks[0] -AzureSubscriptionId 62633f66-ce59-4114-b65d-a50beb5bd8d8 -AzureVMNetworkId "1d0ecfad-ac09-4222-b46f-2ab74839fe7e" + WaitForJobCompletion -JobId $job.ID + + # Enumerate NetworkMappings + $networkMappings = Get-AzureSiteRecoveryNetworkMapping -PrimaryServer $servers[0] -Azure + Assert-NotNull($networkMappings) + Assert-True { $networkMappings.Count -eq 1 } + Assert-NotNull($networkMappings[0].PrimaryServerId) + Assert-NotNull($networkMappings[0].PrimaryNetworkId) + Assert-NotNull($networkMappings[0].PrimaryNetworkName) + Assert-NotNull($networkMappings[0].RecoveryServerId) + Assert-NotNull($networkMappings[0].RecoveryNetworkId) + Assert-NotNull($networkMappings[0].RecoveryNetworkName) +} + <# .SYNOPSIS Recovery Services Network unmapping tests and validation @@ -285,7 +348,7 @@ function Test-NetworkUnMapping Assert-NotNull($networkMappings[0].RecoveryNetworkId) Assert-NotNull($networkMappings[0].RecoveryNetworkName) - # Remove StorageMapping + # Remove NetworkMapping $job = Remove-AzureSiteRecoveryNetworkMapping -NetworkMapping $networkMappings[0] WaitForJobCompletion -JobId $job.ID @@ -294,6 +357,47 @@ function Test-NetworkUnMapping Assert-True { $networkMappings.Count -eq 0 } } +<# +.SYNOPSIS +Recovery Services Azure Network unmapping tests and validation +#> +function Test-AzureNetworkUnMapping +{ + param([string] $vaultSettingsFilePath) + + # Import Azure Site Recovery Vault Settings + Import-AzureSiteRecoveryVaultSettingsFile $vaultSettingsFilePath + + # Enumerate Servers + $servers = Get-AzureSiteRecoveryServer + Assert-True { $servers.Count -gt 0 } + Assert-NotNull($servers) + foreach($server in $servers) + { + Assert-NotNull($server.Name) + Assert-NotNull($server.ID) + } + + # Enumerate Azure NetworkMappings + $networkMappings = Get-AzureSiteRecoveryNetworkMapping -PrimaryServer $servers[0] -Azure + Assert-NotNull($networkMappings) + Assert-True { $networkMappings.Count -eq 1 } + Assert-NotNull($networkMappings[0].PrimaryServerId) + Assert-NotNull($networkMappings[0].PrimaryNetworkId) + Assert-NotNull($networkMappings[0].PrimaryNetworkName) + Assert-NotNull($networkMappings[0].RecoveryServerId) + Assert-NotNull($networkMappings[0].RecoveryNetworkId) + Assert-NotNull($networkMappings[0].RecoveryNetworkName) + + # Remove Azure NetworkMapping + $job = Remove-AzureSiteRecoveryNetworkMapping -NetworkMapping $networkMappings[0] + WaitForJobCompletion -JobId $job.ID + + # Enumerate Azure NetworkMappings + $networkMappings = Get-AzureSiteRecoveryNetworkMapping -PrimaryServer $servers[0] -Azure + Assert-True { $networkMappings.Count -eq 0 } +} + <# .SYNOPSIS Recovery Services Failback Tests diff --git a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/lib/Microsoft.Azure.RecoveryServices.dll b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/lib/Microsoft.Azure.RecoveryServices.dll index d4b273d2b8898715e9cc1ff8777840a6c117d572..928622f86742ceea6e189ed74bf6f8b2db8cc5e6 100644 GIT binary patch delta 89 zcmZp;BHM69c0vbpz1;rB?$&O`)^4WOZsyi*mey|8t=(*yj|3d{n5TVkv2xtYYRb*x s@1VS$)o%~$J{j(C6ZY*-;@D-l0X*U&4*&oF delta 89 zcmV-f0H*(d)E$7-9gv6vrNX{}i-n5;g^L1(ivxv=1ci$QwTlL6;t+_9tP(G&lSjFV v(I>Prliari;|8>Q1Es>gm%CmE84%@> Date: Wed, 21 Jan 2015 10:26:53 +0530 Subject: [PATCH 2/2] updated e2a network mapping tests with POD values --- .../ScenarioTests/RecoveryServicesTests.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/ScenarioTests/RecoveryServicesTests.ps1 b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/ScenarioTests/RecoveryServicesTests.ps1 index 36edcbd3c686..53ec9c6e7e56 100644 --- a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/ScenarioTests/RecoveryServicesTests.ps1 +++ b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/ScenarioTests/RecoveryServicesTests.ps1 @@ -301,7 +301,8 @@ function Test-AzureNetworkMapping # TODO (sriramvu): There are few dependency issues on using Get-AzureVNetSite to get list of Azure VM Networks, will update the test. # Should setup NetworkManagementClient along with our two mgmt clients in RecoveryServicesTestsBase.cs # $job = New-AzureSiteRecoveryNetworkMapping -PrimaryNetwork $networks[0] -AzureSubscriptionId $subscription.SubscriptionId -AzureVMNetworkId $azureVmNetworks[0].Id - $job = New-AzureSiteRecoveryNetworkMapping -PrimaryNetwork $networks[0] -AzureSubscriptionId 62633f66-ce59-4114-b65d-a50beb5bd8d8 -AzureVMNetworkId "1d0ecfad-ac09-4222-b46f-2ab74839fe7e" + # $job = New-AzureSiteRecoveryNetworkMapping -PrimaryNetwork $networks[0] -AzureSubscriptionId 62633f66-ce59-4114-b65d-a50beb5bd8d8 -AzureVMNetworkId "1d0ecfad-ac09-4222-b46f-2ab74839fe7e" # OneBox details + $job = New-AzureSiteRecoveryNetworkMapping -PrimaryNetwork $networks[0] -AzureSubscriptionId a5aa5997-33e5-46cc-8ab8-8bd89b76b7ba -AzureVMNetworkId ecb3a462-664f-4f57-873e-d09b5925e1a1 # POD details WaitForJobCompletion -JobId $job.ID # Enumerate NetworkMappings