4 # cleanup any previous (unsuccessful) runs.
11 # cleanup any previous (unsuccessful) runs.
16 # wait until sdnr up & running
18 res=$(curl -o /dev/null -sw %{http_code} http://localhost:8181/odlux/index.html)
21 if [ "$res" == "$expect" ]; then
22 echo -e "SDNR is up and running\n"
34 echo -e "RU failed to connect.\n"
43 echo -e "DU failed to connect.\n"
47 # Adding delay to avoid curl failures
50 HOST_IP=$(hostname -I | awk '{print $1}')
51 USER_PWD=admin:Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U
54 echo "Adding DU simulator"
55 res=$(curl -o /dev/null -sw %{http_code} -u $USER_PWD -X POST "http://localhost:8181/rests/operations/netconf-node-topology:create-device" -H "accept: */*" -H "Content-Type: application/json" -d '{"input":{"pass-through":{},"login-password":{"username":"netconf","password":"netconf!"},"host":"'"$HOST_IP"'","port":"18310","node-id":"du_sim"}}')
57 if [ "$res" == "204" ]; then
58 echo -e "Successfully added device DU \n"
60 echo -e "Failed to add DU.\n"
66 echo -e "Checking DU simulator \n"
67 res=$(curl -o /dev/null -sw '%{http_code}' -u $USER_PWD -X GET "http://localhost:8181/rests/data/network-topology:network-topology/topology=topology-netconf/node=du_sim/netconf-node-topology:available-capabilities?content=nonconfig" -H "accept: application/xml")
68 if [ $res == 200 ]; then
69 echo -e "DU simulator is alive.\n"
71 echo -e "DU simulator is not responding.\n"
77 echo "Adding RU Simulator\n"
78 res=$(curl -o /dev/null -sw %{http_code} -u $USER_PWD -X POST "http://localhost:8181/rests/operations/netconf-node-topology:create-device" -H "accept: */*" -H "Content-Type: application/json" -d '{"input":{"pass-through":{},"login-password":{"username":"netconf","password":"netconf!"},"host":"'"$HOST_IP"'","port":"18300","node-id":"ru_sim"}}')
80 if [ "$res" == "204" ]; then
81 echo -e "Successfully added device RU \n"
83 echo -e "Failed to add RU.\n"
89 echo -e "Checking RU simulator connection"
90 res=$(curl -o /dev/null -sw '%{http_code}' -u $USER_PWD -X GET "http://localhost:8181/rests/data/network-topology:network-topology/topology=topology-netconf/node=ru_sim/netconf-node-topology:available-capabilities?content=nonconfig" -H "accept: application/xml")
91 if [ $res == 200 ]; then
92 echo -e "RU simulator is alive.\n"
94 echo -e "RU simulator is not responding.\n"
98 echo -e "\nRU cofig before update"
99 res=$(curl -o /dev/null -sw '%{http_code}' -u $USER_PWD -X GET "http://localhost:8181/rests/data/network-topology:network-topology/topology=topology-netconf/node=ru_sim/yang-ext:mount/o-ran-delay-management:delay-management/adaptive-delay-configuration/transport-delay" -H "accept: application/xml")
100 if [ $res == 200 ]; then
101 echo -e "RU config check before update succeeded.\n"
103 echo -e "RU config check before update failed.\n"
107 echo -e "\nUpdating RU config"
108 res=$(curl -o /dev/null -sw %{http_code} -u $USER_PWD -X PUT "http://localhost:8181/rests/data/network-topology:network-topology/topology=topology-netconf/node=ru_sim/yang-ext:mount/o-ran-delay-management:delay-management/adaptive-delay-configuration/transport-delay" -H "accept: */*" -H "Content-Type: application/json" -d '{"transport-delay":{"t12-min":1000,"t12-max":66666,"t34-min":2000,"t34-max":55555}}')
109 if [ "$res" == "204" ]; then
110 echo -e "Successfully updated RU config.\n"
112 echo -e "Failed to update RU config.\n"
116 echo -e "\nRU config afer update."
117 res=$(curl -o /dev/null -sw '%{http_code}' -u $USER_PWD -X GET "http://localhost:8181/rests/data/network-topology:network-topology/topology=topology-netconf/node=ru_sim/yang-ext:mount/o-ran-delay-management:delay-management/adaptive-delay-configuration/transport-delay" -H "accept: application/xml")
118 if [ $res == 200 ]; then
119 echo -e "RU config after update succeeded.\n"
121 echo -e "RU config after update failed.\n"
126 echo -e "\nDU config before update."
127 res=$(curl -o /dev/null -sw '%{http_code}' -u $USER_PWD -X GET "http://localhost:8181/rests/data/network-topology:network-topology/topology=topology-netconf/node=du_sim/yang-ext:mount/o-ran-sc-du-hello-world:network-function/du-to-ru-connection=O-RU-1" -H "accept: application/xml")
128 if [ $res == 200 ]; then
129 echo -e "DU config before update succeeded.\n"
131 echo -e "DU config before update failed.\n"
136 echo -e "Updating DU config"
137 res=$(curl -o /dev/null -sw %{http_code} -u $USER_PWD -X PUT "http://localhost:8181/rests/data/network-topology:network-topology/topology=topology-netconf/node=du_sim/yang-ext:mount/o-ran-sc-du-hello-world:network-function/du-to-ru-connection=O-RU-1" -H "accept: */*" -H "Content-Type: application/json" -d "{"du-to-ru-connection":[{"name":"O-RU-1","administrative-state":"UNLOCKED"}]}")
138 if [ "$res" == "204" ]; then
139 echo -e "Successfully updated DU config.\n"
141 echo -e "Failed to update DU config.\n"
145 # Validate DU config after update
146 echo -e "DU cofig afer update"
147 res=$(curl -o /dev/null -sw '%{http_code}' -u $USER_PWD -X GET "http://localhost:8181/rests/data/network-topology:network-topology/topology=topology-netconf/node=du_sim/yang-ext:mount/o-ran-sc-du-hello-world:network-function/du-to-ru-connection=O-RU-1" -H "accept: application/xml")
148 if [ $res == 200 ]; then
149 echo -e "DU config after update succeeded.\n"
151 echo -e "DU config after update failed.\n"
155 # Bring down the sdnr
158 # bring down the simulators
161 echo -e "\nTests completed"