@@ -253,6 +253,69 @@ 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"
305
+ WaitForJobCompletion - JobId $job.ID
306
+
307
+ # Enumerate NetworkMappings
308
+ $networkMappings = Get-AzureSiteRecoveryNetworkMapping - PrimaryServer $servers [0 ] - Azure
309
+ Assert-NotNull ($networkMappings )
310
+ Assert-True { $networkMappings.Count -eq 1 }
311
+ Assert-NotNull ($networkMappings [0 ].PrimaryServerId)
312
+ Assert-NotNull ($networkMappings [0 ].PrimaryNetworkId)
313
+ Assert-NotNull ($networkMappings [0 ].PrimaryNetworkName)
314
+ Assert-NotNull ($networkMappings [0 ].RecoveryServerId)
315
+ Assert-NotNull ($networkMappings [0 ].RecoveryNetworkId)
316
+ Assert-NotNull ($networkMappings [0 ].RecoveryNetworkName)
317
+ }
318
+
256
319
<#
257
320
. SYNOPSIS
258
321
Recovery Services Network unmapping tests and validation
@@ -285,7 +348,7 @@ function Test-NetworkUnMapping
285
348
Assert-NotNull ($networkMappings [0 ].RecoveryNetworkId)
286
349
Assert-NotNull ($networkMappings [0 ].RecoveryNetworkName)
287
350
288
- # Remove StorageMapping
351
+ # Remove NetworkMapping
289
352
$job = Remove-AzureSiteRecoveryNetworkMapping - NetworkMapping $networkMappings [0 ]
290
353
WaitForJobCompletion - JobId $job.ID
291
354
@@ -294,6 +357,47 @@ function Test-NetworkUnMapping
294
357
Assert-True { $networkMappings.Count -eq 0 }
295
358
}
296
359
360
+ <#
361
+ . SYNOPSIS
362
+ Recovery Services Azure Network unmapping tests and validation
363
+ #>
364
+ function Test-AzureNetworkUnMapping
365
+ {
366
+ param ([string ] $vaultSettingsFilePath )
367
+
368
+ # Import Azure Site Recovery Vault Settings
369
+ Import-AzureSiteRecoveryVaultSettingsFile $vaultSettingsFilePath
370
+
371
+ # Enumerate Servers
372
+ $servers = Get-AzureSiteRecoveryServer
373
+ Assert-True { $servers.Count -gt 0 }
374
+ Assert-NotNull ($servers )
375
+ foreach ($server in $servers )
376
+ {
377
+ Assert-NotNull ($server.Name )
378
+ Assert-NotNull ($server.ID )
379
+ }
380
+
381
+ # Enumerate Azure NetworkMappings
382
+ $networkMappings = Get-AzureSiteRecoveryNetworkMapping - PrimaryServer $servers [0 ] - Azure
383
+ Assert-NotNull ($networkMappings )
384
+ Assert-True { $networkMappings.Count -eq 1 }
385
+ Assert-NotNull ($networkMappings [0 ].PrimaryServerId)
386
+ Assert-NotNull ($networkMappings [0 ].PrimaryNetworkId)
387
+ Assert-NotNull ($networkMappings [0 ].PrimaryNetworkName)
388
+ Assert-NotNull ($networkMappings [0 ].RecoveryServerId)
389
+ Assert-NotNull ($networkMappings [0 ].RecoveryNetworkId)
390
+ Assert-NotNull ($networkMappings [0 ].RecoveryNetworkName)
391
+
392
+ # Remove Azure NetworkMapping
393
+ $job = Remove-AzureSiteRecoveryNetworkMapping - NetworkMapping $networkMappings [0 ]
394
+ WaitForJobCompletion - JobId $job.ID
395
+
396
+ # Enumerate Azure NetworkMappings
397
+ $networkMappings = Get-AzureSiteRecoveryNetworkMapping - PrimaryServer $servers [0 ] - Azure
398
+ Assert-True { $networkMappings.Count -eq 0 }
399
+ }
400
+
297
401
<#
298
402
. SYNOPSIS
299
403
Recovery Services Failback Tests
0 commit comments