blob: 474108c471c286cc83b2df7a175cd2741a6fa090 [file] [log] [blame]
Jeremy Ronquillo5263c732020-10-13 09:42:19 -07001# Copyright 2018-present Open Networking Foundation
2#
3# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
4
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 Bavierabac8202021-11-03 13:29:28 -070017ROC_VALUES ?= $(MAKEDIR)/roc-values-v4.yaml
Andy Bavierebf479c2021-09-08 15:47:58 -070018UPF_VALUES ?= $(MAKEDIR)/upf-values.yaml
19RANSIM_VALUES ?= $(MAKEDIR)/ransim-values.yaml
Andy Bavierabac8202021-11-03 13:29:28 -070020ROC_4G_MODELS ?= $(MAKEDIR)/roc-4g-models-v4.json
21ROC_5G_MODELS ?= $(MAKEDIR)/roc-5g-models-v4.json
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070022
Hyunsun Moon8c3fe402021-10-04 18:06:07 -070023KUBESPRAY_VERSION ?= release-2.17
24DOCKER_VERSION ?= '20.10'
25K8S_VERSION ?= v1.20.11
26HELM_VERSION ?= v3.6.3
Amit Wankhede01b20c32021-12-01 12:45:58 +053027ENABLE_SUBSCRIBER_PROXY ?= false
Andy Baviercd93a202022-01-10 18:03:26 -080028GNBSIM_COLORS ?= true
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070029
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070030HELM_GLOBAL_ARGS ?=
Andy Baviereda466b2021-08-27 15:00:36 -070031
32# Allow installing local charts or specific versions of published charts.
33# E.g., to install the Aether 1.5 release:
34# CHARTS=release-1.5 make test
35# Default is to install from the local charts.
36CHARTS ?= local
37CONFIGFILE := configs/$(CHARTS)
38include $(CONFIGFILE)
39include configs/authentication
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070040
41cpu_family := $(shell lscpu | grep 'CPU family:' | awk '{print $$3}')
42cpu_model := $(shell lscpu | grep 'Model:' | awk '{print $$2}')
43os_vendor := $(shell lsb_release -i -s)
44os_release := $(shell lsb_release -r -s)
45
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
Badhrinath3e081e22020-12-02 15:02:08 -060050.PHONY: omec oaisim 5gc test reset-test 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
122 touch $@
123
124$(M)/helm-ready: | $(M)/k8s-ready
Woojoong Kim8425cb32021-01-08 16:18:53 -0800125 helm repo add incubator https://charts.helm.sh/incubator
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700126 helm repo add cord https://charts.opencord.org
Andy Baviereda466b2021-08-27 15:00:36 -0700127 helm repo add atomix https://charts.atomix.io
128 helm repo add onosproject https://charts.onosproject.org
Andy Baviere7d09bd2021-10-27 15:08:04 -0700129 @if [ "$(REPO_PASSWORD)" ]; then \
Andy Baviereda466b2021-08-27 15:00:36 -0700130 helm repo add aether --username ${REPO_USERNAME} --password ${REPO_PASSWORD} https://charts.aetherproject.org; \
Andy Baviereda466b2021-08-27 15:00:36 -0700131 fi
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700132 touch $@
133
134/opt/cni/bin/simpleovs: | $(M)/k8s-ready
135 sudo cp $(RESOURCEDIR)/simpleovs /opt/cni/bin/
136
137/opt/cni/bin/static: | $(M)/k8s-ready
138 mkdir -p $(BUILD)/cni-plugins; cd $(BUILD)/cni-plugins; \
139 wget https://github.com/containernetworking/plugins/releases/download/v0.8.2/cni-plugins-linux-amd64-v0.8.2.tgz && \
140 tar xvfz cni-plugins-linux-amd64-v0.8.2.tgz
141 sudo cp $(BUILD)/cni-plugins/static /opt/cni/bin/
142
143# TODO: need to connect ONOS
144$(M)/fabric: | $(M)/setup /opt/cni/bin/simpleovs /opt/cni/bin/static
145 sudo apt install -y openvswitch-switch
146 sudo ovs-vsctl --may-exist add-br br-enb-net
147 sudo ovs-vsctl --may-exist add-port br-enb-net enb -- set Interface enb type=internal
148 sudo ip addr add 192.168.251.4/24 dev enb || true
149 sudo ip link set enb up
150 sudo ethtool --offload enb tx off
151 sudo ip route replace 192.168.252.0/24 via 192.168.251.1 dev enb
152 kubectl apply -f $(RESOURCEDIR)/router.yaml
153 kubectl wait pod -n default --for=condition=Ready -l app=router --timeout=300s
Andy Baviereda466b2021-08-27 15:00:36 -0700154 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 -0700155 kubectl delete net-attach-def core-net
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700156 touch $@
157
Andy Bavierebf479c2021-09-08 15:47:58 -0700158auth-secret: $(RESOURCEDIR)/aether.registry.yaml
159$(RESOURCEDIR)/aether.registry.yaml: configs/authentication
Andy Bavier15a7ec62021-10-28 12:32:56 -0700160 @kubectl -n omec create secret docker-registry aether.registry \
Andy Baviereda466b2021-08-27 15:00:36 -0700161 --docker-server=https://registry.aetherproject.org \
162 --docker-username=${REGISTRY_USERNAME} \
163 --docker-password=${REGISTRY_CLI_SECRET} \
164 --dry-run=client --output=yaml > $@
165
166$(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 -0700167 kubectl get namespace omec 2> /dev/null || kubectl create namespace omec
Andy Baviereda466b2021-08-27 15:00:36 -0700168 kubectl -n omec get secret aether.registry || kubectl create -f $(RESOURCEDIR)/aether.registry.yaml
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700169 helm repo update
Andy Bavierc7c07d52021-11-11 20:09:44 -0700170 if [[ "${CHARTS}" == "local" || "${CHARTS}" == "local-sdcore" ]]; then helm dep up $(OMEC_CONTROL_PLANE_CHART); fi
Andy Bavierebf479c2021-09-08 15:47:58 -0700171 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700172 --namespace omec \
Andy Bavierebf479c2021-09-08 15:47:58 -0700173 --values $(4G_CORE_VALUES) \
174 sim-app \
175 $(OMEC_SUB_PROVISION_CHART) && \
176 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
177 --namespace omec \
178 --values $(4G_CORE_VALUES) \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700179 omec-control-plane \
Andy Baviereda466b2021-08-27 15:00:36 -0700180 $(OMEC_CONTROL_PLANE_CHART) && \
Andy Bavierebf479c2021-09-08 15:47:58 -0700181 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700182 --namespace omec \
Andy Bavierebf479c2021-09-08 15:47:58 -0700183 --values $(UPF_VALUES) \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700184 omec-user-plane \
Andy Bavierebf479c2021-09-08 15:47:58 -0700185 $(OMEC_USER_PLANE_CHART)
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700186 touch $@
187
Andy Baviereda466b2021-08-27 15:00:36 -0700188$(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 -0600189 kubectl get namespace omec 2> /dev/null || kubectl create namespace omec
Andy Bavierebf479c2021-09-08 15:47:58 -0700190 kubectl -n omec get secret aether.registry || kubectl create -f $(RESOURCEDIR)/aether.registry.yaml
Badhrinath3e081e22020-12-02 15:02:08 -0600191 helm repo update
Andy Bavierc7c07d52021-11-11 20:09:44 -0700192 if [[ "${CHARTS}" == "local" || "${CHARTS}" == "local-sdcore" ]]; then helm dep up $(5GC_CONTROL_PLANE_CHART); fi
Andy Bavierebf479c2021-09-08 15:47:58 -0700193 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
Badhrinath3e081e22020-12-02 15:02:08 -0600194 --namespace omec \
Andy Bavierebf479c2021-09-08 15:47:58 -0700195 --values $(5G_CORE_VALUES) \
Ajay Lotan Thakur980823b2021-06-23 18:55:05 -0500196 sim-app \
Andy Baviereda466b2021-08-27 15:00:36 -0700197 $(OMEC_SUB_PROVISION_CHART) && \
Andy Bavierebf479c2021-09-08 15:47:58 -0700198 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
Ajay Lotan Thakur980823b2021-06-23 18:55:05 -0500199 --namespace omec \
Andy Bavierebf479c2021-09-08 15:47:58 -0700200 --values $(UPF_VALUES) \
Badhrinath3e081e22020-12-02 15:02:08 -0600201 5g-core-up \
Andy Baviereda466b2021-08-27 15:00:36 -0700202 $(OMEC_USER_PLANE_CHART) && \
Andy Bavierebf479c2021-09-08 15:47:58 -0700203 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
Badhrinath3e081e22020-12-02 15:02:08 -0600204 --namespace omec \
Andy Bavierebf479c2021-09-08 15:47:58 -0700205 --values $(5G_CORE_VALUES) \
Badhrinath3e081e22020-12-02 15:02:08 -0600206 fgc-core \
Andy Baviereda466b2021-08-27 15:00:36 -0700207 $(5GC_CONTROL_PLANE_CHART) && \
Andy Bavierebf479c2021-09-08 15:47:58 -0700208 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
Badhrinath3e081e22020-12-02 15:02:08 -0600209 --namespace omec \
Andy Bavierebf479c2021-09-08 15:47:58 -0700210 --values $(RANSIM_VALUES) \
Badhrinath3e081e22020-12-02 15:02:08 -0600211 5g-ransim-plane \
Andy Bavierebf479c2021-09-08 15:47:58 -0700212 $(5G_RAN_SIM_CHART)
Badhrinath3e081e22020-12-02 15:02:08 -0600213 touch $@
214
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700215# UE images includes kernel module, ue_ip.ko
216# which should be built in the exactly same kernel version of the host machine
217$(BUILD)/openairinterface: | $(M)/setup
218 mkdir -p $(BUILD)
219 cd $(BUILD); git clone https://github.com/opencord/openairinterface.git
220
Andy Bavierd6de5612021-11-08 10:39:17 -0700221download-ue-image: | $(M)/k8s-ready
222 sudo docker pull ${OAISIM_UE_IMAGE}
223 sudo docker tag ${OAISIM_UE_IMAGE} omecproject/lte-uesoftmodem:1.1.0
224 touch $(M)/ue-image
225
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700226$(M)/ue-image: | $(M)/k8s-ready $(BUILD)/openairinterface
227 cd $(BUILD)/openairinterface; \
228 sudo docker build . --target lte-uesoftmodem \
Hyunsun7b640512020-10-27 19:49:51 -0500229 --build-arg build_base=omecproject/oai-base:1.1.0 \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700230 --file Dockerfile.ue \
Hyunsun7b640512020-10-27 19:49:51 -0500231 --tag omecproject/lte-uesoftmodem:1.1.0
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700232 touch $@
233
234$(M)/oaisim: | $(M)/ue-image $(M)/omec
235 sudo ip addr add 127.0.0.2/8 dev lo || true
236 $(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 -0700237 helm upgrade --install $(HELM_GLOBAL_ARGS) --namespace omec oaisim cord/oaisim -f $(OAISIM_VALUES) \
Jeremy Ronquilloaf084f32020-08-24 13:18:47 -0700238 --set config.enb.networks.s1_mme.interface=$(mme_iface) \
239 --set images.pullPolicy=IfNotPresent
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700240 kubectl rollout status -n omec statefulset ue
241 @timeout 60s bash -c \
242 "until ip addr show oip1 | grep -q inet; \
243 do \
244 echo 'Waiting for UE 1 gets IP address'; \
245 sleep 3; \
246 done"
247 touch $@
248
Andy Bavierebf479c2021-09-08 15:47:58 -0700249roc: $(M)/roc
250$(M)/roc: $(M)/helm-ready
251 kubectl get namespace aether-roc 2> /dev/null || kubectl create namespace aether-roc
252 helm repo update
253 if [ "$(CHARTS)" == "local" ]; then helm dep up $(AETHER_ROC_UMBRELLA_CHART); fi
254 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
255 --namespace kube-system \
256 --values $(ROC_VALUES) \
257 atomix-controller \
258 $(ATOMIX_CONTROLLER_CHART)
259 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
260 --namespace kube-system \
261 --values $(ROC_VALUES) \
262 atomix-raft-storage \
263 $(ATOMIX_RAFT_STORAGE_CHART)
264 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
265 --namespace kube-system \
266 --values $(ROC_VALUES) \
267 onos-operator \
268 $(ONOS_OPERATOR_CHART)
269 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
270 --namespace aether-roc \
271 --values $(ROC_VALUES) \
272 aether-roc-umbrella \
273 $(AETHER_ROC_UMBRELLA_CHART)
274 touch $@
275
276# Load the ROC 4G models. Disable loading network slice from SimApp.
277roc-4g-models: $(M)/roc
278 sed -i 's/provision-network-slice: true/provision-network-slice: false/' $(4G_CORE_VALUES)
279 sed -i 's/# syncUrl/syncUrl/' $(4G_CORE_VALUES)
Amit Wankhede01b20c32021-12-01 12:45:58 +0530280 if [ "${ENABLE_SUBSCRIBER_PROXY}" == "true" ] ; then \
281 sed -i 's/config4g/subscriber-proxy.aether-roc.svc.cluster.local/' $(4G_CORE_VALUES) ; \
282 fi
Andy Bavierebf479c2021-09-08 15:47:58 -0700283 $(eval ONOS_CLI_POD := $(shell kubectl -n aether-roc get pods -l name=onos-cli -o name))
284 echo "ONOS CLI pod: ${ONOS_CLI_POD}"
285 until kubectl -n aether-roc exec ${ONOS_CLI_POD} -- \
286 curl -s -f -L -X PATCH "http://aether-roc-api:8181/aether-roc-api" \
287 --header 'Content-Type: application/json' \
288 --data-raw "$$(cat ${ROC_4G_MODELS})"; do sleep 5; done
289
290# Load the ROC 5G models. Disable loading network slice from SimApp.
291roc-5g-models: $(M)/roc
292 sed -i 's/provision-network-slice: true/provision-network-slice: false/' $(5G_CORE_VALUES)
293 sed -i 's/# syncUrl/syncUrl/' $(5G_CORE_VALUES)
Amit Wankhede01b20c32021-12-01 12:45:58 +0530294 if [ "${ENABLE_SUBSCRIBER_PROXY}" == "true" ] ; then \
295 sed -i 's/webui/subscriber-proxy.aether-roc.svc.cluster.local/' $(5G_CORE_VALUES) ;\
296 fi
Andy Bavierebf479c2021-09-08 15:47:58 -0700297 $(eval ONOS_CLI_POD := $(shell kubectl -n aether-roc get pods -l name=onos-cli -o name))
298 echo "ONOS CLI pod: ${ONOS_CLI_POD}"
299 until kubectl -n aether-roc exec ${ONOS_CLI_POD} -- \
300 curl -s -f -L -X PATCH "http://aether-roc-api:8181/aether-roc-api" \
301 --header 'Content-Type: application/json' \
302 --data-raw "$$(cat ${ROC_5G_MODELS})"; do sleep 5; done
303
304roc-clean:
305 @echo "This could take 2-3 minutes..."
306 sed -i 's/provision-network-slice: false/provision-network-slice: true/' $(4G_CORE_VALUES)
307 sed -i 's/ syncUrl/ # syncUrl/' $(4G_CORE_VALUES)
Amit Wankhede01b20c32021-12-01 12:45:58 +0530308 sed -i 's/subscriber-proxy.aether-roc.svc.cluster.local/config4g/' $(4G_CORE_VALUES)
Andy Bavierebf479c2021-09-08 15:47:58 -0700309 sed -i 's/provision-network-slice: false/provision-network-slice: true/' $(5G_CORE_VALUES)
310 sed -i 's/ syncUrl/ # syncUrl/' $(5G_CORE_VALUES)
Amit Wankhede01b20c32021-12-01 12:45:58 +0530311 sed -i 's/subscriber-proxy.aether-roc.svc.cluster.local/webui/' $(5G_CORE_VALUES)
Andy Bavierebf479c2021-09-08 15:47:58 -0700312 kubectl delete namespace aether-roc || true
313 rm -rf $(M)/roc
314
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700315test: | $(M)/fabric $(M)/omec $(M)/oaisim
316 @sleep 5
317 @echo "Test1: ping from UE to SGI network gateway"
Hyunsun Moon0bd8cec2020-09-28 00:38:26 -0500318 ping -I oip1 192.168.250.1 -c 15
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700319 @echo "Test2: ping from UE to 8.8.8.8"
320 ping -I oip1 8.8.8.8 -c 3
Hyunsun Moon0bd8cec2020-09-28 00:38:26 -0500321 @echo "Test3: ping from UE to google.com"
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700322 ping -I oip1 google.com -c 3
323 @echo "Finished to test"
324
Andy Bavier0a055a52022-01-07 10:46:17 -07003255g-test: | $(M)/5g-core
326 @echo "Test: Registration + UE initiated PDU Session Establishment + User Data packets"
327 @sleep 5
328 @rm -f /tmp/gnbsim.out
Andy Baviercd93a202022-01-10 18:03:26 -0800329 @if [[ ${GNBSIM_COLORS} == "true" ]]; then \
330 kubectl -n omec exec gnbsim-0 -- ./gnbsim 2>&1 | tee /tmp/gnbsim.out; \
331 else \
332 kubectl -n omec exec gnbsim-0 -- ./gnbsim 2>&1 | sed -u "s,\x1B\[[0-9;]*[a-zA-Z],,g" | tee /tmp/gnbsim.out; \
333 fi
Andy Bavier0a055a52022-01-07 10:46:17 -0700334 @echo ""
335 @echo "Test summary:"
336 @grep "Result: " /tmp/gnbsim.out
337 @[ "$$(grep -c "Result: PASS" /tmp/gnbsim.out)" == "5" ] \
338 && echo "*** TEST PASSED ***" \
339 || (echo "*** TEST FAILED ***" && exit 1)
340
Andy Bavier1ead2752022-01-07 17:58:48 -0700341cleanup-omec:
342 helm delete -n omec $$(helm -n omec ls -q) || true
343 @echo ""
344 @echo "Wait for all pods to terminate..."
345 kubectl wait -n omec --for=delete --all=true -l app!=ue pod --timeout=180s || true
346
347reset-test: cleanup-omec
Jeremy Ronquillob2b64ea2020-12-09 13:49:03 -0800348 kubectl delete po router || true
349 cd $(M); rm -f oaisim omec fabric
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700350
Andy Bavier1ead2752022-01-07 17:58:48 -0700351reset-5g-test: cleanup-omec
Badhrinath3e081e22020-12-02 15:02:08 -0600352 cd $(M); rm -f 5g-core
353
Andy Bavier01e0a1c2021-11-05 12:41:36 -0700354clean:
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700355 kubectl delete po router || true
Jeremy Ronquilloaf084f32020-08-24 13:18:47 -0700356 kubectl delete net-attach-def core-net || true
357 sudo ovs-vsctl del-br br-access-net || true
358 sudo ovs-vsctl del-br br-core-net || true
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700359 sudo apt remove --purge openvswitch-switch -y
360 source "$(VENV)/bin/activate" && cd $(BUILD)/kubespray; \
Andy Bavier125baa02021-10-26 16:26:44 -0700361 ansible-playbook -b -i inventory/local/hosts.ini reset.yml --extra-vars "reset_confirmation=yes"
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700362 @if [ -d /usr/local/etc/emulab ]; then \
363 mount | grep /mnt/extra/kubelet/pods | cut -d" " -f3 | sudo xargs umount; \
364 sudo rm -rf /mnt/extra/kubelet; \
365 fi
366 rm -rf $(M)