Ievgeniia Zadorozhna | 7800859 | 2025-02-23 00:49:21 +0100 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | . "$(dirname "$0")/functions.sh" |
| 4 | cd /artifacts |
| 5 | . env.sh |
| 6 | . /opt/cfg-checker/.checkervenv/bin/activate |
| 7 | fname="/artifacts/reports/$MY_CLIENTSHORTNAME-mos-networks-ping-$(get_timestamp).txt" |
| 8 | nets=$(mos-checker --env-name $MY_CLIENTSHORTNAME-mos --env-config /artifacts/envs/mos-checker.env --kube-config /artifacts/envs/mos-kubeconfig.yaml network list 2>&1 | grep -A20 "# Runtime networks list" | grep "\:" | grep -v 'o-hm0' | awk '{print $1}') |
| 9 | nets=$(echo "$nets" | tr ' ' '\n' | grep -v '/32' | grep -v '10.99.') |
| 10 | |
| 11 | echo "The following CIRDs will be pinged:" |
| 12 | printf "%s\n\n" "$nets" |
| 13 | |
| 14 | cidr_options="" |
| 15 | for net in $nets; do |
| 16 | cidr_options+="--cidr $net " # Append each network to the list |
| 17 | done |
| 18 | |
| 19 | summary=$(mos-checker --env-name $MY_CLIENTSHORTNAME-mos --env-config /artifacts/envs/mos-checker.env --kube-config /artifacts/envs/mos-kubeconfig.yaml network ping --detailed $cidr_options 2>&1 | awk '/Summary/ {flag=1} flag') |
| 20 | |
| 21 | printf "%s\n" "$summary" |
| 22 | printf "%s\n" "$summary" > $fname |
| 23 | |
| 24 | echo "" |
| 25 | echo "The report is saved to $fname" |
| 26 | deactivate |