Unverified Commit ed7de74c authored by Raphael Defosseux's avatar Raphael Defosseux Committed by GitHub

Merge pull request #7 from OPENAIRINTERFACE/helm3.1-onap-sync-with-cn-split-repos

Helm3.1 onap sync with cn split repos

* Proper openshift image build support
* Helm chart based deployment
parents e812920b 0b40323a
# Any CI/CD artifact
openair-spgwu.tar.bz2
archives
*-cfg.sh
*-env.list
src/oai_rules_result*txt
......@@ -38,7 +38,7 @@ case "$OS_DISTRO" in
ubuntu) OS_BASEDISTRO="debian"; INSTALLER="apt-get"; CMAKE="cmake" ;;
esac
IS_CONTAINER=`egrep -c "docker|kubepods" /proc/self/cgroup`
IS_CONTAINER=`egrep -c "docker|podman|kubepods" /proc/self/cgroup || true`
if [ $IS_CONTAINER -eq 0 ]
then
......@@ -128,6 +128,7 @@ check_supported_distribution() {
case "$distribution" in
"ubuntu18.04") return 0 ;;
"rhel8") return 0 ;;
"rhel8.2") return 0 ;;
"centos8") return 0 ;;
esac
return 1
......
......@@ -31,6 +31,7 @@ source $THIS_SCRIPT_PATH/build_helper
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
install_fb_folly_from_source(){
echo_info "Starting to install folly from source"
if [ $1 -eq 0 ]; then
OPTION=""
read -p "Do you want to install FaceBook folly (github)? <y/N> " prompt
......@@ -143,6 +144,7 @@ install_fb_folly_from_source(){
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
popd
fi
echo_success "End of folly installation"
return 0
}
......@@ -69,6 +69,7 @@ install_fmt() {
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
install_spdlog_from_git() {
echo_info "Starting to install spdlog from source"
if [ $1 -eq 0 ]; then
read -p "Do you want to install spdlog ? <y/N> " prompt
OPTION=""
......@@ -101,6 +102,7 @@ install_spdlog_from_git() {
sed -i '/#define SPDLOG_ENABLE_SYSLOG/s/^\/\///g' include/spdlog/tweakme.h
popd
fi
echo_success "End of spdlog installation"
return 0
}
......@@ -382,6 +384,7 @@ check_install_spgwu_deps() {
bison \
$CMAKE \
cppcheck \
procps-ng \
flex \
gdb \
git"
......@@ -420,12 +423,20 @@ check_install_spgwu_deps() {
python \
pkg-config"
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
case "$(get_distribution_release)" in
"centos8")
specific_packages="libidn2-devel"
;;
"rhel8.2")
specific_packages=""
;;
esac
PACKAGE_LIST="\
$specific_packages \
guile-devel \
libconfig-devel \
libgcrypt-devel \
gmp-devel \
libidn2-devel \
libidn-devel \
lksctp-tools \
lksctp-tools-devel \
......@@ -444,6 +455,7 @@ check_install_spgwu_deps() {
$SUDO $INSTALLER install $OPTION $PACKAGE_LIST
ret=$?;[[ $ret -ne 0 ]] && return $ret
echo_info "Packages and Libraries installation finished!"
# Use fmt lib included in spdlog
#install_fmt $1
......
......@@ -144,24 +144,26 @@ function main()
mkdir -m 777 -p $dext
if [ $var_check_install_min_deps -gt 0 ];then
disable_ipv6
check_install_spgwu_min_deps $force $debug
if [[ $? -ne 0 ]]; then
echo_error "Error: SPGW-U minimal deps installation failed"
return 1
else
# Done now after
disable_ipv6
echo_success "SPGW-U minimal deps installation successful"
echo_warning "SPGW-U not compiled, to compile it, re-run build_spgwu without -i option"
return 0
fi
fi
if [ $var_check_install_deps -gt 0 ];then
disable_ipv6
check_install_spgwu_deps $force $debug
if [[ $? -ne 0 ]]; then
echo_error "Error: SPGW-U deps installation failed"
return 1
else
# Done now after
disable_ipv6
echo_success "SPGW-U deps installation successful"
echo_warning "SPGW-U not compiled, to compile it, re-run build_spgwu without -I option"
return 0
......
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (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.openairinterface.org/?page_id=698
# *
# * 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.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
#---------------------------------------------------------------------
#
# Dockerfile for the Open-Air-Interface SPGW-U-TINY service
# Valid for Ubuntu-18.04 (bionic)
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
FROM ubuntu:bionic as oai-spgwu-tiny-builder
ARG EURECOM_PROXY
ARG BUILD_FOR_CI
ARG CI_SRC_BRANCH
ARG CI_SRC_COMMIT
ARG CI_DEST_BRANCH
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && DEBIAN_FRONTEND=noninteractive apt-get install --yes \
psmisc \
git \
&& rm -rf /var/lib/apt/lists/*
# Some GIT configuration command quite useful
RUN /bin/bash -c "if [[ -v EURECOM_PROXY ]]; then git config --global http.proxy $EURECOM_PROXY; fi"
RUN git config --global https.postBuffer 123289600
RUN git config --global http.sslverify false
# In normal case, we build out of the develop branch
RUN /bin/bash -c "if [[ -v CI_SRC_BRANCH ]]; then git clone https://github.com/OPENAIRINTERFACE/openair-spgwu-tiny.git -b $CI_SRC_BRANCH /openair-spgwu-tiny; else git clone https://github.com/OPENAIRINTERFACE/openair-spgwu-tiny.git -b develop /openair-spgwu-tiny; fi"
# For CI, especially for Pull/Merge Requests, we build out of temp merge
WORKDIR /openair-spgwu-tiny
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git config --global user.name \"OAI CI\"; fi"
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git config --global user.email ci@openairinterface.org; fi"
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git checkout -f $CI_SRC_COMMIT; fi"
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git merge --ff origin/$CI_DEST_BRANCH -m \"Temporary merge for CI\"; fi"
# Installing and Building SPGW-U-TINY
WORKDIR /openair-spgwu-tiny/build/scripts
RUN ./build_spgwu --install-deps --force
RUN ./build_spgwu --clean --build-type Release --jobs
RUN cat /openair-spgwu-tiny/build/log/spgwu.txt
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
FROM ubuntu:bionic as oai-spgwu-tiny
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# We install some debug tools for the moment in addition of mandatory libraries
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && DEBIAN_FRONTEND=noninteractive apt-get install --yes \
psmisc \
net-tools \
iproute2 \
tshark \
libgoogle-glog0v5 \
libdouble-conversion1 \
libconfig++9v5 \
libboost-system1.65.1 \
&& rm -rf /var/lib/apt/lists/*
# Copying executable and generated libraries
WORKDIR /openair-spgwu-tiny/bin
COPY --from=oai-spgwu-tiny-builder /openair-spgwu-tiny/build/spgw_u/build/spgwu oai_spgwu
# Copying template configuration files
# The configuration folder will be flat
WORKDIR /openair-spgwu-tiny/etc
COPY --from=oai-spgwu-tiny-builder /openair-spgwu-tiny/etc/spgw_u.conf .
WORKDIR /openair-spgwu-tiny
../docker/Dockerfile.ubuntu18.04
\ No newline at end of file
......@@ -122,17 +122,13 @@ pipeline {
stage ('Build SPGW-U Image') {
steps {
script {
if (env.ghprbPullId != null) {
// Building a temporary image
myShCmd('docker image prune --force', new_host_flag, new_host_user, new_host)
myShCmd('docker build --target oai-spgwu-tiny --tag oai-spgwu-tiny:ci-temp --file ci-scripts/Dockerfile.ubuntu18.04 --build-arg EURECOM_PROXY="http://proxy.eurecom.fr:8080" --build-arg BUILD_FOR_CI="True" --build-arg CI_SRC_BRANCH="' + env.ghprbSourceBranch + '" --build-arg CI_SRC_COMMIT="' + env.ghprbActualCommit + '" --build-arg CI_DEST_BRANCH="develop" . > archives/spgwu_docker_image_build.log 2>&1', new_host_flag, new_host_user, new_host)
} else {
if (env.ghprbPullId == null) {
// Currently this pipeline only runs for pushes to `develop` branch
// First clean image registry
myShCmd('docker image rm oai-spgwu-tiny:develop', new_host_flag, new_host_user, new_host)
myShCmd('docker image prune --force', new_host_flag, new_host_user, new_host)
myShCmd('docker build --target oai-spgwu-tiny --tag oai-spgwu-tiny:develop --file ci-scripts/Dockerfile.ubuntu18.04 --build-arg EURECOM_PROXY="http://proxy.eurecom.fr:8080" --build-arg CI_SRC_BRANCH="develop" . > archives/spgwu_docker_image_build.log 2>&1', new_host_flag, new_host_user, new_host)
}
myShCmd('docker image prune --force', new_host_flag, new_host_user, new_host)
myShCmd('docker build --target oai-spgwu-tiny --tag oai-spgwu-tiny:' + spgwu_tag + ' --file docker/Dockerfile.ubuntu18.04 --build-arg EURECOM_PROXY="http://proxy.eurecom.fr:8080" . > archives/spgwu_docker_image_build.log 2>&1', new_host_flag, new_host_user, new_host)
myShCmd('docker image ls >> archives/spgwu_docker_image_build.log', new_host_flag, new_host_user, new_host)
}
}
......
......@@ -7,7 +7,7 @@
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
......@@ -16,7 +16,7 @@
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# * contact@openairinterface.org
# */
#---------------------------------------------------------------------
......@@ -31,6 +31,8 @@ class spgwuConfigGen():
self.sxu_name = ''
self.spgwc0_ip_addr = ''
self.fromDockerFile = False
self.envForEntrypoint = False
self.network_ue_ip = '12.1.1.0/24'
def GenerateSpgwuConfigurer(self):
spgwuFile = open('./spgwu-cfg.sh', 'w')
......@@ -60,7 +62,7 @@ class spgwuConfigGen():
spgwuFile.write('SPGWU_CONF[@SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP@]=\'' + self.s1u_name + '\'\n')
spgwuFile.write('SPGWU_CONF[@SGW_INTERFACE_NAME_FOR_SX@]=\'' + self.sxu_name + '\'\n')
# SGI is fixed on SGI
spgwuFile.write('SPGWU_CONF[@SGW_INTERFACE_NAME_FOR_SGI@]=\'eth0\'\n')
spgwuFile.write('SPGWU_CONF[@PGW_INTERFACE_NAME_FOR_SGI@]=\'eth0\'\n')
spgwuFile.write('SPGWU_CONF[@SPGWC0_IP_ADDRESS@]=\'' + self.spgwc0_ip_addr + '\'\n')
spgwuFile.write('\n')
spgwuFile.write('for K in "${!SPGWU_CONF[@]}"; do \n')
......@@ -70,6 +72,18 @@ class spgwuConfigGen():
spgwuFile.write('exit 0\n')
spgwuFile.close()
def GenerateSpgwuEnvList(self):
spgwuFile = open('./spgwu-env.list', 'w')
spgwuFile.write('# Environment Variables used by the OAI-SPGW-U-TINY Entrypoint Script\n')
spgwuFile.write('INSTANCE=1\n')
spgwuFile.write('PID_DIRECTORY=/var/run\n')
spgwuFile.write('SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP=' + self.s1u_name + '\n')
spgwuFile.write('SGW_INTERFACE_NAME_FOR_SX=' + self.sxu_name + '\n')
spgwuFile.write('PGW_INTERFACE_NAME_FOR_SGI=eth0\n')
spgwuFile.write('SPGWC0_IP_ADDRESS=' + self.spgwc0_ip_addr + '\n')
spgwuFile.write('NETWORK_UE_IP=' + self.network_ue_ip + '\n')
spgwuFile.close()
#-----------------------------------------------------------
# Usage()
#-----------------------------------------------------------
......@@ -87,6 +101,8 @@ def Usage():
print(' --sxu=[SPGW-U SX Interface Name]')
print(' --s1u=[SPGW-U S1-U Interface Name]')
print(' --from_docker_file')
print('------------------------------------------------------------------------------------------- SPGW-U Not Mandatory -----')
print(' --envForEntrypoint [generates a spgwc-env.list interpreted by the entrypoint]')
argvs = sys.argv
argc = len(argvs)
......@@ -113,6 +129,8 @@ while len(argvs) > 1:
mySpgwuCfg.s1u_name = matchReg.group(1)
elif re.match('^\-\-from_docker_file', myArgv, re.IGNORECASE):
mySpgwuCfg.fromDockerFile = True
elif re.match('^\-\-env_for_entrypoint', myArgv, re.IGNORECASE):
mySpgwuCfg.envForEntrypoint = True
else:
Usage()
sys.exit('Invalid Parameter: ' + myArgv)
......@@ -132,7 +150,10 @@ if mySpgwuCfg.kind == 'SPGW-U':
Usage()
sys.exit('missing SPGW-C #0 IP address on SX interface')
else:
mySpgwuCfg.GenerateSpgwuConfigurer()
if mySpgwuCfg.envForEntrypoint:
mySpgwuCfg.GenerateSpgwuEnvList()
else:
mySpgwuCfg.GenerateSpgwuConfigurer()
sys.exit(0)
else:
Usage()
......
......@@ -445,7 +445,7 @@ class HtmlReport():
if os.path.isfile(cwd + '/archives/' + logFileName):
status = False
section_start_pattern = 'build_spgwu --install-deps --force'
section_end_pattern = 'build_spgwu --clean --build-type Release --jobs'
section_end_pattern = 'build_spgwu --clean --build-type Release --jobs --Verbose'
section_status = False
package_install = False
folly_build_start = False
......@@ -464,22 +464,22 @@ class HtmlReport():
result = re.search('SPGW-U deps installation successful', line)
if result is not None:
status = True
result = re.search('/tmp /openair-spgwu-tiny/build/scripts', line)
result = re.search('Packages and Libraries installation finished', line)
if result is not None:
package_install = True
result = re.search('Cloning into \'folly\'', line)
result = re.search('Starting to install folly from source', line)
if result is not None:
folly_build_start = True
if folly_build_start:
result = re.search('Installing: /usr/local/lib/libfollybenchmark', line)
result = re.search('End of folly installation', line)
if result is not None:
folly_build_start = False
folly_build = True
result = re.search('Install spdlog from ', line)
result = re.search('Starting to install spdlog from source', line)
if result is not None:
spdlog_build_start = True
if spdlog_build_start:
result = re.search('/openair-spgwu-tiny/build/scripts', line)
result = re.search('End of spdlog installation', line)
if result is not None:
spdlog_build_start = False
spdlog_build = True
......@@ -531,8 +531,8 @@ class HtmlReport():
cwd = os.getcwd()
if os.path.isfile(cwd + '/archives/' + logFileName):
status = False
section_start_pattern = 'build_spgwu --clean --build-type Release --jobs'
section_end_pattern = 'cat /openair-spgwu-tiny/build/log/spgwu.txt'
section_start_pattern = 'build_spgwu --clean --build-type Release --jobs --Verbose'
section_end_pattern = 'git log -n1 > version.txt'
section_status = False
with open(cwd + '/archives/' + logFileName, 'r') as logfile:
for line in logfile:
......@@ -574,8 +574,8 @@ class HtmlReport():
nb_warnings = 0
if os.path.isfile(cwd + '/archives/' + logFileName):
section_start_pattern = 'cat /openair-spgwu-tiny/build/log/spgwu.txt'
section_end_pattern = 'FROM ubuntu:bionic as oai-spgwu-tiny$'
section_start_pattern = 'build_spgwu --clean --build-type Release --jobs --Verbose'
section_end_pattern = 'git log -n1 > version.txt'
section_status = False
with open(cwd + '/archives/' + logFileName, 'r') as logfile:
for line in logfile:
......
......@@ -96,6 +96,9 @@ class deploySanityCheckTest():
subprocess_run_w_echo('python3 ci-scripts/generateSpgwcConfigFiles.py --kind=SPGW-C --s11c=eth0 --sxc=eth1 --from_docker_file')
subprocess_run_w_echo('docker cp ./spgwc-cfg.sh ci-oai-spgwc:/openair-spgwc')
subprocess_run_w_echo('docker exec -it ci-oai-spgwc /bin/bash -c "cd /openair-spgwc && chmod 777 spgwc-cfg.sh && ./spgwc-cfg.sh" >> archives/spgwc_config.log')
# If we deploy a SPGW-U w/ entrypoint, SPGW-C SHALL be started
# This will be removed later on.
subprocess_run_w_echo('docker exec -d ci-oai-spgwc /bin/bash -c "nohup ./bin/oai_spgwc -o -c ./etc/spgw_c.conf > spgwc_check_run.log 2>&1"')
def deploySPGWU(self):
res = ''
......@@ -144,7 +147,8 @@ class deploySanityCheckTest():
if entrypoint is not None:
print('there is an entrypoint -- no need')
else:
subprocess_run_w_echo('docker exec -d ci-oai-spgwc /bin/bash -c "nohup ./bin/oai_spgwc -o -c ./etc/spgw_c.conf > spgwc_check_run.log 2>&1"')
print('Already started')
#subprocess_run_w_echo('docker exec -d ci-oai-spgwc /bin/bash -c "nohup ./bin/oai_spgwc -o -c ./etc/spgw_c.conf > spgwc_check_run.log 2>&1"')
def startSPGWU(self):
res = ''
......
......@@ -77,6 +77,7 @@ RUN yum update -y \
psmisc \
net-tools \
tcpdump \
iptables \
glog \
double-conversion \
libconfig \
......
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (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.openairinterface.org/?page_id=698
# *
# * 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.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
#---------------------------------------------------------------------
#
# Dockerfile for the Open-Air-Interface SPGW-U-TINY service
# Valid for CentOS 8
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
FROM centos:8 as oai-spgwu-tiny-builder
ARG EURECOM_PROXY
ARG BUILD_FOR_CI
ARG CI_SRC_BRANCH
ARG CI_SRC_COMMIT
ARG CI_DEST_BRANCH
RUN yum update -y \
&& yum install epel-release -y \
&& yum install dnf-plugins-core -y \
&& yum config-manager --set-enabled PowerTools \
&& yum install -y \
psmisc \
git \
&& yum clean all -y \
&& rm -rf /var/cache/yum
# Some GIT configuration command quite useful
RUN /bin/bash -c "if [[ -v EURECOM_PROXY ]]; then git config --global http.proxy $EURECOM_PROXY; fi"
RUN git config --global https.postBuffer 123289600
RUN git config --global http.sslverify false
# In normal case, we build out of the develop branch
RUN /bin/bash -c "if [[ -v CI_SRC_BRANCH ]]; then git clone https://github.com/OPENAIRINTERFACE/openair-spgwu-tiny.git -b $CI_SRC_BRANCH /openair-spgwu-tiny; else git clone https://github.com/OPENAIRINTERFACE/openair-spgwu-tiny.git -b helm3.1-onap-sync-with-cn-split-repos /openair-spgwu-tiny; fi"
# For CI, especially for Pull/Merge Requests, we build out of temp merge
WORKDIR /openair-spgwu-tiny
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git config --global user.name \"OAI CI\"; fi"
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git config --global user.email ci@openairinterface.org; fi"
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git checkout -f $CI_SRC_COMMIT; fi"
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git merge --ff origin/$CI_DEST_BRANCH -m \"Temporary merge for CI\"; fi"
# Installing and Building SPGW-C
WORKDIR /openair-spgwu-tiny/build/scripts
RUN ./build_spgwu --install-deps --force
RUN ./build_spgwu --clean --build-type Debug --jobs --Verbose
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
FROM centos:8 as oai-spgwu-tiny
# We install some debug tools for the moment in addition of mandatory libraries
RUN yum update -y \
&& yum install epel-release -y \
&& yum install dnf-plugins-core -y \
&& yum config-manager --set-enabled PowerTools \
&& yum install -y \
psmisc \
net-tools \
tcpdump \
iptables \
glog \
double-conversion \
libconfig \
libevent \
boost-system \
gdb \
valgrind \
&& yum clean all -y \
&& rm -rf /var/cache/yum
# Copying executable and generated libraries
WORKDIR /openair-spgwu-tiny/bin
COPY --from=oai-spgwu-tiny-builder /openair-spgwu-tiny/build/spgw_u/build/spgwu oai_spgwu
# Copying template configuration files
# The configuration folder will be flat
WORKDIR /openair-spgwu-tiny/etc
COPY --from=oai-spgwu-tiny-builder /openair-spgwu-tiny/etc/spgw_u.conf .
WORKDIR /openair-spgwu-tiny
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (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.openairinterface.org/?page_id=698
# *
# * 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.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
#---------------------------------------------------------------------
#
# Dockerfile for the Open-Air-Interface SPGW-U-TINY service
# Valid for RHEL8.2 in the OpenShift context (v4.4)
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
FROM registry.access.redhat.com/ubi8/ubi:latest as oai-spgwu-tiny-builder
# Entitlements and RHSM configurations are Open-Shift Secret and ConfigMaps
# It is pre-requisite
RUN rm -Rf /etc/rhsm/ca /etc/pki/entitlement
# Copy the entitlements
COPY ./etc-pki-entitlement /etc/pki/entitlement
# Copy the subscription manager configurations
COPY ./rhsm-conf /etc/rhsm
COPY ./rhsm-ca /etc/rhsm/ca
RUN rm /etc/rhsm-host && \
# Initialize /etc/yum.repos.d/redhat.repo
# See https://access.redhat.com/solutions/1443553
yum repolist --disablerepo=* && \
subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms && \
yum update -y && \
yum -y install --enablerepo="codeready-builder-for-rhel-8-x86_64-rpms" \
# diff, cmp and file are not in the ubi???
diffutils \
file \
psmisc \
git
# Copy the workspace as is
WORKDIR /openair-spgwu-tiny
COPY . /openair-spgwu-tiny
# Installing and Building SPGW-U-TINY
WORKDIR /openair-spgwu-tiny/build/scripts
RUN ./build_spgwu --install-deps --force
RUN ./build_spgwu --clean --build-type Release --jobs --Verbose
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
FROM registry.access.redhat.com/ubi8/ubi:latest as oai-spgwu-tiny
# We install some debug tools for the moment in addition of mandatory libraries
RUN yum update -y && \
yum -y install --enablerepo="ubi-8-codeready-builder" \
psmisc \
net-tools \
iproute \
iptables \
initscripts \
libevent && \
yum clean all -y && \
rm -rf /var/cache/yum
# Copying executable and generated libraries
WORKDIR /openair-spgwu-tiny/bin
COPY --from=oai-spgwu-tiny-builder /openair-spgwu-tiny/build/spgw_u/build/spgwu oai_spgwu
COPY --from=oai-spgwu-tiny-builder /openair-spgwu-tiny/scripts/entrypoint.sh .
# Copying installed libraries from builder
COPY --from=oai-spgwu-tiny-builder /lib64/libgflags.so.2.1 /lib64/
COPY --from=oai-spgwu-tiny-builder /lib64/libglog.so.0 /lib64/
COPY --from=oai-spgwu-tiny-builder /lib64/libdouble-conversion.so.1 /lib64/
COPY --from=oai-spgwu-tiny-builder /lib64/libconfig++.so.9 /lib64/
COPY --from=oai-spgwu-tiny-builder /lib64/libboost_system.so.1.66.0 /lib64/
RUN ldconfig
# Copying template configuration files
# The configuration folder will be flat
WORKDIR /openair-spgwu-tiny/etc
COPY --from=oai-spgwu-tiny-builder /openair-spgwu-tiny/etc/spgw_u.conf .
WORKDIR /openair-spgwu-tiny
# expose ports
EXPOSE 2152/udp 8805/udp
CMD ["/openair-spgwu-tiny/bin/oai_spgwu", "-c", "/openair-spgwu-tiny/etc/spgw_u.conf", "-o"]
ENTRYPOINT ["/openair-spgwu-tiny/bin/entrypoint.sh"]
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (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.openairinterface.org/?page_id=698
# *
# * 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.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
#---------------------------------------------------------------------
#
# Dockerfile for the Open-Air-Interface SPGW-U-TINY service
# Valid for Ubuntu-18.04 (bionic)
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
FROM ubuntu:bionic as oai-spgwu-tiny-builder
ARG EURECOM_PROXY
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && DEBIAN_FRONTEND=noninteractive apt-get install --yes \
psmisc \
git
# Some GIT configuration command quite useful
RUN /bin/bash -c "if [[ -v EURECOM_PROXY ]]; then git config --global http.proxy $EURECOM_PROXY; fi"
RUN git config --global https.postBuffer 123289600
RUN git config --global http.sslverify false
# Copy the workspace as is
WORKDIR /openair-spgwu-tiny
COPY . /openair-spgwu-tiny
# Installing and Building SPGW-U-TINY
WORKDIR /openair-spgwu-tiny/build/scripts
RUN ./build_spgwu --install-deps --force
RUN ./build_spgwu --clean --build-type Release --jobs --Verbose
# Getting SHA-ONE for support
WORKDIR /openair-spgwu-tiny
RUN git log -n1 > version.txt
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
FROM ubuntu:bionic as oai-spgwu-tiny
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# We install some debug tools for the moment in addition of mandatory libraries
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && DEBIAN_FRONTEND=noninteractive apt-get install --yes \
psmisc \
net-tools \
iproute2 \
iptables \
tshark \
libgoogle-glog0v5 \
libdouble-conversion1 \
libconfig++9v5 \
libboost-system1.65.1 \
&& rm -rf /var/lib/apt/lists/*
# Copying executable and generated libraries
WORKDIR /openair-spgwu-tiny/bin
COPY --from=oai-spgwu-tiny-builder /openair-spgwu-tiny/build/spgw_u/build/spgwu oai_spgwu
COPY --from=oai-spgwu-tiny-builder /openair-spgwu-tiny/scripts/entrypoint.sh .
# Copying template configuration files
# The configuration folder will be flat
WORKDIR /openair-spgwu-tiny/etc
COPY --from=oai-spgwu-tiny-builder /openair-spgwu-tiny/etc/spgw_u.conf .
WORKDIR /openair-spgwu-tiny
COPY --from=oai-spgwu-tiny-builder /openair-spgwu-tiny/version.txt .
# expose ports
EXPOSE 2152/udp 8805/udp
CMD ["/openair-spgwu-tiny/bin/oai_spgwu", "-c", "/openair-spgwu-tiny/etc/spgw_u.conf", "-o"]
ENTRYPOINT ["/openair-spgwu-tiny/bin/entrypoint.sh"]
......@@ -20,7 +20,7 @@
################################################################################
SPGW-U =
{
INSTANCE = @INSTANCE@; # 0 is the default
INSTANCE = 0; # 0 is the default
PID_DIRECTORY = "@PID_DIRECTORY@"; # /var/run is the default
#ITTI_TASKS :
......@@ -82,7 +82,7 @@ SPGW-U =
SGI :
{
# No config to set, the software will set the SGi interface to the interface used for the default route.
INTERFACE_NAME = "@SGW_INTERFACE_NAME_FOR_SGI@"; # STRING, interface name or "default_gateway"
INTERFACE_NAME = "@PGW_INTERFACE_NAME_FOR_SGI@"; # STRING, interface name or "default_gateway"
IPV4_ADDRESS = "read"; # STRING, CIDR or "read" to let app read interface configured IP address
#SCHED_PARAMS :
#{
......@@ -94,11 +94,7 @@ SPGW-U =
};
PDN_NETWORK_LIST = (
{NETWORK_IPV4 = "12.1.1.0/24"; NETWORK_IPV6 = "2001:1:2::0/64"; SNAT = "yes";},
{NETWORK_IPV4 = "12.1.2.0/24"; SNAT = "no";},
{NETWORK_IPV4 = "192.169.0.0/24"; SNAT = "no";},
{NETWORK_IPV4 = "192.170.0.0/24"; SNAT = "no";},
{NETWORK_IPV4 = "192.171.0.0/24"; SNAT = "no";}
{NETWORK_IPV4 = "@NETWORK_UE_IP@"; SNAT = "no";}
);
SPGW-C_LIST = (
......
# Build and deploying OAI-SPGW-C in OpenShift cluster #
## Pre-requisite ##
On a `RHEL8` physical machine (or a virtual machine) connected to the OpenShift Cluster, recover the entitlement and the RH subscription manager configs:
```bash
oc create configmap rhsm-conf --from-file /etc/rhsm/rhsm.conf
oc create configmap rhsm-ca --from-file /etc/rhsm/ca/redhat-uep.pem
oc create secret generic etc-pki-entitlement --from-file /etc/pki/entitlement/{NUMBER_ON_YOUR_COMPUTER}.pem --from-file /etc/pki/entitlement/{NUMBER_ON_YOUR_COMPUTER}-key.pem
```
These configmaps and secret will be shared by all the build configs in your OC project. No need to do it each time.
## Launching the Build ##
On a machine connected to the OpenShift Cluster, create the target image stream and the build configuration.
Note that the project name is currently hard-coded to `oai-cn`.
**TODO: pass as env variables: branch name, image tag and project name**
```bash
git clone https://github.com/OPENAIRINTERFACE/openair-spgwu-tiny.git
cd openair-spgwu-tiny
git checkout dockerfile-improvements-2020-08
oc apply -f openshift/oai-spgwu-tiny-image-stream.yml
oc apply -f openshift/oai-spgwu-tiny-build-config.yml
```
Note that this step has to be done once before the first build and if you modify the yaml files.
Then anytime you want to build:
```bash
oc start-build oai-spgwu-tiny-build-config --follow
```
The `--follow` might break.
```bash
oc logs build/oai-spgwu-tiny-build-config-XYZ --follow
```
where `XYZ` is the build number.
You should see a successful buid when :
```bash
...
Pushing image image-registry.openshift-image-registry.svc:5000/oai-cn/oai-spgwu-tiny:onap-test ...
Getting image source signatures
Copying blob sha256:087e0da17c56af1aaf0a1eba37169b46f6c46936b554b7e13f11165dac4ba8ef
...
Copying blob sha256:0adcf0e0c86fbba84ed7a22a57a2cd4d7695c1ce858dd03f03dc3002880b8061
Copying config sha256:73330dfa1a733335355324848a02ba1899f9d125559979f9911f3dedcd4450ca
Writing manifest to image destination
Storing signatures
Successfully pushed image-registry.openshift-image-registry.svc:5000/oai-cn/oai-spgwu-tiny@sha256:c1de087af5515d22e40486fb181f6ff65a7f34788d8174aa122d686667042cf9
Push successful
```
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (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.openairinterface.org/?page_id=698
# *
# * 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.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
#---------------------------------------------------------------------
#
kind: BuildConfig
apiVersion: build.openshift.io/v1
metadata:
name: "oai-spgwu-tiny-build-config"
spec:
runPolicy: "Serial"
source:
git:
uri: "https://github.com/OPENAIRINTERFACE/openair-spgwu-tiny.git"
ref: "helm3.1-onap-sync-with-cn-split-repos"
httpProxy: http://proxy.eurecom.fr:8080
httpsProxy: https://proxy.eurecom.fr:8080
secrets:
- secret:
name: etc-pki-entitlement
destinationDir: etc-pki-entitlement
configMaps:
- configMap:
name: rhsm-conf
destinationDir: rhsm-conf
- configMap:
name: rhsm-ca
destinationDir: rhsm-ca
strategy:
dockerStrategy:
dockerfilePath: "docker/Dockerfile.rhel8-2.oc4-4"
output:
to:
kind: "ImageStreamTag"
name: "oai-spgwu-tiny:onap-0.1.0"
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (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.openairinterface.org/?page_id=698
# *
# * 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.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
#
apiVersion: v1
kind: ImageStream
metadata:
name: oai-spgwu-tiny
namespace: oai
status:
tag: onap-0.1.0
#!/bin/bash
set -euo pipefail
CONFIG_DIR="/openair-spgwu-tiny/etc"
for c in ${CONFIG_DIR}/*.conf; do
# grep variable names (format: ${VAR}) from template to be rendered
VARS=$(grep -oP '@[a-zA-Z0-9_]+@' ${c} | sort | uniq | xargs)
# create sed expressions for substituting each occurrence of ${VAR}
# with the value of the environment variable "VAR"
EXPRESSIONS=""
for v in ${VARS}; do
NEW_VAR=`echo $v | sed -e "s#@##g"`
if [[ "${!NEW_VAR}x" == "x" ]]; then
echo "Error: Environment variable '${NEW_VAR}' is not set." \
"Config file '$(basename $c)' requires all of $VARS."
exit 1
fi
EXPRESSIONS="${EXPRESSIONS};s|${v}|${!NEW_VAR}|g"
done
EXPRESSIONS="${EXPRESSIONS#';'}"
# render template and inline replace config file
sed -i "${EXPRESSIONS}" ${c}
done
exec "$@"
......@@ -127,7 +127,8 @@ if (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
endif()
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
add_boolean_option(LOG_OAI True "Thread safe logging API")
SET(ASAN asan)
# Set it manually if needed: SET(ASAN asan)
SET(ASAN)
endif()
if (CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE "MinSizeRel")
......@@ -155,21 +156,14 @@ set(CMAKE_C_FLAGS
add_definitions(-DCMAKER)
add_definitions(-DBSTRLIB_CAN_USE_STL=1 -DBSTRLIB_CAN_USE_IOSTREAM=1 -DBSTRLIB_THROWS_EXCEPTIONS=1)
if(STATIC_LINKING)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -fstack-protector-all -DMALLOC_CHECK_=3 -DINFO_IS_ON=1 -DDEBUG_IS_ON=1 -DTRACE_IS_ON=1 -O0 -fno-omit-frame-pointer")
else (STATIC_LINKING)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -fstack-protector-all -DMALLOC_CHECK_=3 -DINFO_IS_ON=1 -DDEBUG_IS_ON=1 -DTRACE_IS_ON=1 -O0 -fsanitize=address -fno-omit-frame-pointer")
endif(STATIC_LINKING)
# CMAKE_C_FLAGS_DEBUG: -fsanitize=address not compatible with valgrind
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -fstack-protector-all -DMALLOC_CHECK_=3 -DINFO_IS_ON=1 -DDEBUG_IS_ON=1 -DTRACE_IS_ON=1 -O0 -fno-omit-frame-pointer")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O2 -fno-omit-frame-pointer -s -DINFO_IS_ON=1")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g -O1 -DINFO_IS_ON=1 ")
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS} -Os -s")
if(STATIC_LINKING)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -std=c++17 -g -fstack-protector-all -DMALLOC_CHECK_=3 -DINFO_IS_ON=1 -DDEBUG_IS_ON=1 -DTRACE_IS_ON=1 -O0 -fno-omit-frame-pointer")
else(STATIC_LINKING)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -std=c++17 -g -fstack-protector-all -DMALLOC_CHECK_=3 -DINFO_IS_ON=1 -DDEBUG_IS_ON=1 -DTRACE_IS_ON=1 -O0 -fsanitize=address -fno-omit-frame-pointer")
endif(STATIC_LINKING)
# CMAKE_CXX_FLAGS_DEBUG: -fsanitize=address not compatible with valgrind
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -std=c++17 -g -fstack-protector-all -DMALLOC_CHECK_=3 -DINFO_IS_ON=1 -DDEBUG_IS_ON=1 -DTRACE_IS_ON=1 -O0 -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -std=c++17 -O2 -fno-omit-frame-pointer -s -DINFO_IS_ON=1")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} -std=c++17 -g -O1 -DINFO_IS_ON=1")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS} -std=c++17 -Os -s")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment