blob: 1b3334bb4672e31deb01ca915934cedf31724d0f [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
23DOCKER_VERSION ?= '20.10'
24K8S_VERSION ?= v1.20.11
25HELM_VERSION ?= v3.6.3
Amit Wankhede01b20c32021-12-01 12:45:58 +053026ENABLE_SUBSCRIBER_PROXY ?= false
Andy Baviercd93a202022-01-10 18:03:26 -080027GNBSIM_COLORS ?= true
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070028
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070029HELM_GLOBAL_ARGS ?=
Andy Baviereda466b2021-08-27 15:00:36 -070030
31# Allow installing local charts or specific versions of published charts.
32# E.g., to install the Aether 1.5 release:
33# CHARTS=release-1.5 make test
34# Default is to install from the local charts.
35CHARTS ?= local
36CONFIGFILE := configs/$(CHARTS)
37include $(CONFIGFILE)
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070038
39cpu_family := $(shell lscpu | grep 'CPU family:' | awk '{print $$3}')
40cpu_model := $(shell lscpu | grep 'Model:' | awk '{print $$2}')
41os_vendor := $(shell lsb_release -i -s)
42os_release := $(shell lsb_release -r -s)
Andy Bavier9ee69d02022-02-11 10:31:21 -070043USER := $(shell whoami)
44
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070045
Badhrinath3e081e22020-12-02 15:02:08 -060046omec: $(M)/system-check $(M)/omec
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070047oaisim: $(M)/oaisim
Badhrinath3e081e22020-12-02 15:02:08 -0600485gc: $(M)/system-check $(M)/5g-core
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070049
Andy Bavier8819b9f2022-01-28 16:54:06 -070050.PHONY: omec oaisim 5gc test reset-test reset-ue 5g-core reset-5g-test clean
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070051
52$(M):
53 mkdir -p $(M)
54
55$(M)/system-check: | $(M)
56 @if [[ $(cpu_family) -eq 6 ]]; then \
57 if [[ $(cpu_model) -lt 60 ]]; then \
58 echo "FATAL: haswell CPU or newer is required."; \
59 exit 1; \
60 fi \
61 else \
62 echo "FATAL: unsupported CPU family."; \
63 exit 1; \
64 fi
65 @if [[ $(os_vendor) =~ (Ubuntu) ]]; then \
Hyunsun7b640512020-10-27 19:49:51 -050066 if [[ ! $(os_release) =~ (18.04) ]]; then \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070067 echo "WARN: $(os_vendor) $(os_release) has not been tested."; \
68 fi; \
69 if dpkg --compare-versions 4.15 gt $(shell uname -r); then \
70 echo "FATAL: kernel 4.15 or later is required."; \
71 echo "Please upgrade your kernel by running" \
72 "apt install --install-recommends linux-generic-hwe-$(os_release)"; \
73 exit 1; \
74 fi \
75 else \
76 echo "FAIL: unsupported OS."; \
77 exit 1; \
78 fi
79 touch $@
80
81$(M)/setup: | $(M)
82 sudo $(SCRIPTDIR)/cloudlab-disksetup.sh
Hyunsun Moon82e47c22021-06-28 12:30:20 -050083 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 -070084 touch $@
85
86$(BUILD)/kubespray: | $(M)/setup
87 mkdir -p $(BUILD)
88 cd $(BUILD); git clone https://github.com/kubernetes-incubator/kubespray.git -b $(KUBESPRAY_VERSION)
89
90$(VENV)/bin/activate: | $(M)/setup
Hyunsun Moon82e47c22021-06-28 12:30:20 -050091 python3 -m venv $(VENV)
Wei-Yu Chen7edb7e72021-07-28 11:37:55 +080092 source "$(VENV)/bin/activate" && \
93 python -m pip install -U pip && \
94 deactivate
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070095
96$(M)/kubespray-requirements: $(BUILD)/kubespray | $(VENV)/bin/activate
97 source "$(VENV)/bin/activate" && \
98 pip install -r $(BUILD)/kubespray/requirements.txt
99 touch $@
100
101$(M)/k8s-ready: | $(M)/setup $(BUILD)/kubespray $(VENV)/bin/activate $(M)/kubespray-requirements
102 source "$(VENV)/bin/activate" && cd $(BUILD)/kubespray; \
103 ansible-playbook -b -i inventory/local/hosts.ini \
104 -e "{'override_system_hostname' : False, 'disable_swap' : True}" \
105 -e "{'docker_version' : $(DOCKER_VERSION)}" \
106 -e "{'docker_iptables_enabled' : True}" \
107 -e "{'kube_version' : $(K8S_VERSION)}" \
Hyunsun84f0f172020-09-23 15:40:08 -0500108 -e "{'kube_network_plugin_multus' : True, 'multus_version' : stable, 'multus_cni_version' : 0.3.1}" \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700109 -e "{'kube_proxy_metrics_bind_address' : 0.0.0.0:10249}" \
110 -e "{'kube_pods_subnet' : 192.168.0.0/17, 'kube_service_addresses' : 192.168.128.0/17}" \
111 -e "{'kube_apiserver_node_port_range' : 2000-36767}" \
112 -e "{'kubeadm_enabled': True}" \
113 -e "{'kube_feature_gates' : [SCTPSupport=True]}" \
114 -e "{'kubelet_custom_flags' : [--allowed-unsafe-sysctls=net.*]}" \
115 -e "{'dns_min_replicas' : 1}" \
116 -e "{'helm_enabled' : True, 'helm_version' : $(HELM_VERSION)}" \
117 cluster.yml
118 mkdir -p $(HOME)/.kube
119 sudo cp -f /etc/kubernetes/admin.conf $(HOME)/.kube/config
120 sudo chown $(shell id -u):$(shell id -g) $(HOME)/.kube/config
121 kubectl wait pod -n kube-system --for=condition=Ready --all
Andy Bavier9ee69d02022-02-11 10:31:21 -0700122 sudo adduser $(USER) docker
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700123 touch $@
124
125$(M)/helm-ready: | $(M)/k8s-ready
Woojoong Kim8425cb32021-01-08 16:18:53 -0800126 helm repo add incubator https://charts.helm.sh/incubator
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700127 helm repo add cord https://charts.opencord.org
Andy Baviereda466b2021-08-27 15:00:36 -0700128 helm repo add atomix https://charts.atomix.io
129 helm repo add onosproject https://charts.onosproject.org
Andy Bavier9ee69d02022-02-11 10:31:21 -0700130 helm repo add aether https://charts.aetherproject.org
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700131 touch $@
132
Andy Bavier9ee69d02022-02-11 10:31:21 -0700133node-prep: | $(M)/k8s-ready $(M)/fabric $(M)/oaisim-lo
134
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700135/opt/cni/bin/simpleovs: | $(M)/k8s-ready
136 sudo cp $(RESOURCEDIR)/simpleovs /opt/cni/bin/
137
138/opt/cni/bin/static: | $(M)/k8s-ready
139 mkdir -p $(BUILD)/cni-plugins; cd $(BUILD)/cni-plugins; \
140 wget https://github.com/containernetworking/plugins/releases/download/v0.8.2/cni-plugins-linux-amd64-v0.8.2.tgz && \
141 tar xvfz cni-plugins-linux-amd64-v0.8.2.tgz
142 sudo cp $(BUILD)/cni-plugins/static /opt/cni/bin/
143
144# TODO: need to connect ONOS
145$(M)/fabric: | $(M)/setup /opt/cni/bin/simpleovs /opt/cni/bin/static
146 sudo apt install -y openvswitch-switch
147 sudo ovs-vsctl --may-exist add-br br-enb-net
148 sudo ovs-vsctl --may-exist add-port br-enb-net enb -- set Interface enb type=internal
149 sudo ip addr add 192.168.251.4/24 dev enb || true
150 sudo ip link set enb up
151 sudo ethtool --offload enb tx off
152 sudo ip route replace 192.168.252.0/24 via 192.168.251.1 dev enb
153 kubectl apply -f $(RESOURCEDIR)/router.yaml
154 kubectl wait pod -n default --for=condition=Ready -l app=router --timeout=300s
Andy Baviereda466b2021-08-27 15:00:36 -0700155 kubectl -n default exec router -- ip route add 172.250.0.0/16 via 192.168.250.3
Jeremy Ronquilloaf084f32020-08-24 13:18:47 -0700156 kubectl delete net-attach-def core-net
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700157 touch $@
158
Andy Bavier7b01b682022-03-17 13:26:55 -07001594g-core: | $(M)/omec
Andy Baviere9690892022-03-14 18:04:09 -0700160$(M)/omec: | $(M)/helm-ready /opt/cni/bin/simpleovs /opt/cni/bin/static $(M)/fabric
Scott Baker17b70d12020-09-29 23:26:21 -0700161 kubectl get namespace omec 2> /dev/null || kubectl create namespace omec
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700162 helm repo update
Andy Bavier31dfb9e2022-02-15 15:24:57 -0700163 if [[ "${CHARTS}" == "local" || "${CHARTS}" == "local-sdcore" ]]; then helm dep up $(SD_CORE_CHART); fi
Andy Bavierebf479c2021-09-08 15:47:58 -0700164 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700165 --namespace omec \
Andy Bavierebf479c2021-09-08 15:47:58 -0700166 --values $(4G_CORE_VALUES) \
Andy Bavier31dfb9e2022-02-15 15:24:57 -0700167 sd-core \
168 $(SD_CORE_CHART)
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700169 touch $@
170
Andy Baviere9690892022-03-14 18:04:09 -0700171$(M)/5g-core: | $(M)/helm-ready /opt/cni/bin/simpleovs /opt/cni/bin/static $(M)/fabric
Badhrinath3e081e22020-12-02 15:02:08 -0600172 kubectl get namespace omec 2> /dev/null || kubectl create namespace omec
173 helm repo update
Andy Bavier31dfb9e2022-02-15 15:24:57 -0700174 if [[ "${CHARTS}" == "local" || "${CHARTS}" == "local-sdcore" ]]; then helm dep up $(SD_CORE_CHART); fi
Andy Bavierebf479c2021-09-08 15:47:58 -0700175 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
Badhrinath3e081e22020-12-02 15:02:08 -0600176 --namespace omec \
Andy Bavierebf479c2021-09-08 15:47:58 -0700177 --values $(5G_CORE_VALUES) \
Andy Bavier31dfb9e2022-02-15 15:24:57 -0700178 sd-core \
179 $(SD_CORE_CHART)
Badhrinath3e081e22020-12-02 15:02:08 -0600180 touch $@
181
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700182# UE images includes kernel module, ue_ip.ko
183# which should be built in the exactly same kernel version of the host machine
184$(BUILD)/openairinterface: | $(M)/setup
185 mkdir -p $(BUILD)
186 cd $(BUILD); git clone https://github.com/opencord/openairinterface.git
187
Andy Bavierd6de5612021-11-08 10:39:17 -0700188download-ue-image: | $(M)/k8s-ready
Andy Bavier9ee69d02022-02-11 10:31:21 -0700189 sg docker -c "docker pull ${OAISIM_UE_IMAGE} && \
190 docker tag ${OAISIM_UE_IMAGE} omecproject/lte-uesoftmodem:1.1.0"
Andy Bavierd6de5612021-11-08 10:39:17 -0700191 touch $(M)/ue-image
192
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700193$(M)/ue-image: | $(M)/k8s-ready $(BUILD)/openairinterface
194 cd $(BUILD)/openairinterface; \
Andy Bavier9ee69d02022-02-11 10:31:21 -0700195 sg docker -c "docker build . --target lte-uesoftmodem \
Hyunsun7b640512020-10-27 19:49:51 -0500196 --build-arg build_base=omecproject/oai-base:1.1.0 \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700197 --file Dockerfile.ue \
Andy Bavier9ee69d02022-02-11 10:31:21 -0700198 --tag omecproject/lte-uesoftmodem:1.1.0"
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700199 touch $@
200
Andy Bavier9ee69d02022-02-11 10:31:21 -0700201$(M)/oaisim-lo:
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700202 sudo ip addr add 127.0.0.2/8 dev lo || true
Andy Bavier9ee69d02022-02-11 10:31:21 -0700203 touch $@
204
Andy Bavier7b01b682022-03-17 13:26:55 -0700205oaisim-standalone: | $(M)/helm-ready $(M)/ue-image $(M)/oaisim-lo
206 kubectl get namespace omec 2> /dev/null || kubectl create namespace omec
207 kubectl apply -f resources/busybox-sleep.yaml --namespace=omec
208 helm repo update
Andy Bavierebf479c2021-09-08 15:47:58 -0700209 helm upgrade --install $(HELM_GLOBAL_ARGS) --namespace omec oaisim cord/oaisim -f $(OAISIM_VALUES) \
Andy Bavier7b01b682022-03-17 13:26:55 -0700210 --set images.pullPolicy=IfNotPresent
211 kubectl rollout status -n omec statefulset ue
212 @timeout 60s bash -c \
213 "until ip addr show oip1 | grep -q inet; \
214 do \
215 echo 'Waiting for UE 1 gets IP address'; \
216 sleep 3; \
217 done"
218 touch $(M)/oaisim $(M)/omec $(M)/fabric
219
220
221$(M)/oaisim: | $(M)/ue-image $(M)/omec $(M)/oaisim-lo
222 helm upgrade --install $(HELM_GLOBAL_ARGS) --namespace omec oaisim cord/oaisim -f $(OAISIM_VALUES) \
Jeremy Ronquilloaf084f32020-08-24 13:18:47 -0700223 --set images.pullPolicy=IfNotPresent
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700224 kubectl rollout status -n omec statefulset ue
225 @timeout 60s bash -c \
226 "until ip addr show oip1 | grep -q inet; \
227 do \
228 echo 'Waiting for UE 1 gets IP address'; \
229 sleep 3; \
230 done"
231 touch $@
232
Andy Bavierebf479c2021-09-08 15:47:58 -0700233roc: $(M)/roc
234$(M)/roc: $(M)/helm-ready
235 kubectl get namespace aether-roc 2> /dev/null || kubectl create namespace aether-roc
236 helm repo update
237 if [ "$(CHARTS)" == "local" ]; then helm dep up $(AETHER_ROC_UMBRELLA_CHART); fi
238 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
239 --namespace kube-system \
240 --values $(ROC_VALUES) \
241 atomix-controller \
242 $(ATOMIX_CONTROLLER_CHART)
243 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
244 --namespace kube-system \
245 --values $(ROC_VALUES) \
246 atomix-raft-storage \
247 $(ATOMIX_RAFT_STORAGE_CHART)
248 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
249 --namespace kube-system \
250 --values $(ROC_VALUES) \
251 onos-operator \
252 $(ONOS_OPERATOR_CHART)
253 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
254 --namespace aether-roc \
255 --values $(ROC_VALUES) \
256 aether-roc-umbrella \
257 $(AETHER_ROC_UMBRELLA_CHART)
258 touch $@
259
260# Load the ROC 4G models. Disable loading network slice from SimApp.
261roc-4g-models: $(M)/roc
262 sed -i 's/provision-network-slice: true/provision-network-slice: false/' $(4G_CORE_VALUES)
263 sed -i 's/# syncUrl/syncUrl/' $(4G_CORE_VALUES)
Amit Wankhede01b20c32021-12-01 12:45:58 +0530264 if [ "${ENABLE_SUBSCRIBER_PROXY}" == "true" ] ; then \
Amit Wankhedefdf10ff2022-02-16 08:37:20 -0600265 sed -i 's/# sub-proxy-endpt:/sub-proxy-endpt:/' $(4G_CORE_VALUES) ; \
266 sed -i 's/# addr: sub/ addr: sub/' $(4G_CORE_VALUES) ; \
267 sed -i 's/# port: 5000/ port: 5000/' $(4G_CORE_VALUES) ; \
Amit Wankhede01b20c32021-12-01 12:45:58 +0530268 fi
Andy Bavierebf479c2021-09-08 15:47:58 -0700269 $(eval ONOS_CLI_POD := $(shell kubectl -n aether-roc get pods -l name=onos-cli -o name))
270 echo "ONOS CLI pod: ${ONOS_CLI_POD}"
271 until kubectl -n aether-roc exec ${ONOS_CLI_POD} -- \
272 curl -s -f -L -X PATCH "http://aether-roc-api:8181/aether-roc-api" \
273 --header 'Content-Type: application/json' \
274 --data-raw "$$(cat ${ROC_4G_MODELS})"; do sleep 5; done
275
276# Load the ROC 5G models. Disable loading network slice from SimApp.
277roc-5g-models: $(M)/roc
278 sed -i 's/provision-network-slice: true/provision-network-slice: false/' $(5G_CORE_VALUES)
279 sed -i 's/# syncUrl/syncUrl/' $(5G_CORE_VALUES)
Amit Wankhede01b20c32021-12-01 12:45:58 +0530280 if [ "${ENABLE_SUBSCRIBER_PROXY}" == "true" ] ; then \
Amit Wankhedefdf10ff2022-02-16 08:37:20 -0600281 sed -i 's/# sub-proxy-endpt:/sub-proxy-endpt:/' $(5G_CORE_VALUES) ; \
282 sed -i 's/# addr: sub/ addr: sub/' $(5G_CORE_VALUES) ; \
283 sed -i 's/# port: 5000/ port: 5000/' $(5G_CORE_VALUES) ; \
Amit Wankhede01b20c32021-12-01 12:45:58 +0530284 fi
Andy Bavierebf479c2021-09-08 15:47:58 -0700285 $(eval ONOS_CLI_POD := $(shell kubectl -n aether-roc get pods -l name=onos-cli -o name))
286 echo "ONOS CLI pod: ${ONOS_CLI_POD}"
287 until kubectl -n aether-roc exec ${ONOS_CLI_POD} -- \
288 curl -s -f -L -X PATCH "http://aether-roc-api:8181/aether-roc-api" \
289 --header 'Content-Type: application/json' \
290 --data-raw "$$(cat ${ROC_5G_MODELS})"; do sleep 5; done
291
292roc-clean:
293 @echo "This could take 2-3 minutes..."
294 sed -i 's/provision-network-slice: false/provision-network-slice: true/' $(4G_CORE_VALUES)
295 sed -i 's/ syncUrl/ # syncUrl/' $(4G_CORE_VALUES)
Amit Wankhedefdf10ff2022-02-16 08:37:20 -0600296 sed -i 's/ sub-proxy-endpt:/ # sub-proxy-endpt:/' $(4G_CORE_VALUES)
297 sed -i 's/ addr: sub/ # addr: sub/' $(4G_CORE_VALUES)
298 sed -i 's/ port: 5000/ # port: 5000/' $(4G_CORE_VALUES)
Andy Bavierebf479c2021-09-08 15:47:58 -0700299 sed -i 's/provision-network-slice: false/provision-network-slice: true/' $(5G_CORE_VALUES)
300 sed -i 's/ syncUrl/ # syncUrl/' $(5G_CORE_VALUES)
Amit Wankhedefdf10ff2022-02-16 08:37:20 -0600301 sed -i 's/ sub-proxy-endpt:/ # sub-proxy-endpt:/' $(5G_CORE_VALUES)
302 sed -i 's/ addr: sub/ # addr: sub/' $(5G_CORE_VALUES)
303 sed -i 's/ port: 5000/ # port: 5000/' $(5G_CORE_VALUES)
Andy Bavierebf479c2021-09-08 15:47:58 -0700304 kubectl delete namespace aether-roc || true
305 rm -rf $(M)/roc
306
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700307test: | $(M)/fabric $(M)/omec $(M)/oaisim
308 @sleep 5
309 @echo "Test1: ping from UE to SGI network gateway"
Hyunsun Moon0bd8cec2020-09-28 00:38:26 -0500310 ping -I oip1 192.168.250.1 -c 15
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700311 @echo "Test2: ping from UE to 8.8.8.8"
312 ping -I oip1 8.8.8.8 -c 3
Hyunsun Moon0bd8cec2020-09-28 00:38:26 -0500313 @echo "Test3: ping from UE to google.com"
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700314 ping -I oip1 google.com -c 3
315 @echo "Finished to test"
316
Andy Bavier0a055a52022-01-07 10:46:17 -07003175g-test: | $(M)/5g-core
Andy Bavier31dfb9e2022-02-15 15:24:57 -0700318 @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 -0700319 @echo "Test: Registration + UE initiated PDU Session Establishment + User Data packets"
Andy Bavier0e4906f2022-03-03 15:31:48 -0700320 @sleep 60
Andy Bavier0a055a52022-01-07 10:46:17 -0700321 @rm -f /tmp/gnbsim.out
Andy Baviercd93a202022-01-10 18:03:26 -0800322 @if [[ ${GNBSIM_COLORS} == "true" ]]; then \
323 kubectl -n omec exec gnbsim-0 -- ./gnbsim 2>&1 | tee /tmp/gnbsim.out; \
324 else \
325 kubectl -n omec exec gnbsim-0 -- ./gnbsim 2>&1 | sed -u "s,\x1B\[[0-9;]*[a-zA-Z],,g" | tee /tmp/gnbsim.out; \
326 fi
Andy Bavier094d6ef2022-03-08 13:21:52 -0700327 @grep -q "Simulation Result: PASS" /tmp/gnbsim.out
Andy Bavier0a055a52022-01-07 10:46:17 -0700328
Andy Bavier1ead2752022-01-07 17:58:48 -0700329cleanup-omec:
Andy Bavier73d9c712022-01-19 14:18:48 -0700330 helm delete -n omec $$(helm -n omec ls -qa) || true
Andy Bavier1ead2752022-01-07 17:58:48 -0700331 @echo ""
332 @echo "Wait for all pods to terminate..."
333 kubectl wait -n omec --for=delete --all=true -l app!=ue pod --timeout=180s || true
334
335reset-test: cleanup-omec
Jeremy Ronquillob2b64ea2020-12-09 13:49:03 -0800336 kubectl delete po router || true
337 cd $(M); rm -f oaisim omec fabric
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700338
Andy Bavier8819b9f2022-01-28 16:54:06 -0700339reset-ue:
340 helm delete -n omec oaisim || true
341 kubectl wait -n omec --for=delete pod enb-0 || true
342 kubectl wait -n omec --for=delete pod ue-0 || true
343 cd $(M); rm -f oaisim
344
Andy Bavier1ead2752022-01-07 17:58:48 -0700345reset-5g-test: cleanup-omec
Badhrinath3e081e22020-12-02 15:02:08 -0600346 cd $(M); rm -f 5g-core
347
Osman Amjad488a0222022-01-12 11:58:43 -0600348reset-dbtestapp:
349 helm uninstall --namespace omec 5g-test-app
350
351dbtestapp:
352 helm repo update
353 if [ "$(CHARTS)" == "local" ]; then helm dep up $(5G_TEST_APPS_CHART); fi
354 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
355 --namespace omec \
356 5g-test-app \
357 --values $(TEST_APP_VALUES) \
358 $(5G_TEST_APPS_CHART)
359 @echo "Finished to dbtestapp"
360
Andy Bavier01e0a1c2021-11-05 12:41:36 -0700361clean:
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700362 kubectl delete po router || true
Jeremy Ronquilloaf084f32020-08-24 13:18:47 -0700363 kubectl delete net-attach-def core-net || true
364 sudo ovs-vsctl del-br br-access-net || true
365 sudo ovs-vsctl del-br br-core-net || true
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700366 sudo apt remove --purge openvswitch-switch -y
367 source "$(VENV)/bin/activate" && cd $(BUILD)/kubespray; \
Andy Bavier125baa02021-10-26 16:26:44 -0700368 ansible-playbook -b -i inventory/local/hosts.ini reset.yml --extra-vars "reset_confirmation=yes"
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700369 @if [ -d /usr/local/etc/emulab ]; then \
370 mount | grep /mnt/extra/kubelet/pods | cut -d" " -f3 | sudo xargs umount; \
371 sudo rm -rf /mnt/extra/kubelet; \
372 fi
373 rm -rf $(M)