diff --git a/.gitmodules b/.gitmodules index d24d33c..884e354 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,3 +2,10 @@ path = xranc-sb-api url = https://github.com/OpenNetworkingFoundation/xranc-sb-api.git branch = master +[submodule "common/hiredis"] + path = common/hiredis + url = https://github.com/redis/hiredis +[submodule "common/grpc"] + path = common/grpc + url = https://github.com/grpc/grpc + branch = v1.20.x diff --git a/Makefile b/Makefile index 42d2580..8199ed0 100644 --- a/Makefile +++ b/Makefile @@ -2,9 +2,10 @@ SHELL := /bin/bash ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) OS_VENDOR := $(shell lsb_release -i -s) OS_RELEASE := $(shell lsb_release -r -s) -GRPC_BRANCH := master -NUM_CORES := 4 -GRPC_DIR := /tmp/grpc +GRPC_BRANCH := v1.20.0 +GRPC_DIR := $(ROOT_DIR)/common/grpc +HIREDIS_TAG := v0.14.0 +HIREDIS_DIR := $(ROOT_DIR)/common/hiredis PROTOBUF_DIR := $(GRPC_DIR)/third_party/protobuf XRANC_DIR := $(ROOT_DIR)/xranc XRANC_SBI_DIR := $(ROOT_DIR)/xranc-sb-api-src @@ -12,31 +13,37 @@ XRANC_NBI_DIR := $(ROOT_DIR)/xranc-nb-api-src XRANC_ENBSIM_DIR := $(ROOT_DIR)/enbsim XRANC_DB_DIR := $(ROOT_DIR)/database -all: install_prerequisites get_submodules build_xranc-sb build_xranc-nb build_xranc build_enbsim +all: modules utilities build -install_prerequisites: +build: build_xranc-sb build_xranc-nb build_xranc build_enbsim + +modules: + cd $(ROOT_DIR) && git submodule init && git submodule update; + cd $(GRPC_DIR) && git fetch --all && git checkout $(GRPC_BRANCH) + cd $(HIREDIS_DIR) && git fetch --all && git checkout $(HIREDIS_TAG); + +utilities: @if [[ $(OS_VENDOR) =~ (Ubuntu) ]]; then \ if [[ $(OS_RELEASE) =~ (16.04) ]]; then \ echo "WARN: Not fully tested on $(OS_VENDOR) $(OS_RELEASE)."; \ sudo apt update; \ - sudo apt-get install -y libevent2-dev libjsoncpp-dev libsctp-dev; \ + sudo apt install -y libevent2-dev libjsoncpp-dev libsctp-dev; \ elif [[ $(OS_RELEASE) =~ (18.04) ]]; then \ sudo apt update; \ - sudo apt-get install libevent-dev libjsoncpp-dev libsctp-dev; \ + sudo apt install -y libevent-dev libjsoncpp-dev libsctp-dev; \ fi \ else \ echo "Unsupported OS - Ubuntu 18.04 is recommended"; \ exit 1; \ fi - sudo apt-get install -y build-essential autoconf git pkg-config automake libtool curl make g++ unzip; - git clone -b $(GRPC_BRANCH) https://github.com/grpc/grpc $(GRPC_DIR); \ - cd $(GRPC_DIR) && git submodule update --init && echo "--- installing protobuf ---" && cd $(PROTOBUF_DIR) && \ - ./autogen.sh && ./configure --enable-shared && make -j$(NUM_CORES) && sudo make install && make clean && sudo ldconfig && \ - echo "--- installing grpc ---" && cd $(GRPC_DIR) && make -j$(NUM_CORES) && sudo make install && make clean && sudo ldconfig; + sudo apt install -y build-essential autoconf git pkg-config automake libtool curl make g++ unzip; + # build gRPC + cd $(GRPC_DIR) && git submodule update --init && make && sudo make install; + # build protobuf + cd $(PROTOBUF_DIR) && make && sudo make install; + # build hiredis + cd $(HIREDIS_DIR) && make && sudo make install; -get_submodules: - cd $(ROOT_DIR) && git submodule init && git submodule update; - build_xranc-sb: cd $(XRANC_SBI_DIR) && make; diff --git a/README.md b/README.md index 585133f..ae77744 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,12 @@ cd xranc make ``` +**NOTE**: Makefile in the root directory has four options: +- make or make all: install everything in this repo +- make utilities: only install utilities and dependencies +- make build: build xranc interfaces, xranc, and enbsim +- make clean: clean all object and binary files + ## Manual steps to install xRANc ### Install dependencies ``` @@ -19,6 +25,14 @@ sudo apt install libsctp-dev #### Install gRPC Please follow this [link](https://github.com/grpc/grpc/blob/v1.25.0/BUILDING.md) +#### Install hiredis +``` +git clone https://github.com/redis/hiredis +cd /path/to/hiredis +make +sudo make install +``` + #### Clone with SSH or HTTPS ``` git clone git@github.com:OpenNetworkingFoundation/xranc.git diff --git a/common/grpc b/common/grpc new file mode 160000 index 0000000..200e0fd --- /dev/null +++ b/common/grpc @@ -0,0 +1 @@ +Subproject commit 200e0fd4c0f18440c17626fb26ee5a7417ba9fe0 diff --git a/common/hiredis b/common/hiredis new file mode 160000 index 0000000..5d0568d --- /dev/null +++ b/common/hiredis @@ -0,0 +1 @@ +Subproject commit 5d0568d9ae49363ad21b512c52025e45bbf8d02e diff --git a/xranc/xran-cfg.json b/xranc/xran-cfg.json index 91d76cb..88ea98c 100644 --- a/xranc/xran-cfg.json +++ b/xranc/xran-cfg.json @@ -19,14 +19,14 @@ "l2_meas_report_interval_ms": 5000, "rx_signal_meas_report_interval_ms": 7000, "xranc_cellconfigrequest_interval_seconds": 5, - "xranc_bind_ip": "10.0.0.10", + "xranc_bind_ip": "127.0.0.1", "xranc_port": 5555, "admission_success": true, "bearer_success": true, "no_meas_link_removal_ms": 1000000, "idle_ue_removal_ms": 1, "nb_response_timeout_ms": 10000, - "redis_ip_addr": "10.0.0.11", + "redis_ip_addr": "127.0.0.1", "redis_port": 50002, "xranc_nbi_port": 50001 }