Install/Un-install scripts for o-du/l2 repo
[it/dep.git] / o-du-high / bin / install
1 ################################################################################
2 #   Copyright (c) [2020] [Radisys]                                             #
3 #                                                                              #
4 #   Licensed under the Apache License, Version 2.0 (the "License");            #
5 #   you may not use this file except in compliance with the License.           #
6 #   You may obtain a copy of the License at                                    #
7 #                                                                              #
8 #       http://www.apache.org/licenses/LICENSE-2.0                             #
9 #                                                                              #
10 #   Unless required by applicable law or agreed to in writing, software        #
11 #   distributed under the License is distributed on an "AS IS" BASIS,          #
12 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
13 #   See the License for the specific language governing permissions and        #
14 #   limitations under the License.                                             #
15 ################################################################################
16 # This script is used to setup environment and install O-DU High
17 #!/bin/bash
18
19 if [[ $# -eq 0 ]] ; then
20     echo "ERROR : Missing input to the script"
21     echo "Required : ./install <O-DU_High_Directory_Path_To_Clone_Code>"
22     exit 1
23 fi
24
25 INSTALL_DIR=$PWD
26 CLONE_DIR=$1
27
28 echo "***** Installation Start *****"
29
30 if [ -f /etc/os-release ]; then
31    . /etc/os-release
32    OS=$ID
33 fi
34
35 echo "===> Installing GCC"
36 if [ $OS == "ubuntu" ] ; then
37    sudo apt-get install -y build-essential
38 else
39    sudo yum groups mark install -y “Development Tools”
40 fi
41 echo""
42
43 echo "===> Installing LKSCTP"
44 if [ $OS == "ubuntu" ] ; then
45    sudo apt-get install -y libsctp-dev
46 else
47    sudo yum install -y lksctp-tools-devel
48 fi
49 echo ""
50
51 echo "===> Installing PCAP"
52 if [ $OS == "ubuntu" ] ; then
53    sudo apt-get install -y libpcap-dev
54 else
55    sudo yum install -y libpcap-devel
56 fi
57 echo ""
58
59 echo "===> Installing XTERM"
60 if [ $OS == "ubuntu" ] ; then
61    sudo apt-get install -y xterm
62 else
63    sudo yum install -y xterm
64 fi
65 echo ""
66
67 echo "***** Installation Complete *****"
68
69 echo ""
70 echo "***** Cloning O-DU High *****"
71 cd $CLONE_DIR
72 git clone "https://gerrit.o-ran-sc.org/r/o-du/l2"
73
74 echo ""
75 cd $CLONE_DIR/l2/build/odu
76 echo "***** Building O-DU Binary *****"
77 make odu MACHINE=BIT64 MODE=FDD
78 echo ""
79 echo "***** Building CU Stub Binary *****"
80 make cu_stub NODE=TEST_STUB MACHINE=BIT64 MODE=FDD
81 echo ""
82 echo "***** Building RIC Stub Binary *****"
83 make ric_stub NODE=TEST_STUB MACHINE=BIT64 MODE=FDD
84
85 echo ""
86 echo "***** Assigning IP addresses *****"
87 INTERFACE=$(ip route | grep default | sed -e "s/^.*dev.//" -e "s/.proto.*//")
88 INTERFACE="$(echo -e "${INTERFACE}" | tr -d '[:space:]')"
89 ifconfig $INTERFACE:ODU "192.168.130.81"
90 ifconfig $INTERFACE:CU_STUB "192.168.130.82"
91 ifconfig $INTERFACE:RIC_STUB "192.168.130.80"
92
93 xterm -hold -e "cd $CLONE_DIR/l2/bin/cu_stub; ./cu_stub" &
94 sleep 2
95 xterm -hold -e "cd $CLONE_DIR//l2/bin/ric_stub; ./ric_stub" &
96 sleep 2
97 xterm -hold -e "cd $CLONE_DIR//l2/bin/odu; ./odu" &
98 sleep 2
99
100 ################################################################################
101 #                              End of file                                     #
102 ################################################################################