Skip to content
Snippets Groups Projects
Commit aa1d3afc authored by Hanna Führ's avatar Hanna Führ Committed by Sandra Westerhoff
Browse files

Issue/2031 ip connectivity checker

parent 6d7cbd9f
No related branches found
No related tags found
2 merge requests!2Release: Sprint/2022 06 :robot:,!1Issue/2031 ip connectivity checker
stages:
- test_live
- schedule
test_live:
stage: test_live
tags:
- live
script:
- PowerShell .\ipconnectivitychecker.ps1
when: always
ipChecker_live:
stage: schedule
variables:
ErrorActionPreference: stop
tags:
- live
script:
- PowerShell .\ipconnectivitychecker.ps1
only:
- schedules
\ No newline at end of file
# IP Connectivity Checker
This script checks the ip connectivity in connection with onboarded universities using their own rds.
## Usage
* The script runs as a daily scheduled gitlab job. It passes the pipelinie only if all ip connections are checked "ok".
* The logs can be seen in the pipeline logs.
* Users can set up merge requests for correcting/updating IP addresses.
function testport([string]$srv,$p,$timeout=2000){
$ErrorActionPreference = "SilentlyContinue"
$tcpclient = new-Object system.Net.Sockets.TcpClient
$iar = $tcpclient.BeginConnect($srv,$port,$null,$null)
$wait = $iar.AsyncWaitHandle.WaitOne($timeout,$false)
if(!$wait)
{
$tcpclient.Close()
$global:pipelineFails=$true
Return "Connection Timeout at " + (Get-Date).ToString()
}
else
{
$error.Clear()
$tcpclient.EndConnect($iar) | out-Null
if(!$?){
$global:pipelineFails=$true
Return $error[0] + (Get-Date).ToString()
}
$tcpclient.Close()
}
Return "ok"
}
$global:pipelineFails=$false
echo "********************************"
echo " Checking IP connectivity "
echo "********************************"
echo "=== UDE Management ==="
$ips = @("132.252.182.129","132.252.182.130", "132.252.182.131", "132.252.182.132", "132.252.182.133", "132.252.182.134", "132.252.182.135", "132.252.182.136", "132.252.182.137", "132.252.182.138", "132.252.182.139","132.252.182.140","134.91.199.65","134.91.199.66","134.91.199.67","134.91.199.68","134.91.199.69","134.91.199.70","134.91.199.71","134.91.199.72","134.91.199.73","134.91.199.74","134.91.199.75","134.91.199.76")
$port ="4443";
foreach($ip in $ips){
echo "$($ip):$port $(testport $ip -p $port)";
}
echo "=== UDE Data ==="
$ips = @("132.252.182.1", "132.252.182.2","132.252.182.3","132.252.182.4","132.252.182.5", "132.252.182.6","132.252.182.7","132.252.182.8","132.252.182.9", "132.252.182.10","132.252.182.11","132.252.182.12","134.91.199.1", "134.91.199.2","134.91.199.3", "134.91.199.4","134.91.199.5","134.91.199.6","134.91.199.7","134.91.199.8","134.91.199.9","134.91.199.10","134.91.199.11","134.91.199.12")
$port ="9021";
foreach($ip in $ips){
echo "$($ip):$port $(testport $ip -p $port)";
}
echo "=== TUDO Management ==="
$ips = @("129.217.149.130","129.217.149.131", "129.217.149.132","129.217.149.133","129.217.149.134","129.217.149.135", "129.217.149.136","129.217.149.137", "129.217.149.138", "129.217.149.160", "129.217.149.161", "129.217.149.162","129.217.149.163", "129.217.149.164", "129.217.149.165", "129.217.149.166", "129.217.149.167", "129.217.149.168")
$port ="4443";
foreach($ip in $ips){
echo "$($ip):$port $(testport $ip -p $port)";
}
echo "=== TUDO Data ==="
$ips = @("129.217.149.2", "129.217.149.3","129.217.149.4","129.217.149.5","129.217.149.6","129.217.149.7","129.217.149.8", "129.217.149.9", "129.217.149.10","129.217.149.32","129.217.149.33","129.217.149.34","129.217.149.35","129.217.149.36","129.217.149.37","129.217.149.38","129.217.149.39","129.217.149.40")
$port ="9021";
foreach($ip in $ips){
echo "$($ip):$port $(testport $ip -p $port)";
}
if($pipelineFails) {
echo "IP connectivity check fails at least once"
$Host.SetShouldExit(-1)
Exit -1
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment