@@ -253,6 +253,70 @@ function Test-NetworkMapping
253
253
Assert-NotNull ($networkMappings [0 ].RecoveryNetworkName)
254
254
}
255
255
256
+ <#
257
+ . SYNOPSIS
258
+ Recovery Services Azure Network mapping tests and validation
259
+ #>
260
+ function Test-AzureNetworkMapping
261
+ {
262
+ param ([string ] $vaultSettingsFilePath )
263
+
264
+ # Import Azure Site Recovery Vault Settings
265
+ Import-AzureSiteRecoveryVaultSettingsFile $vaultSettingsFilePath
266
+
267
+ # Enumerate Servers
268
+ $servers = Get-AzureSiteRecoveryServer
269
+ Assert-True { $servers.Count -gt 0 }
270
+ Assert-NotNull ($servers )
271
+ foreach ($server in $servers )
272
+ {
273
+ Assert-NotNull ($server.Name )
274
+ Assert-NotNull ($server.ID )
275
+ }
276
+
277
+ # Enumerate Networks
278
+ $networks = Get-AzureSiteRecoveryNetwork - Server $servers [0 ]
279
+ Assert-NotNull ($networks )
280
+ Assert-True { $networks.Count -gt 0 }
281
+ foreach ($network in $networks )
282
+ {
283
+ Assert-NotNull ($network.Name )
284
+ Assert-NotNull ($network.ID )
285
+ }
286
+
287
+ <#
288
+ # Enumerate Azure VM Networks
289
+ $azureVmNetworks = Get-AzureVNetSite
290
+ Assert-NotNull($azureVmNetworks)
291
+ Assert-True { $azureVmNetworks.Count -gt 0 }
292
+ #>
293
+
294
+ # Enumerate AzureNetworkMappings
295
+ $networkMappings = Get-AzureSiteRecoveryNetworkMapping - PrimaryServer $servers [0 ] - Azure
296
+ Assert-True { $networkMappings.Count -eq 0 }
297
+
298
+ # Create AzureNetworkMapping
299
+ # $subscription = Get-AzureSubscription -Current
300
+
301
+ # TODO (sriramvu): There are few dependency issues on using Get-AzureVNetSite to get list of Azure VM Networks, will update the test.
302
+ # Should setup NetworkManagementClient along with our two mgmt clients in RecoveryServicesTestsBase.cs
303
+ # $job = New-AzureSiteRecoveryNetworkMapping -PrimaryNetwork $networks[0] -AzureSubscriptionId $subscription.SubscriptionId -AzureVMNetworkId $azureVmNetworks[0].Id
304
+ # $job = New-AzureSiteRecoveryNetworkMapping -PrimaryNetwork $networks[0] -AzureSubscriptionId 62633f66-ce59-4114-b65d-a50beb5bd8d8 -AzureVMNetworkId "1d0ecfad-ac09-4222-b46f-2ab74839fe7e" # OneBox details
305
+ $job = New-AzureSiteRecoveryNetworkMapping - PrimaryNetwork $networks [0 ] - AzureSubscriptionId a5aa5997- 33e5 - 46cc- 8ab8- 8bd89b76b7ba - AzureVMNetworkId ecb3a462- 664f - 4f57- 873e - d09b5925e1a1 # POD details
306
+ WaitForJobCompletion - JobId $job.ID
307
+
308
+ # Enumerate NetworkMappings
309
+ $networkMappings = Get-AzureSiteRecoveryNetworkMapping - PrimaryServer $servers [0 ] - Azure
310
+ Assert-NotNull ($networkMappings )
311
+ Assert-True { $networkMappings.Count -eq 1 }
312
+ Assert-NotNull ($networkMappings [0 ].PrimaryServerId)
313
+ Assert-NotNull ($networkMappings [0 ].PrimaryNetworkId)
314
+ Assert-NotNull ($networkMappings [0 ].PrimaryNetworkName)
315
+ Assert-NotNull ($networkMappings [0 ].RecoveryServerId)
316
+ Assert-NotNull ($networkMappings [0 ].RecoveryNetworkId)
317
+ Assert-NotNull ($networkMappings [0 ].RecoveryNetworkName)
318
+ }
319
+
256
320
<#
257
321
. SYNOPSIS
258
322
Recovery Services Network unmapping tests and validation
@@ -285,7 +349,7 @@ function Test-NetworkUnMapping
285
349
Assert-NotNull ($networkMappings [0 ].RecoveryNetworkId)
286
350
Assert-NotNull ($networkMappings [0 ].RecoveryNetworkName)
287
351
288
- # Remove StorageMapping
352
+ # Remove NetworkMapping
289
353
$job = Remove-AzureSiteRecoveryNetworkMapping - NetworkMapping $networkMappings [0 ]
290
354
WaitForJobCompletion - JobId $job.ID
291
355
@@ -294,6 +358,47 @@ function Test-NetworkUnMapping
294
358
Assert-True { $networkMappings.Count -eq 0 }
295
359
}
296
360
361
+ <#
362
+ . SYNOPSIS
363
+ Recovery Services Azure Network unmapping tests and validation
364
+ #>
365
+ function Test-AzureNetworkUnMapping
366
+ {
367
+ param ([string ] $vaultSettingsFilePath )
368
+
369
+ # Import Azure Site Recovery Vault Settings
370
+ Import-AzureSiteRecoveryVaultSettingsFile $vaultSettingsFilePath
371
+
372
+ # Enumerate Servers
373
+ $servers = Get-AzureSiteRecoveryServer
374
+ Assert-True { $servers.Count -gt 0 }
375
+ Assert-NotNull ($servers )
376
+ foreach ($server in $servers )
377
+ {
378
+ Assert-NotNull ($server.Name )
379
+ Assert-NotNull ($server.ID )
380
+ }
381
+
382
+ # Enumerate Azure NetworkMappings
383
+ $networkMappings = Get-AzureSiteRecoveryNetworkMapping - PrimaryServer $servers [0 ] - Azure
384
+ Assert-NotNull ($networkMappings )
385
+ Assert-True { $networkMappings.Count -eq 1 }
386
+ Assert-NotNull ($networkMappings [0 ].PrimaryServerId)
387
+ Assert-NotNull ($networkMappings [0 ].PrimaryNetworkId)
388
+ Assert-NotNull ($networkMappings [0 ].PrimaryNetworkName)
389
+ Assert-NotNull ($networkMappings [0 ].RecoveryServerId)
390
+ Assert-NotNull ($networkMappings [0 ].RecoveryNetworkId)
391
+ Assert-NotNull ($networkMappings [0 ].RecoveryNetworkName)
392
+
393
+ # Remove Azure NetworkMapping
394
+ $job = Remove-AzureSiteRecoveryNetworkMapping - NetworkMapping $networkMappings [0 ]
395
+ WaitForJobCompletion - JobId $job.ID
396
+
397
+ # Enumerate Azure NetworkMappings
398
+ $networkMappings = Get-AzureSiteRecoveryNetworkMapping - PrimaryServer $servers [0 ] - Azure
399
+ Assert-True { $networkMappings.Count -eq 0 }
400
+ }
401
+
297
402
<#
298
403
. SYNOPSIS
299
404
Recovery Services Failback Tests
0 commit comments