blob: 63be4275dae664e429d80efc864f140cc3f558d2 [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
Hyunsun Moon4e5795a2022-04-07 09:27:12 -070039
40NODE_IP ?= $(shell ip route get 8.8.8.8 | grep -oP 'src \K\S+')
41ifndef NODE_IP
42$(error NODE_IP is not set)
43endif
44
Hyunsun Mooncbdac112022-03-19 22:01:27 -060045MME_IP ?=
46
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070047HELM_GLOBAL_ARGS ?=
Andy Baviereda466b2021-08-27 15:00:36 -070048
49# Allow installing local charts or specific versions of published charts.
50# E.g., to install the Aether 1.5 release:
51# CHARTS=release-1.5 make test
52# Default is to install from the local charts.
53CHARTS ?= local
54CONFIGFILE := configs/$(CHARTS)
55include $(CONFIGFILE)
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070056
57cpu_family := $(shell lscpu | grep 'CPU family:' | awk '{print $$3}')
58cpu_model := $(shell lscpu | grep 'Model:' | awk '{print $$2}')
59os_vendor := $(shell lsb_release -i -s)
60os_release := $(shell lsb_release -r -s)
Andy Bavier9ee69d02022-02-11 10:31:21 -070061USER := $(shell whoami)
62
Hyunsun Mooncbdac112022-03-19 22:01:27 -060063.PHONY: 4g-core 5g-core oaisim test reset-test reset-ue reset-5g-test clean
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070064
65$(M):
66 mkdir -p $(M)
67
68$(M)/system-check: | $(M)
69 @if [[ $(cpu_family) -eq 6 ]]; then \
70 if [[ $(cpu_model) -lt 60 ]]; then \
71 echo "FATAL: haswell CPU or newer is required."; \
72 exit 1; \
73 fi \
74 else \
75 echo "FATAL: unsupported CPU family."; \
76 exit 1; \
77 fi
78 @if [[ $(os_vendor) =~ (Ubuntu) ]]; then \
Hyunsun7b640512020-10-27 19:49:51 -050079 if [[ ! $(os_release) =~ (18.04) ]]; then \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070080 echo "WARN: $(os_vendor) $(os_release) has not been tested."; \
81 fi; \
82 if dpkg --compare-versions 4.15 gt $(shell uname -r); then \
83 echo "FATAL: kernel 4.15 or later is required."; \
84 echo "Please upgrade your kernel by running" \
85 "apt install --install-recommends linux-generic-hwe-$(os_release)"; \
86 exit 1; \
87 fi \
88 else \
89 echo "FAIL: unsupported OS."; \
90 exit 1; \
91 fi
92 touch $@
93
94$(M)/setup: | $(M)
95 sudo $(SCRIPTDIR)/cloudlab-disksetup.sh
Hyunsun Moon82e47c22021-06-28 12:30:20 -050096 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 -070097 touch $@
98
99$(BUILD)/kubespray: | $(M)/setup
100 mkdir -p $(BUILD)
101 cd $(BUILD); git clone https://github.com/kubernetes-incubator/kubespray.git -b $(KUBESPRAY_VERSION)
102
103$(VENV)/bin/activate: | $(M)/setup
Hyunsun Moon82e47c22021-06-28 12:30:20 -0500104 python3 -m venv $(VENV)
Wei-Yu Chen7edb7e72021-07-28 11:37:55 +0800105 source "$(VENV)/bin/activate" && \
106 python -m pip install -U pip && \
107 deactivate
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700108
109$(M)/kubespray-requirements: $(BUILD)/kubespray | $(VENV)/bin/activate
110 source "$(VENV)/bin/activate" && \
111 pip install -r $(BUILD)/kubespray/requirements.txt
112 touch $@
113
114$(M)/k8s-ready: | $(M)/setup $(BUILD)/kubespray $(VENV)/bin/activate $(M)/kubespray-requirements
115 source "$(VENV)/bin/activate" && cd $(BUILD)/kubespray; \
116 ansible-playbook -b -i inventory/local/hosts.ini \
117 -e "{'override_system_hostname' : False, 'disable_swap' : True}" \
118 -e "{'docker_version' : $(DOCKER_VERSION)}" \
119 -e "{'docker_iptables_enabled' : True}" \
120 -e "{'kube_version' : $(K8S_VERSION)}" \
Hyunsun84f0f172020-09-23 15:40:08 -0500121 -e "{'kube_network_plugin_multus' : True, 'multus_version' : stable, 'multus_cni_version' : 0.3.1}" \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700122 -e "{'kube_proxy_metrics_bind_address' : 0.0.0.0:10249}" \
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600123 -e "{'kube_pods_subnet' : 192.168.84.0/24, 'kube_service_addresses' : 192.168.85.0/24}" \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700124 -e "{'kube_apiserver_node_port_range' : 2000-36767}" \
125 -e "{'kubeadm_enabled': True}" \
126 -e "{'kube_feature_gates' : [SCTPSupport=True]}" \
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600127 -e "{'kubelet_custom_flags' : [--allowed-unsafe-sysctls=net.*, --node-ip=$(NODE_IP)]}" \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700128 -e "{'dns_min_replicas' : 1}" \
129 -e "{'helm_enabled' : True, 'helm_version' : $(HELM_VERSION)}" \
130 cluster.yml
131 mkdir -p $(HOME)/.kube
132 sudo cp -f /etc/kubernetes/admin.conf $(HOME)/.kube/config
133 sudo chown $(shell id -u):$(shell id -g) $(HOME)/.kube/config
134 kubectl wait pod -n kube-system --for=condition=Ready --all
Andy Bavier9ee69d02022-02-11 10:31:21 -0700135 sudo adduser $(USER) docker
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700136 touch $@
137
138$(M)/helm-ready: | $(M)/k8s-ready
Woojoong Kim8425cb32021-01-08 16:18:53 -0800139 helm repo add incubator https://charts.helm.sh/incubator
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700140 helm repo add cord https://charts.opencord.org
Andy Baviereda466b2021-08-27 15:00:36 -0700141 helm repo add atomix https://charts.atomix.io
142 helm repo add onosproject https://charts.onosproject.org
Andy Bavier9ee69d02022-02-11 10:31:21 -0700143 helm repo add aether https://charts.aetherproject.org
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700144 touch $@
145
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700146/opt/cni/bin/static: | $(M)/k8s-ready
147 mkdir -p $(BUILD)/cni-plugins; cd $(BUILD)/cni-plugins; \
148 wget https://github.com/containernetworking/plugins/releases/download/v0.8.2/cni-plugins-linux-amd64-v0.8.2.tgz && \
149 tar xvfz cni-plugins-linux-amd64-v0.8.2.tgz
150 sudo cp $(BUILD)/cni-plugins/static /opt/cni/bin/
151
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600152node-prep: | $(M)/helm-ready /opt/cni/bin/static
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700153
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600154$(M)/router-pod:
155 sudo ip link add $(DATA_IFACE) type dummy || true;
156 sudo ip link set $(DATA_IFACE) up || true;
157 DATA_IFACE=$(DATA_IFACE) envsubst < $(RESOURCEDIR)/router.yaml | kubectl apply -f -
158 kubectl wait pod -n default --for=condition=Ready -l app=router --timeout=300s
159 @touch $@
160
161$(M)/router-host:
162 sudo ip link add core link $(DATA_IFACE) type macvlan mode bridge
163 sudo ip link set core up
164 sudo ip addr add 192.168.250.1/24 dev core
165 sudo ip link add access link $(DATA_IFACE) type macvlan mode bridge
166 sudo ip link set access up
167 sudo ip addr add 192.168.252.1/24 dev access
168 sudo sysctl -w net.ipv4.ip_forward=1;
169 $(eval oiface := $(shell ip route list default | awk -F 'dev' '{ print $$2; exit }' | awk '{ print $$1 }'))
170 sudo ip route add 172.250.0.0/16 via 192.168.250.3
171 sudo iptables -t nat -A POSTROUTING -s 172.250.0.0/16 -o $(oiface) -j MASQUERADE
172 @touch $@
173
1744g-core: node-prep
175ifeq ($(ENABLE_ROUTER),true)
176ifeq ($(ENABLE_OAISIM),true)
1774g-core: $(M)/router-pod
178else
1794g-core: $(M)/router-host
180endif
181endif
1824g-core: $(M)/omec
183$(M)/omec:
184 @if [[ "${CHARTS}" == "local" || "${CHARTS}" == "local-sdcore" ]]; then \
185 helm dep up $(SD_CORE_CHART); \
186 else \
187 helm repo update; \
188 fi
189 NODE_IP=${NODE_IP} DATA_IFACE=${DATA_IFACE} RAN_SUBNET=${RAN_SUBNET} envsubst < $(4G_CORE_VALUES) | \
190 helm upgrade --create-namespace --install --wait $(HELM_GLOBAL_ARGS) \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700191 --namespace omec \
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600192 --values - \
Andy Bavier31dfb9e2022-02-15 15:24:57 -0700193 sd-core \
194 $(SD_CORE_CHART)
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600195 @if [[ "${ENABLE_OAISIM}" == "false" ]]; then \
196 $(eval mme_ip := $(shell ip -4 -o addr show $${DATA_IFACE} | awk '{print $$4}' | cut -d'/' -f1)) \
197 echo "Your MME IP is $(mme_ip)"; \
198 fi
199 @touch $@
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700200
Hyunsun Mooncbdac112022-03-19 22:01:27 -06002015g-core: node-prep
202ifeq ($(ENABLE_ROUTER),true)
203ifeq ($(ENABLE_GNBSIM),true)
2045g-core: $(M)/router-pod
205else
2065g-core: $(M)/router-host
207endif
208endif
2095g-core: $(M)/5g-core
210$(M)/5g-core:
211 @if [[ "${CHARTS}" == "local" || "${CHARTS}" == "local-sdcore" ]]; then \
212 helm dep up $(SD_CORE_CHART); \
213 else \
214 helm repo update; \
215 fi
216 NODE_IP=${NODE_IP} DATA_IFACE=${DATA_IFACE} RAN_SUBNET=${RAN_SUBNET} envsubst < $(5G_CORE_VALUES) | \
217 helm upgrade --create-namespace --install --wait $(HELM_GLOBAL_ARGS) \
Badhrinath3e081e22020-12-02 15:02:08 -0600218 --namespace omec \
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600219 --values - \
Andy Bavier31dfb9e2022-02-15 15:24:57 -0700220 sd-core \
221 $(SD_CORE_CHART)
Badhrinath3e081e22020-12-02 15:02:08 -0600222 touch $@
223
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700224# UE images includes kernel module, ue_ip.ko
225# which should be built in the exactly same kernel version of the host machine
226$(BUILD)/openairinterface: | $(M)/setup
227 mkdir -p $(BUILD)
228 cd $(BUILD); git clone https://github.com/opencord/openairinterface.git
229
Andy Bavierd6de5612021-11-08 10:39:17 -0700230download-ue-image: | $(M)/k8s-ready
Andy Bavier9ee69d02022-02-11 10:31:21 -0700231 sg docker -c "docker pull ${OAISIM_UE_IMAGE} && \
232 docker tag ${OAISIM_UE_IMAGE} omecproject/lte-uesoftmodem:1.1.0"
Andy Bavierd6de5612021-11-08 10:39:17 -0700233 touch $(M)/ue-image
234
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700235$(M)/ue-image: | $(M)/k8s-ready $(BUILD)/openairinterface
236 cd $(BUILD)/openairinterface; \
Andy Bavier9ee69d02022-02-11 10:31:21 -0700237 sg docker -c "docker build . --target lte-uesoftmodem \
Hyunsun7b640512020-10-27 19:49:51 -0500238 --build-arg build_base=omecproject/oai-base:1.1.0 \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700239 --file Dockerfile.ue \
Andy Bavier9ee69d02022-02-11 10:31:21 -0700240 --tag omecproject/lte-uesoftmodem:1.1.0"
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700241 touch $@
242
Andy Bavier9ee69d02022-02-11 10:31:21 -0700243$(M)/oaisim-lo:
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600244 @sudo ip addr add 127.0.0.2/8 dev lo || true
245 @touch $@
Andy Bavier9ee69d02022-02-11 10:31:21 -0700246
Andy Bavier7b01b682022-03-17 13:26:55 -0700247oaisim-standalone: | $(M)/helm-ready $(M)/ue-image $(M)/oaisim-lo
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600248 @ip link show $(DATA_IFACE) > /dev/null || (echo DATA_IFACE is not set or does not exist; exit 1)
249 @if [[ "${MME_IP}" == "" ]]; then \
250 echo MME_IP is not set; \
251 exit 1; \
252 else \
253 ping -c 3 $(MME_IP) > /dev/null || (echo MME $(MME_IP) is not reachable; exit 1) \
254 fi
255 sudo ip route add 192.168.252.0/24 via $(MME_IP)
Andy Bavier7b01b682022-03-17 13:26:55 -0700256 helm repo update
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600257 helm upgrade --create-namespace --install $(HELM_GLOBAL_ARGS) --namespace omec oaisim cord/oaisim -f $(OAISIM_VALUES) \
258 --set config.enb.networks.s1u.interface=$(DATA_IFACE) \
259 --set config.enb.networks.s1_mme.interface=$(DATA_IFACE) \
260 --set config.enb.mme.address=$(MME_IP) \
261 --set config.enb.mme.isLocal=false \
262 --set images.pullPolicy=IfNotPresent
Andy Bavier7b01b682022-03-17 13:26:55 -0700263 kubectl rollout status -n omec statefulset ue
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600264 @echo "Test: registration"
Andy Bavier7b01b682022-03-17 13:26:55 -0700265 @timeout 60s bash -c \
266 "until ip addr show oip1 | grep -q inet; \
267 do \
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600268 echo 'Waiting for UE 1 gets IP address'; \
269 sleep 3; \
Andy Bavier7b01b682022-03-17 13:26:55 -0700270 done"
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600271 @echo "Test: ping from UE to 8.8.8.8"
272 ping -I oip1 8.8.8.8 -c 3
273 @touch $(M)/oaisim $(M)/omec
Andy Bavier7b01b682022-03-17 13:26:55 -0700274
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600275oaisim: | $(M)/oaisim
276$(M)/oaisim: | $(M)/ue-image $(M)/router-pod $(M)/oaisim-lo
277 sudo ip link add enb link $(DATA_IFACE) type macvlan mode bridge || true
278 sudo ip link set enb up || true
279 sudo ip addr add 192.168.251.3/24 dev enb || true
280 sudo ip route add 192.168.252.0/24 via 192.168.251.1 || true
281 helm upgrade --create-namespace --install $(HELM_GLOBAL_ARGS) --namespace omec oaisim cord/oaisim -f $(OAISIM_VALUES) \
Jeremy Ronquilloaf084f32020-08-24 13:18:47 -0700282 --set images.pullPolicy=IfNotPresent
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700283 kubectl rollout status -n omec statefulset ue
284 @timeout 60s bash -c \
285 "until ip addr show oip1 | grep -q inet; \
286 do \
287 echo 'Waiting for UE 1 gets IP address'; \
288 sleep 3; \
289 done"
290 touch $@
291
Andy Bavierebf479c2021-09-08 15:47:58 -0700292roc: $(M)/roc
293$(M)/roc: $(M)/helm-ready
294 kubectl get namespace aether-roc 2> /dev/null || kubectl create namespace aether-roc
295 helm repo update
296 if [ "$(CHARTS)" == "local" ]; then helm dep up $(AETHER_ROC_UMBRELLA_CHART); fi
297 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
298 --namespace kube-system \
299 --values $(ROC_VALUES) \
300 atomix-controller \
301 $(ATOMIX_CONTROLLER_CHART)
302 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
303 --namespace kube-system \
304 --values $(ROC_VALUES) \
305 atomix-raft-storage \
306 $(ATOMIX_RAFT_STORAGE_CHART)
307 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
308 --namespace kube-system \
309 --values $(ROC_VALUES) \
310 onos-operator \
311 $(ONOS_OPERATOR_CHART)
312 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
313 --namespace aether-roc \
314 --values $(ROC_VALUES) \
315 aether-roc-umbrella \
316 $(AETHER_ROC_UMBRELLA_CHART)
317 touch $@
318
319# Load the ROC 4G models. Disable loading network slice from SimApp.
320roc-4g-models: $(M)/roc
321 sed -i 's/provision-network-slice: true/provision-network-slice: false/' $(4G_CORE_VALUES)
322 sed -i 's/# syncUrl/syncUrl/' $(4G_CORE_VALUES)
Amit Wankhede01b20c32021-12-01 12:45:58 +0530323 if [ "${ENABLE_SUBSCRIBER_PROXY}" == "true" ] ; then \
Amit Wankhedefdf10ff2022-02-16 08:37:20 -0600324 sed -i 's/# sub-proxy-endpt:/sub-proxy-endpt:/' $(4G_CORE_VALUES) ; \
325 sed -i 's/# addr: sub/ addr: sub/' $(4G_CORE_VALUES) ; \
326 sed -i 's/# port: 5000/ port: 5000/' $(4G_CORE_VALUES) ; \
Amit Wankhede01b20c32021-12-01 12:45:58 +0530327 fi
Andy Bavierebf479c2021-09-08 15:47:58 -0700328 $(eval ONOS_CLI_POD := $(shell kubectl -n aether-roc get pods -l name=onos-cli -o name))
329 echo "ONOS CLI pod: ${ONOS_CLI_POD}"
330 until kubectl -n aether-roc exec ${ONOS_CLI_POD} -- \
331 curl -s -f -L -X PATCH "http://aether-roc-api:8181/aether-roc-api" \
332 --header 'Content-Type: application/json' \
333 --data-raw "$$(cat ${ROC_4G_MODELS})"; do sleep 5; done
334
335# Load the ROC 5G models. Disable loading network slice from SimApp.
336roc-5g-models: $(M)/roc
337 sed -i 's/provision-network-slice: true/provision-network-slice: false/' $(5G_CORE_VALUES)
338 sed -i 's/# syncUrl/syncUrl/' $(5G_CORE_VALUES)
Amit Wankhede01b20c32021-12-01 12:45:58 +0530339 if [ "${ENABLE_SUBSCRIBER_PROXY}" == "true" ] ; then \
Amit Wankhedefdf10ff2022-02-16 08:37:20 -0600340 sed -i 's/# sub-proxy-endpt:/sub-proxy-endpt:/' $(5G_CORE_VALUES) ; \
341 sed -i 's/# addr: sub/ addr: sub/' $(5G_CORE_VALUES) ; \
342 sed -i 's/# port: 5000/ port: 5000/' $(5G_CORE_VALUES) ; \
Amit Wankhede01b20c32021-12-01 12:45:58 +0530343 fi
Andy Bavierebf479c2021-09-08 15:47:58 -0700344 $(eval ONOS_CLI_POD := $(shell kubectl -n aether-roc get pods -l name=onos-cli -o name))
345 echo "ONOS CLI pod: ${ONOS_CLI_POD}"
346 until kubectl -n aether-roc exec ${ONOS_CLI_POD} -- \
347 curl -s -f -L -X PATCH "http://aether-roc-api:8181/aether-roc-api" \
348 --header 'Content-Type: application/json' \
349 --data-raw "$$(cat ${ROC_5G_MODELS})"; do sleep 5; done
350
351roc-clean:
352 @echo "This could take 2-3 minutes..."
353 sed -i 's/provision-network-slice: false/provision-network-slice: true/' $(4G_CORE_VALUES)
354 sed -i 's/ syncUrl/ # syncUrl/' $(4G_CORE_VALUES)
Amit Wankhedefdf10ff2022-02-16 08:37:20 -0600355 sed -i 's/ sub-proxy-endpt:/ # sub-proxy-endpt:/' $(4G_CORE_VALUES)
356 sed -i 's/ addr: sub/ # addr: sub/' $(4G_CORE_VALUES)
357 sed -i 's/ port: 5000/ # port: 5000/' $(4G_CORE_VALUES)
Andy Bavierebf479c2021-09-08 15:47:58 -0700358 sed -i 's/provision-network-slice: false/provision-network-slice: true/' $(5G_CORE_VALUES)
359 sed -i 's/ syncUrl/ # syncUrl/' $(5G_CORE_VALUES)
Amit Wankhedefdf10ff2022-02-16 08:37:20 -0600360 sed -i 's/ sub-proxy-endpt:/ # sub-proxy-endpt:/' $(5G_CORE_VALUES)
361 sed -i 's/ addr: sub/ # addr: sub/' $(5G_CORE_VALUES)
362 sed -i 's/ port: 5000/ # port: 5000/' $(5G_CORE_VALUES)
Andy Bavierebf479c2021-09-08 15:47:58 -0700363 kubectl delete namespace aether-roc || true
364 rm -rf $(M)/roc
365
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600366omec-clean:
367 helm delete -n omec $$(helm -n omec ls -qa) || true
368 @echo ""
369 @echo "Wait for all pods to terminate..."
370 kubectl wait -n omec --for=delete --all=true -l app!=ue pod --timeout=180s || true
371
372router-clean:
373 @kubectl delete net-attach-def router-net 2>/dev/null || true
374 @kubectl delete po router 2>/dev/null || true
375 kubectl wait --for=delete -l app=router pod --timeout=180s 2>/dev/null || true
376 sudo ip link del access || true
377 sudo ip link del core || true
378 $(eval oiface := $(shell ip route list default | awk -F 'dev' '{ print $$2; exit }' | awk '{ print $$1 }'))
379 sudo iptables -t nat -D POSTROUTING -s 172.250.0.0/16 -o $(oiface) -j MASQUERADE || true
380 @sudo ip link del data 2>/dev/null || true
381 @cd $(M); rm -f router-pod router-host
382
383oaisim-clean: reset-ue
384 @sudo ip addr del 127.0.0.2/8 dev lo 2>/dev/null || true
385 @sudo ip link del enb 2>/dev/null || true
386 @sudo ip route del 192.168.252.0/24 || true
387 @cd $(M); rm -f oaisim-lo
388
389test: | 4g-core $(M)/oaisim
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700390 @sleep 5
391 @echo "Test1: ping from UE to SGI network gateway"
Hyunsun Moon0bd8cec2020-09-28 00:38:26 -0500392 ping -I oip1 192.168.250.1 -c 15
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700393 @echo "Test2: ping from UE to 8.8.8.8"
394 ping -I oip1 8.8.8.8 -c 3
Hyunsun Moon0bd8cec2020-09-28 00:38:26 -0500395 @echo "Test3: ping from UE to google.com"
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700396 ping -I oip1 google.com -c 3
397 @echo "Finished to test"
398
Hyunsun Mooncbdac112022-03-19 22:01:27 -06003995g-test: | 5g-core
Andy Bavier31dfb9e2022-02-15 15:24:57 -0700400 @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 -0700401 @echo "Test: Registration + UE initiated PDU Session Establishment + User Data packets"
Andy Bavier0e4906f2022-03-03 15:31:48 -0700402 @sleep 60
Andy Bavier0a055a52022-01-07 10:46:17 -0700403 @rm -f /tmp/gnbsim.out
Andy Baviercd93a202022-01-10 18:03:26 -0800404 @if [[ ${GNBSIM_COLORS} == "true" ]]; then \
405 kubectl -n omec exec gnbsim-0 -- ./gnbsim 2>&1 | tee /tmp/gnbsim.out; \
406 else \
407 kubectl -n omec exec gnbsim-0 -- ./gnbsim 2>&1 | sed -u "s,\x1B\[[0-9;]*[a-zA-Z],,g" | tee /tmp/gnbsim.out; \
408 fi
Andy Bavier094d6ef2022-03-08 13:21:52 -0700409 @grep -q "Simulation Result: PASS" /tmp/gnbsim.out
Andy Bavier0a055a52022-01-07 10:46:17 -0700410
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600411reset-test: | oaisim-clean omec-clean router-clean
412 @cd $(M); rm -f omec oaisim 5g-core
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700413
Andy Bavier8819b9f2022-01-28 16:54:06 -0700414reset-ue:
415 helm delete -n omec oaisim || true
416 kubectl wait -n omec --for=delete pod enb-0 || true
417 kubectl wait -n omec --for=delete pod ue-0 || true
418 cd $(M); rm -f oaisim
419
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600420reset-5g-test: omec-clean
Badhrinath3e081e22020-12-02 15:02:08 -0600421 cd $(M); rm -f 5g-core
422
Osman Amjad488a0222022-01-12 11:58:43 -0600423reset-dbtestapp:
424 helm uninstall --namespace omec 5g-test-app
425
426dbtestapp:
427 helm repo update
428 if [ "$(CHARTS)" == "local" ]; then helm dep up $(5G_TEST_APPS_CHART); fi
429 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
430 --namespace omec \
431 5g-test-app \
432 --values $(TEST_APP_VALUES) \
433 $(5G_TEST_APPS_CHART)
434 @echo "Finished to dbtestapp"
435
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600436clean: | oaisim-clean router-clean
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700437 source "$(VENV)/bin/activate" && cd $(BUILD)/kubespray; \
Andy Bavier125baa02021-10-26 16:26:44 -0700438 ansible-playbook -b -i inventory/local/hosts.ini reset.yml --extra-vars "reset_confirmation=yes"
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700439 @if [ -d /usr/local/etc/emulab ]; then \
440 mount | grep /mnt/extra/kubelet/pods | cut -d" " -f3 | sudo xargs umount; \
441 sudo rm -rf /mnt/extra/kubelet; \
442 fi
443 rm -rf $(M)