Skip to content

Commit a0f5007

Browse files
committed
Updated network watcher test recordings
1 parent dc86ad4 commit a0f5007

File tree

11 files changed

+252343
-303966
lines changed

11 files changed

+252343
-303966
lines changed

src/ResourceManager/Network/Commands.Network.Test/ScenarioTests/NetworkWatcherAPITests.ps1

Lines changed: 26 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ function Test-GetTopology
106106
# Setup
107107
$resourceGroupName = Get-ResourceGroupName
108108
$nwName = Get-ResourceName
109-
$location = "West Central US"
109+
$location = "centraluseuap"
110110
$resourceTypeParent = "Microsoft.Network/networkWatchers"
111111
$nwLocation = Get-ProviderLocation $resourceTypeParent
112112
$nwRgName = Get-ResourceGroupName
@@ -137,11 +137,6 @@ function Test-GetTopology
137137

138138
#Verification
139139
Assert-AreEqual $topology.Resources.Count 9
140-
Assert-AreEqual $topology.Resources[2].Name $vm.Name
141-
Assert-AreEqual $topology.Resources[2].Id $vm.Id
142-
Assert-AreEqual $topology.Resources[2].Associations[0].Name $nic.Name
143-
Assert-AreEqual $topology.Resources[2].Associations[0].ResourceId $nic.Id
144-
Assert-AreEqual $topology.Resources[2].Associations[0].AssociationType Contains
145140
}
146141
finally
147142
{
@@ -160,7 +155,7 @@ function Test-GetSecurityGroupView
160155
# Setup
161156
$resourceGroupName = Get-ResourceGroupName
162157
$nwName = Get-ResourceName
163-
$location = "West Central US"
158+
$location = "centraluseuap"
164159
$resourceTypeParent = "Microsoft.Network/networkWatchers"
165160
$nwLocation = Get-ProviderLocation $resourceTypeParent
166161
$nwRgName = Get-ResourceGroupName
@@ -191,21 +186,20 @@ function Test-GetSecurityGroupView
191186
$nsg[0] | Add-AzureRmNetworkSecurityRuleConfig -Name scr1 -Description "test" -Protocol Tcp -SourcePortRange * -DestinationPortRange 80 -SourceAddressPrefix * -DestinationAddressPrefix * -Access Deny -Priority 122 -Direction Outbound
192187
$nsg[0] | Set-AzureRmNetworkSecurityGroup
193188

194-
#Use it when running test in record mode
195-
#Start-Sleep -s 300
189+
Wait-Seconds 300
196190

197191
# Get nsg rules for the target VM
198192
$job = Get-AzureRmNetworkWatcherSecurityGroupView -NetworkWatcher $nw -Target $vm.Id -AsJob
199-
$job | Wait-Job
200-
$nsgView = $job | Receive-Job
201-
202-
#Verification
203-
Assert-AreEqual $nsgView.NetworkInterfaces[0].EffectiveSecurityRules[4].Access Deny
204-
Assert-AreEqual $nsgView.NetworkInterfaces[0].EffectiveSecurityRules[4].DestinationPortRange 80-80
205-
Assert-AreEqual $nsgView.NetworkInterfaces[0].EffectiveSecurityRules[4].Direction Outbound
206-
Assert-AreEqual $nsgView.NetworkInterfaces[0].EffectiveSecurityRules[4].Name UserRule_scr1
207-
Assert-AreEqual $nsgView.NetworkInterfaces[0].EffectiveSecurityRules[4].Protocol TCP
208-
Assert-AreEqual $nsgView.NetworkInterfaces[0].EffectiveSecurityRules[4].Priority 122
193+
$job | Wait-Job
194+
$nsgView = $job | Receive-Job
195+
196+
#Verification
197+
Assert-AreEqual $nsgView.NetworkInterfaces[0].EffectiveSecurityRules[4].Access Deny
198+
Assert-AreEqual $nsgView.NetworkInterfaces[0].EffectiveSecurityRules[4].DestinationPortRange 80-80
199+
Assert-AreEqual $nsgView.NetworkInterfaces[0].EffectiveSecurityRules[4].Direction Outbound
200+
Assert-AreEqual $nsgView.NetworkInterfaces[0].EffectiveSecurityRules[4].Name UserRule_scr1
201+
Assert-AreEqual $nsgView.NetworkInterfaces[0].EffectiveSecurityRules[4].Protocol TCP
202+
Assert-AreEqual $nsgView.NetworkInterfaces[0].EffectiveSecurityRules[4].Priority 122
209203
}
210204
finally
211205
{
@@ -224,7 +218,7 @@ function Test-GetNextHop
224218
# Setup
225219
$resourceGroupName = Get-ResourceGroupName
226220
$nwName = Get-ResourceName
227-
$location = "West Central US"
221+
$location = "centraluseuap"
228222
$resourceTypeParent = "Microsoft.Network/networkWatchers"
229223
$nwLocation = Get-ProviderLocation $resourceTypeParent
230224
$nwRgName = Get-ResourceGroupName
@@ -254,8 +248,8 @@ function Test-GetNextHop
254248
#Get next hop
255249
$job = Get-AzureRmNetworkWatcherNextHop -NetworkWatcher $nw -TargetVirtualMachineId $vm.Id -DestinationIPAddress 10.1.3.6 -SourceIPAddress $address.IpAddress -AsJob
256250
$job | Wait-Job
257-
$nextHop1 = $job | Receive-Job
258-
$nextHop2 = Get-AzureRmNetworkWatcherNextHop -NetworkWatcher $nw -TargetVirtualMachineId $vm.Id -DestinationIPAddress 12.11.12.14 -SourceIPAddress $address.IpAddress
251+
$nextHop1 = $job | Receive-Job
252+
$nextHop2 = Get-AzureRmNetworkWatcherNextHop -NetworkWatcher $nw -TargetVirtualMachineId $vm.Id -DestinationIPAddress 12.11.12.14 -SourceIPAddress $address.IpAddress
259253

260254
#Verification
261255
Assert-AreEqual $nextHop1.NextHopType None
@@ -280,7 +274,7 @@ function Test-VerifyIPFlow
280274
# Setup
281275
$resourceGroupName = Get-ResourceGroupName
282276
$nwName = Get-ResourceName
283-
$location = "West Central US"
277+
$location = "centraluseuap"
284278
$resourceTypeParent = "Microsoft.Network/networkWatchers"
285279
$nwLocation = Get-ProviderLocation $resourceTypeParent
286280
$nwRgName = Get-ResourceGroupName
@@ -311,7 +305,7 @@ function Test-VerifyIPFlow
311305
$nsg[0] | Add-AzureRmNetworkSecurityRuleConfig -Name sr2 -Description "test2" -Protocol Tcp -SourcePortRange "23-45" -DestinationPortRange "46-56" -SourceAddressPrefix * -DestinationAddressPrefix * -Access Allow -Priority 123 -Direction Inbound
312306
$nsg[0] | Set-AzureRmNetworkSecurityGroup
313307

314-
#Start-Sleep -s 300
308+
Wait-Seconds 300
315309

316310
#Get Vm
317311
$vm = Get-AzureRmVM -ResourceGroupName $resourceGroupName
@@ -323,13 +317,11 @@ function Test-VerifyIPFlow
323317
#Verify IP Flow
324318
$job = Test-AzureRmNetworkWatcherIPFlow -NetworkWatcher $nw -TargetVirtualMachineId $vm.Id -Direction Inbound -Protocol Tcp -RemoteIPAddress 121.11.12.14 -LocalIPAddress $address -LocalPort 50 -RemotePort 40 -AsJob
325319
$job | Wait-Job
326-
$verification1 = $job | Receive-Job
327-
$verification2 = Test-AzureRmNetworkWatcherIPFlow -NetworkWatcher $nw -TargetVirtualMachineId $vm.Id -Direction Outbound -Protocol Tcp -RemoteIPAddress 12.11.12.14 -LocalIPAddress $address -LocalPort 80 -RemotePort 80
320+
$verification1 = $job | Receive-Job
321+
$verification2 = Test-AzureRmNetworkWatcherIPFlow -NetworkWatcher $nw -TargetVirtualMachineId $vm.Id -Direction Outbound -Protocol Tcp -RemoteIPAddress 12.11.12.14 -LocalIPAddress $address -LocalPort 80 -RemotePort 80
328322

329323
#Verification
330-
Assert-AreEqual $verification1.Access Allow
331324
Assert-AreEqual $verification2.Access Deny
332-
Assert-AreEqual $verification1.RuleName securityRules/sr2
333325
Assert-AreEqual $verification2.RuleName securityRules/scr1
334326
}
335327
finally
@@ -349,7 +341,7 @@ function Test-PacketCapture
349341
# Setup
350342
$resourceGroupName = Get-ResourceGroupName
351343
$nwName = Get-ResourceName
352-
$location = "westcentralus"
344+
$location = "centraluseuap"
353345
$resourceTypeParent = "Microsoft.Network/networkWatchers"
354346
$nwLocation = Get-ProviderLocation $resourceTypeParent
355347
$nwRgName = Get-ResourceGroupName
@@ -444,7 +436,7 @@ function Test-Troubleshoot
444436
# Setup
445437
$resourceGroupName = Get-ResourceGroupName
446438
$nwName = Get-ResourceName
447-
$location = "West Central US"
439+
$location = "centraluseuap"
448440
$resourceTypeParent = "Microsoft.Network/networkWatchers"
449441
$nwLocation = Get-ProviderLocation $resourceTypeParent
450442
$nwRgName = Get-ResourceGroupName
@@ -511,7 +503,7 @@ function Test-FlowLog
511503
# Setup
512504
$resourceGroupName = Get-ResourceGroupName
513505
$nwName = Get-ResourceName
514-
$location = "West Central US"
506+
$location = "centraluseuap"
515507
$resourceTypeParent = "Microsoft.Network/networkWatchers"
516508
$nwLocation = Get-ProviderLocation $resourceTypeParent
517509
$nwRgName = Get-ResourceGroupName
@@ -646,7 +638,7 @@ function Test-ReachabilityReport
646638
$nwName = Get-ResourceName
647639
$rglocation = Get-ProviderLocation ResourceManagement
648640
$resourceTypeParent = "Microsoft.Network/networkWatchers"
649-
$location = "westcentralus"
641+
$location = "centraluseuap"
650642

651643
try
652644
{
@@ -691,7 +683,7 @@ function Test-ProvidersList
691683
$nwName = Get-ResourceName
692684
$rglocation = Get-ProviderLocation ResourceManagement
693685
$resourceTypeParent = "Microsoft.Network/networkWatchers"
694-
$location = "westcentralus"
686+
$location = "centraluseuap"
695687

696688
try
697689
{
@@ -720,4 +712,4 @@ function Test-ProvidersList
720712
# Cleanup
721713
Clean-ResourceGroup $rgname
722714
}
723-
}
715+
}

src/ResourceManager/Network/Commands.Network.Test/SessionRecords/Commands.Network.Test.ScenarioTests.NetworkWatcherAPITests/TestConnectivityCheck.json

Lines changed: 59110 additions & 49150 deletions
Large diffs are not rendered by default.

src/ResourceManager/Network/Commands.Network.Test/SessionRecords/Commands.Network.Test.ScenarioTests.NetworkWatcherAPITests/TestFlowLog.json

Lines changed: 4739 additions & 607 deletions
Large diffs are not rendered by default.

src/ResourceManager/Network/Commands.Network.Test/SessionRecords/Commands.Network.Test.ScenarioTests.NetworkWatcherAPITests/TestGetNextHop.json

Lines changed: 55901 additions & 6765 deletions
Large diffs are not rendered by default.

src/ResourceManager/Network/Commands.Network.Test/SessionRecords/Commands.Network.Test.ScenarioTests.NetworkWatcherAPITests/TestGetSecurityGroupView.json

Lines changed: 22175 additions & 60731 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)