Compare commits

..

20 Commits

Author SHA1 Message Date
7287471c93 test 2024-03-26 14:46:57 +01:00
08e1fb839a use the new dockerfile 2024-03-26 14:45:49 +01:00
8f3f20cfa3 make docker use the cache 2024-03-26 14:42:26 +01:00
cf8cd37685 debug: add more print 2024-03-25 16:30:05 +01:00
f2e465c33e add missing";" 2024-03-25 15:44:12 +01:00
178ec65486 debug: add print 2024-03-25 15:39:17 +01:00
a09d784d52 debug 2024-03-22 16:28:29 +01:00
45fa45ee2c debug: still prototyping 2024-03-22 16:17:21 +01:00
887f0d180a add missing ";" 2024-03-22 15:56:23 +01:00
93d45e3c58 Add more verbosity 2024-03-22 15:11:06 +01:00
a34e83b524 debug: trying to figure out why sub req is not beeing spamed 2024-03-22 15:09:33 +01:00
290e030071 forece x-app to send sub. req. indefinitly 2024-03-22 12:53:46 +01:00
Andrea Lacava
e3161c1f4c
Fix delivery of indication message - merge pull request #11 from JaykobJ/ns-o-ran
xapp-sm-connector now sends entire indication message to the connected xApp. Previously only first Byte of the message was sent.

Thanks @JaykobJ
2023-12-01 11:32:54 -05:00
JaykobJ
54fee7c1d0
Update setup/xapp-sm-connector/src/agent_connector.cc
Co-authored-by: Andrea Lacava <thecave003@gmail.com>
2023-12-01 08:50:22 +02:00
Andrea Lacava
4f46bbf4b1
Merge pull request #8 from wineslab/e2term_crash
Remove of RIC_INTERFACE lines in ns-O-RAN copy
2023-11-30 19:37:18 -05:00
JaykobJ
b65e2a4a1f Fix delivery of indication message
xApp can now receive entire indication message.
2023-11-30 10:46:49 +00:00
Andrea Lacava
edf7fe9e8d Remove of RIC_INTERFACE lines that may be the cause of unexpected crash in e2term 2023-01-09 20:07:57 +01:00
Andrea Lacava
b2c654518e Update of Dockerfile to build ns-o-ran and to rebuild e2interface 2022-11-02 01:13:25 +01:00
Andrea Lacava
0849c7769a better launch of the x-app
add setup-e2term.sh
2022-11-02 00:39:52 +01:00
Thecave3
e58988f8b9 add ns-o-ran files
new file:   Dockerfile
	new file:   build-ns-o-ran.sh
	new file:   setup-scripts/import-wines-images.sh
	new file:   setup-scripts/setup-ric-bronze.sh
	new file:   setup-scripts/start-xapp-ns-o-ran.sh
	modified:   setup-scripts/start-xapp.sh
	modified:   setup/xapp-sm-connector/src/xapp.cc
	modified:   setup/xapp-sm-connector/src/xapp.hpp
2022-11-01 18:13:33 +01:00
16 changed files with 580 additions and 20 deletions

58
Dockerfile Normal file
View File

@ -0,0 +1,58 @@
#==================================================================================
# Copyright (c) 2022 Northeastern University
#
# 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.
#==================================================================================
FROM wineslab/o-ran-sc-bldr-ubuntu18-c-go:9-u18.04 as buildenv
ARG log_level_e2sim=2
# log_level_e2sim = 0 -> LOG_LEVEL_UNCOND 0
# log_level_e2sim = 1 -> LOG_LEVEL_ERROR 1
# log_level_e2sim = 2 -> LOG_LEVEL_INFO 2
# log_level_e2sim = 3 -> LOG_LEVEL_DEBUG 3
# Install E2sim
RUN mkdir -p /workspace
RUN apt-get update && apt-get install -y build-essential git cmake libsctp-dev autoconf automake libtool bison flex libboost-all-dev
WORKDIR /workspace
RUN git clone -b develop https://github.com/wineslab/ns-o-ran-e2-sim /workspace/e2sim
RUN mkdir /workspace/e2sim/e2sim/build
WORKDIR /workspace/e2sim/e2sim/build
RUN cmake .. -DDEV_PKG=1 -DLOG_LEVEL=${log_level_e2sim}
RUN make package
RUN echo "Going to install e2sim-dev"
RUN dpkg --install ./e2sim-dev_1.0.0_amd64.deb
RUN ldconfig
WORKDIR /workspace
# Install ns-3
RUN apt-get install -y g++ python3 qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools
RUN git clone -b release https://github.com/wineslab/ns-o-ran-ns3-mmwave /workspace/ns3-mmwave-oran
RUN git clone -b master https://github.com/o-ran-sc/sim-ns3-o-ran-e2 /workspace/ns3-mmwave-oran/contrib/oran-interface
WORKDIR /workspace/ns3-mmwave-oran
RUN ./waf configure --enable-tests --enable-examples
RUN ./waf build
WORKDIR /workspace
CMD [ "/bin/sh" ]

22
build-ns-o-ran.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/sh
# Script to import the base images to create the RIC containers from Wineslab Docker Hub
# This shall execute first wineslab images and ns-o-ran after
# import-wines-images.sh
# setup-ric-bronze.sh
# Build image for ns-o-ran
$SUDO docker build -t ns-o-ran -f Dockerfile .
remove_container() {
$SUDO docker inspect $1 >/dev/null 2>&1
if [ $? -eq 0 ]; then
$SUDO docker kill $1
$SUDO docker rm $1
fi
}
remove_container ns-o-ran
$SUDO docker run -d -it --network=ric --name ns-o-ran ns-o-ran

View File

@ -0,0 +1,18 @@
#!/bin/sh
# Script to import the base images to create the RIC containers from Wineslab Docker Hub
# Pull Wines base images
docker pull wineslab/o-ran-sc-bldr-ubuntu18-c-go:9-u18.04
docker pull wineslab/o-ran-sc-bldr-alpine3-go:6-a3.11-rmr3
# Pull Wines RIC images
docker pull wineslab/colo-ran-e2term:bronze
docker pull wineslab/colo-ran-e2mgr:bronze
docker pull wineslab/colo-ran-e2rtmansim:bronze
docker pull wineslab/colo-ran-dbaas:bronze
# Tag images to be used with the setup-ric script
docker tag wineslab/colo-ran-e2term:bronze e2term:bronze
docker tag wineslab/colo-ran-e2mgr:bronze e2mgr:bronze
docker tag wineslab/colo-ran-e2rtmansim:bronze e2rtmansim:bronze
docker tag wineslab/colo-ran-dbaas:bronze dbaas:bronze

103
setup-scripts/setup-e2term.sh Executable file
View File

@ -0,0 +1,103 @@
#!/bin/sh
# Script to setup the E2 termination.
set -x
export SRC=`dirname $0`
. $SRC/setup-lib.sh
OURDIR=../setup
cd $OURDIR
tagvers=`git log --pretty=format:"%h" -n 1`
docker kill e2term
docker rm e2term
docker rmi e2term:bronze
# build e2term
$SUDO docker image inspect e2term:bronze >/dev/null 2>&1
if [ ! $? -eq 0 ]; then
cd e2/RIC-E2-TERMINATION
$SUDO docker image inspect e2term:$tagvers >/dev/null 2>&1
if [ ! $? -eq 0 ]; then
$SUDO docker build -f Dockerfile -t e2term:$tagvers .
fi
$SUDO docker tag e2term:$tagvers e2term:bronze
$SUDO docker rmi e2term:$tagvers
cd ../..
fi
# remove dangling images
docker rmi $(docker images --filter "dangling=true" -q --no-trunc) 2> /dev/null
# Create a route info file to tell the containers where to send various
# messages. This will be mounted on the containers
ROUTERFILE=`pwd`/router.txt
cat << EOF > $ROUTERFILE
newrt|start
rte|10020|$E2MGR_IP:3801
rte|10060|$E2TERM_IP:38000
rte|10061|$E2MGR_IP:3801
rte|10062|$E2MGR_IP:3801
rte|10070|$E2MGR_IP:3801
rte|10071|$E2MGR_IP:3801
rte|10080|$E2MGR_IP:3801
rte|10081|$E2TERM_IP:38000
rte|10082|$E2TERM_IP:38000
rte|10360|$E2TERM_IP:38000
rte|10361|$E2MGR_IP:3801
rte|10362|$E2MGR_IP:3801
rte|10370|$E2MGR_IP:3801
rte|10371|$E2TERM_IP:38000
rte|10372|$E2TERM_IP:38000
rte|1080|$E2MGR_IP:3801
rte|1090|$E2TERM_IP:38000
rte|1100|$E2MGR_IP:3801
rte|12010|$E2MGR_IP:38010
rte|1101|$E2TERM_IP:38000
rte|12002|$E2TERM_IP:38000
rte|12003|$E2TERM_IP:38000
rte|10091|$E2MGR_IP:4801
rte|10092|$E2MGR_IP:4801
rte|1101|$E2TERM_IP:38000
rte|1102|$E2MGR_IP:3801
rte|12001|$E2MGR_IP:3801
mse|12050|$(echo $XAPP_IP | cut -d "." -f 4)|$XAPP_IP:4560
newrt|end
EOF
remove_container() {
$SUDO docker inspect $1 >/dev/null 2>&1
if [ $? -eq 0 ]; then
$SUDO docker kill $1
$SUDO docker rm $1
fi
}
remove_container e2term
E2TERMCONFFILE=`pwd`/e2term_config.conf
if [ ! -e $E2TERMCONFFILE ]; then
cat <<EOF >$E2TERMCONFFILE
nano=38000
loglevel=debug
volume=log
#the key name of the environment holds the local ip address
#ip address of the E2T in the RMR
local-ip=$E2TERM_IP
#trace is start, stop
trace=start
external-fqdn=e2t.com
#put pointer to the key that point to pod name
pod_name=E2TERM_POD_NAME
sctp-port=$E2TERM_SCTP_PORT
EOF
fi
E2TERM_CONFIG_BIND="--mount type=bind,source=$E2TERMCONFFILE,destination=/opt/e2/config/config.conf,ro"
$SUDO docker run -d -it --network=ric --ip $E2TERM_IP --name e2term \
--mount type=bind,source=$ROUTERFILE,destination=/opt/e2/dockerRouter.txt,ro \
$E2TERM_CONFIG_BIND \
e2term:bronze
exit 0

180
setup-scripts/setup-ric-bronze.sh Executable file
View File

@ -0,0 +1,180 @@
#!/bin/sh
# Script to setup the RIC containers. Call as ./setup-ric.sh [network interface]
set -x
# get flags
for ARGUMENT in "$@"
do
KEY=$(echo $ARGUMENT | cut -f1 -d=)
case "$KEY" in
arena) arena=true;;
import) import=true;;
*)
esac
done
export SRC=`dirname $0`
. $SRC/setup-lib.sh
OURDIR=../setup
# import base RIC images
if [ "$import" = true ] || [ $(docker image ls -q | wc -l) -eq "0" ]; then
echo "Importing base Docker images"
cd $SRC
./import-wines-images.sh
fi
cd $OURDIR
tagvers=`git log --pretty=format:"%h" -n 1`
# build e2term
$SUDO docker image inspect e2term:bronze >/dev/null 2>&1
if [ ! $? -eq 0 ]; then
cd e2/RIC-E2-TERMINATION
$SUDO docker image inspect e2term:$tagvers >/dev/null 2>&1
if [ ! $? -eq 0 ]; then
$SUDO docker build -f Dockerfile -t e2term:$tagvers .
fi
$SUDO docker tag e2term:$tagvers e2term:bronze
$SUDO docker rmi e2term:$tagvers
cd ../..
fi
# build e2mgr
$SUDO docker image inspect e2mgr:bronze >/dev/null 2>&1
if [ ! $? -eq 0 ]; then
cd e2mgr/E2Manager
$SUDO docker image inspect e2mgr:$tagvers >/dev/null 2>&1
if [ ! $? -eq 0 ]; then
$SUDO docker build -f Dockerfile -t e2mgr:$tagvers .
fi
$SUDO docker tag e2mgr:$tagvers e2mgr:bronze
$SUDO docker rmi e2mgr:$tagvers
cd ../..
fi
# build e2rtmansim
$SUDO docker image inspect e2rtmansim:bronze >/dev/null 2>&1
if [ ! $? -eq 0 ]; then
cd e2mgr/tools/RoutingManagerSimulator
$SUDO docker image inspect e2rtmansim:$tagvers >/dev/null 2>&1
if [ ! $? -eq 0 ]; then
$SUDO docker build -f Dockerfile -t e2rtmansim:$tagvers .
fi
$SUDO docker tag e2rtmansim:$tagvers e2rtmansim:bronze
$SUDO docker rmi e2rtmansim:$tagvers
cd ../../..
fi
# build dbaas
$SUDO docker image inspect dbaas:bronze >/dev/null 2>&1
if [ ! $? -eq 0 ]; then
cd dbaas
$SUDO docker build -f docker/Dockerfile.redis -t dbaas:bronze .
cd ..
fi
# remove dangling images
docker rmi $(docker images --filter "dangling=true" -q --no-trunc) 2> /dev/null
# create a private network for near-real-time RIC
$SUDO docker network inspect ric >/dev/null 2>&1
if [ ! $? -eq 0 ]; then
$SUDO brctl addbr brric
$SUDO docker network create --subnet=$RIC_SUBNET -d bridge --attachable -o com.docker.network.bridge.name=brric ric
fi
# Create a route info file to tell the containers where to send various
# messages. This will be mounted on the containers
ROUTERFILE=`pwd`/router.txt
cat << EOF > $ROUTERFILE
newrt|start
rte|10020|$E2MGR_IP:3801
rte|10060|$E2TERM_IP:38000
rte|10061|$E2MGR_IP:3801
rte|10062|$E2MGR_IP:3801
rte|10070|$E2MGR_IP:3801
rte|10071|$E2MGR_IP:3801
rte|10080|$E2MGR_IP:3801
rte|10081|$E2TERM_IP:38000
rte|10082|$E2TERM_IP:38000
rte|10360|$E2TERM_IP:38000
rte|10361|$E2MGR_IP:3801
rte|10362|$E2MGR_IP:3801
rte|10370|$E2MGR_IP:3801
rte|10371|$E2TERM_IP:38000
rte|10372|$E2TERM_IP:38000
rte|1080|$E2MGR_IP:3801
rte|1090|$E2TERM_IP:38000
rte|1100|$E2MGR_IP:3801
rte|12010|$E2MGR_IP:38010
rte|1101|$E2TERM_IP:38000
rte|12002|$E2TERM_IP:38000
rte|12003|$E2TERM_IP:38000
rte|10091|$E2MGR_IP:4801
rte|10092|$E2MGR_IP:4801
rte|1101|$E2TERM_IP:38000
rte|1102|$E2MGR_IP:3801
rte|12001|$E2MGR_IP:3801
mse|12050|$(echo $XAPP_IP | cut -d "." -f 4)|$XAPP_IP:4560
newrt|end
EOF
remove_container() {
$SUDO docker inspect $1 >/dev/null 2>&1
if [ $? -eq 0 ]; then
$SUDO docker kill $1
$SUDO docker rm $1
fi
}
# create RIC various containers. Kill and remove them if they exist.
remove_container db
$SUDO docker run -d --network ric --ip $DBAAS_IP --name db dbaas:bronze
remove_container e2rtmansim
$SUDO docker run -d -it --network ric --ip $E2RTMANSIM_IP --name e2rtmansim e2rtmansim:bronze
remove_container e2mgr
$SUDO docker run -d -it --network ric --ip $E2MGR_IP -e RIC_ID=7b0000-000000/18 \
-e DBAAS_PORT_6379_TCP_ADDR=$DBAAS_IP -e DBAAS_PORT_6379_TCP_PORT="6379" \
-e DBAAS_SERVICE_HOST=$DBAAS_IP -e DBAAS_SERCE_PORT="6379" \
--mount type=bind,source=$ROUTERFILE,destination=/opt/E2Manager/router.txt,ro \
--name e2mgr e2mgr:bronze
remove_container e2term
E2TERMCONFFILE=`pwd`/e2term_config.conf
if [ ! -e $E2TERMCONFFILE ]; then
cat <<EOF >$E2TERMCONFFILE
nano=38000
loglevel=debug
volume=log
#the key name of the environment holds the local ip address
#ip address of the E2T in the RMR
local-ip=$E2TERM_IP
#trace is start, stop
trace=start
external-fqdn=e2t.com
#put pointer to the key that point to pod name
pod_name=E2TERM_POD_NAME
sctp-port=$E2TERM_SCTP_PORT
EOF
fi
E2TERM_CONFIG_BIND="--mount type=bind,source=$E2TERMCONFFILE,destination=/opt/e2/config/config.conf,ro"
if [ "$arena" = true ]; then
echo 'Starting local setup'
# if both RIC and DU are executed on the same machine, do not set Docker NAT rules
$SUDO docker run -d -it --network=ric --ip $E2TERM_IP --name e2term \
--mount type=bind,source=$ROUTERFILE,destination=/opt/e2/dockerRouter.txt,ro \
$E2TERM_CONFIG_BIND \
e2term:bronze
else
$SUDO docker run -d -it --network=ric --ip $E2TERM_IP --name e2term -p ${RIC_IP}:${E2TERM_SCTP_PORT}:${E2TERM_SCTP_PORT}/sctp\
--mount type=bind,source=$ROUTERFILE,destination=/opt/e2/dockerRouter.txt,ro \
$E2TERM_CONFIG_BIND e2term:bronze
fi
exit 0

View File

@ -36,7 +36,7 @@ if [ ! $? -eq 0 ]; then
$SUDO docker build \
--build-arg DBAAS_SERVICE_HOST=$DBAAS_IP \
--build-arg DBAAS_SERVICE_PORT=$DBAAS_PORT \
-f ${DOCKER_FILE}_${IMAGE_NAME} -t ${IMAGE_NAME}:$tagvers .
-f ${DOCKER_FILE}_${IMAGE_NAME}_c -t ${IMAGE_NAME}:$tagvers .
# remove copied Dockerfile
rm ${DOCKER_FILE}_${IMAGE_NAME}

View File

@ -0,0 +1,7 @@
#!/bin/bash
docker kill sample-xapp-24
docker rm sample-xapp-24
docker rmi sample-xapp:latest
./setup-sample-xapp.sh ns-o-ran
docker exec -it sample-xapp-24 bash

View File

@ -1,2 +1,2 @@
#!/bin/bash
./setup-sample-xapp.sh gnb:311-048-01000501
./setup-sample-xapp.sh gnb:131-133-31000000

View File

@ -0,0 +1,129 @@
##-----------------------------------
# BS Connector
#------------------------------------
ARG SCHEMA_PATH=schemas
ARG XAPP_DIR=sample-xapp
ARG CONNECTOR_DIR=xapp-sm-connector
ARG STAGE_DIR=/home/${CONNECTOR_DIR}
ARG DBAAS_SERVICE_HOST=10.0.2.12
ARG DBAAS_SERVICE_PORT="6379"
#==================================================================================
FROM ubuntu:18.04 as ricbuild1
# to override repo base, pass in repo argument when running docker build:
# docker build --build-arg REPOBASE=http://abc.def.org . ....
ARG REPOBASE=https://gerrit.oran-osc.org/r
ARG SCHEMA_FILE
ARG SCHEMA_PATH
ARG XAPP_DIR
ARG CONNECTOR_DIR
ARG STAGE_DIR
ARG MDC_VER=0.0.4-1
ARG RMR_VER=4.0.5
ARG RNIB_VER=1.0.0
ENV RMR_RTG_SVC="9999" \
RMR_SEED_RT="/home/${CONNECTOR_DIR}/init/routes.txt" \
LD_LIBRARY_PATH="/usr/local/lib:/usr/local/libexec" \
VERBOSE=0 \
CONFIG_FILE=/opt/ric/config/config-file.json \
DBAAS_SERVICE_HOST=${DBAAS_SERVICE_HOST} \
DBAAS_SERVICE_PORT=${DBAAS_SERVICE_PORT}
COPY ${CONNECTOR_DIR} ${STAGE_DIR}
COPY ${XAPP_DIR} /home/${XAPP_DIR}
WORKDIR ${STAGE_DIR}
# Install necessary packages
RUN apt-get update \
&& apt-get install -y \
cmake \
git \
build-essential \
automake \
autoconf-archive \
autoconf \
pkg-config \
gawk \
libtool \
wget \
zlib1g-dev \
libffi-dev \
libcurl4-openssl-dev \
vim \
cpputest \
libboost-all-dev \
libhiredis-dev \
&& apt-get remove -y --purge python* \
&& apt-get install -y \
python3 \
python3-pip \
# Install mdclog using debian package hosted at packagecloud.io
&& wget -nv --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/mdclog_${MDC_VER}_amd64.deb/download.deb \
&& wget -nv --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/mdclog-dev_${MDC_VER}_amd64.deb/download.deb \
&& dpkg -i mdclog_${MDC_VER}_amd64.deb \
&& dpkg -i mdclog-dev_${MDC_VER}_amd64.deb \
&& rm mdclog_${MDC_VER}_amd64.deb mdclog-dev_${MDC_VER}_amd64.deb \
# Install RMR using debian package hosted at packagecloud.io
&& wget -nv --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rmr_${RMR_VER}_amd64.deb/download.deb \
&& wget -nv --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rmr-dev_${RMR_VER}_amd64.deb/download.deb \
&& dpkg -i rmr_${RMR_VER}_amd64.deb \
&& dpkg -i rmr-dev_${RMR_VER}_amd64.deb \
&& rm rmr_${RMR_VER}_amd64.deb rmr-dev_${RMR_VER}_amd64.deb \
# Install RNIB libraries
&& wget -nv --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rnib_${RNIB_VER}_all.deb/download.deb \
&& dpkg -i rnib_${RNIB_VER}_all.deb \
&& rm rnib_${RNIB_VER}_all.deb \
# Install dbaas
&& cd ${STAGE_DIR} \
&& git clone https://gerrit.o-ran-sc.org/r/ric-plt/dbaas \
&& cd dbaas/redismodule \
&& ./autogen.sh \
&& ./configure \
&& make -j ${nproc} all \
&& make install \
&& rm -Rf ${STAGE_DIR}/dbaas \
# Install sdl
&& cd ${STAGE_DIR} \
&& git clone https://gerrit.o-ran-sc.org/r/ric-plt/sdl \
&& cd sdl \
&& ./autogen.sh \
&& ./configure \
&& make -j ${nproc} all \
&& make install \
&& rm -Rf ${STAGE_DIR}/sdl \
# Install rapidjson
&& cd ${STAGE_DIR} \
&& git clone https://github.com/Tencent/rapidjson \
&& cd rapidjson \
&& mkdir build \
&& cd build \
&& cmake -DCMAKE_INSTALL_PREFIX=/usr/local .. \
&& make -j ${nproc} \
&& make install \
&& cd ${STAGE_DIR} \
&& rm -rf rapidjson
FROM ricbuild1
##-----------------------------------
# Now install the program
#------------------------------------
# build connector
RUN export CPATH=$CPATH:/usr/local/include \
&& cd src \
&& make clean \
&& make -j ${nproc} \
&& make install \
&& ldconfig \
&& sysctl -w net.ipv6.conf.lo.disable_ipv6=1 \
###-----------------------------------
## DRL Agent
##------------------------------------
## install packages and pip requirements
# && pip3 --no-cache-dir install -U pip \
# && pip3 --no-cache-dir install -r /home/${XAPP_DIR}/requirements.txt \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

View File

@ -20,7 +20,7 @@
# This source code is part of the near-RT RIC (RAN Intelligent Controller)
# platform project (RICP).
#
FROM nexus3.o-ran-sc.org:10004/o-ran-sc/bldr-ubuntu18-c-go:9-u18.04 as ubuntu
FROM wineslab/o-ran-sc-bldr-ubuntu18-c-go:9-u18.04 as ubuntu
WORKDIR /opt/e2/

View File

@ -104,7 +104,7 @@ std::string find_agent_ip_from_gnb(unsigned char* gnb_id_trans) {
// send through socket
int send_socket(char* buf, std::string dest_ip) {
int send_socket(char* buf, size_t payload_size, std::string dest_ip) {
int control_sckfd = -1;
@ -126,8 +126,7 @@ int send_socket(char* buf, std::string dest_ip) {
// const size_t max_size = 512;
// char buf[max_size] = "Hello, Server!"; // store the data in a buffer
size_t data_size = strlen(buf);
int sent_size = send(control_sckfd ,buf, data_size, 0);
int sent_size = send(control_sckfd, buf, payload_size, 0);
if(sent_size < 0) { // the send returns a size of -1 in case of errors
std::cout << "ERROR: SEND to agent " << dest_ip << std::endl;

View File

@ -27,6 +27,6 @@ extern std::map<std::string, std::string> agentIp_gnbId;
int open_control_socket_agent(const char* dest_ip, const int dest_port);
void close_control_socket_agent(void);
std::string find_agent_ip_from_gnb(unsigned char* gnb_id);
int send_socket(char* buf, std::string dest_ip);
int send_socket(char* buf, size_t payload_size, std::string dest_ip);
#endif

View File

@ -30,6 +30,7 @@ void signalHandler( int signum ) {
}
int main(int argc, char *argv[]){
std::cout << "hw_xapp_main Running";
// Get the thread id
std::thread::id my_id = std::this_thread::get_id();
@ -71,7 +72,9 @@ int main(int argc, char *argv[]){
sleep(1);
//Startup E2 subscription and A1 policy
//hw_xapp->startup(std::ref(*sub_handler));
std::cout << "Startup E2 subscription and A1 policy";
hw_xapp->startup(std::ref(*sub_handler));
//start listener threads and register message handlers.
int num_threads = std::stoi(config[XappSettings::SettingName::THREADS]);

View File

@ -271,7 +271,7 @@ uint8_t procRicIndication(E2AP_PDU_t *e2apMsg, transaction_identifier gnb_id)
}
case 26: // RIC indication message
{
int payload_size = ricIndication->protocolIEs.list.array[idx]-> \
size_t payload_size = ricIndication->protocolIEs.list.array[idx]-> \
value.choice.RICindicationMessage.size;
@ -283,7 +283,7 @@ uint8_t procRicIndication(E2AP_PDU_t *e2apMsg, transaction_identifier gnb_id)
// send payload to agent
std::string agent_ip = find_agent_ip_from_gnb(gnb_id);
send_socket(payload, agent_ip);
send_socket(payload, payload_size, agent_ip);
break;
}

View File

@ -87,19 +87,48 @@ void Xapp::stop(void){
void Xapp::startup(SubscriptionHandler &sub_ref) {
std::cout << "Startup beeing called";
subhandler_ref = &sub_ref;
if (GNB_ID == "") {
// get list of gnbs from ric
std::cout << "Getting gNB list from RIC" << std::endl;
set_rnib_gnblist();
}
else {
} else if (strcmp(GNB_ID, "file") == 0) {
// Get gNB list from file
std::cout << "Getting gNB list from file" << std::endl;
std::ifstream id_file("gnb_list.txt", ios_base::in);
if(!id_file) {
std::cerr << "Error in opening file, gonna crash!" << std::endl;
exit(-1);
}
std::string id_gnb;
while(getline(id_file,id_gnb)){
std::cout << "gNB read: " << id_gnb << std::endl;
rnib_gnblist.push_back(id_gnb);
}
} else if (strcmp(GNB_ID, "ns-o-ran") == 0) {
std::vector <std::string> gnb_ids{"gnb:131-133-31000000", "gnb:131-133-32000000", "gnb:131-133-33000000",
"gnb:131-133-34000000", "gnb:131-133-35000000"};
for (vector<string>::iterator it = gnb_ids.begin(); it != gnb_ids.end(); it++) {
std::cout << "gNB read: " << *it << std::endl;
rnib_gnblist.push_back(*it);
}
} else {
// only insert target gnb
std::cout << "Querying target gNB" << std::endl;
rnib_gnblist.push_back(GNB_ID);
}
while (
true
)
{
std::cout << "Send sub. req.";
std::cout << "yeet";
startup_subscribe_requests();
}
// open external control socket in thread and wait for message
ext_control_thr_rx = std::unique_ptr<std::thread>(new std::thread{&Xapp::handle_external_control_message, this, SOCKET_PORT_EXT});
@ -116,7 +145,16 @@ void Xapp::startup(SubscriptionHandler &sub_ref) {
// send_socket("Hello, Server!", AGENT_1);
//send subscriptions.
startup_subscribe_requests();
while (
true
)
{
std::cout << "Send sub. req.";
std::cout << "yeet";
startup_subscribe_requests();
}
//read A1 policies
// startup_get_policies();
@ -398,7 +436,7 @@ void Xapp::send_ric_control_request(char* payload, std::string gnb_id) {
}
void Xapp::startup_subscribe_requests(void ){
std::cout << "Startup subscribe request \n";
bool res;
size_t data_size = ASN_BUFF_MAX_SIZE;
unsigned char data[data_size];
@ -413,11 +451,12 @@ void Xapp::startup_subscribe_requests(void ){
if(sz <= 0)
mdclog_write(MDCLOG_INFO,"Subscriptions cannot be sent as GNBList in RNIB is NULL");
std::cout << "pre for loop \n";
for(int i = 0; i<sz; i++){
std::cout << "Sending subscriptions to: " << gnblist[i] << std::endl;
// give the message to subscription handler, along with the transmitter.
strcpy((char*)meid,gnblist[i].c_str());
// char *strMsg = "Subscription Request from HelloWorld XApp\0";
@ -436,7 +475,7 @@ void Xapp::startup_subscribe_requests(void ){
//Random Data for request
int request_id = XAPP_REQ_ID;
int function_id = 0;
int function_id = 200;
// DU report timer in ms
std::string event_def = "250";
@ -464,6 +503,7 @@ void Xapp::startup_subscribe_requests(void ){
mdclog_write(MDCLOG_INFO,"Subscription SUCCESSFUL in file= %s, line=%d for MEID %s",__FILE__,__LINE__, meid);
}
}
std::cout << "Finisched subscribe request \n";
}
void Xapp::startup_get_policies(void){

View File

@ -28,6 +28,7 @@
#define SRC_XAPP_HPP_
#include <iostream>
#include <fstream>
#include <string>
#include <memory>
#include <csignal>