blob: 0d82dee6c657b32c5b6ae1cde7e8538e8dd928d2 [file] [log] [blame]
Jeremy Ronquillo5263c732020-10-13 09:42:19 -07001# Copyright 2018-present Open Networking Foundation
2#
Andy Bavier2c427732022-02-03 15:16:46 -07003# SPDX-License-Identifier: Apache-2.0
Jeremy Ronquillo5263c732020-10-13 09:42:19 -07004
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -07005SHELL := /bin/bash
6BUILD ?= /tmp/build
7M ?= $(BUILD)/milestones
8MAKEDIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
Jeremy Ronquilloaf084f32020-08-24 13:18:47 -07009SCRIPTDIR := $(MAKEDIR)/scripts
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070010RESOURCEDIR := $(MAKEDIR)/resources
11WORKSPACE ?= $(HOME)
Jeremy Ronquillod3cab742020-08-24 11:49:00 -070012VENV ?= $(BUILD)/venv/aiab
Andy Bavierebf479c2021-09-08 15:47:58 -070013
Andy Bavier31dfb9e2022-02-15 15:24:57 -0700144G_CORE_VALUES ?= $(MAKEDIR)/sd-core-4g-values.yaml
155G_CORE_VALUES ?= $(MAKEDIR)/sd-core-5g-values.yaml
Andy Bavierebf479c2021-09-08 15:47:58 -070016OAISIM_VALUES ?= $(MAKEDIR)/oaisim-values.yaml
Andy Bavier794566f2022-02-04 16:10:18 -070017ROC_VALUES ?= $(MAKEDIR)/roc-values.yaml
Andy Bavier794566f2022-02-04 16:10:18 -070018ROC_4G_MODELS ?= $(MAKEDIR)/roc-4g-models.json
19ROC_5G_MODELS ?= $(MAKEDIR)/roc-5g-models.json
Osman Amjad488a0222022-01-12 11:58:43 -060020TEST_APP_VALUES?= $(MAKEDIR)/5g-test-apps-values.yaml
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070021
Hyunsun Moon8c3fe402021-10-04 18:06:07 -070022KUBESPRAY_VERSION ?= release-2.17
Hyunsun Mooncbdac112022-03-19 22:01:27 -060023DOCKER_VERSION ?= '20.10'
24K8S_VERSION ?= v1.20.11
25HELM_VERSION ?= v3.6.3
26
27ENABLE_ROUTER ?= true
28ENABLE_OAISIM ?= true
29ENABLE_GNBSIM ?= true
Amit Wankhede01b20c32021-12-01 12:45:58 +053030ENABLE_SUBSCRIBER_PROXY ?= false
Andy Baviercd93a202022-01-10 18:03:26 -080031GNBSIM_COLORS ?= true
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070032
Hyunsun Mooncbdac112022-03-19 22:01:27 -060033DATA_IFACE ?= data
34ifeq ($(DATA_IFACE), data)
35 RAN_SUBNET := 192.168.251.0/24
36else
37 RAN_SUBNET := $(shell ip route | grep $${DATA_IFACE} | awk '/kernel/ {print $$1}')
38endif
39NODE_IP ?= $(shell ip route list default | awk -F 'src' '{ print $$2; exit }' | awk '{ print $$1 }')
40MME_IP ?=
41
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070042HELM_GLOBAL_ARGS ?=
Andy Baviereda466b2021-08-27 15:00:36 -070043
44# Allow installing local charts or specific versions of published charts.
45# E.g., to install the Aether 1.5 release:
46# CHARTS=release-1.5 make test
47# Default is to install from the local charts.
48CHARTS ?= local
49CONFIGFILE := configs/$(CHARTS)
50include $(CONFIGFILE)
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070051
52cpu_family := $(shell lscpu | grep 'CPU family:' | awk '{print $$3}')
53cpu_model := $(shell lscpu | grep 'Model:' | awk '{print $$2}')
54os_vendor := $(shell lsb_release -i -s)
55os_release := $(shell lsb_release -r -s)
Andy Bavier9ee69d02022-02-11 10:31:21 -070056USER := $(shell whoami)
57
Hyunsun Mooncbdac112022-03-19 22:01:27 -060058.PHONY: 4g-core 5g-core oaisim test reset-test reset-ue reset-5g-test clean
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070059
60$(M):
61 mkdir -p $(M)
62
63$(M)/system-check: | $(M)
64 @if [[ $(cpu_family) -eq 6 ]]; then \
65 if [[ $(cpu_model) -lt 60 ]]; then \
66 echo "FATAL: haswell CPU or newer is required."; \
67 exit 1; \
68 fi \
69 else \
70 echo "FATAL: unsupported CPU family."; \
71 exit 1; \
72 fi
73 @if [[ $(os_vendor) =~ (Ubuntu) ]]; then \
Hyunsun7b640512020-10-27 19:49:51 -050074 if [[ ! $(os_release) =~ (18.04) ]]; then \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070075 echo "WARN: $(os_vendor) $(os_release) has not been tested."; \
76 fi; \
77 if dpkg --compare-versions 4.15 gt $(shell uname -r); then \
78 echo "FATAL: kernel 4.15 or later is required."; \
79 echo "Please upgrade your kernel by running" \
80 "apt install --install-recommends linux-generic-hwe-$(os_release)"; \
81 exit 1; \
82 fi \
83 else \
84 echo "FAIL: unsupported OS."; \
85 exit 1; \
86 fi
87 touch $@
88
89$(M)/setup: | $(M)
90 sudo $(SCRIPTDIR)/cloudlab-disksetup.sh
Hyunsun Moon82e47c22021-06-28 12:30:20 -050091 sudo apt update; sudo apt install -y software-properties-common python3 python3-pip python3-venv jq httpie ipvsadm
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070092 touch $@
93
94$(BUILD)/kubespray: | $(M)/setup
95 mkdir -p $(BUILD)
96 cd $(BUILD); git clone https://github.com/kubernetes-incubator/kubespray.git -b $(KUBESPRAY_VERSION)
97
98$(VENV)/bin/activate: | $(M)/setup
Hyunsun Moon82e47c22021-06-28 12:30:20 -050099 python3 -m venv $(VENV)
Wei-Yu Chen7edb7e72021-07-28 11:37:55 +0800100 source "$(VENV)/bin/activate" && \
101 python -m pip install -U pip && \
102 deactivate
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700103
104$(M)/kubespray-requirements: $(BUILD)/kubespray | $(VENV)/bin/activate
105 source "$(VENV)/bin/activate" && \
106 pip install -r $(BUILD)/kubespray/requirements.txt
107 touch $@
108
109$(M)/k8s-ready: | $(M)/setup $(BUILD)/kubespray $(VENV)/bin/activate $(M)/kubespray-requirements
110 source "$(VENV)/bin/activate" && cd $(BUILD)/kubespray; \
111 ansible-playbook -b -i inventory/local/hosts.ini \
112 -e "{'override_system_hostname' : False, 'disable_swap' : True}" \
113 -e "{'docker_version' : $(DOCKER_VERSION)}" \
114 -e "{'docker_iptables_enabled' : True}" \
115 -e "{'kube_version' : $(K8S_VERSION)}" \
Hyunsun84f0f172020-09-23 15:40:08 -0500116 -e "{'kube_network_plugin_multus' : True, 'multus_version' : stable, 'multus_cni_version' : 0.3.1}" \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700117 -e "{'kube_proxy_metrics_bind_address' : 0.0.0.0:10249}" \
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600118 -e "{'kube_pods_subnet' : 192.168.84.0/24, 'kube_service_addresses' : 192.168.85.0/24}" \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700119 -e "{'kube_apiserver_node_port_range' : 2000-36767}" \
120 -e "{'kubeadm_enabled': True}" \
121 -e "{'kube_feature_gates' : [SCTPSupport=True]}" \
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600122 -e "{'kubelet_custom_flags' : [--allowed-unsafe-sysctls=net.*, --node-ip=$(NODE_IP)]}" \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700123 -e "{'dns_min_replicas' : 1}" \
124 -e "{'helm_enabled' : True, 'helm_version' : $(HELM_VERSION)}" \
125 cluster.yml
126 mkdir -p $(HOME)/.kube
127 sudo cp -f /etc/kubernetes/admin.conf $(HOME)/.kube/config
128 sudo chown $(shell id -u):$(shell id -g) $(HOME)/.kube/config
129 kubectl wait pod -n kube-system --for=condition=Ready --all
Andy Bavier9ee69d02022-02-11 10:31:21 -0700130 sudo adduser $(USER) docker
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700131 touch $@
132
133$(M)/helm-ready: | $(M)/k8s-ready
Woojoong Kim8425cb32021-01-08 16:18:53 -0800134 helm repo add incubator https://charts.helm.sh/incubator
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700135 helm repo add cord https://charts.opencord.org
Andy Baviereda466b2021-08-27 15:00:36 -0700136 helm repo add atomix https://charts.atomix.io
137 helm repo add onosproject https://charts.onosproject.org
Andy Bavier9ee69d02022-02-11 10:31:21 -0700138 helm repo add aether https://charts.aetherproject.org
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700139 touch $@
140
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700141/opt/cni/bin/static: | $(M)/k8s-ready
142 mkdir -p $(BUILD)/cni-plugins; cd $(BUILD)/cni-plugins; \
143 wget https://github.com/containernetworking/plugins/releases/download/v0.8.2/cni-plugins-linux-amd64-v0.8.2.tgz && \
144 tar xvfz cni-plugins-linux-amd64-v0.8.2.tgz
145 sudo cp $(BUILD)/cni-plugins/static /opt/cni/bin/
146
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600147node-prep: | $(M)/helm-ready /opt/cni/bin/static
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700148
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600149$(M)/router-pod:
150 sudo ip link add $(DATA_IFACE) type dummy || true;
151 sudo ip link set $(DATA_IFACE) up || true;
152 DATA_IFACE=$(DATA_IFACE) envsubst < $(RESOURCEDIR)/router.yaml | kubectl apply -f -
153 kubectl wait pod -n default --for=condition=Ready -l app=router --timeout=300s
154 @touch $@
155
156$(M)/router-host:
157 sudo ip link add core link $(DATA_IFACE) type macvlan mode bridge
158 sudo ip link set core up
159 sudo ip addr add 192.168.250.1/24 dev core
160 sudo ip link add access link $(DATA_IFACE) type macvlan mode bridge
161 sudo ip link set access up
162 sudo ip addr add 192.168.252.1/24 dev access
163 sudo sysctl -w net.ipv4.ip_forward=1;
164 $(eval oiface := $(shell ip route list default | awk -F 'dev' '{ print $$2; exit }' | awk '{ print $$1 }'))
165 sudo ip route add 172.250.0.0/16 via 192.168.250.3
166 sudo iptables -t nat -A POSTROUTING -s 172.250.0.0/16 -o $(oiface) -j MASQUERADE
167 @touch $@
168
1694g-core: node-prep
170ifeq ($(ENABLE_ROUTER),true)
171ifeq ($(ENABLE_OAISIM),true)
1724g-core: $(M)/router-pod
173else
1744g-core: $(M)/router-host
175endif
176endif
1774g-core: $(M)/omec
178$(M)/omec:
179 @if [[ "${CHARTS}" == "local" || "${CHARTS}" == "local-sdcore" ]]; then \
180 helm dep up $(SD_CORE_CHART); \
181 else \
182 helm repo update; \
183 fi
184 NODE_IP=${NODE_IP} DATA_IFACE=${DATA_IFACE} RAN_SUBNET=${RAN_SUBNET} envsubst < $(4G_CORE_VALUES) | \
185 helm upgrade --create-namespace --install --wait $(HELM_GLOBAL_ARGS) \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700186 --namespace omec \
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600187 --values - \
Andy Bavier31dfb9e2022-02-15 15:24:57 -0700188 sd-core \
189 $(SD_CORE_CHART)
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600190 @if [[ "${ENABLE_OAISIM}" == "false" ]]; then \
191 $(eval mme_ip := $(shell ip -4 -o addr show $${DATA_IFACE} | awk '{print $$4}' | cut -d'/' -f1)) \
192 echo "Your MME IP is $(mme_ip)"; \
193 fi
194 @touch $@
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700195
Hyunsun Mooncbdac112022-03-19 22:01:27 -06001965g-core: node-prep
197ifeq ($(ENABLE_ROUTER),true)
198ifeq ($(ENABLE_GNBSIM),true)
1995g-core: $(M)/router-pod
200else
2015g-core: $(M)/router-host
202endif
203endif
2045g-core: $(M)/5g-core
205$(M)/5g-core:
206 @if [[ "${CHARTS}" == "local" || "${CHARTS}" == "local-sdcore" ]]; then \
207 helm dep up $(SD_CORE_CHART); \
208 else \
209 helm repo update; \
210 fi
211 NODE_IP=${NODE_IP} DATA_IFACE=${DATA_IFACE} RAN_SUBNET=${RAN_SUBNET} envsubst < $(5G_CORE_VALUES) | \
212 helm upgrade --create-namespace --install --wait $(HELM_GLOBAL_ARGS) \
Badhrinath3e081e22020-12-02 15:02:08 -0600213 --namespace omec \
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600214 --values - \
Andy Bavier31dfb9e2022-02-15 15:24:57 -0700215 sd-core \
216 $(SD_CORE_CHART)
Badhrinath3e081e22020-12-02 15:02:08 -0600217 touch $@
218
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700219# UE images includes kernel module, ue_ip.ko
220# which should be built in the exactly same kernel version of the host machine
221$(BUILD)/openairinterface: | $(M)/setup
222 mkdir -p $(BUILD)
223 cd $(BUILD); git clone https://github.com/opencord/openairinterface.git
224
Andy Bavierd6de5612021-11-08 10:39:17 -0700225download-ue-image: | $(M)/k8s-ready
Andy Bavier9ee69d02022-02-11 10:31:21 -0700226 sg docker -c "docker pull ${OAISIM_UE_IMAGE} && \
227 docker tag ${OAISIM_UE_IMAGE} omecproject/lte-uesoftmodem:1.1.0"
Andy Bavierd6de5612021-11-08 10:39:17 -0700228 touch $(M)/ue-image
229
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700230$(M)/ue-image: | $(M)/k8s-ready $(BUILD)/openairinterface
231 cd $(BUILD)/openairinterface; \
Andy Bavier9ee69d02022-02-11 10:31:21 -0700232 sg docker -c "docker build . --target lte-uesoftmodem \
Hyunsun7b640512020-10-27 19:49:51 -0500233 --build-arg build_base=omecproject/oai-base:1.1.0 \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700234 --file Dockerfile.ue \
Andy Bavier9ee69d02022-02-11 10:31:21 -0700235 --tag omecproject/lte-uesoftmodem:1.1.0"
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700236 touch $@
237
Andy Bavier9ee69d02022-02-11 10:31:21 -0700238$(M)/oaisim-lo:
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600239 @sudo ip addr add 127.0.0.2/8 dev lo || true
240 @touch $@
Andy Bavier9ee69d02022-02-11 10:31:21 -0700241
Andy Bavier7b01b682022-03-17 13:26:55 -0700242oaisim-standalone: | $(M)/helm-ready $(M)/ue-image $(M)/oaisim-lo
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600243 @ip link show $(DATA_IFACE) > /dev/null || (echo DATA_IFACE is not set or does not exist; exit 1)
244 @if [[ "${MME_IP}" == "" ]]; then \
245 echo MME_IP is not set; \
246 exit 1; \
247 else \
248 ping -c 3 $(MME_IP) > /dev/null || (echo MME $(MME_IP) is not reachable; exit 1) \
249 fi
250 sudo ip route add 192.168.252.0/24 via $(MME_IP)
Andy Bavier7b01b682022-03-17 13:26:55 -0700251 helm repo update
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600252 helm upgrade --create-namespace --install $(HELM_GLOBAL_ARGS) --namespace omec oaisim cord/oaisim -f $(OAISIM_VALUES) \
253 --set config.enb.networks.s1u.interface=$(DATA_IFACE) \
254 --set config.enb.networks.s1_mme.interface=$(DATA_IFACE) \
255 --set config.enb.mme.address=$(MME_IP) \
256 --set config.enb.mme.isLocal=false \
257 --set images.pullPolicy=IfNotPresent
Andy Bavier7b01b682022-03-17 13:26:55 -0700258 kubectl rollout status -n omec statefulset ue
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600259 @echo "Test: registration"
Andy Bavier7b01b682022-03-17 13:26:55 -0700260 @timeout 60s bash -c \
261 "until ip addr show oip1 | grep -q inet; \
262 do \
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600263 echo 'Waiting for UE 1 gets IP address'; \
264 sleep 3; \
Andy Bavier7b01b682022-03-17 13:26:55 -0700265 done"
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600266 @echo "Test: ping from UE to 8.8.8.8"
267 ping -I oip1 8.8.8.8 -c 3
268 @touch $(M)/oaisim $(M)/omec
Andy Bavier7b01b682022-03-17 13:26:55 -0700269
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600270oaisim: | $(M)/oaisim
271$(M)/oaisim: | $(M)/ue-image $(M)/router-pod $(M)/oaisim-lo
272 sudo ip link add enb link $(DATA_IFACE) type macvlan mode bridge || true
273 sudo ip link set enb up || true
274 sudo ip addr add 192.168.251.3/24 dev enb || true
275 sudo ip route add 192.168.252.0/24 via 192.168.251.1 || true
276 helm upgrade --create-namespace --install $(HELM_GLOBAL_ARGS) --namespace omec oaisim cord/oaisim -f $(OAISIM_VALUES) \
Jeremy Ronquilloaf084f32020-08-24 13:18:47 -0700277 --set images.pullPolicy=IfNotPresent
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700278 kubectl rollout status -n omec statefulset ue
279 @timeout 60s bash -c \
280 "until ip addr show oip1 | grep -q inet; \
281 do \
282 echo 'Waiting for UE 1 gets IP address'; \
283 sleep 3; \
284 done"
285 touch $@
286
Andy Bavierebf479c2021-09-08 15:47:58 -0700287roc: $(M)/roc
288$(M)/roc: $(M)/helm-ready
289 kubectl get namespace aether-roc 2> /dev/null || kubectl create namespace aether-roc
290 helm repo update
291 if [ "$(CHARTS)" == "local" ]; then helm dep up $(AETHER_ROC_UMBRELLA_CHART); fi
292 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
293 --namespace kube-system \
294 --values $(ROC_VALUES) \
295 atomix-controller \
296 $(ATOMIX_CONTROLLER_CHART)
297 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
298 --namespace kube-system \
299 --values $(ROC_VALUES) \
300 atomix-raft-storage \
301 $(ATOMIX_RAFT_STORAGE_CHART)
302 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
303 --namespace kube-system \
304 --values $(ROC_VALUES) \
305 onos-operator \
306 $(ONOS_OPERATOR_CHART)
307 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
308 --namespace aether-roc \
309 --values $(ROC_VALUES) \
310 aether-roc-umbrella \
311 $(AETHER_ROC_UMBRELLA_CHART)
312 touch $@
313
314# Load the ROC 4G models. Disable loading network slice from SimApp.
315roc-4g-models: $(M)/roc
316 sed -i 's/provision-network-slice: true/provision-network-slice: false/' $(4G_CORE_VALUES)
317 sed -i 's/# syncUrl/syncUrl/' $(4G_CORE_VALUES)
Amit Wankhede01b20c32021-12-01 12:45:58 +0530318 if [ "${ENABLE_SUBSCRIBER_PROXY}" == "true" ] ; then \
Amit Wankhedefdf10ff2022-02-16 08:37:20 -0600319 sed -i 's/# sub-proxy-endpt:/sub-proxy-endpt:/' $(4G_CORE_VALUES) ; \
320 sed -i 's/# addr: sub/ addr: sub/' $(4G_CORE_VALUES) ; \
321 sed -i 's/# port: 5000/ port: 5000/' $(4G_CORE_VALUES) ; \
Amit Wankhede01b20c32021-12-01 12:45:58 +0530322 fi
Andy Bavierebf479c2021-09-08 15:47:58 -0700323 $(eval ONOS_CLI_POD := $(shell kubectl -n aether-roc get pods -l name=onos-cli -o name))
324 echo "ONOS CLI pod: ${ONOS_CLI_POD}"
325 until kubectl -n aether-roc exec ${ONOS_CLI_POD} -- \
326 curl -s -f -L -X PATCH "http://aether-roc-api:8181/aether-roc-api" \
327 --header 'Content-Type: application/json' \
328 --data-raw "$$(cat ${ROC_4G_MODELS})"; do sleep 5; done
329
330# Load the ROC 5G models. Disable loading network slice from SimApp.
331roc-5g-models: $(M)/roc
332 sed -i 's/provision-network-slice: true/provision-network-slice: false/' $(5G_CORE_VALUES)
333 sed -i 's/# syncUrl/syncUrl/' $(5G_CORE_VALUES)
Amit Wankhede01b20c32021-12-01 12:45:58 +0530334 if [ "${ENABLE_SUBSCRIBER_PROXY}" == "true" ] ; then \
Amit Wankhedefdf10ff2022-02-16 08:37:20 -0600335 sed -i 's/# sub-proxy-endpt:/sub-proxy-endpt:/' $(5G_CORE_VALUES) ; \
336 sed -i 's/# addr: sub/ addr: sub/' $(5G_CORE_VALUES) ; \
337 sed -i 's/# port: 5000/ port: 5000/' $(5G_CORE_VALUES) ; \
Amit Wankhede01b20c32021-12-01 12:45:58 +0530338 fi
Andy Bavierebf479c2021-09-08 15:47:58 -0700339 $(eval ONOS_CLI_POD := $(shell kubectl -n aether-roc get pods -l name=onos-cli -o name))
340 echo "ONOS CLI pod: ${ONOS_CLI_POD}"
341 until kubectl -n aether-roc exec ${ONOS_CLI_POD} -- \
342 curl -s -f -L -X PATCH "http://aether-roc-api:8181/aether-roc-api" \
343 --header 'Content-Type: application/json' \
344 --data-raw "$$(cat ${ROC_5G_MODELS})"; do sleep 5; done
345
346roc-clean:
347 @echo "This could take 2-3 minutes..."
348 sed -i 's/provision-network-slice: false/provision-network-slice: true/' $(4G_CORE_VALUES)
349 sed -i 's/ syncUrl/ # syncUrl/' $(4G_CORE_VALUES)
Amit Wankhedefdf10ff2022-02-16 08:37:20 -0600350 sed -i 's/ sub-proxy-endpt:/ # sub-proxy-endpt:/' $(4G_CORE_VALUES)
351 sed -i 's/ addr: sub/ # addr: sub/' $(4G_CORE_VALUES)
352 sed -i 's/ port: 5000/ # port: 5000/' $(4G_CORE_VALUES)
Andy Bavierebf479c2021-09-08 15:47:58 -0700353 sed -i 's/provision-network-slice: false/provision-network-slice: true/' $(5G_CORE_VALUES)
354 sed -i 's/ syncUrl/ # syncUrl/' $(5G_CORE_VALUES)
Amit Wankhedefdf10ff2022-02-16 08:37:20 -0600355 sed -i 's/ sub-proxy-endpt:/ # sub-proxy-endpt:/' $(5G_CORE_VALUES)
356 sed -i 's/ addr: sub/ # addr: sub/' $(5G_CORE_VALUES)
357 sed -i 's/ port: 5000/ # port: 5000/' $(5G_CORE_VALUES)
Andy Bavierebf479c2021-09-08 15:47:58 -0700358 kubectl delete namespace aether-roc || true
359 rm -rf $(M)/roc
360
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600361omec-clean:
362 helm delete -n omec $$(helm -n omec ls -qa) || true
363 @echo ""
364 @echo "Wait for all pods to terminate..."
365 kubectl wait -n omec --for=delete --all=true -l app!=ue pod --timeout=180s || true
366
367router-clean:
368 @kubectl delete net-attach-def router-net 2>/dev/null || true
369 @kubectl delete po router 2>/dev/null || true
370 kubectl wait --for=delete -l app=router pod --timeout=180s 2>/dev/null || true
371 sudo ip link del access || true
372 sudo ip link del core || true
373 $(eval oiface := $(shell ip route list default | awk -F 'dev' '{ print $$2; exit }' | awk '{ print $$1 }'))
374 sudo iptables -t nat -D POSTROUTING -s 172.250.0.0/16 -o $(oiface) -j MASQUERADE || true
375 @sudo ip link del data 2>/dev/null || true
376 @cd $(M); rm -f router-pod router-host
377
378oaisim-clean: reset-ue
379 @sudo ip addr del 127.0.0.2/8 dev lo 2>/dev/null || true
380 @sudo ip link del enb 2>/dev/null || true
381 @sudo ip route del 192.168.252.0/24 || true
382 @cd $(M); rm -f oaisim-lo
383
384test: | 4g-core $(M)/oaisim
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700385 @sleep 5
386 @echo "Test1: ping from UE to SGI network gateway"
Hyunsun Moon0bd8cec2020-09-28 00:38:26 -0500387 ping -I oip1 192.168.250.1 -c 15
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700388 @echo "Test2: ping from UE to 8.8.8.8"
389 ping -I oip1 8.8.8.8 -c 3
Hyunsun Moon0bd8cec2020-09-28 00:38:26 -0500390 @echo "Test3: ping from UE to google.com"
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700391 ping -I oip1 google.com -c 3
392 @echo "Finished to test"
393
Hyunsun Mooncbdac112022-03-19 22:01:27 -06003945g-test: | 5g-core
Andy Bavier31dfb9e2022-02-15 15:24:57 -0700395 @if [[ "${CHARTS}" == "release-1.6" ]]; then echo "[NOTE] 5G Test not supported for Aether 1.6, exiting..."; exit 1; fi
Andy Bavier0a055a52022-01-07 10:46:17 -0700396 @echo "Test: Registration + UE initiated PDU Session Establishment + User Data packets"
Andy Bavier0e4906f2022-03-03 15:31:48 -0700397 @sleep 60
Andy Bavier0a055a52022-01-07 10:46:17 -0700398 @rm -f /tmp/gnbsim.out
Andy Baviercd93a202022-01-10 18:03:26 -0800399 @if [[ ${GNBSIM_COLORS} == "true" ]]; then \
400 kubectl -n omec exec gnbsim-0 -- ./gnbsim 2>&1 | tee /tmp/gnbsim.out; \
401 else \
402 kubectl -n omec exec gnbsim-0 -- ./gnbsim 2>&1 | sed -u "s,\x1B\[[0-9;]*[a-zA-Z],,g" | tee /tmp/gnbsim.out; \
403 fi
Andy Bavier094d6ef2022-03-08 13:21:52 -0700404 @grep -q "Simulation Result: PASS" /tmp/gnbsim.out
Andy Bavier0a055a52022-01-07 10:46:17 -0700405
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600406reset-test: | oaisim-clean omec-clean router-clean
407 @cd $(M); rm -f omec oaisim 5g-core
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700408
Andy Bavier8819b9f2022-01-28 16:54:06 -0700409reset-ue:
410 helm delete -n omec oaisim || true
411 kubectl wait -n omec --for=delete pod enb-0 || true
412 kubectl wait -n omec --for=delete pod ue-0 || true
413 cd $(M); rm -f oaisim
414
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600415reset-5g-test: omec-clean
Badhrinath3e081e22020-12-02 15:02:08 -0600416 cd $(M); rm -f 5g-core
417
Osman Amjad488a0222022-01-12 11:58:43 -0600418reset-dbtestapp:
419 helm uninstall --namespace omec 5g-test-app
420
421dbtestapp:
422 helm repo update
423 if [ "$(CHARTS)" == "local" ]; then helm dep up $(5G_TEST_APPS_CHART); fi
424 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
425 --namespace omec \
426 5g-test-app \
427 --values $(TEST_APP_VALUES) \
428 $(5G_TEST_APPS_CHART)
429 @echo "Finished to dbtestapp"
430
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600431clean: | oaisim-clean router-clean
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700432 source "$(VENV)/bin/activate" && cd $(BUILD)/kubespray; \
Andy Bavier125baa02021-10-26 16:26:44 -0700433 ansible-playbook -b -i inventory/local/hosts.ini reset.yml --extra-vars "reset_confirmation=yes"
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700434 @if [ -d /usr/local/etc/emulab ]; then \
435 mount | grep /mnt/extra/kubelet/pods | cut -d" " -f3 | sudo xargs umount; \
436 sudo rm -rf /mnt/extra/kubelet; \
437 fi
438 rm -rf $(M)