From: lal.harshita Date: Mon, 7 Jun 2021 10:40:59 +0000 (+0530) Subject: Automation scripts X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=bfd03f1e56692fc661435811b185d907f79808b2;p=o-du%2Fl2.git Automation scripts Change-Id: I4e8e93617844b06797739b3b397e793520ff7d81 Signed-off-by: lal.harshita --- diff --git a/Dockerfile b/Dockerfile index 32742005b..02e0e275a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,7 +25,7 @@ RUN cd build/odu && make clean_odu odu MACHINE=BIT64 MODE=TDD #CMD /opt/o-du-l2/bin/odu/odu #cleanup netconf folder and install libraries -RUN cd build/scripts && /bin/bash install_lib.sh -c +RUN cd build/scripts && /bin/bash install_lib_O1.sh -c # Install the data models based on the ODU yang model RUN /usr/local/bin/sysrepoctl -i build/yang/o-ran-sc-odu-alarm-v1.yang diff --git a/build/odu/makefile b/build/odu/makefile index 99cd9dfc0..31183ea2d 100644 --- a/build/odu/makefile +++ b/build/odu/makefile @@ -283,7 +283,7 @@ link_cu: $(L_OPTS) -L$(LIB_ROOT)/cu_stub -L$(ROOT_DIR)/libs/cu_stub $(Q)cp -f ./obj/cu_stub/cu_stub ./bin/cu_stub $(Q)cp -rf ./bin/cu_stub $(ROOT_DIR)/bin/ - $(Q)cp -f ../scripts/cu_script.sh $(ROOT_DIR)/bin/cu_stub + $(Q)cp -f ../scripts/start_cu_stub_logging.sh $(ROOT_DIR)/bin/cu_stub $(Q)echo -e "***** CU STUB BUILD COMPLETE *****" ric: @@ -320,19 +320,19 @@ link_ric: $(L_OPTS) -L$(LIB_ROOT)/ric_stub -L$(ROOT_DIR)/libs/ric_stub $(Q)cp -f ./obj/ric_stub/ric_stub ./bin/ric_stub $(Q)cp -rf ./bin/ric_stub $(ROOT_DIR)/bin/ + $(Q)cp -f ../scripts/start_ric_stub_logging.sh $(ROOT_DIR)/bin/ric_stub $(Q)echo -e "***** RIC STUB BUILD COMPLETE *****" copy_build: link_du $(Q)cp -f ./obj/odu/odu ./bin/odu $(Q)cp -rf ./bin/odu $(ROOT_DIR)/bin/ - $(Q)cp -f ../scripts/odu_script.sh $(ROOT_DIR)/bin/odu + $(Q)cp -f ../scripts/start_du_logging.sh $(ROOT_DIR)/bin/odu $(Q)cp -rf ../config/ $(ROOT_DIR)/bin/odu $(Q)cp -f ./lib/odu/*.a $(ROOT_DIR)/libs/ $(Q)echo -e "***** BUILD COMPLETE *****" odu: prepare_dirs copy_build - cu_stub: prepare_cu_dirs cu link_cu ric_stub: prepare_ric_dirs ric link_ric diff --git a/build/scripts/cleanup b/build/scripts/cleanup new file mode 100755 index 000000000..7a47aa605 --- /dev/null +++ b/build/scripts/cleanup @@ -0,0 +1,63 @@ +################################################################################ +# Copyright (c) [2020] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ +# This script is used to clean-up the system environment +#!/bin/bash + +echo "***** Environment Clean-up Start *****" + +if [ -f /etc/os-release ]; then + . /etc/os-release + OS=$ID +fi + +echo "===> Uninstalling GCC" +if [ $OS == "ubuntu" ] ; then + sudo apt-get remove -y build-essential +else + sudo yum groups mark remove -y "Development Tools" +fi + +echo "" +echo "===> Uninstalling LKSCTP" +if [ $OS == "ubuntu" ] ; then + sudo apt-get remove -y libsctp-dev +else + sudo yum remove -y lksctp-tools-devel +fi + +echo "" +echo "===> Uninstalling PCAP" +if [ $OS == "ubuntu" ] ; then + sudo apt-get remove -y libpcap-dev +else + sudo yum remove -y libpcap-devel +fi + +echo "" +echo "===> Uninstalling XTERM" +if [ $OS == "ubuntu" ] ; then + sudo apt-get remove -y xterm +else + sudo yum remove -y xterm +fi + +echo "" +echo "***** Environment Clean-up Complete *****" + +################################################################################ +# End of file # +################################################################################ + diff --git a/build/scripts/install_lib.sh b/build/scripts/install_lib_O1.sh similarity index 99% rename from build/scripts/install_lib.sh rename to build/scripts/install_lib_O1.sh index f4e2df5e8..25a75edc9 100755 --- a/build/scripts/install_lib.sh +++ b/build/scripts/install_lib_O1.sh @@ -195,7 +195,7 @@ acknowledge() { #show help for user to provide valid input show_help(){ echo "use -c option for cleanup" - echo "ex : $./install_lib.sh -c" + echo "ex : $./install_lib_O1.sh -c" exit } diff --git a/build/scripts/install_odu_dependency.sh b/build/scripts/install_odu_dependency.sh new file mode 100755 index 000000000..a48a30317 --- /dev/null +++ b/build/scripts/install_odu_dependency.sh @@ -0,0 +1,62 @@ +################################################################################ +# Copyright (c) [2020] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ +# This script is used to setup environment for execution of ODU-High +#!/bin/bash + +echo "***** Installation Start *****" + +if [ -f /etc/os-release ]; then + . /etc/os-release + OS=$ID +fi + +echo "===> Installing GCC" +if [ $OS == "ubuntu" ] ; then + sudo apt-get install -y build-essential +else + sudo yum groups mark install -y “Development Tools” +fi +echo"" + +echo "===> Installing LKSCTP" +if [ $OS == "ubuntu" ] ; then + sudo apt-get install -y libsctp-dev +else + sudo yum install -y lksctp-tools-devel +fi +echo "" + +echo "===> Installing PCAP" +if [ $OS == "ubuntu" ] ; then + sudo apt-get install -y libpcap-dev +else + sudo yum install -y libpcap-devel +fi +echo "" + +echo "===> Installing XTERM" +if [ $OS == "ubuntu" ] ; then + sudo apt-get install -y xterm +else + sudo yum install -y xterm +fi +echo "" + +echo "***** Installation Complete *****" + +################################################################################ +# End of file # +################################################################################ diff --git a/build/scripts/odu_high.sh b/build/scripts/odu_high.sh new file mode 100755 index 000000000..51ec331be --- /dev/null +++ b/build/scripts/odu_high.sh @@ -0,0 +1,28 @@ +################################################################################ +# Copyright (c) [2020] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ +# This is the main script that in turn triggers sub-scripts to install, compile +# and execute ODU-High modules +#!/bin/bash + +# Installing dependencies for ODU-High +./install_odu_dependency.sh + +# Compiling and executing ODU-High binaries +./start_gnb.sh + +################################################################################ +# End of file # +################################################################################ diff --git a/build/scripts/cu_script.sh b/build/scripts/start_cu_stub_logging.sh old mode 100644 new mode 100755 similarity index 74% rename from build/scripts/cu_script.sh rename to build/scripts/start_cu_stub_logging.sh index 4737f588b..e07fb737b --- a/build/scripts/cu_script.sh +++ b/build/scripts/start_cu_stub_logging.sh @@ -1,29 +1,19 @@ ################################################################################ -# Copyright (c) [2017-2019] [Radisys] -# # +# Copyright (c) [2017-2019] [Radisys] # # # -# Licensed under the Apache License, Version 2.0 (the "License"); -# # -# you may not use this file except in compliance with the License. -# # -# You may obtain a copy of the License at -# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # # # -# http://www.apache.org/licenses/LICENSE-2.0 -# # +# http://www.apache.org/licenses/LICENSE-2.0 # # # -# Unless required by applicable law or agreed to in writing, software -# # -# distributed under the License is distributed on an "AS IS" BASIS, -# # -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. # -# See the License for the specific language governing permissions -# and # -# limitations under the License. -# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # ################################################################################ - +# This script is used to log CU Stub #!/bin/sh ROOT_DIR=$PWD diff --git a/build/scripts/odu_script.sh b/build/scripts/start_du_logging.sh old mode 100644 new mode 100755 similarity index 73% rename from build/scripts/odu_script.sh rename to build/scripts/start_du_logging.sh index fc8b28557..d53afc992 --- a/build/scripts/odu_script.sh +++ b/build/scripts/start_du_logging.sh @@ -1,29 +1,19 @@ ################################################################################ -# Copyright (c) [2017-2019] [Radisys] -# # +# Copyright (c) [2017-2019] [Radisys] # # # -# Licensed under the Apache License, Version 2.0 (the "License"); -# # -# you may not use this file except in compliance with the License. -# # -# You may obtain a copy of the License at -# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # # # -# http://www.apache.org/licenses/LICENSE-2.0 -# # +# http://www.apache.org/licenses/LICENSE-2.0 # # # -# Unless required by applicable law or agreed to in writing, software -# # -# distributed under the License is distributed on an "AS IS" BASIS, -# # -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. # -# See the License for the specific language governing permissions -# and # -# limitations under the License. -# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # ################################################################################ - +# This script is used to log ODU-High #!/bin/sh ROOT_DIR=$PWD diff --git a/build/scripts/start_gnb.sh b/build/scripts/start_gnb.sh new file mode 100755 index 000000000..8c9a47c64 --- /dev/null +++ b/build/scripts/start_gnb.sh @@ -0,0 +1,50 @@ +################################################################################ +# Copyright (c) [2020] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ +# This script is used to build and execute ODU-High and test stubs +#!/bin/bash + +CURRENT_DIR=$PWD +ROOT_DIR=$CURRENT_DIR/../../ + +echo "" +cd $ROOT_DIR/build/odu +make clean_all +echo "***** Building O-DU Binary *****" +make odu MACHINE=BIT64 MODE=FDD +echo "" +echo "***** Building CU Stub Binary *****" +make cu_stub NODE=TEST_STUB MACHINE=BIT64 MODE=FDD +echo "" +echo "***** Building RIC Stub Binary *****" +make ric_stub NODE=TEST_STUB MACHINE=BIT64 MODE=FDD + +echo "" +echo "***** Assigning IP addresses *****" +INTERFACE=$(ip route | grep default | sed -e "s/^.*dev.//" -e "s/.proto.*//") +INTERFACE="$(echo -e "${INTERFACE}" | tr -d '[:space:]')" +ifconfig $INTERFACE:ODU "192.168.130.81" +ifconfig $INTERFACE:CU_STUB "192.168.130.82" +ifconfig $INTERFACE:RIC_STUB "192.168.130.80" + +xterm -hold -e "cd $ROOT_DIR/bin/cu_stub; chmod 777 *; ./start_cu_stub_logging.sh && ./cu_stub" & +sleep 2 +xterm -hold -e "cd $ROOT_DIR/bin/ric_stub; chmod 777 *; ./start_ric_stub_logging.sh && ./ric_stub" & +sleep 2 +xterm -hold -e "cd $ROOT_DIR/bin/odu; chmod 777 *; ./start_du_logging.sh && ./odu" & + +################################################################################ +# End of file # +################################################################################ diff --git a/build/scripts/start_ric_stub_logging.sh b/build/scripts/start_ric_stub_logging.sh new file mode 100755 index 000000000..252e7c6b9 --- /dev/null +++ b/build/scripts/start_ric_stub_logging.sh @@ -0,0 +1,35 @@ +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ +# This script is used to log RIC stub +#!/bin/sh + +ROOT_DIR=$PWD +d=`date +%Y_%m_%d_%I_%M_%S` + +touch $ROOT_DIR/"log_ric_stub_$d.txt" +chmod -c 777 $ROOT_DIR/"log_ric_stub_$d.txt" +touch /etc/rsyslog.d/rsyslog_loginauth.conf +cp /dev/null /etc/rsyslog.d/rsyslog_loginauth.conf +echo "if \$programname == \"RIC_STUB\" then" >> \ +/etc/rsyslog.d/rsyslog_loginauth.conf +echo "$ROOT_DIR/../ric_stub/log_ric_stub_$d.txt" >> \ +/etc/rsyslog.d/rsyslog_loginauth.conf +systemctl restart rsyslog + + +#********************************************************************** +# End of file +#********************************************************************** diff --git a/docs/README b/docs/README index 5d864161d..98d5b6cd7 100644 --- a/docs/README +++ b/docs/README @@ -47,8 +47,8 @@ C. Pre-requisite for O1 Interface (Required only if run with O1 interface enable cat /home/netconf/.ssh/id_dsa.pub > /home/netconf/.ssh/authorized_keys Install netconf packages. $cd l2/build/scripts - $chmod +x install_lib.sh - $ ./install_lib.sh -c + $chmod +x install_lib_O1.sh + $ ./install_lib_O1.sh -c 2. Start Netopeer2-server: $cd l2/build/scripts diff --git a/docs/installation-guide.rst b/docs/installation-guide.rst index 700180e4e..78d620bfa 100644 --- a/docs/installation-guide.rst +++ b/docs/installation-guide.rst @@ -123,7 +123,7 @@ Setting up Netconf server - Ubuntu : | cd /l2/build/scripts - | sudo ./install_lib.sh -c + | sudo ./install_lib_O1.sh -c - Start Netopeer2-server: