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