Skip to content

Commit

Permalink
Fixed traffic-selector incremental counter
Browse files Browse the repository at this point in the history
  • Loading branch information
scottdware committed Jun 18, 2014
1 parent 17f3457 commit 9c5a272
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions Posh-Junos.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,9 @@ function Get-SRXProxyID {
[string] $File
)

$Total = $Local.Count * $Remote.Count
$Start = 1

if ($File) {
if (Test-Path $File) {
$ans = Read-Host 'Log file exists. Do you wish to overwrite? [y/n]'
Expand All @@ -326,10 +329,15 @@ function Get-SRXProxyID {

Log-Output -File $File -Content "configure"

foreach ($localIP in $Local) {
foreach ($remoteIP in $Remote) {
$selector = "set security ipsec vpn $VPN traffic-selector $($localIP)_$($remoteIP) local-ip $localIP remote-ip $remoteIP"
Log-Output -File $File -Content $selector
while ($Start -le $Total) {
foreach ($localIP in $Local) {
foreach ($remoteIP in $Remote) {
# $selector = "set security ipsec vpn $VPN traffic-selector $($localIP)_$($remoteIP) local-ip $localIP remote-ip $remoteIP"
$selector = "set security ipsec vpn $VPN traffic-selector TS$($Start) local-ip $localIP remote-ip $remoteIP"
Log-Output -File $File -Content $selector

$Start += 1
}
}
}

Expand All @@ -339,11 +347,16 @@ function Get-SRXProxyID {
else {
Write-Output "-- Copy & Paste into SRX --`n"

foreach ($localIP in $Local) {
foreach ($remoteIP in $Remote) {
Write-Output "set security ipsec vpn $VPN traffic-selector $($localIP)_$($remoteIP) local-ip $localIP remote-ip $remoteIP"
while ($Start -le $Total) {
foreach ($localIP in $Local) {
foreach ($remoteIP in $Remote) {
# Write-Output "set security ipsec vpn $VPN traffic-selector $($localIP)_$($remoteIP) local-ip $localIP remote-ip $remoteIP"
Write-Output "set security ipsec vpn $VPN traffic-selector TS$($Start) local-ip $localIP remote-ip $remoteIP"

$Start += 1
}
}
}
}
}
}

Expand Down

0 comments on commit 9c5a272

Please sign in to comment.