Lusheng Ji | 37534a5 | 2020-08-02 21:25:26 -0400 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | |
| 3 | #set -x |
| 4 | |
| 5 | acknowledge() { |
| 6 | echo "$1" |
| 7 | read -n 1 -p "Press any key to continue" mainmenuinput |
| 8 | echo |
| 9 | } |
| 10 | |
| 11 | |
| 12 | echo "This script demonstrates raising alarm within Near RT RIC" |
| 13 | |
| 14 | DIRNAME="/tmp/tsflow-$(date +%Y%m%d%H%M)" |
| 15 | mkdir $DIRNAME |
| 16 | cd $DIRNAME |
| 17 | |
| 18 | echo "===> Add network topology node for Near RT RIC" |
| 19 | |
| 20 | ipaddr="$(kubectl get svc --all-namespaces | grep alarmadapter-http | awk '{print $4}')" |
| 21 | port="$(kubectl get svc --all-namespaces | grep alarmadapter-http | awk '{print $6}' | cut -f1 -d'/')" |
| 22 | |
| 23 | |
| 24 | OP="POST" |
| 25 | SpecificProblem="8006" |
| 26 | PerceivedSeverity="MAJOR" |
| 27 | AdditionalInfo="ethernet" |
| 28 | IdentifyingInfo="eth1" |
| 29 | curl -v -X $OP http://"$ipaddr":"$port"/ric/v1/alarms -d '{"SpecificProblem": "${SpecificProblem}", "PerceivedSeverity": "${PerceivedSeverity}", "AdditionalInfo": "${AdditionalInfo}", "IdentifyingInfo": "${IdentifyingInfo}"}' |
| 30 | |
| 31 | |
| 32 | OP="POST" |
| 33 | SpecificProblem="8005" |
| 34 | PerceivedSeverity="CRITICAL" |
| 35 | AdditionalInfo="network-down" |
| 36 | IdentifyingInfo="switch 1" |
| 37 | curl -v -X $OP http://"$ipaddr":"$port"/ric/v1/alarms -d '{"SpecificProblem": "${SpecificProblem}", "PerceivedSeverity": "${PerceivedSeverity}", "AdditionalInfo": "${AdditionalInfo}", "IdentifyingInfo": "${IdentifyingInfo}"}' |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | OP="DELETE" |
| 43 | SpecificProblem="8005" |
| 44 | PerceivedSeverity="CRITICAL" |
| 45 | AdditionalInfo="network-down" |
| 46 | IdentifyingInfo="switch 1" |
| 47 | curl -v -X $OP http://"$ipaddr":"$port"/ric/v1/alarms -d '{"SpecificProblem": "${SpecificProblem}", "PerceivedSeverity": "${PerceivedSeverity}", "AdditionalInfo": "${AdditionalInfo}", "IdentifyingInfo": "${IdentifyingInfo}"}' |