2022-09-22 00:43:52 +03:00
|
|
|
param([string]$podIps)
|
2022-11-04 20:52:48 +03:00
|
|
|
$filepath = "npm-exec-logs"
|
|
|
|
|
|
|
|
Write-Output "attempting to delete previous results if they exist"
|
|
|
|
Remove-Item -path $filepath -recurse
|
2022-09-22 00:43:52 +03:00
|
|
|
|
|
|
|
$podIp = @()
|
|
|
|
foreach ($r in ($podIps -split " ")) {
|
|
|
|
$podIp += $r
|
|
|
|
}
|
|
|
|
|
|
|
|
(Get-HnsNetwork | ? Name -Like azure).Policies >>( New-Item -Path ./$filepath/hns_state.out -Force )
|
|
|
|
Get-HnsEndpoint | ConvertTo-Json >> $filepath/hns_state.out
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($row in $podIp) {
|
|
|
|
Write-Output "Gathering logs for IP $row"
|
|
|
|
[string]$endpoint = hnsdiag list endpoints | select-string -context 2, 0 "$row"
|
|
|
|
if($endpoint -ne $null){
|
|
|
|
$endpointID = $endpoint.Substring($endpoint.IndexOf(":")+2,37).Trim()
|
|
|
|
hnsdiag list endpoints | select-string -context 2, 0 "$row" >> $filepath/vfp_state_$row.out
|
|
|
|
vfpctrl /port $endpointID /list-tag >> $filepath/vfp_state_$row.out
|
|
|
|
vfpctrl /port $endpointID /layer ACL_ENDPOINT_LAYER /list-rule >> $filepath/vfp_state_$row.out
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-04 20:52:48 +03:00
|
|
|
Compress-Archive -Path "$filepath" -DestinationPath "$filepath.zip" -Force
|
2022-09-22 00:43:52 +03:00
|
|
|
|
|
|
|
exit
|