@@ -618,4 +618,85 @@ function Test-ConnectivityCheck
618
618
}
619
619
}
620
620
621
+ <#
622
+ . SYNOPSIS
623
+ Test ReachabilityReport NetworkWatcher API.
624
+ #>
625
+ function Test-ReachabilityReport
626
+ {
627
+ # Setup
628
+ $rgname = Get-ResourceGroupName
629
+ $nwName = Get-ResourceName
630
+ $rglocation = Get-ProviderLocation ResourceManagement
631
+ $resourceTypeParent = " Microsoft.Network/networkWatchers"
632
+ $location = " westcentralus"
633
+
634
+ try
635
+ {
636
+ # Create the resource group
637
+ $resourceGroup = New-AzureRmResourceGroup - Name $rgname - Location $rglocation - Tags @ { testtag = " testval" }
638
+
639
+ # Create the Network Watcher
640
+ $tags = @ {" key1" = " value1" ; " key2" = " value2" }
641
+ $nw = New-AzureRmNetworkWatcher - Name $nwName - ResourceGroupName $rgname - Location $location - Tag $tags
642
+
643
+ $report1 = Get-AzureRmNetworkWatcherReachabilityReport - NetworkWatcher $nw - AzureLocations " West US" - Country " United States" - StartTime " 2017-10-05" - EndTime " 2017-10-10"
644
+ $report2 = Get-AzureRmNetworkWatcherReachabilityReport - NetworkWatcher $nw - AzureLocations " West US" - Country " United States" - State " washington" - StartTime " 2017-10-05" - EndTime " 2017-10-10"
645
+ $report3 = Get-AzureRmNetworkWatcherReachabilityReport - NetworkWatcher $nw - AzureLocations " West US" - Country " United States" - State " washington" - City " seattle" - StartTime " 2017-10-05" - EndTime " 2017-10-10"
646
+
647
+ Assert-AreEqual $report1.AggregationLevel " Country"
648
+ Assert-AreEqual $report1.ProviderLocation.Country " United States"
649
+ Assert-AreEqual $report2.AggregationLevel " State"
650
+ Assert-AreEqual $report2.ProviderLocation.Country " United States"
651
+ Assert-AreEqual $report2.ProviderLocation.State " washington"
652
+ Assert-AreEqual $report3.AggregationLevel " City"
653
+ Assert-AreEqual $report3.ProviderLocation.Country " United States"
654
+ Assert-AreEqual $report3.ProviderLocation.State " washington"
655
+ Assert-AreEqual $report3.ProviderLocation.City " seattle"
656
+ }
657
+ finally
658
+ {
659
+ # Cleanup
660
+ Clean - ResourceGroup $rgname
661
+ }
662
+ }
621
663
664
+ <#
665
+ . SYNOPSIS
666
+ Test ProvidersList NetworkWatcher API.
667
+ #>
668
+ function Test-ProvidersList
669
+ {
670
+ # Setup
671
+ $rgname = Get-ResourceGroupName
672
+ $nwName = Get-ResourceName
673
+ $rglocation = Get-ProviderLocation ResourceManagement
674
+ $resourceTypeParent = " Microsoft.Network/networkWatchers"
675
+ $location = " westcentralus"
676
+
677
+ try
678
+ {
679
+ # Create the resource group
680
+ $resourceGroup = New-AzureRmResourceGroup - Name $rgname - Location $rglocation - Tags @ { testtag = " testval" }
681
+
682
+ # Create the Network Watcher
683
+ $tags = @ {" key1" = " value1" ; " key2" = " value2" }
684
+ $nw = New-AzureRmNetworkWatcher - Name $nwName - ResourceGroupName $rgname - Location $location - Tag $tags
685
+
686
+ $list1 = Get-AzureRmNetworkWatcherReachabilityProvidersList - NetworkWatcher $nw - AzureLocations " West US" - Country " United States"
687
+ $list2 = Get-AzureRmNetworkWatcherReachabilityProvidersList - NetworkWatcher $nw - AzureLocations " West US" - Country " United States" - State " washington"
688
+ $list3 = Get-AzureRmNetworkWatcherReachabilityProvidersList - NetworkWatcher $nw - AzureLocations " West US" - Country " United States" - State " washington" - City " seattle"
689
+
690
+ Assert-AreEqual $list1.Countries.CountryName " United States"
691
+ Assert-AreEqual $list2.Countries.CountryName " United States"
692
+ Assert-AreEqual $list2.Countries.States.StateName " washington"
693
+ Assert-AreEqual $list3.Countries.CountryName " United States"
694
+ Assert-AreEqual $list3.Countries.States.StateName " washington"
695
+ Assert-AreEqual $list3.Countries.States.Cities.CityName " seattle"
696
+ }
697
+ finally
698
+ {
699
+ # Cleanup
700
+ Clean - ResourceGroup $rgname
701
+ }
702
+ }
0 commit comments