Compare commits
	
		
			11 Commits
		
	
	
		
			ns-o-ran
			...
			08e1fb839a
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 08e1fb839a | |||
| 8f3f20cfa3 | |||
| cf8cd37685 | |||
| f2e465c33e | |||
| 178ec65486 | |||
| a09d784d52 | |||
| 45fa45ee2c | |||
| 887f0d180a | |||
| 93d45e3c58 | |||
| a34e83b524 | |||
| 290e030071 | 
@@ -36,7 +36,7 @@ if [ ! $? -eq 0 ]; then
 | 
				
			|||||||
	    $SUDO docker build  \
 | 
						    $SUDO docker build  \
 | 
				
			||||||
            --build-arg DBAAS_SERVICE_HOST=$DBAAS_IP \
 | 
					            --build-arg DBAAS_SERVICE_HOST=$DBAAS_IP \
 | 
				
			||||||
            --build-arg DBAAS_SERVICE_PORT=$DBAAS_PORT \
 | 
					            --build-arg DBAAS_SERVICE_PORT=$DBAAS_PORT \
 | 
				
			||||||
            -f ${DOCKER_FILE}_${IMAGE_NAME} -t ${IMAGE_NAME}:$tagvers .
 | 
					            -f Dockerfile_sample_xapp_c -t ${IMAGE_NAME}:$tagvers .
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            # remove copied Dockerfile
 | 
					            # remove copied Dockerfile
 | 
				
			||||||
            rm ${DOCKER_FILE}_${IMAGE_NAME}
 | 
					            rm ${DOCKER_FILE}_${IMAGE_NAME}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										129
									
								
								setup/Dockerfile_sample-xapp_c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										129
									
								
								setup/Dockerfile_sample-xapp_c
									
									
									
									
									
										Normal 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/*
 | 
				
			||||||
@@ -30,6 +30,7 @@ void signalHandler( int signum ) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int main(int argc, char *argv[]){
 | 
					int main(int argc, char *argv[]){
 | 
				
			||||||
 | 
						std::cout << "hw_xapp_main Running";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Get the thread id
 | 
						// Get the thread id
 | 
				
			||||||
	std::thread::id my_id = std::this_thread::get_id();
 | 
						std::thread::id my_id = std::this_thread::get_id();
 | 
				
			||||||
@@ -71,7 +72,9 @@ int main(int argc, char *argv[]){
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	sleep(1);
 | 
						sleep(1);
 | 
				
			||||||
	//Startup E2 subscription and A1 policy
 | 
						//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.
 | 
						//start listener threads and register message handlers.
 | 
				
			||||||
	int num_threads = std::stoi(config[XappSettings::SettingName::THREADS]);
 | 
						int num_threads = std::stoi(config[XappSettings::SettingName::THREADS]);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -87,6 +87,8 @@ void Xapp::stop(void){
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void Xapp::startup(SubscriptionHandler &sub_ref) {
 | 
					void Xapp::startup(SubscriptionHandler &sub_ref) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    std::cout << "Startup beeing called";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	subhandler_ref = &sub_ref;
 | 
						subhandler_ref = &sub_ref;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (GNB_ID == "") {
 | 
					    if (GNB_ID == "") {
 | 
				
			||||||
@@ -118,7 +120,15 @@ void Xapp::startup(SubscriptionHandler &sub_ref) {
 | 
				
			|||||||
        std::cout << "Querying target gNB" << std::endl;
 | 
					        std::cout << "Querying target gNB" << std::endl;
 | 
				
			||||||
        rnib_gnblist.push_back(GNB_ID);
 | 
					        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
 | 
					    // 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});
 | 
					    ext_control_thr_rx = std::unique_ptr<std::thread>(new std::thread{&Xapp::handle_external_control_message, this, SOCKET_PORT_EXT});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -135,7 +145,16 @@ void Xapp::startup(SubscriptionHandler &sub_ref) {
 | 
				
			|||||||
    // send_socket("Hello, Server!", AGENT_1);
 | 
					    // send_socket("Hello, Server!", AGENT_1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	//send subscriptions.
 | 
						//send subscriptions.
 | 
				
			||||||
	startup_subscribe_requests();
 | 
					    while (
 | 
				
			||||||
 | 
					        true
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        std::cout << "Send sub. req.";
 | 
				
			||||||
 | 
					        std::cout << "yeet";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    	startup_subscribe_requests();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	//read A1 policies
 | 
						//read A1 policies
 | 
				
			||||||
	// startup_get_policies();
 | 
						// startup_get_policies();
 | 
				
			||||||
@@ -417,7 +436,7 @@ void Xapp::send_ric_control_request(char* payload, std::string gnb_id) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Xapp::startup_subscribe_requests(void ){
 | 
					void Xapp::startup_subscribe_requests(void ){
 | 
				
			||||||
 | 
					    std::cout << "Startup subscribe request \n";
 | 
				
			||||||
    bool res;
 | 
					    bool res;
 | 
				
			||||||
    size_t data_size = ASN_BUFF_MAX_SIZE;
 | 
					    size_t data_size = ASN_BUFF_MAX_SIZE;
 | 
				
			||||||
    unsigned char	data[data_size];
 | 
					    unsigned char	data[data_size];
 | 
				
			||||||
@@ -432,11 +451,12 @@ void Xapp::startup_subscribe_requests(void ){
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if(sz <= 0)
 | 
					    if(sz <= 0)
 | 
				
			||||||
       mdclog_write(MDCLOG_INFO,"Subscriptions cannot be sent as GNBList in RNIB is NULL");
 | 
					       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++){
 | 
					    for(int i = 0; i<sz; i++){
 | 
				
			||||||
        std::cout << "Sending subscriptions to: " << gnblist[i] << std::endl;
 | 
					        std::cout << "Sending subscriptions to: " << gnblist[i] << std::endl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // give the message to subscription handler, along with the transmitter.
 | 
					        // give the message to subscription handler, along with the transmitter.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        strcpy((char*)meid,gnblist[i].c_str());
 | 
					        strcpy((char*)meid,gnblist[i].c_str());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // char *strMsg = "Subscription Request from HelloWorld XApp\0";
 | 
					        // char *strMsg = "Subscription Request from HelloWorld XApp\0";
 | 
				
			||||||
@@ -483,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);
 | 
					            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){
 | 
					void Xapp::startup_get_policies(void){
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user