Skip to content

Commit

Permalink
all vnv tests working
Browse files Browse the repository at this point in the history
  • Loading branch information
sssharma24 committed Oct 14, 2024
1 parent 8d5f24a commit 006645b
Show file tree
Hide file tree
Showing 8 changed files with 2,398 additions and 442 deletions.
21 changes: 11 additions & 10 deletions src/Network/Network.Test/ScenarioTests/NetworkManagerTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1058,6 +1058,7 @@ function Test-NetworkManagerVerifierWorkspaceReachabilityAnalysisIntentCRUD
$verifierWorkspaceName = Get-ResourceName
$rglocation = "eastus2euap"
$subscriptionId = "/subscriptions/c9295b92-3574-4021-95a1-26c8f74f8359"
$reachabilityAnalysisIntentName = "analysisIntentTest06"

try{
#Create the resource group
Expand All @@ -1073,28 +1074,26 @@ function Test-NetworkManagerVerifierWorkspaceReachabilityAnalysisIntentCRUD
# Create verifier workspace
New-AzNetworkManagerVerifierWorkspace -ResourceGroupName $rgName -NetworkManagerName $networkManagerName -Name $verifierWorkspaceName -Location $rglocation -Description "Sample description"

# Create analysis intent
$sourcePortList = @("100")
$destinationPortList = @("99")
$protocolList = @("TCP")
$sourceIpList = @("192.168.1.10")
$destinationIpList = @("172.16.0.5")
[System.Collections.Generic.List[Microsoft.Azure.Commands.Network.Models.NetworkManager.PSIPTraffic]]$ipTraffic = @()
$groupItem = New-AzNetworkManagerIPTraffic -SourceIps $sourceIpList -DestinationIps $destinationIpList -SourcePorts $sourcePortList -DestinationPorts $destinationPortList -Protocols $protocolList
$ipTraffic.Add($groupItem)

New-AzNetworkManagerVerifierWorkspaceReachabilityAnalysisIntent -ResourceGroupName $rgName -NetworkManagerName $networkManagerName -VerifierWorkspaceName $verifierWorkspaceName -Location $rglocation -Name $reachabilityAnalysisIntentName -SourceResourceId "/subscriptions/c9295b92-3574-4021-95a1-26c8f74f8359/resourceGroups/ipam-test-rg/providers/Microsoft.Compute/virtualMachines/testVM" -DestinationResourceId "/subscriptions/c9295b92-3574-4021-95a1-26c8f74f8359/resourceGroups/ipam-test-rg/providers/Microsoft.Compute/virtualMachines/ipam-test-vm-integration-test" -IpTraffic $ipTraffic
$ipTraffic = New-AzNetworkManagerIPTraffic -SourceIps $sourceIpList -DestinationIps $destinationIpList -SourcePorts $sourcePortList -DestinationPorts $destinationPortList -Protocols $protocolList

$analysisIntent = New-AzNetworkManagerVerifierWorkspaceReachabilityAnalysisIntent -ResourceGroupName $rgName -NetworkManagerName $networkManagerName -VerifierWorkspaceName $verifierWorkspaceName -Name $reachabilityAnalysisIntentName -SourceResourceId "/subscriptions/c9295b92-3574-4021-95a1-26c8f74f8359/resourceGroups/ipam-test-rg/providers/Microsoft.Compute/virtualMachines/testVM" -DestinationResourceId "/subscriptions/c9295b92-3574-4021-95a1-26c8f74f8359/resourceGroups/ipam-test-rg/providers/Microsoft.Compute/virtualMachines/ipam-test-vm-integration-test" -IpTraffic $ipTraffic


# Get analysis intent
$reachabilityAnalysisIntent = Get-AzNetworkManagerVerifierWorkspaceReachabilityAnalysisIntent -ResourceGroupName $rgName -NetworkManagerName $networkManagerName -VerifierWorkspaceName $verifierWorkspaceName -Name $reachabilityAnalysisIntentName
Assert-NotNull $reachabilityAnalysisIntent;
Assert-AreEqual $reachabilityAnalysisIntentName $reachabilityAnalysisIntent.Name;
Assert-AreEqual $reachabilityAnalysisIntent.Properties.SourceResourceId $sourceResourceId;
Assert-AreEqual $reachabilityAnalysisIntent.Properties.DestinationResourceId $destinationResourceId;
Assert-AreEqual $reachabilityAnalysisIntent.Properties.IpTraffic.SourceIps $sourceIpList;
Assert-AreEqual $reachabilityAnalysisIntent.Properties.IpTraffic.DestinationIps $destinationIpList;

# Delete analysis intent
$job = Remove-AzNetworkManagerVerifierWorkspace -ResourceGroupName $rgName -NetworkManagerName $networkManagerName -VerifierWorkspaceName $verifierWorkspaceName -Name $reachabilityAnalysisIntentName -PassThru -Force -AsJob;
$job = Remove-AzNetworkManagerVerifierWorkspaceReachabilityAnalysisIntent -ResourceGroupName $rgName -NetworkManagerName $networkManagerName -VerifierWorkspaceName $verifierWorkspaceName -Name $reachabilityAnalysisIntentName -PassThru -Force -AsJob;
$job | Wait-Job;
$removeResult = $job | Receive-Job;
}
Expand Down Expand Up @@ -1149,12 +1148,14 @@ function Test-NetworkManagerVerifierWorkspaceReachabilityAnalysisRunCRUD
New-AzNetworkManagerVerifierWorkspaceReachabilityAnalysisRun -ResourceGroupName $rgName -NetworkManagerName $networkManagerName -VerifierWorkspaceName $verifierWorkspaceName -Name $reachabilityAnalysisRunName -IntentId $intentId

# Get analysis run
$reachabilityAnalysisRun = Get-AzNetworkManagerVerifierWorkspaceReachabilityAnalysisRun -ResourceGroupName $rgName -NetworkManagerName $networkManagerName -workspaceName $verifierWorkspaceName -Name $reachabilityAnalysisRunName
$reachabilityAnalysisRun = Get-AzNetworkManagerVerifierWorkspaceReachabilityAnalysisRun -ResourceGroupName $rgName -NetworkManagerName $networkManagerName -VerifierWorkspaceName $verifierWorkspaceName -Name $reachabilityAnalysisRunName
Assert-NotNull $reachabilityAnalysisRun
Assert-AreEqual $reachabilityAnalysisRunName $reachabilityAnalysisRun.Name

Start-TestSleep -Seconds 300

# Delete analysis run
$job = Remove-AzNetworkManagerVerifierWorkspace -ResourceGroupName $rgName -NetworkManagerName $networkManagerName -Name $verifierWorkspaceName -PassThru -Force -AsJob;
$job = Remove-AzNetworkManagerVerifierWorkspaceReachabilityAnalysisRun -ResourceGroupName $rgName -NetworkManagerName $networkManagerName -Name $reachabilityAnalysisRunName -VerifierWorkspaceName $verifierWorkspaceName -PassThru -Force -AsJob;
$job | Wait-Job;
$removeResult = $job | Receive-Job;
}
Expand Down
Loading

0 comments on commit 006645b

Please sign in to comment.