blob: 73cdf4ec6f0383471a4bbd64ce8a9a1cda382683 [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
144G_CORE_VALUES ?= $(MAKEDIR)/4g-core-values.yaml
155G_CORE_VALUES ?= $(MAKEDIR)/5g-core-values.yaml
16OAISIM_VALUES ?= $(MAKEDIR)/oaisim-values.yaml
Andy Bavier794566f2022-02-04 16:10:18 -070017ROC_VALUES ?= $(MAKEDIR)/roc-values.yaml
Andy Bavierebf479c2021-09-08 15:47:58 -070018UPF_VALUES ?= $(MAKEDIR)/upf-values.yaml
19RANSIM_VALUES ?= $(MAKEDIR)/ransim-values.yaml
Andy Bavier794566f2022-02-04 16:10:18 -070020ROC_4G_MODELS ?= $(MAKEDIR)/roc-4g-models.json
21ROC_5G_MODELS ?= $(MAKEDIR)/roc-5g-models.json
Osman Amjad488a0222022-01-12 11:58:43 -060022TEST_APP_VALUES?= $(MAKEDIR)/5g-test-apps-values.yaml
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070023
Hyunsun Moon8c3fe402021-10-04 18:06:07 -070024KUBESPRAY_VERSION ?= release-2.17
25DOCKER_VERSION ?= '20.10'
26K8S_VERSION ?= v1.20.11
27HELM_VERSION ?= v3.6.3
Amit Wankhede01b20c32021-12-01 12:45:58 +053028ENABLE_SUBSCRIBER_PROXY ?= false
Andy Baviercd93a202022-01-10 18:03:26 -080029GNBSIM_COLORS ?= true
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070030
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070031HELM_GLOBAL_ARGS ?=
Andy Baviereda466b2021-08-27 15:00:36 -070032
33# Allow installing local charts or specific versions of published charts.
34# E.g., to install the Aether 1.5 release:
35# CHARTS=release-1.5 make test
36# Default is to install from the local charts.
37CHARTS ?= local
38CONFIGFILE := configs/$(CHARTS)
39include $(CONFIGFILE)
40include configs/authentication
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070041
42cpu_family := $(shell lscpu | grep 'CPU family:' | awk '{print $$3}')
43cpu_model := $(shell lscpu | grep 'Model:' | awk '{print $$2}')
44os_vendor := $(shell lsb_release -i -s)
45os_release := $(shell lsb_release -r -s)
Andy Bavier9ee69d02022-02-11 10:31:21 -070046USER := $(shell whoami)
47
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070048
Badhrinath3e081e22020-12-02 15:02:08 -060049omec: $(M)/system-check $(M)/omec
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070050oaisim: $(M)/oaisim
Badhrinath3e081e22020-12-02 15:02:08 -0600515gc: $(M)/system-check $(M)/5g-core
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070052
Andy Bavier8819b9f2022-01-28 16:54:06 -070053.PHONY: omec oaisim 5gc test reset-test reset-ue 5g-core reset-5g-test clean
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070054
55$(M):
56 mkdir -p $(M)
57
58$(M)/system-check: | $(M)
59 @if [[ $(cpu_family) -eq 6 ]]; then \
60 if [[ $(cpu_model) -lt 60 ]]; then \
61 echo "FATAL: haswell CPU or newer is required."; \
62 exit 1; \
63 fi \
64 else \
65 echo "FATAL: unsupported CPU family."; \
66 exit 1; \
67 fi
68 @if [[ $(os_vendor) =~ (Ubuntu) ]]; then \
Hyunsun7b640512020-10-27 19:49:51 -050069 if [[ ! $(os_release) =~ (18.04) ]]; then \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070070 echo "WARN: $(os_vendor) $(os_release) has not been tested."; \
71 fi; \
72 if dpkg --compare-versions 4.15 gt $(shell uname -r); then \
73 echo "FATAL: kernel 4.15 or later is required."; \
74 echo "Please upgrade your kernel by running" \
75 "apt install --install-recommends linux-generic-hwe-$(os_release)"; \
76 exit 1; \
77 fi \
78 else \
79 echo "FAIL: unsupported OS."; \
80 exit 1; \
81 fi
82 touch $@
83
84$(M)/setup: | $(M)
85 sudo $(SCRIPTDIR)/cloudlab-disksetup.sh
Hyunsun Moon82e47c22021-06-28 12:30:20 -050086 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 -070087 touch $@
88
89$(BUILD)/kubespray: | $(M)/setup
90 mkdir -p $(BUILD)
91 cd $(BUILD); git clone https://github.com/kubernetes-incubator/kubespray.git -b $(KUBESPRAY_VERSION)
92
93$(VENV)/bin/activate: | $(M)/setup
Hyunsun Moon82e47c22021-06-28 12:30:20 -050094 python3 -m venv $(VENV)
Wei-Yu Chen7edb7e72021-07-28 11:37:55 +080095 source "$(VENV)/bin/activate" && \
96 python -m pip install -U pip && \
97 deactivate
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070098
99$(M)/kubespray-requirements: $(BUILD)/kubespray | $(VENV)/bin/activate
100 source "$(VENV)/bin/activate" && \
101 pip install -r $(BUILD)/kubespray/requirements.txt
102 touch $@
103
104$(M)/k8s-ready: | $(M)/setup $(BUILD)/kubespray $(VENV)/bin/activate $(M)/kubespray-requirements
105 source "$(VENV)/bin/activate" && cd $(BUILD)/kubespray; \
106 ansible-playbook -b -i inventory/local/hosts.ini \
107 -e "{'override_system_hostname' : False, 'disable_swap' : True}" \
108 -e "{'docker_version' : $(DOCKER_VERSION)}" \
109 -e "{'docker_iptables_enabled' : True}" \
110 -e "{'kube_version' : $(K8S_VERSION)}" \
Hyunsun84f0f172020-09-23 15:40:08 -0500111 -e "{'kube_network_plugin_multus' : True, 'multus_version' : stable, 'multus_cni_version' : 0.3.1}" \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700112 -e "{'kube_proxy_metrics_bind_address' : 0.0.0.0:10249}" \
113 -e "{'kube_pods_subnet' : 192.168.0.0/17, 'kube_service_addresses' : 192.168.128.0/17}" \
114 -e "{'kube_apiserver_node_port_range' : 2000-36767}" \
115 -e "{'kubeadm_enabled': True}" \
116 -e "{'kube_feature_gates' : [SCTPSupport=True]}" \
117 -e "{'kubelet_custom_flags' : [--allowed-unsafe-sysctls=net.*]}" \
118 -e "{'dns_min_replicas' : 1}" \
119 -e "{'helm_enabled' : True, 'helm_version' : $(HELM_VERSION)}" \
120 cluster.yml
121 mkdir -p $(HOME)/.kube
122 sudo cp -f /etc/kubernetes/admin.conf $(HOME)/.kube/config
123 sudo chown $(shell id -u):$(shell id -g) $(HOME)/.kube/config
124 kubectl wait pod -n kube-system --for=condition=Ready --all
Andy Bavier9ee69d02022-02-11 10:31:21 -0700125 sudo adduser $(USER) docker
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700126 touch $@
127
128$(M)/helm-ready: | $(M)/k8s-ready
Woojoong Kim8425cb32021-01-08 16:18:53 -0800129 helm repo add incubator https://charts.helm.sh/incubator
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700130 helm repo add cord https://charts.opencord.org
Andy Baviereda466b2021-08-27 15:00:36 -0700131 helm repo add atomix https://charts.atomix.io
132 helm repo add onosproject https://charts.onosproject.org
Andy Bavier9ee69d02022-02-11 10:31:21 -0700133 helm repo add aether https://charts.aetherproject.org
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700134 touch $@
135
Andy Bavier9ee69d02022-02-11 10:31:21 -0700136node-prep: | $(M)/k8s-ready $(M)/fabric $(M)/oaisim-lo
137
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700138/opt/cni/bin/simpleovs: | $(M)/k8s-ready
139 sudo cp $(RESOURCEDIR)/simpleovs /opt/cni/bin/
140
141/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
147# TODO: need to connect ONOS
148$(M)/fabric: | $(M)/setup /opt/cni/bin/simpleovs /opt/cni/bin/static
149 sudo apt install -y openvswitch-switch
150 sudo ovs-vsctl --may-exist add-br br-enb-net
151 sudo ovs-vsctl --may-exist add-port br-enb-net enb -- set Interface enb type=internal
152 sudo ip addr add 192.168.251.4/24 dev enb || true
153 sudo ip link set enb up
154 sudo ethtool --offload enb tx off
155 sudo ip route replace 192.168.252.0/24 via 192.168.251.1 dev enb
156 kubectl apply -f $(RESOURCEDIR)/router.yaml
157 kubectl wait pod -n default --for=condition=Ready -l app=router --timeout=300s
Andy Baviereda466b2021-08-27 15:00:36 -0700158 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 -0700159 kubectl delete net-attach-def core-net
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700160 touch $@
161
Andy Bavierebf479c2021-09-08 15:47:58 -0700162auth-secret: $(RESOURCEDIR)/aether.registry.yaml
163$(RESOURCEDIR)/aether.registry.yaml: configs/authentication
Andy Bavier15a7ec62021-10-28 12:32:56 -0700164 @kubectl -n omec create secret docker-registry aether.registry \
Andy Baviereda466b2021-08-27 15:00:36 -0700165 --docker-server=https://registry.aetherproject.org \
166 --docker-username=${REGISTRY_USERNAME} \
167 --docker-password=${REGISTRY_CLI_SECRET} \
168 --dry-run=client --output=yaml > $@
169
170$(M)/omec: | $(M)/helm-ready /opt/cni/bin/simpleovs /opt/cni/bin/static $(M)/fabric $(RESOURCEDIR)/aether.registry.yaml
Scott Baker17b70d12020-09-29 23:26:21 -0700171 kubectl get namespace omec 2> /dev/null || kubectl create namespace omec
Andy Baviereda466b2021-08-27 15:00:36 -0700172 kubectl -n omec get secret aether.registry || kubectl create -f $(RESOURCEDIR)/aether.registry.yaml
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700173 helm repo update
Andy Bavierc7c07d52021-11-11 20:09:44 -0700174 if [[ "${CHARTS}" == "local" || "${CHARTS}" == "local-sdcore" ]]; then helm dep up $(OMEC_CONTROL_PLANE_CHART); fi
Andy Bavierebf479c2021-09-08 15:47:58 -0700175 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700176 --namespace omec \
Andy Bavierebf479c2021-09-08 15:47:58 -0700177 --values $(4G_CORE_VALUES) \
178 sim-app \
179 $(OMEC_SUB_PROVISION_CHART) && \
180 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
181 --namespace omec \
182 --values $(4G_CORE_VALUES) \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700183 omec-control-plane \
Andy Baviereda466b2021-08-27 15:00:36 -0700184 $(OMEC_CONTROL_PLANE_CHART) && \
Andy Bavierebf479c2021-09-08 15:47:58 -0700185 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700186 --namespace omec \
Andy Bavierebf479c2021-09-08 15:47:58 -0700187 --values $(UPF_VALUES) \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700188 omec-user-plane \
Andy Bavierebf479c2021-09-08 15:47:58 -0700189 $(OMEC_USER_PLANE_CHART)
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700190 touch $@
191
Andy Baviereda466b2021-08-27 15:00:36 -0700192$(M)/5g-core: | $(M)/helm-ready /opt/cni/bin/simpleovs /opt/cni/bin/static $(M)/fabric $(RESOURCEDIR)/aether.registry.yaml
Badhrinath3e081e22020-12-02 15:02:08 -0600193 kubectl get namespace omec 2> /dev/null || kubectl create namespace omec
Andy Bavierebf479c2021-09-08 15:47:58 -0700194 kubectl -n omec get secret aether.registry || kubectl create -f $(RESOURCEDIR)/aether.registry.yaml
Badhrinath3e081e22020-12-02 15:02:08 -0600195 helm repo update
Andy Bavierc7c07d52021-11-11 20:09:44 -0700196 if [[ "${CHARTS}" == "local" || "${CHARTS}" == "local-sdcore" ]]; then helm dep up $(5GC_CONTROL_PLANE_CHART); fi
Andy Bavierebf479c2021-09-08 15:47:58 -0700197 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
Badhrinath3e081e22020-12-02 15:02:08 -0600198 --namespace omec \
Andy Bavierebf479c2021-09-08 15:47:58 -0700199 --values $(5G_CORE_VALUES) \
Ajay Lotan Thakur980823b2021-06-23 18:55:05 -0500200 sim-app \
Andy Baviereda466b2021-08-27 15:00:36 -0700201 $(OMEC_SUB_PROVISION_CHART) && \
Andy Bavierebf479c2021-09-08 15:47:58 -0700202 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
Ajay Lotan Thakur980823b2021-06-23 18:55:05 -0500203 --namespace omec \
Andy Bavierebf479c2021-09-08 15:47:58 -0700204 --values $(UPF_VALUES) \
Badhrinath3e081e22020-12-02 15:02:08 -0600205 5g-core-up \
Andy Baviereda466b2021-08-27 15:00:36 -0700206 $(OMEC_USER_PLANE_CHART) && \
Andy Bavierebf479c2021-09-08 15:47:58 -0700207 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
Badhrinath3e081e22020-12-02 15:02:08 -0600208 --namespace omec \
Andy Bavierebf479c2021-09-08 15:47:58 -0700209 --values $(5G_CORE_VALUES) \
Badhrinath3e081e22020-12-02 15:02:08 -0600210 fgc-core \
Andy Baviereda466b2021-08-27 15:00:36 -0700211 $(5GC_CONTROL_PLANE_CHART) && \
Andy Bavierebf479c2021-09-08 15:47:58 -0700212 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
Badhrinath3e081e22020-12-02 15:02:08 -0600213 --namespace omec \
Andy Bavierebf479c2021-09-08 15:47:58 -0700214 --values $(RANSIM_VALUES) \
Badhrinath3e081e22020-12-02 15:02:08 -0600215 5g-ransim-plane \
Andy Bavierebf479c2021-09-08 15:47:58 -0700216 $(5G_RAN_SIM_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:
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700239 sudo ip addr add 127.0.0.2/8 dev lo || true
Andy Bavier9ee69d02022-02-11 10:31:21 -0700240 touch $@
241
242$(M)/oaisim: | $(M)/ue-image $(M)/omec $(M)/oaisim-lo
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700243 $(eval mme_iface=$(shell ip -4 route list default | awk -F 'dev' '{ print $$2; exit }' | awk '{ print $$1 }'))
Andy Bavierebf479c2021-09-08 15:47:58 -0700244 helm upgrade --install $(HELM_GLOBAL_ARGS) --namespace omec oaisim cord/oaisim -f $(OAISIM_VALUES) \
Jeremy Ronquilloaf084f32020-08-24 13:18:47 -0700245 --set config.enb.networks.s1_mme.interface=$(mme_iface) \
246 --set images.pullPolicy=IfNotPresent
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700247 kubectl rollout status -n omec statefulset ue
248 @timeout 60s bash -c \
249 "until ip addr show oip1 | grep -q inet; \
250 do \
251 echo 'Waiting for UE 1 gets IP address'; \
252 sleep 3; \
253 done"
254 touch $@
255
Andy Bavierebf479c2021-09-08 15:47:58 -0700256roc: $(M)/roc
257$(M)/roc: $(M)/helm-ready
258 kubectl get namespace aether-roc 2> /dev/null || kubectl create namespace aether-roc
259 helm repo update
260 if [ "$(CHARTS)" == "local" ]; then helm dep up $(AETHER_ROC_UMBRELLA_CHART); fi
261 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
262 --namespace kube-system \
263 --values $(ROC_VALUES) \
264 atomix-controller \
265 $(ATOMIX_CONTROLLER_CHART)
266 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
267 --namespace kube-system \
268 --values $(ROC_VALUES) \
269 atomix-raft-storage \
270 $(ATOMIX_RAFT_STORAGE_CHART)
271 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
272 --namespace kube-system \
273 --values $(ROC_VALUES) \
274 onos-operator \
275 $(ONOS_OPERATOR_CHART)
276 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
277 --namespace aether-roc \
278 --values $(ROC_VALUES) \
279 aether-roc-umbrella \
280 $(AETHER_ROC_UMBRELLA_CHART)
281 touch $@
282
283# Load the ROC 4G models. Disable loading network slice from SimApp.
284roc-4g-models: $(M)/roc
285 sed -i 's/provision-network-slice: true/provision-network-slice: false/' $(4G_CORE_VALUES)
286 sed -i 's/# syncUrl/syncUrl/' $(4G_CORE_VALUES)
Amit Wankhede01b20c32021-12-01 12:45:58 +0530287 if [ "${ENABLE_SUBSCRIBER_PROXY}" == "true" ] ; then \
Amit Wankhedeb29e58e2022-01-14 10:19:04 -0600288 sed -i 's/addr: config4g/addr: subscriber-proxy.aether-roc.svc.cluster.local/' $(4G_CORE_VALUES) ; \
Amit Wankhede01b20c32021-12-01 12:45:58 +0530289 fi
Andy Bavierebf479c2021-09-08 15:47:58 -0700290 $(eval ONOS_CLI_POD := $(shell kubectl -n aether-roc get pods -l name=onos-cli -o name))
291 echo "ONOS CLI pod: ${ONOS_CLI_POD}"
292 until kubectl -n aether-roc exec ${ONOS_CLI_POD} -- \
293 curl -s -f -L -X PATCH "http://aether-roc-api:8181/aether-roc-api" \
294 --header 'Content-Type: application/json' \
295 --data-raw "$$(cat ${ROC_4G_MODELS})"; do sleep 5; done
296
297# Load the ROC 5G models. Disable loading network slice from SimApp.
298roc-5g-models: $(M)/roc
299 sed -i 's/provision-network-slice: true/provision-network-slice: false/' $(5G_CORE_VALUES)
300 sed -i 's/# syncUrl/syncUrl/' $(5G_CORE_VALUES)
Amit Wankhede01b20c32021-12-01 12:45:58 +0530301 if [ "${ENABLE_SUBSCRIBER_PROXY}" == "true" ] ; then \
Amit Wankhedeb29e58e2022-01-14 10:19:04 -0600302 sed -i 's/addr: webui/addr: subscriber-proxy.aether-roc.svc.cluster.local/' $(5G_CORE_VALUES) ;\
Amit Wankhede01b20c32021-12-01 12:45:58 +0530303 fi
Andy Bavierebf479c2021-09-08 15:47:58 -0700304 $(eval ONOS_CLI_POD := $(shell kubectl -n aether-roc get pods -l name=onos-cli -o name))
305 echo "ONOS CLI pod: ${ONOS_CLI_POD}"
306 until kubectl -n aether-roc exec ${ONOS_CLI_POD} -- \
307 curl -s -f -L -X PATCH "http://aether-roc-api:8181/aether-roc-api" \
308 --header 'Content-Type: application/json' \
309 --data-raw "$$(cat ${ROC_5G_MODELS})"; do sleep 5; done
310
311roc-clean:
312 @echo "This could take 2-3 minutes..."
313 sed -i 's/provision-network-slice: false/provision-network-slice: true/' $(4G_CORE_VALUES)
314 sed -i 's/ syncUrl/ # syncUrl/' $(4G_CORE_VALUES)
Amit Wankhede01b20c32021-12-01 12:45:58 +0530315 sed -i 's/subscriber-proxy.aether-roc.svc.cluster.local/config4g/' $(4G_CORE_VALUES)
Andy Bavierebf479c2021-09-08 15:47:58 -0700316 sed -i 's/provision-network-slice: false/provision-network-slice: true/' $(5G_CORE_VALUES)
317 sed -i 's/ syncUrl/ # syncUrl/' $(5G_CORE_VALUES)
Amit Wankhede01b20c32021-12-01 12:45:58 +0530318 sed -i 's/subscriber-proxy.aether-roc.svc.cluster.local/webui/' $(5G_CORE_VALUES)
Andy Bavierebf479c2021-09-08 15:47:58 -0700319 kubectl delete namespace aether-roc || true
320 rm -rf $(M)/roc
321
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700322test: | $(M)/fabric $(M)/omec $(M)/oaisim
323 @sleep 5
324 @echo "Test1: ping from UE to SGI network gateway"
Hyunsun Moon0bd8cec2020-09-28 00:38:26 -0500325 ping -I oip1 192.168.250.1 -c 15
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700326 @echo "Test2: ping from UE to 8.8.8.8"
327 ping -I oip1 8.8.8.8 -c 3
Hyunsun Moon0bd8cec2020-09-28 00:38:26 -0500328 @echo "Test3: ping from UE to google.com"
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700329 ping -I oip1 google.com -c 3
330 @echo "Finished to test"
331
Andy Bavier0a055a52022-01-07 10:46:17 -07003325g-test: | $(M)/5g-core
333 @echo "Test: Registration + UE initiated PDU Session Establishment + User Data packets"
334 @sleep 5
335 @rm -f /tmp/gnbsim.out
Andy Baviercd93a202022-01-10 18:03:26 -0800336 @if [[ ${GNBSIM_COLORS} == "true" ]]; then \
337 kubectl -n omec exec gnbsim-0 -- ./gnbsim 2>&1 | tee /tmp/gnbsim.out; \
338 else \
339 kubectl -n omec exec gnbsim-0 -- ./gnbsim 2>&1 | sed -u "s,\x1B\[[0-9;]*[a-zA-Z],,g" | tee /tmp/gnbsim.out; \
340 fi
Andy Bavier0a055a52022-01-07 10:46:17 -0700341 @echo ""
342 @echo "Test summary:"
343 @grep "Result: " /tmp/gnbsim.out
344 @[ "$$(grep -c "Result: PASS" /tmp/gnbsim.out)" == "5" ] \
345 && echo "*** TEST PASSED ***" \
346 || (echo "*** TEST FAILED ***" && exit 1)
347
Andy Bavier1ead2752022-01-07 17:58:48 -0700348cleanup-omec:
Andy Bavier73d9c712022-01-19 14:18:48 -0700349 helm delete -n omec $$(helm -n omec ls -qa) || true
Andy Bavier1ead2752022-01-07 17:58:48 -0700350 @echo ""
351 @echo "Wait for all pods to terminate..."
352 kubectl wait -n omec --for=delete --all=true -l app!=ue pod --timeout=180s || true
353
354reset-test: cleanup-omec
Jeremy Ronquillob2b64ea2020-12-09 13:49:03 -0800355 kubectl delete po router || true
356 cd $(M); rm -f oaisim omec fabric
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700357
Andy Bavier8819b9f2022-01-28 16:54:06 -0700358reset-ue:
359 helm delete -n omec oaisim || true
360 kubectl wait -n omec --for=delete pod enb-0 || true
361 kubectl wait -n omec --for=delete pod ue-0 || true
362 cd $(M); rm -f oaisim
363
Andy Bavier1ead2752022-01-07 17:58:48 -0700364reset-5g-test: cleanup-omec
Badhrinath3e081e22020-12-02 15:02:08 -0600365 cd $(M); rm -f 5g-core
366
Osman Amjad488a0222022-01-12 11:58:43 -0600367reset-dbtestapp:
368 helm uninstall --namespace omec 5g-test-app
369
370dbtestapp:
371 helm repo update
372 if [ "$(CHARTS)" == "local" ]; then helm dep up $(5G_TEST_APPS_CHART); fi
373 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
374 --namespace omec \
375 5g-test-app \
376 --values $(TEST_APP_VALUES) \
377 $(5G_TEST_APPS_CHART)
378 @echo "Finished to dbtestapp"
379
Andy Bavier01e0a1c2021-11-05 12:41:36 -0700380clean:
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700381 kubectl delete po router || true
Jeremy Ronquilloaf084f32020-08-24 13:18:47 -0700382 kubectl delete net-attach-def core-net || true
383 sudo ovs-vsctl del-br br-access-net || true
384 sudo ovs-vsctl del-br br-core-net || true
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700385 sudo apt remove --purge openvswitch-switch -y
386 source "$(VENV)/bin/activate" && cd $(BUILD)/kubespray; \
Andy Bavier125baa02021-10-26 16:26:44 -0700387 ansible-playbook -b -i inventory/local/hosts.ini reset.yml --extra-vars "reset_confirmation=yes"
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700388 @if [ -d /usr/local/etc/emulab ]; then \
389 mount | grep /mnt/extra/kubelet/pods | cut -d" " -f3 | sudo xargs umount; \
390 sudo rm -rf /mnt/extra/kubelet; \
391 fi
392 rm -rf $(M)