Commit 16e3b213 authored by Raphael Defosseux's avatar Raphael Defosseux

CI: Adding building of the test images and deploy without testing

Signed-off-by: default avatarRaphael Defosseux <raphael.defosseux@openairinterface.org>
parent bc90efdb
#/*
# * 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 SMF service
# Valid for Ubuntu-18.04 (bionic)
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
FROM ubuntu:bionic as oai-smf-builder
ARG EURECOM_PROXY
ARG GITLAB_USERNAME
ARG GITLAB_PASSWORD
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://$GITLAB_USERNAME:$GITLAB_PASSWORD@gitlab.eurecom.fr/oai/oai-cn5g-smf.git -b $CI_SRC_BRANCH /openair-smf; else git clone https://$GITLAB_USERNAME:$GITLAB_PASSWORD@gitlab.eurecom.fr/oai/oai-cn5g-smf.git -b develop /openair-smf; fi"
# For CI, especially for Pull/Merge Requests, we build out of temp merge
WORKDIR /openair-smf
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 SMF
WORKDIR /openair-smf/build/scripts
RUN ./build_smf --install-deps --force
WORKDIR /openair-smf/src/test/amf_client
RUN mkdir build && cd build && cmake .. && make
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
FROM ubuntu:bionic as test-amf-client
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 \
libcurl4-gnutls-dev \
&& rm -rf /var/lib/apt/lists/*
# Copying executable and generated libraries
WORKDIR /test-amf-client/bin
COPY --from=oai-smf-builder /openair-smf/src/test/amf_client/build/amf-client .
COPY --from=oai-smf-builder /usr/local/lib/libpistache.so /usr/local/lib/
RUN ldconfig
WORKDIR /test-amf-client
#/*
# * 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 SMF service
# Valid for Ubuntu-18.04 (bionic)
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
FROM ubuntu:bionic as oai-smf-builder
ARG EURECOM_PROXY
ARG GITLAB_USERNAME
ARG GITLAB_PASSWORD
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://$GITLAB_USERNAME:$GITLAB_PASSWORD@gitlab.eurecom.fr/oai/oai-cn5g-smf.git -b $CI_SRC_BRANCH /openair-smf; else git clone https://$GITLAB_USERNAME:$GITLAB_PASSWORD@gitlab.eurecom.fr/oai/oai-cn5g-smf.git -b develop /openair-smf; fi"
# For CI, especially for Pull/Merge Requests, we build out of temp merge
WORKDIR /openair-smf
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 SMF
WORKDIR /openair-smf/build/scripts
RUN ./build_smf --install-deps --force
WORKDIR /openair-smf/src/test/amf
RUN mkdir build && cd build && cmake .. && make
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
FROM ubuntu:bionic as test-amf-server
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 \
&& rm -rf /var/lib/apt/lists/*
# Copying executable and generated libraries
WORKDIR /test-amf-server/bin
COPY --from=oai-smf-builder /openair-smf/src/test/amf/build/amf-server .
COPY --from=oai-smf-builder /usr/local/lib/libpistache.so /usr/local/lib/
RUN ldconfig
WORKDIR /test-amf-server
......@@ -62,7 +62,7 @@ RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git merge --ff origin/$CI_DEST_
# Installing and Building SMF
WORKDIR /openair-smf/build/scripts
RUN ./build_smf --install-deps --force
RUN ./build_smf --clean --Verbose --build-type Release --jobs
RUN ./build_smf --clean --Verbose --build-type Debug --jobs
#---------------------------------------------------------------------
# TARGET IMAGE
......
#/*
# * 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 SMF service
# Valid for Ubuntu-18.04 (bionic)
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
FROM ubuntu:bionic as oai-smf-builder
ARG EURECOM_PROXY
ARG GITLAB_USERNAME
ARG GITLAB_PASSWORD
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://$GITLAB_USERNAME:$GITLAB_PASSWORD@gitlab.eurecom.fr/oai/oai-cn5g-smf.git -b $CI_SRC_BRANCH /openair-smf; else git clone https://$GITLAB_USERNAME:$GITLAB_PASSWORD@gitlab.eurecom.fr/oai/oai-cn5g-smf.git -b develop /openair-smf; fi"
# For CI, especially for Pull/Merge Requests, we build out of temp merge
WORKDIR /openair-smf
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 SMF
WORKDIR /openair-smf/build/scripts
RUN ./build_smf --install-deps --force
WORKDIR /openair-smf/src/test/udm
RUN mkdir build && cd build && cmake .. && make
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
FROM ubuntu:bionic as test-udm-server
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 \
&& rm -rf /var/lib/apt/lists/*
# Copying executable and generated libraries
WORKDIR /test-udm-server/bin
COPY --from=oai-smf-builder /openair-smf/src/test/udm/build/udm-server .
COPY --from=oai-smf-builder /usr/local/lib/libpistache.so /usr/local/lib/
RUN ldconfig
WORKDIR /test-udm-server
......@@ -48,7 +48,10 @@ pipeline {
gitlabBuilds(builds: [
"Build SMF Image",
"Static Code Analysis",
"Code Formatting Checker"
"Code Formatting Checker",
"Build AMF-server",
"Build UMD-server",
"Build AMF-client"
])
}
......@@ -240,10 +243,178 @@ pipeline {
}
}
}
stage('Build Test Images') {
stages {
stage('Build Test AMF-server') {
steps {
script {
gitlabCommitStatus(name: "Build AMF-server") {
withCredentials([
[$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.PrivateGitLabRepository_Credentials}", usernameVariable: 'git_username', passwordVariable: 'git_password']
]) {
if ("MERGE".equals(env.gitlabActionType)) {
myShCmd('docker build --target test-amf-server --tag test-amf-server:test-deploy --file ci-scripts/Dockerfile.private.amf-server.ubuntu18.04 --build-arg EURECOM_PROXY="http://proxy.eurecom.fr:8080" --build-arg GITLAB_USERNAME="' + git_username + '" --build-arg GITLAB_PASSWORD="' + git_password + '" --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/amf_server_docker_image_build.log 2>&1', new_host_flag, new_host_user, new_host)
} else {
myShCmd('docker build --target test-amf-server --tag test-amf-server:test-deploy --file ci-scripts/Dockerfile.private.amf-server.ubuntu18.04 --build-arg EURECOM_PROXY="http://proxy.eurecom.fr:8080" --build-arg GITLAB_USERNAME="' + git_username + '" --build-arg GITLAB_PASSWORD="' + git_password + '" --build-arg CI_SRC_BRANCH="develop" . > archives/amf_server_docker_image_build.log 2>&1', new_host_flag, new_host_user, new_host)
}
}
myShCmd('docker image ls >> archives/amf_server_docker_image_build.log', new_host_flag, new_host_user, new_host)
}
}
}
post {
always {
script {
copyFrom2ndServer('archives/amf_server_docker_image_build.log', 'archives', new_host_flag, new_host_user, new_host)
}
}
success {
sh "echo 'TEST-AMF-SERVER DOCKER IMAGE BUILD: OK' >> archives/amf_server_docker_image_build.log"
}
unsuccessful {
sh "echo 'TEST-AMF-SERVER DOCKER IMAGE BUILD: KO' >> archives/amf_server_docker_image_build.log"
}
}
}
stage('Build Test UMD-server') {
steps {
script {
gitlabCommitStatus(name: "Build UMD-server") {
withCredentials([
[$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.PrivateGitLabRepository_Credentials}", usernameVariable: 'git_username', passwordVariable: 'git_password']
]) {
if ("MERGE".equals(env.gitlabActionType)) {
myShCmd('docker build --target test-umd-server --tag test-umd-server:test-deploy --file ci-scripts/Dockerfile.private.umd-server.ubuntu18.04 --build-arg EURECOM_PROXY="http://proxy.eurecom.fr:8080" --build-arg GITLAB_USERNAME="' + git_username + '" --build-arg GITLAB_PASSWORD="' + git_password + '" --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/umd_server_docker_image_build.log 2>&1', new_host_flag, new_host_user, new_host)
} else {
myShCmd('docker build --target test-umd-server --tag test-umd-server:test-deploy --file ci-scripts/Dockerfile.private.umd-server.ubuntu18.04 --build-arg EURECOM_PROXY="http://proxy.eurecom.fr:8080" --build-arg GITLAB_USERNAME="' + git_username + '" --build-arg GITLAB_PASSWORD="' + git_password + '" --build-arg CI_SRC_BRANCH="develop" . > archives/umd_server_docker_image_build.log 2>&1', new_host_flag, new_host_user, new_host)
}
}
myShCmd('docker image ls >> archives/umd_server_docker_image_build.log', new_host_flag, new_host_user, new_host)
}
}
}
post {
always {
script {
copyFrom2ndServer('archives/umd_server_docker_image_build.log', 'archives', new_host_flag, new_host_user, new_host)
}
}
success {
sh "echo 'TEST-UMD-SERVER DOCKER IMAGE BUILD: OK' >> archives/umd_server_docker_image_build.log"
}
unsuccessful {
sh "echo 'TEST-UMD-SERVER DOCKER IMAGE BUILD: KO' >> archives/umd_server_docker_image_build.log"
}
}
}
stage('Build Test AMF-client') {
steps {
script {
gitlabCommitStatus(name: "Build AMF-client") {
withCredentials([
[$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.PrivateGitLabRepository_Credentials}", usernameVariable: 'git_username', passwordVariable: 'git_password']
]) {
if ("MERGE".equals(env.gitlabActionType)) {
myShCmd('docker build --target test-amf-client --tag test-amf-client:test-deploy --file ci-scripts/Dockerfile.private.amf-client.ubuntu18.04 --build-arg EURECOM_PROXY="http://proxy.eurecom.fr:8080" --build-arg GITLAB_USERNAME="' + git_username + '" --build-arg GITLAB_PASSWORD="' + git_password + '" --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/amf_client_docker_image_build.log 2>&1', new_host_flag, new_host_user, new_host)
} else {
myShCmd('docker build --target test-amf-client --tag test-amf-client:test-deploy --file ci-scripts/Dockerfile.private.amf-client.ubuntu18.04 --build-arg EURECOM_PROXY="http://proxy.eurecom.fr:8080" --build-arg GITLAB_USERNAME="' + git_username + '" --build-arg GITLAB_PASSWORD="' + git_password + '" --build-arg CI_SRC_BRANCH="develop" . > archives/amf_client_docker_image_build.log 2>&1', new_host_flag, new_host_user, new_host)
}
}
myShCmd('docker image ls >> archives/amf_client_docker_image_build.log', new_host_flag, new_host_user, new_host)
}
}
}
post {
always {
script {
copyFrom2ndServer('archives/amf_client_docker_image_build.log', 'archives', new_host_flag, new_host_user, new_host)
}
}
success {
sh "echo 'TEST-AMF-CLIENT DOCKER IMAGE BUILD: OK' >> archives/amf_client_docker_image_build.log"
}
unsuccessful {
sh "echo 'TEST-AMF-CLIENT DOCKER IMAGE BUILD: KO' >> archives/amf_client_docker_image_build.log"
}
}
}
}
}
stage('Deploy Simple Test') {
stages {
stage ('Create Networks') {
steps {
script {
myShCmd('docker network create --attachable --subnet 192.168.28.0/24 --ip-range 192.168.28.0/24 ci-sbi', new_host_flag, new_host_user, new_host)
myShCmd('docker network create --attachable --subnet 192.168.29.0/24 --ip-range 192.168.29.0/24 ci-n4', new_host_flag, new_host_user, new_host)
}
}
}
stage ('Deploy Containers') {
steps {
script {
if ("MERGE".equals(env.gitlabActionType)) {
myShCmd('docker run --name ci-oai-smf -d oai-smf:ci-temp /bin/bash -c "sleep infinity"', new_host_flag, new_host_user, new_host)
} else {
myShCmd('docker run --name ci-oai-smf -d oai-smf:develop /bin/bash -c "sleep infinity"', new_host_flag, new_host_user, new_host)
}
// SBI --> eth1
myShCmd('docker network connect ci-sbi ci-oai-smf', new_host_flag, new_host_user, new_host)
// N4 --> eth2
myShCmd('docker network connect ci-n4 ci-oai-smf', new_host_flag, new_host_user, new_host)
// Test containers
myShCmd('docker run --name ci-test-amf-server -d test-amf-server:test-deploy /bin/bash -c "sleep infinity"', new_host_flag, new_host_user, new_host)
myShCmd('docker network connect ci-sbi ci-test-amf-server', new_host_flag, new_host_user, new_host)
myShCmd('docker run --name ci-test-udm-server -d test-udm-server:test-deploy /bin/bash -c "sleep infinity"', new_host_flag, new_host_user, new_host)
myShCmd('docker network connect ci-sbi ci-test-udm-server', new_host_flag, new_host_user, new_host)
myShCmd('docker run --name ci-test-amf-client -d test-amf-client:test-deploy /bin/bash -c "sleep infinity"', new_host_flag, new_host_user, new_host)
myShCmd('docker network connect ci-sbi ci-test-amf-client', new_host_flag, new_host_user, new_host)
// SPGWU as UPF
myShCmd('docker run --name ci-oai-spgwu -d oai-spgwu-tiny:develop /bin/bash -c "sleep infinity"', new_host_flag, new_host_user, new_host)
// N4 --> eth1
myShCmd('docker network connect ci-n4 ci-oai-spgwu', new_host_flag, new_host_user, new_host)
}
}
}
stage ('Test') {
steps {
script {
sh "sleep 30"
}
}
}
stage ('Undeploy Containers') {
steps {
script {
myShCmd('docker rm -f ci-oai-smf ci-test-amf-server ci-test-udm-server ci-test-amf-client ci-oai-spgwu', new_host_flag, new_host_user, new_host)
}
}
}
stage ('Delete Networks') {
steps {
script {
myShCmd('docker network rm ci-sbi ci-n4', new_host_flag, new_host_user, new_host)
}
}
}
}
}
}
post {
cleanup {
script {
// Deleting containers in case of errors
try {
} catch (Exception e) {
echo "We failed to remove any existing containers"
myShCmd('docker rm -f ci-oai-smf', new_host_flag, new_host_user, new_host)
}
// Deleting networks in case of errors
try {
myShCmd('docker network rm ci-sbi ci-n4', new_host_flag, new_host_user, new_host)
} catch (Exception e) {
echo "We failed to remove any existing networks"
}
// Removing temporary / intermediate images
try {
if ("MERGE".equals(env.gitlabActionType)) {
......@@ -252,6 +423,11 @@ pipeline {
} catch (Exception e) {
echo "We failed to delete the OAI-SMF temp image"
}
try {
myShCmd('docker image rm --force test-amf-server:test-deploy test-umd-server:test-deploy test-amf-client:test-deploy', new_host_flag, new_host_user, new_host)
} catch (Exception e) {
echo "We failed to delete the test temp images"
}
try {
myShCmd('docker image prune --force', new_host_flag, new_host_user, new_host)
} catch (Exception e) {
......
......@@ -66,12 +66,37 @@ static void setUpUnixSignals(std::vector<int> quitSignals) {
using namespace oai::amf::api;
int main() {
int main(int argc, char* argv[]) {
#ifdef __linux__
std::vector<int> sigs{SIGQUIT, SIGINT, SIGTERM, SIGHUP};
setUpUnixSignals(sigs);
#endif
Pistache::Address addr("172.16.1.102", Pistache::Port(80));
std::string amf_ip_address;
if ((argc != 1) && (argc != 3)) {
std::cout << "Error: Usage is " <<std::endl;
std::cout << " " << argv[0] << " [ -i www.xxx.yy.zz ]" <<std::endl;
return -1;
}
if (argc == 1) {
amf_ip_address.append(std::string("172.16.1.102"));
} else {
int opt = 0;
while ((opt = getopt(argc, argv, "i:")) != -1) {
switch(opt) {
case 'i':
amf_ip_address.append(optarg);
break;
default:
std::cout << "Error: Usage is " <<std::endl;
std::cout << " " << argv[0] << " [ -i www.xxx.yy.zz ]" <<std::endl;
return -1;
break;
}
}
}
Pistache::Address addr(amf_ip_address, Pistache::Port(80));
httpEndpoint = new Pistache::Http::Endpoint((addr));
auto router = std::make_shared<Pistache::Rest::Router>();
......
......@@ -67,7 +67,7 @@ unsigned char * format_string_as_hex(std::string str){
return datavalue;
}
void send_pdu_session_establishment_request()
void send_pdu_session_establishment_request(std::string smf_ip_address)
{
std::cout << "[AMF N11] PDU Session Establishment Request"<<std::endl;
......@@ -81,7 +81,9 @@ void send_pdu_session_establishment_request()
//Fill Json part
//get supi and put into URL
std::string supi_str;
std::string url = std::string("http://172.16.1.101/nsmf-pdusession/v2/sm-contexts");
std::string url = std::string("http://");
url.append(smf_ip_address);
url.append(std::string("/nsmf-pdusession/v2/sm-contexts"));
//Fill the json part
pdu_session_establishment_request["supi"] = "imsi-200000000000001";
......@@ -175,7 +177,7 @@ void send_pdu_session_establishment_request()
}
void send_pdu_session_update_sm_context_establishment()
void send_pdu_session_update_sm_context_establishment(std::string smf_ip_address)
{
std::cout << "[AMF N11] send_pdu_session_update_sm_context_establishment"<<std::endl;
......@@ -227,7 +229,9 @@ void send_pdu_session_update_sm_context_establishment()
std::string supi_str;
//std::string url = std::string("http://172.16.1.101/nsmf-pdusession/v2/sm-contexts");
//std::string url = std::string("http://172.16.1.101/nsmf-pdusession/v2/sm-contexts/imsi-200000000000001/modify");
std::string url = std::string("http://172.16.1.101/nsmf-pdusession/v2/sm-contexts/1/modify");
std::string url = std::string("http://");
url.append(smf_ip_address);
url.append(std::string("/nsmf-pdusession/v2/sm-contexts/1/modify"));
//Fill the json part
pdu_session_modification_request["n2SmInfoType"] = "PDU_RES_SETUP_RSP";
......@@ -309,7 +313,7 @@ void send_pdu_session_update_sm_context_establishment()
}
void send_pdu_session_update_sm_context_modification()
void send_pdu_session_update_sm_context_modification(std::string smf_ip_address)
{
std::cout << "[AMF N11] send_pdu_session_update_sm_context_modification"<<std::endl;
......@@ -348,7 +352,9 @@ void send_pdu_session_update_sm_context_modification()
std::string supi_str;
//std::string url = std::string("http://172.16.1.101/nsmf-pdusession/v2/sm-contexts");
//std::string url = std::string("http://172.16.1.101/nsmf-pdusession/v2/sm-contexts/imsi-200000000000001/modify");
std::string url = std::string("http://172.16.1.101/nsmf-pdusession/v2/sm-contexts/1/modify");
std::string url = std::string("http://");
url.append(smf_ip_address);
url.append(std::string("/nsmf-pdusession/v2/sm-contexts/1/modify"));
//Fill the json part
pdu_session_modification_request["n1SmMsg"]["contentId"] = "n1SmMsg"; //part 2
......@@ -431,11 +437,36 @@ void send_pdu_session_update_sm_context_modification()
int main(int argc, char* argv[])
{
std::string smf_ip_address;
send_pdu_session_establishment_request();
if ((argc != 1) && (argc != 3)) {
std::cout << "Error: Usage is " <<std::endl;
std::cout << " " << argv[0] << " [ -i www.xxx.yy.zz ]" <<std::endl;
return -1;
}
if (argc == 1) {
smf_ip_address.append(std::string("172.16.1.101"));
} else {
int opt = 0;
while ((opt = getopt(argc, argv, "i:")) != -1) {
switch(opt) {
case 'i':
smf_ip_address.append(optarg);
break;
default:
std::cout << "Error: Usage is " <<std::endl;
std::cout << " " << argv[0] << " [ -i www.xxx.yy.zz ]" <<std::endl;
return -1;
break;
}
}
}
send_pdu_session_establishment_request(smf_ip_address);
usleep(100000);
send_pdu_session_update_sm_context_establishment();
//send_pdu_session_update_sm_context_modification();
send_pdu_session_update_sm_context_establishment(smf_ip_address);
//send_pdu_session_update_sm_context_modification(smf_ip_address);
return 0;
}
......@@ -77,12 +77,37 @@ static void setUpUnixSignals(std::vector<int> quitSignals) {
using namespace oai::udm::api;
int main() {
int main(int argc, char* argv[]) {
#ifdef __linux__
std::vector<int> sigs{SIGQUIT, SIGINT, SIGTERM, SIGHUP};
setUpUnixSignals(sigs);
#endif
Pistache::Address addr("172.16.1.103", Pistache::Port(80));
std::string udm_ip_address;
if ((argc != 1) && (argc != 3)) {
std::cout << "Error: Usage is " <<std::endl;
std::cout << " " << argv[0] << " [ -i www.xxx.yy.zz ]" <<std::endl;
return -1;
}
if (argc == 1) {
udm_ip_address.append(std::string("172.16.1.103"));
} else {
int opt = 0;
while ((opt = getopt(argc, argv, "i:")) != -1) {
switch(opt) {
case 'i':
udm_ip_address.append(optarg);
break;
default:
std::cout << "Error: Usage is " <<std::endl;
std::cout << " " << argv[0] << " [ -i www.xxx.yy.zz ]" <<std::endl;
return -1;
break;
}
}
}
Pistache::Address addr(udm_ip_address, Pistache::Port(80));
httpEndpoint = new Pistache::Http::Endpoint((addr));
auto router = std::make_shared<Pistache::Rest::Router>();
......
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