2 ################################################################################
3 # Copyright (c) 2020 AT&T Intellectual Property. #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
22 read -n 1 -p "Press any key to continue" mainmenuinput
27 echo "This script demonstrates alarm communication between SMO (ONAP SDNC-SDNR) and"
28 echo "Near RT RIC O1 Mediator over netconf interface"
30 DIRNAME="/tmp/o1flow-$(date +%Y%m%d%H%M)"
34 echo && echo "===> Add network topology node for Near RT RIC in SDNC-SDNR."
36 # parameters used in API call into SDNC-SDNR
37 controller="192.168.130.182"
40 nodeId="near-rt-ric-01"
41 basicAuth="admin:Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"
42 accept="Accept:application/json"
43 content="Content-Type:application/json"
45 echo && acknowledge "Next step: check initial list of nodes configured"
46 echo "======> Check list of nodes"
47 path="restconf/config/network-topology:network-topology/topology/topology-netconf"
48 uri="$protocol://$controller:$port/$path"
49 echo "curl -u $basicAuth $uri"
50 curl -s -u $basicAuth $uri | jq .
51 echo "You should see that pretty an empty list under the \"topology\" array."
54 echo && echo "======> Prepare config file for the new node"
55 cat << EOF > oam-connect-${nodeId}.json
59 "node-id": "near-rt-ric-01",
60 "netconf-node-topology:host": "192.168.130.80",
61 "netconf-node-topology:port": 30830,
62 "netconf-node-topology:username": "netconf",
63 "netconf-node-topology:password": "netconf",
64 "netconf-node-topology:reconnect-on-changed-schema": false,
65 "netconf-node-topology:sleep-factor": 1.5,
66 "netconf-node-topology:tcp-only": false,
67 "netconf-node-topology:connection-timeout-millis": 20000,
68 "netconf-node-topology:max-connection-attempts": 100,
69 "netconf-node-topology:between-attempts-timeout-millis": 2000,
70 "netconf-node-topology:keepalive-delay": 120
75 echo "The configuration file is created at: $(pwd)/oam-connect-${nodeId}.json"
77 echo && echo "======> Create the node"
78 acknowledge "Next step: create the topology node for near real time RIC"
79 path="restconf/config/network-topology:network-topology/topology/topology-netconf"
80 uri="$protocol://$controller:$port/$path/node/$nodeId"
81 echo "curl $basicAuth -H $content -H $accept -X PUT -d @./oam-connect-${nodeId}.json $uri"
82 curl -i -u $basicAuth -H $content -H $accept -X PUT -d @./oam-connect-${nodeId}.json $uri
83 echo "As the tradition, a 200 response means that the API call was successful."
85 echo && acknowledge "Next step: check list of nodes configured"
86 echo "======> Check list of nodes"
87 path="restconf/config/network-topology:network-topology/topology/topology-netconf"
88 uri="$protocol://$controller:$port/$path"
89 echo "curl -u $basicAuth $uri"
90 curl -s -u $basicAuth $uri | jq .
91 echo "You should see that under the \"topology\" array, a node called \"neat-rt-ric-01\"."
93 echo && acknowledge "Next step: check capabilities and supported models of the Near RT RIC node"
94 echo "======> Querying capabilities and supported models of the Near RT RIC node"
95 path="restconf/operational/network-topology:network-topology/topology/topology-netconf"
96 uri="$protocol://$controller:$port/$path"
97 echo "curl -u $basicAuth $uri"
98 curl -s -u $basicAuth $uri | jq .
99 echo "You should see bunch of capabilities advertiised by the near-rt-ric-01 node. Among which the \"(urn:o-ran:ric:alarm:1.0?revision=2020-01-29)o-ran-sc-ric-alarm-v1\" is what we will use in the demo."
101 echo && acknowledge "Next step: retrieving outstanding alarms at the Near RT RIC node"
102 echo "======> Retrieving outstanding alarms at the Near RT RIC node"
103 path="restconf/operational/network-topology:network-topology/topology/topology-netconf/node/$nodeId/yang-ext:mount/o-ran-sc-ric-alarm-v1:ric/alarms"
104 uri="$protocol://$controller:$port/$path"
105 echo "curl -u $basicAuth $uri"
106 curl -u $basicAuth $uri | jq .
107 acknowledge "We should see two alarms, one MAJOR, the other CRITICAL. Next step: move demo sequence to Near RT RIC for the next step, which will delete one alarm. If you see a \"data-missing\" error, donot panic, it may mean that the near-rt-ric-01 node has nothing to report."
110 echo && echo "======> Retrieving outstanding alarms at the Near RT RIC node, the second time"
111 path="restconf/operational/network-topology:network-topology/topology/topology-netconf/node/$nodeId/yang-ext:mount/o-ran-sc-ric-alarm-v1:ric/alarms"
112 uri="$protocol://$controller:$port/$path"
113 echo "curl -u $basicAuth $uri"
114 curl -u $basicAuth $uri | jq .
115 acknowledge "We should see one alarm now, the MAJOR as the CRITICAL has been deleted. When ready to proceed,"
118 echo && acknowledge "The O1 alarm demonstration is complete. We now remove the Near RT RIC node to stop the netconf interface between OAM and Near RT RIC"
120 echo "===> Remove network topology nodee for Near RT RIC"
121 path="restconf/config/network-topology:network-topology/topology/topology-netconf/node/$nodeId"
122 uri="$protocol://$controller:$port/$path"
123 curl -u $basicAuth -X DELETE $uri | jq .