Add Bronze Get Started demo scripts
[it/dep.git] / demos / bronze / odu-high.sh
1 #!/bin/bash
2 ################################################################################
3 #   Copyright (c) 2020 AT&T Intellectual Property.                             #
4 #                                                                              #
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                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
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 ################################################################################
17
18 acknowledge() {
19   echo "$1"
20   read  -n 1 -p "Press any key to continue, or CTRL-C to abort" mainmenuinput
21   echo
22 }
23
24
25 acknowledge "Make sure the env veriables __RIC_HOST__ and __ODU_HOST__ are populated with the hostname/IP address of the RIC cluster and ODU server."
26 if [[ -z "$__RIC_HOST__" ]] || [[ -z "$__ODU_HOST__" ]]; then
27   echo 'Cannot proceed, must have the Hostname/IP of the RIC and ODU as env variables $__RIC_HOST__ and $__ODU_HOST__'
28   echo 'Use the address of the local NIC that the ODU binds for SCTP communication for $__ODU_HOST__'
29   exit
30 fi
31
32 acknowledge "O-DU HIGH code needs to be recompiled with the RIC and ODU server addresses."
33 apt-get install libpcap-dev gcc-multilib g++-multilib libsctp-dev
34 git clone http://gerrit.o-ran-sc.org/r/o-du/l2
35 cd l2
36 # Edit src/du_app/du_cfg.h for the IP addresses, both ODU and RIC (because ODU binds
37 # to specific local port for SCTP, it needs the ODU IP address as well to decide which 
38 # interface to bind.  use ifconfig to identify.)
39 sed -i "s/^#define RIC_IP_V4_ADDR.*/#define RIC_IP_V4_ADDR \"${__RIC_HOST__}\"/g" src/du_app/du_cfg.h 
40 sed -i "s/^#define DU_IP_V4_ADDR.*/#define DU_IP_V4_ADDR \"${__ODU_HOST__}\"/g" src/du_app/du_cfg.h 
41 # RIC Bronze E2T's SCTP is at 36422, but exposed as nodeport on 36422
42 sed -i "s/^#define RIC_PORT.*/#define RIC_PORT 32222/g" src/du_app/du_cfg.h 
43
44 cd build/odu/
45 make clean_odu odu MACHINE=BIT64 MODE=FDD
46
47 acknowledge "The compilation has completed.  The next step is to run the O-DU HIGH executable.  We will see the ODU HIGH establishes SCTP connection to E2Termination, then sending E2 Setup Request and receiving E2 Setup Response.  It will be good to also start following the logs of the E2 Termination."
48 cd ../../bin/odu
49 ./odu
50 # we should see odu dumps communication parameters
51