blob: 009d6a45c676a0900c814df0bb35bda2b6b92f67 [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
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -07006MAKEDIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
Andy Bavier99f31c82022-04-14 16:16:26 -07007BUILD ?= $(MAKEDIR)/build
8M ?= $(BUILD)/milestones
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
Sean Condone184e6e2023-01-12 09:59:40 +0000144G_CORE_VALUES ?= $(MAKEDIR)/sd-core-4g-values.yaml
155G_CORE_VALUES ?= $(MAKEDIR)/sd-core-5g-values.yaml
Arrobo, Gabriela5366e12023-03-02 12:10:47 -0800165G_UPF_VALUES ?= $(MAKEDIR)/upf-5g-values.yaml
Sean Condone184e6e2023-01-12 09:59:40 +000017OAISIM_VALUES ?= $(MAKEDIR)/oaisim-values.yaml
18ROC_VALUES ?= $(MAKEDIR)/roc-values.yaml
19ROC_DEFAULTENT_MODEL ?= $(MAKEDIR)/roc-defaultent-model.json
20ROC_4G_MODELS ?= $(MAKEDIR)/roc-4g-models.json
21ROC_5G_MODELS ?= $(MAKEDIR)/roc-5g-models.json
22TEST_APP_VALUES ?= $(MAKEDIR)/5g-test-apps-values.yaml
Arrobo, Gabriela5366e12023-03-02 12:10:47 -080023UPF_COUNT = $(MAKEDIR)/upf-count.txt
Sean Condone184e6e2023-01-12 09:59:40 +000024GET_HELM = get_helm.sh
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070025
Amol Jaikar3d296902023-01-19 00:10:11 -050026KUBESPRAY_VERSION ?= release-2.17
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -070027DOCKER_VERSION ?= '20.10'
Amol Jaikarf7402222023-01-17 15:15:07 -050028HELM_VERSION ?= v3.10.3
Amol Jaikar53325922023-01-18 22:43:26 -050029KUBECTL_VERSION ?= v1.23.15
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -070030
Amol Jaikar53325922023-01-18 22:43:26 -050031RKE2_K8S_VERSION ?= v1.23.15+rke2r1
Amol Jaikare10bbd62023-01-18 23:23:25 -050032K8S_VERSION ?= v1.21.6
SeanCondonc72e46c2023-06-05 21:51:07 +010033LPP_VERSION ?= v0.0.24
Hyunsun Mooncbdac112022-03-19 22:01:27 -060034
Amol Jaikarf2124ed2023-01-20 14:05:16 -050035OAISIM_UE_IMAGE ?= andybavier/lte-uesoftmodem:1.1.0-$(shell uname -r)
Hyunsun Mooncbdac112022-03-19 22:01:27 -060036ENABLE_ROUTER ?= true
37ENABLE_OAISIM ?= true
38ENABLE_GNBSIM ?= true
Amit Wankhede01b20c32021-12-01 12:45:58 +053039ENABLE_SUBSCRIBER_PROXY ?= false
Andy Baviercd93a202022-01-10 18:03:26 -080040GNBSIM_COLORS ?= true
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070041
Fatemeh Rouzbeh85654e72022-05-23 09:26:12 -070042K8S_INSTALL ?= rke2
Andy Bavier99f31c82022-04-14 16:16:26 -070043CTR_CMD := sudo /var/lib/rancher/rke2/bin/ctr --address /run/k3s/containerd/containerd.sock --namespace k8s.io
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -070044
Fatemeh Rouzbeh85654e72022-05-23 09:26:12 -070045PROXY_ENABLED ?= false
46HTTP_PROXY ?= ${http_proxy}
47HTTPS_PROXY ?= ${https_proxy}
48NO_PROXY ?= ${no_proxy}
49
50ONECLOUD ?= false
51
Hyunsun Mooncbdac112022-03-19 22:01:27 -060052DATA_IFACE ?= data
53ifeq ($(DATA_IFACE), data)
54 RAN_SUBNET := 192.168.251.0/24
55else
Ajay Lotan Thakur5ee9e0e2022-09-28 23:34:56 -060056 RAN_SUBNET := $(shell ip route | grep $${DATA_IFACE} | awk '/kernel/ {print $$1}' | head -1)
Andy Bavier99f31c82022-04-14 16:16:26 -070057 DATA_IFACE_PATH := $(shell find /*/systemd/network -maxdepth 1 -not -type d -name '*$(DATA_IFACE).network' -print)
58 DATA_IFACE_CONF ?= $(shell basename $(DATA_IFACE_PATH)).d
Hyunsun Mooncbdac112022-03-19 22:01:27 -060059endif
Hyunsun Moon4e5795a2022-04-07 09:27:12 -070060
Andy Bavier99f31c82022-04-14 16:16:26 -070061# systemd-networkd and systemd configs
62LO_NETCONF := /etc/systemd/network/20-aiab-lo.network
63OAISIM_NETCONF := $(LO_NETCONF) /etc/systemd/network/10-aiab-enb.netdev /etc/systemd/network/20-aiab-enb.network
64ROUTER_POD_NETCONF := /etc/systemd/network/10-aiab-dummy.netdev /etc/systemd/network/20-aiab-dummy.network
65ROUTER_HOST_NETCONF := /etc/systemd/network/10-aiab-access.netdev /etc/systemd/network/20-aiab-access.network /etc/systemd/network/10-aiab-core.netdev /etc/systemd/network/20-aiab-core.network /etc/systemd/network/$(DATA_IFACE_CONF)/macvlan.conf
66UE_NAT_CONF := /etc/systemd/system/aiab-ue-nat.service
67
Andy Bavier7d5f0552022-05-23 16:01:45 -070068# monitoring
69RANCHER_MONITORING_CRD_CHART := rancher/rancher-monitoring-crd
70RANCHER_MONITORING_CHART := rancher/rancher-monitoring
71MONITORING_VALUES ?= $(MAKEDIR)/monitoring.yaml
72
Hyunsun Moon4e5795a2022-04-07 09:27:12 -070073NODE_IP ?= $(shell ip route get 8.8.8.8 | grep -oP 'src \K\S+')
74ifndef NODE_IP
75$(error NODE_IP is not set)
76endif
77
Hyunsun Mooncbdac112022-03-19 22:01:27 -060078MME_IP ?=
79
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070080HELM_GLOBAL_ARGS ?=
Andy Baviereda466b2021-08-27 15:00:36 -070081
Arrobo, Gabriela5366e12023-03-02 12:10:47 -080082ifneq ("$(wildcard $(UPF_COUNT))","")
83 UPF_NUMBER = $(shell cat $(UPF_COUNT))
84else
85 UPF_NUMBER = 0
86endif
87
Andy Baviereda466b2021-08-27 15:00:36 -070088# Allow installing local charts or specific versions of published charts.
89# E.g., to install the Aether 1.5 release:
90# CHARTS=release-1.5 make test
91# Default is to install from the local charts.
92CHARTS ?= local
93CONFIGFILE := configs/$(CHARTS)
94include $(CONFIGFILE)
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070095
96cpu_family := $(shell lscpu | grep 'CPU family:' | awk '{print $$3}')
97cpu_model := $(shell lscpu | grep 'Model:' | awk '{print $$2}')
98os_vendor := $(shell lsb_release -i -s)
99os_release := $(shell lsb_release -r -s)
Andy Bavier9ee69d02022-02-11 10:31:21 -0700100USER := $(shell whoami)
101
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700102.PHONY: 4g-core 5g-core oaisim test reset-test reset-ue reset-5g-test node-prep clean
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700103
104$(M):
105 mkdir -p $(M)
106
107$(M)/system-check: | $(M)
108 @if [[ $(cpu_family) -eq 6 ]]; then \
109 if [[ $(cpu_model) -lt 60 ]]; then \
110 echo "FATAL: haswell CPU or newer is required."; \
111 exit 1; \
112 fi \
113 else \
114 echo "FATAL: unsupported CPU family."; \
115 exit 1; \
116 fi
117 @if [[ $(os_vendor) =~ (Ubuntu) ]]; then \
Hyunsun7b640512020-10-27 19:49:51 -0500118 if [[ ! $(os_release) =~ (18.04) ]]; then \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700119 echo "WARN: $(os_vendor) $(os_release) has not been tested."; \
120 fi; \
121 if dpkg --compare-versions 4.15 gt $(shell uname -r); then \
122 echo "FATAL: kernel 4.15 or later is required."; \
123 echo "Please upgrade your kernel by running" \
124 "apt install --install-recommends linux-generic-hwe-$(os_release)"; \
125 exit 1; \
126 fi \
127 else \
128 echo "FAIL: unsupported OS."; \
129 exit 1; \
130 fi
131 touch $@
132
Andy Bavier99f31c82022-04-14 16:16:26 -0700133$(M)/interface-check: | $(M)
134ifeq ($(DATA_IFACE_CONF), .d)
135 @echo
136 @echo FATAL: Could not find systemd-networkd config for interface $(DATA_IFACE), exiting now!; exit 1
137endif
Fatemeh Rouzbeh85654e72022-05-23 09:26:12 -0700138 @echo "Add network configuration for enb interface"
139 @if [[ "${ONECLOUD}" == "true" ]]; then \
140 sudo cp netplan/01-enb-static-config.yaml /etc/netplan ; \
141 sudo netplan apply ; \
142 sleep 1 ; \
143 fi
Andy Bavier99f31c82022-04-14 16:16:26 -0700144 touch $@
145
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700146ifeq ($(K8S_INSTALL),kubespray)
Andy Bavier99f31c82022-04-14 16:16:26 -0700147$(M)/setup: | $(M) $(M)/interface-check
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700148 sudo $(SCRIPTDIR)/cloudlab-disksetup.sh
Hyunsun Moon82e47c22021-06-28 12:30:20 -0500149 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 -0700150 touch $@
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700151endif
152
153ifeq ($(K8S_INSTALL),rke2)
Fatemeh Rouzbeh85654e72022-05-23 09:26:12 -0700154$(M)/initial-setup: | $(M) $(M)/interface-check
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700155 sudo $(SCRIPTDIR)/cloudlab-disksetup.sh
156 sudo apt update; sudo apt install -y software-properties-common python3 python3-pip python3-venv jq httpie ipvsadm apparmor apparmor-utils
157 systemctl list-units --full -all | grep "docker.service" || sudo apt install -y docker.io
158 sudo adduser $(USER) docker || true
Andy Bavier23024432022-05-26 10:10:50 -0700159 touch $(M)/initial-setup
Fatemeh Rouzbeh85654e72022-05-23 09:26:12 -0700160
161ifeq ($(PROXY_ENABLED),true)
162$(M)/proxy-setting: | $(M)
163 echo "Defaults env_keep += \"HTTP_PROXY HTTPS_PROXY NO_PROXY http_proxy https_proxy no_proxy\"" | sudo EDITOR='tee -a' visudo -f /etc/sudoers.d/proxy
164 echo "HTTP_PROXY=$(HTTP_PROXY)" >> rke2-server
165 echo "HTTPS_PROXY=$(HTTPS_PROXY)" >> rke2-server
166 echo "NO_PROXY=$(NO_PROXY),.cluster.local,.svc,$(NODE_IP),192.168.84.0/24,192.168.85.0/24,$(RAN_SUBNET)" >> rke2-server
167 sudo mv rke2-server /etc/default/
168 echo "[Service]" >> http-proxy.conf
169 echo "Environment='HTTP_PROXY=$(HTTP_PROXY)'" >> http-proxy.conf
170 echo "Environment='HTTPS_PROXY=$(HTTPS_PROXY)'" >> http-proxy.conf
171 echo "Environment='NO_PROXY=$(NO_PROXY)'" >> http-proxy.conf
172 sudo mkdir -p /etc/systemd/system/docker.service.d
173 sudo mv http-proxy.conf /etc/systemd/system/docker.service.d
174 sudo systemctl daemon-reload
175 sudo systemctl restart docker
176 touch $(M)/proxy-setting
177else
178$(M)/proxy-setting: | $(M)
179 @echo -n ""
180 touch $(M)/proxy-setting
181endif
182
183$(M)/setup: | $(M)/initial-setup $(M)/proxy-setting
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700184 touch $@
185endif
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700186
187$(BUILD)/kubespray: | $(M)/setup
188 mkdir -p $(BUILD)
189 cd $(BUILD); git clone https://github.com/kubernetes-incubator/kubespray.git -b $(KUBESPRAY_VERSION)
190
191$(VENV)/bin/activate: | $(M)/setup
Hyunsun Moon82e47c22021-06-28 12:30:20 -0500192 python3 -m venv $(VENV)
Wei-Yu Chen7edb7e72021-07-28 11:37:55 +0800193 source "$(VENV)/bin/activate" && \
194 python -m pip install -U pip && \
195 deactivate
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700196
197$(M)/kubespray-requirements: $(BUILD)/kubespray | $(VENV)/bin/activate
198 source "$(VENV)/bin/activate" && \
199 pip install -r $(BUILD)/kubespray/requirements.txt
200 touch $@
201
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700202ifeq ($(K8S_INSTALL),kubespray)
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700203$(M)/k8s-ready: | $(M)/setup $(BUILD)/kubespray $(VENV)/bin/activate $(M)/kubespray-requirements
204 source "$(VENV)/bin/activate" && cd $(BUILD)/kubespray; \
205 ansible-playbook -b -i inventory/local/hosts.ini \
Fatemeh Rouzbeh85654e72022-05-23 09:26:12 -0700206 -e "{'http_proxy' : $(HTTP_PROXY)}" \
207 -e "{'https_proxy' : $(HTTPS_PROXY)}" \
208 -e "{'no_proxy' : $(NO_PROXY)}" \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700209 -e "{'override_system_hostname' : False, 'disable_swap' : True}" \
210 -e "{'docker_version' : $(DOCKER_VERSION)}" \
211 -e "{'docker_iptables_enabled' : True}" \
212 -e "{'kube_version' : $(K8S_VERSION)}" \
Hyunsun84f0f172020-09-23 15:40:08 -0500213 -e "{'kube_network_plugin_multus' : True, 'multus_version' : stable, 'multus_cni_version' : 0.3.1}" \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700214 -e "{'kube_proxy_metrics_bind_address' : 0.0.0.0:10249}" \
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600215 -e "{'kube_pods_subnet' : 192.168.84.0/24, 'kube_service_addresses' : 192.168.85.0/24}" \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700216 -e "{'kube_apiserver_node_port_range' : 2000-36767}" \
217 -e "{'kubeadm_enabled': True}" \
218 -e "{'kube_feature_gates' : [SCTPSupport=True]}" \
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600219 -e "{'kubelet_custom_flags' : [--allowed-unsafe-sysctls=net.*, --node-ip=$(NODE_IP)]}" \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700220 -e "{'dns_min_replicas' : 1}" \
221 -e "{'helm_enabled' : True, 'helm_version' : $(HELM_VERSION)}" \
222 cluster.yml
223 mkdir -p $(HOME)/.kube
224 sudo cp -f /etc/kubernetes/admin.conf $(HOME)/.kube/config
225 sudo chown $(shell id -u):$(shell id -g) $(HOME)/.kube/config
226 kubectl wait pod -n kube-system --for=condition=Ready --all
Andy Bavier9ee69d02022-02-11 10:31:21 -0700227 sudo adduser $(USER) docker
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700228 touch $@
229
230$(M)/helm-ready: | $(M)/k8s-ready
Woojoong Kim8425cb32021-01-08 16:18:53 -0800231 helm repo add incubator https://charts.helm.sh/incubator
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700232 helm repo add cord https://charts.opencord.org
Andy Baviereda466b2021-08-27 15:00:36 -0700233 helm repo add atomix https://charts.atomix.io
234 helm repo add onosproject https://charts.onosproject.org
Andy Bavier9ee69d02022-02-11 10:31:21 -0700235 helm repo add aether https://charts.aetherproject.org
Andy Bavier7d5f0552022-05-23 16:01:45 -0700236 helm repo add rancher http://charts.rancher.io/
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700237 touch $@
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700238endif
239
240ifeq ($(K8S_INSTALL),rke2)
241$(M)/k8s-ready: | $(M)/setup
242 sudo mkdir -p /etc/rancher/rke2/
243 [ -d /usr/local/etc/emulab ] && [ ! -e /var/lib/rancher ] && sudo ln -s /var/lib/rancher /mnt/extra/rancher || true # that link gets deleted on cleanup
244 echo "cni: multus,calico" >> config.yaml
245 echo "cluster-cidr: 192.168.84.0/24" >> config.yaml
246 echo "service-cidr: 192.168.85.0/24" >> config.yaml
247 echo "kubelet-arg:" >> config.yaml
248 echo "- --allowed-unsafe-sysctls="net.*"" >> config.yaml
249 echo "- --node-ip="$(NODE_IP)"" >> config.yaml
250 echo "pause-image: k8s.gcr.io/pause:3.3" >> config.yaml
251 echo "kube-proxy-arg:" >> config.yaml
252 echo "- --metrics-bind-address="0.0.0.0:10249"" >> config.yaml
253 echo "- --proxy-mode="ipvs"" >> config.yaml
254 echo "kube-apiserver-arg:" >> config.yaml
255 echo "- --service-node-port-range="2000-36767"" >> config.yaml
256 sudo mv config.yaml /etc/rancher/rke2/
257 curl -sfL https://get.rke2.io | sudo INSTALL_RKE2_VERSION=$(RKE2_K8S_VERSION) sh -
258 sudo systemctl enable rke2-server.service
259 sudo systemctl start rke2-server.service
260 sudo /var/lib/rancher/rke2/bin/kubectl --kubeconfig /etc/rancher/rke2/rke2.yaml wait nodes --for=condition=Ready --all --timeout=300s
261 sudo /var/lib/rancher/rke2/bin/kubectl --kubeconfig /etc/rancher/rke2/rke2.yaml wait deployment -n kube-system --for=condition=available --all --timeout=300s
SeanCondonc72e46c2023-06-05 21:51:07 +0100262 @$(eval STORAGE_CLASS := $(shell /var/lib/rancher/rke2/bin/kubectl --kubeconfig /etc/rancher/rke2/rke2.yaml get storageclass -o name))
263 @echo "STORAGE_CLASS: ${STORAGE_CLASS}"
264 if [ "$(STORAGE_CLASS)" == "" ]; then \
265 sudo /var/lib/rancher/rke2/bin/kubectl --kubeconfig /etc/rancher/rke2/rke2.yaml apply -f https://raw.githubusercontent.com/rancher/local-path-provisioner/$(LPP_VERSION)/deploy/local-path-storage.yaml --wait=true; \
266 sudo /var/lib/rancher/rke2/bin/kubectl --kubeconfig /etc/rancher/rke2/rke2.yaml patch storageclass local-path -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'; \
267 fi
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700268 curl -LO "https://dl.k8s.io/release/$(KUBECTL_VERSION)/bin/linux/amd64/kubectl"
269 sudo chmod +x kubectl
270 sudo mv kubectl /usr/local/bin/
271 kubectl version --client
272 mkdir -p $(HOME)/.kube
273 sudo cp /etc/rancher/rke2/rke2.yaml $(HOME)/.kube/config
274 sudo chown -R $(shell id -u):$(shell id -g) $(HOME)/.kube
275 touch $@
276
277$(M)/helm-ready: | $(M)/k8s-ready
Arrobo, Gabriel6e54e952022-06-23 21:36:00 +0000278 curl -fsSL -o ${GET_HELM} https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
279 chmod 700 ${GET_HELM}
280 sudo DESIRED_VERSION=$(HELM_VERSION) ./${GET_HELM}
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700281 helm repo add incubator https://charts.helm.sh/incubator
282 helm repo add cord https://charts.opencord.org
283 helm repo add atomix https://charts.atomix.io
284 helm repo add onosproject https://charts.onosproject.org
285 helm repo add aether https://charts.aetherproject.org
Andy Bavier7d5f0552022-05-23 16:01:45 -0700286 helm repo add rancher http://charts.rancher.io/
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700287 touch $@
288endif
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700289
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700290/opt/cni/bin/static: | $(M)/k8s-ready
291 mkdir -p $(BUILD)/cni-plugins; cd $(BUILD)/cni-plugins; \
292 wget https://github.com/containernetworking/plugins/releases/download/v0.8.2/cni-plugins-linux-amd64-v0.8.2.tgz && \
293 tar xvfz cni-plugins-linux-amd64-v0.8.2.tgz
294 sudo cp $(BUILD)/cni-plugins/static /opt/cni/bin/
295
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600296node-prep: | $(M)/helm-ready /opt/cni/bin/static
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700297
Bavier, Andya1377572023-01-10 12:06:52 -0700298router-pod: | $(M)/router-pod
Andy Bavier99f31c82022-04-14 16:16:26 -0700299$(M)/router-pod: $(ROUTER_POD_NETCONF)
300 sudo systemctl restart systemd-networkd
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600301 DATA_IFACE=$(DATA_IFACE) envsubst < $(RESOURCEDIR)/router.yaml | kubectl apply -f -
302 kubectl wait pod -n default --for=condition=Ready -l app=router --timeout=300s
303 @touch $@
304
Andy Bavier99f31c82022-04-14 16:16:26 -0700305$(M)/router-host: $(ROUTER_HOST_NETCONF) $(UE_NAT_CONF)
306 sudo systemctl daemon-reload
307 sudo systemctl enable aiab-ue-nat.service
308 sudo systemctl start aiab-ue-nat.service
309 sudo systemctl restart systemd-networkd
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600310 $(eval oiface := $(shell ip route list default | awk -F 'dev' '{ print $$2; exit }' | awk '{ print $$1 }'))
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600311 @touch $@
312
3134g-core: node-prep
314ifeq ($(ENABLE_ROUTER),true)
315ifeq ($(ENABLE_OAISIM),true)
3164g-core: $(M)/router-pod
317else
3184g-core: $(M)/router-host
319endif
320endif
3214g-core: $(M)/omec
322$(M)/omec:
323 @if [[ "${CHARTS}" == "local" || "${CHARTS}" == "local-sdcore" ]]; then \
324 helm dep up $(SD_CORE_CHART); \
325 else \
326 helm repo update; \
327 fi
328 NODE_IP=${NODE_IP} DATA_IFACE=${DATA_IFACE} RAN_SUBNET=${RAN_SUBNET} envsubst < $(4G_CORE_VALUES) | \
329 helm upgrade --create-namespace --install --wait $(HELM_GLOBAL_ARGS) \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700330 --namespace omec \
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600331 --values - \
Andy Bavier31dfb9e2022-02-15 15:24:57 -0700332 sd-core \
333 $(SD_CORE_CHART)
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600334 @if [[ "${ENABLE_OAISIM}" == "false" ]]; then \
335 $(eval mme_ip := $(shell ip -4 -o addr show $${DATA_IFACE} | awk '{print $$4}' | cut -d'/' -f1)) \
336 echo "Your MME IP is $(mme_ip)"; \
337 fi
338 @touch $@
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700339
Hyunsun Mooncbdac112022-03-19 22:01:27 -06003405g-core: node-prep
341ifeq ($(ENABLE_ROUTER),true)
342ifeq ($(ENABLE_GNBSIM),true)
3435g-core: $(M)/router-pod
344else
3455g-core: $(M)/router-host
346endif
347endif
3485g-core: $(M)/5g-core
349$(M)/5g-core:
350 @if [[ "${CHARTS}" == "local" || "${CHARTS}" == "local-sdcore" ]]; then \
351 helm dep up $(SD_CORE_CHART); \
352 else \
353 helm repo update; \
354 fi
Andy Baviera0c15d92022-06-13 12:55:48 -0700355 NODE_IP=${NODE_IP} DATA_IFACE=${DATA_IFACE} RAN_SUBNET=${RAN_SUBNET} ENABLE_GNBSIM=${ENABLE_GNBSIM} envsubst < $(5G_CORE_VALUES) | \
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600356 helm upgrade --create-namespace --install --wait $(HELM_GLOBAL_ARGS) \
Badhrinath3e081e22020-12-02 15:02:08 -0600357 --namespace omec \
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600358 --values - \
Andy Bavier31dfb9e2022-02-15 15:24:57 -0700359 sd-core \
360 $(SD_CORE_CHART)
Arrobo, Gabriela5366e12023-03-02 12:10:47 -0800361 @echo "1" > ${UPF_COUNT}
Badhrinath3e081e22020-12-02 15:02:08 -0600362 touch $@
363
Arrobo, Gabriela5366e12023-03-02 12:10:47 -0800364# Install additional UPF(s)
3655g-upf:
366 @if [[ $(UPF_NUMBER) -lt 1 ]]; then \
367 echo "Deploy '5g-core' before adding additional UPF(s)"; \
368 exit 1; \
369 fi
370 $(eval IP_ID=$(shell echo $$((3+$(UPF_NUMBER)))))
371 $(eval IP_UE_ID=$(shell echo $$((250-$(UPF_NUMBER)))))
372 NODE_IP=${NODE_IP} DATA_IFACE=${DATA_IFACE} RAN_SUBNET=${RAN_SUBNET} IP_ID=${IP_ID} IP_UE_ID=${IP_UE_ID} envsubst < $(5G_UPF_VALUES) | \
373 helm upgrade --create-namespace --install --wait $(HELM_GLOBAL_ARGS) \
374 --namespace upf-${UPF_NUMBER} \
375 --values - \
376 bess-upf \
377 $(UPF_CHART)
378 kubectl -n default exec -ti router -- ip route add 172.$(IP_UE_ID).0.0/16 via 192.168.250.$(IP_ID)
379 $(eval UPF_NUMBER=$(shell echo $$(($(UPF_NUMBER)+1))))
380 @echo $(UPF_NUMBER) > ${UPF_COUNT}
381
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700382# UE images includes kernel module, ue_ip.ko
383# which should be built in the exactly same kernel version of the host machine
384$(BUILD)/openairinterface: | $(M)/setup
385 mkdir -p $(BUILD)
386 cd $(BUILD); git clone https://github.com/opencord/openairinterface.git
387
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700388ifeq ($(K8S_INSTALL),kubespray)
389download-ue-image: | $(M)/k8s-ready $(BUILD)/openairinterface
Andy Bavier9ee69d02022-02-11 10:31:21 -0700390 sg docker -c "docker pull ${OAISIM_UE_IMAGE} && \
391 docker tag ${OAISIM_UE_IMAGE} omecproject/lte-uesoftmodem:1.1.0"
Andy Bavierd6de5612021-11-08 10:39:17 -0700392 touch $(M)/ue-image
393
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700394$(M)/ue-image: | $(M)/k8s-ready $(BUILD)/openairinterface
395 cd $(BUILD)/openairinterface; \
Andy Bavier9ee69d02022-02-11 10:31:21 -0700396 sg docker -c "docker build . --target lte-uesoftmodem \
Andy Bavier4db21452022-06-21 16:13:31 -0700397 --network=host \
Fatemeh Rouzbeh85654e72022-05-23 09:26:12 -0700398 --build-arg http_proxy=$(HTTP_PROXY)/ \
Hyunsun7b640512020-10-27 19:49:51 -0500399 --build-arg build_base=omecproject/oai-base:1.1.0 \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700400 --file Dockerfile.ue \
Andy Bavier9ee69d02022-02-11 10:31:21 -0700401 --tag omecproject/lte-uesoftmodem:1.1.0"
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700402 touch $@
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700403endif
404
405ifeq ($(K8S_INSTALL),rke2)
406download-ue-image: | $(M)/k8s-ready $(BUILD)/openairinterface
407 sg docker -c "docker pull ${OAISIM_UE_IMAGE} && \
408 docker tag ${OAISIM_UE_IMAGE} omecproject/lte-uesoftmodem:1.1.0 && \
409 docker save -o /tmp/lte-uesoftmodem.tar omecproject/lte-uesoftmodem:1.1.0"
410 $(CTR_CMD) images import /tmp/lte-uesoftmodem.tar
411 touch $(M)/ue-image
412
413$(M)/ue-image: $(M)/k8s-ready $(BUILD)/openairinterface
414 cd $(BUILD)/openairinterface; \
415 sg docker -c "docker build . --target lte-uesoftmodem \
Andy Bavier4db21452022-06-21 16:13:31 -0700416 --network=host \
Fatemeh Rouzbeh85654e72022-05-23 09:26:12 -0700417 --build-arg http_proxy=$(HTTP_PROXY)/ \
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700418 --build-arg build_base=omecproject/oai-base:1.1.0 \
419 --file Dockerfile.ue \
420 --tag omecproject/lte-uesoftmodem:1.1.0 && \
421 docker save -o /tmp/lte-uesoftmodem.tar omecproject/lte-uesoftmodem:1.1.0"
422 $(CTR_CMD) images import /tmp/lte-uesoftmodem.tar
423 touch $@
424endif
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700425
Andy Bavier99f31c82022-04-14 16:16:26 -0700426/etc/systemd/%:
427 @sudo mkdir -p $(@D)
428 @sed 's/DATA_IFACE/$(DATA_IFACE)/g' $(MAKEDIR)/systemd/$(@F) > /tmp/$(@F)
429 @sudo cp /tmp/$(@F) $@
430 echo "Installed $@"
Andy Bavier9ee69d02022-02-11 10:31:21 -0700431
Andy Bavier99f31c82022-04-14 16:16:26 -0700432oaisim-standalone: | $(M)/helm-ready $(M)/ue-image $(LO_NETCONF)
433 sudo systemctl restart systemd-networkd
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600434 @ip link show $(DATA_IFACE) > /dev/null || (echo DATA_IFACE is not set or does not exist; exit 1)
435 @if [[ "${MME_IP}" == "" ]]; then \
436 echo MME_IP is not set; \
437 exit 1; \
438 else \
439 ping -c 3 $(MME_IP) > /dev/null || (echo MME $(MME_IP) is not reachable; exit 1) \
440 fi
441 sudo ip route add 192.168.252.0/24 via $(MME_IP)
Andy Bavier7b01b682022-03-17 13:26:55 -0700442 helm repo update
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600443 helm upgrade --create-namespace --install $(HELM_GLOBAL_ARGS) --namespace omec oaisim cord/oaisim -f $(OAISIM_VALUES) \
444 --set config.enb.networks.s1u.interface=$(DATA_IFACE) \
445 --set config.enb.networks.s1_mme.interface=$(DATA_IFACE) \
446 --set config.enb.mme.address=$(MME_IP) \
447 --set config.enb.mme.isLocal=false \
448 --set images.pullPolicy=IfNotPresent
Andy Bavier7b01b682022-03-17 13:26:55 -0700449 kubectl rollout status -n omec statefulset ue
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600450 @echo "Test: registration"
Andy Bavier7b01b682022-03-17 13:26:55 -0700451 @timeout 60s bash -c \
452 "until ip addr show oip1 | grep -q inet; \
453 do \
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600454 echo 'Waiting for UE 1 gets IP address'; \
455 sleep 3; \
Andy Bavier7b01b682022-03-17 13:26:55 -0700456 done"
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600457 @echo "Test: ping from UE to 8.8.8.8"
458 ping -I oip1 8.8.8.8 -c 3
459 @touch $(M)/oaisim $(M)/omec
Andy Bavier7b01b682022-03-17 13:26:55 -0700460
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600461oaisim: | $(M)/oaisim
Andy Bavier99f31c82022-04-14 16:16:26 -0700462$(M)/oaisim: | $(M)/ue-image $(M)/router-pod $(OAISIM_NETCONF)
463 sudo systemctl restart systemd-networkd
Fatemeh Rouzbeh85654e72022-05-23 09:26:12 -0700464 sleep 1
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600465 helm upgrade --create-namespace --install $(HELM_GLOBAL_ARGS) --namespace omec oaisim cord/oaisim -f $(OAISIM_VALUES) \
Jeremy Ronquilloaf084f32020-08-24 13:18:47 -0700466 --set images.pullPolicy=IfNotPresent
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700467 kubectl rollout status -n omec statefulset ue
468 @timeout 60s bash -c \
469 "until ip addr show oip1 | grep -q inet; \
470 do \
471 echo 'Waiting for UE 1 gets IP address'; \
472 sleep 3; \
473 done"
474 touch $@
475
Andy Bavierebf479c2021-09-08 15:47:58 -0700476roc: $(M)/roc
477$(M)/roc: $(M)/helm-ready
478 kubectl get namespace aether-roc 2> /dev/null || kubectl create namespace aether-roc
479 helm repo update
480 if [ "$(CHARTS)" == "local" ]; then helm dep up $(AETHER_ROC_UMBRELLA_CHART); fi
SeanCondon254f6ce2022-12-01 09:22:13 +0000481 if [ "$(CHARTS)" == "release-2.0" -o "$(CHARTS)" == "release-1.6" ]; then \
482 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
483 --namespace kube-system \
484 --values $(ROC_VALUES) \
485 atomix-controller \
486 $(ATOMIX_CONTROLLER_CHART); \
487 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
488 --namespace kube-system \
489 --values $(ROC_VALUES) \
490 atomix-raft-storage \
491 $(ATOMIX_RAFT_STORAGE_CHART); \
492 else \
493 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
494 --namespace kube-system \
495 --values $(ROC_VALUES) \
Sean Condon3ed79bd2023-05-25 17:16:53 +0100496 atomix \
497 $(ATOMIX_CHART); \
SeanCondon254f6ce2022-12-01 09:22:13 +0000498 fi
Andy Bavierebf479c2021-09-08 15:47:58 -0700499 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
500 --namespace kube-system \
501 --values $(ROC_VALUES) \
502 onos-operator \
503 $(ONOS_OPERATOR_CHART)
504 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
505 --namespace aether-roc \
506 --values $(ROC_VALUES) \
507 aether-roc-umbrella \
508 $(AETHER_ROC_UMBRELLA_CHART)
509 touch $@
510
511# Load the ROC 4G models. Disable loading network slice from SimApp.
512roc-4g-models: $(M)/roc
513 sed -i 's/provision-network-slice: true/provision-network-slice: false/' $(4G_CORE_VALUES)
514 sed -i 's/# syncUrl/syncUrl/' $(4G_CORE_VALUES)
Amit Wankhede01b20c32021-12-01 12:45:58 +0530515 if [ "${ENABLE_SUBSCRIBER_PROXY}" == "true" ] ; then \
Amit Wankhedefdf10ff2022-02-16 08:37:20 -0600516 sed -i 's/# sub-proxy-endpt:/sub-proxy-endpt:/' $(4G_CORE_VALUES) ; \
517 sed -i 's/# addr: sub/ addr: sub/' $(4G_CORE_VALUES) ; \
518 sed -i 's/# port: 5000/ port: 5000/' $(4G_CORE_VALUES) ; \
Amit Wankhede01b20c32021-12-01 12:45:58 +0530519 fi
Sean Condone184e6e2023-01-12 09:59:40 +0000520 @$(eval ONOS_CLI_POD := $(shell kubectl -n aether-roc get pods -l name=onos-cli -o name))
Andy Bavierebf479c2021-09-08 15:47:58 -0700521 echo "ONOS CLI pod: ${ONOS_CLI_POD}"
Sean Condone184e6e2023-01-12 09:59:40 +0000522 @$(eval API_SERVICE := $(shell kubectl -n aether-roc get --no-headers=true services -l app.kubernetes.io/name=aether-roc-api | awk '{print $$1}'))
523 echo "API SERVICE : ${API_SERVICE}"
SeanCondon47660272023-01-15 22:24:24 +0000524 if [ "$(CHARTS)" != "release-2.0" -a "$(CHARTS)" != "release-1.6" ]; then \
525 until kubectl -n aether-roc exec ${ONOS_CLI_POD} -- \
526 curl -s -f -L -X PATCH "http://${API_SERVICE}:8181/aether-roc-api" \
527 --header 'Content-Type: application/json' \
528 --data-raw "$$(cat ${ROC_DEFAULTENT_MODEL})"; do sleep 5; done; \
529 fi
Sean Condone184e6e2023-01-12 09:59:40 +0000530 until kubectl -n aether-roc exec ${ONOS_CLI_POD} -- \
531 curl -s -f -L -X PATCH "http://${API_SERVICE}:8181/aether-roc-api" \
Andy Bavierebf479c2021-09-08 15:47:58 -0700532 --header 'Content-Type: application/json' \
533 --data-raw "$$(cat ${ROC_4G_MODELS})"; do sleep 5; done
534
535# Load the ROC 5G models. Disable loading network slice from SimApp.
536roc-5g-models: $(M)/roc
537 sed -i 's/provision-network-slice: true/provision-network-slice: false/' $(5G_CORE_VALUES)
538 sed -i 's/# syncUrl/syncUrl/' $(5G_CORE_VALUES)
Amit Wankhede01b20c32021-12-01 12:45:58 +0530539 if [ "${ENABLE_SUBSCRIBER_PROXY}" == "true" ] ; then \
Amit Wankhedefdf10ff2022-02-16 08:37:20 -0600540 sed -i 's/# sub-proxy-endpt:/sub-proxy-endpt:/' $(5G_CORE_VALUES) ; \
541 sed -i 's/# addr: sub/ addr: sub/' $(5G_CORE_VALUES) ; \
542 sed -i 's/# port: 5000/ port: 5000/' $(5G_CORE_VALUES) ; \
Amit Wankhede01b20c32021-12-01 12:45:58 +0530543 fi
Sean Condone184e6e2023-01-12 09:59:40 +0000544 @$(eval ONOS_CLI_POD := $(shell kubectl -n aether-roc get pods -l name=onos-cli -o name))
Andy Bavierebf479c2021-09-08 15:47:58 -0700545 echo "ONOS CLI pod: ${ONOS_CLI_POD}"
Sean Condone184e6e2023-01-12 09:59:40 +0000546 @$(eval API_SERVICE := $(shell kubectl -n aether-roc get --no-headers=true services -l app.kubernetes.io/name=aether-roc-api | awk '{print $$1}'))
547 echo "API SERVICE : ${API_SERVICE}"
SeanCondon47660272023-01-15 22:24:24 +0000548 if [ "$(CHARTS)" != "release-2.0" -a "$(CHARTS)" != "release-1.6" ]; then \
549 until kubectl -n aether-roc exec ${ONOS_CLI_POD} -- \
550 curl -s -f -L -X PATCH "http://${API_SERVICE}:8181/aether-roc-api" \
551 --header 'Content-Type: application/json' \
552 --data-raw "$$(cat ${ROC_DEFAULTENT_MODEL})"; do sleep 5; done; \
553 fi
Sean Condone184e6e2023-01-12 09:59:40 +0000554 until kubectl -n aether-roc exec ${ONOS_CLI_POD} -- \
555 curl -s -f -L -X PATCH "http://${API_SERVICE}:8181/aether-roc-api" \
Andy Bavierebf479c2021-09-08 15:47:58 -0700556 --header 'Content-Type: application/json' \
557 --data-raw "$$(cat ${ROC_5G_MODELS})"; do sleep 5; done
558
559roc-clean:
560 @echo "This could take 2-3 minutes..."
561 sed -i 's/provision-network-slice: false/provision-network-slice: true/' $(4G_CORE_VALUES)
562 sed -i 's/ syncUrl/ # syncUrl/' $(4G_CORE_VALUES)
Amit Wankhedefdf10ff2022-02-16 08:37:20 -0600563 sed -i 's/ sub-proxy-endpt:/ # sub-proxy-endpt:/' $(4G_CORE_VALUES)
564 sed -i 's/ addr: sub/ # addr: sub/' $(4G_CORE_VALUES)
565 sed -i 's/ port: 5000/ # port: 5000/' $(4G_CORE_VALUES)
Andy Bavierebf479c2021-09-08 15:47:58 -0700566 sed -i 's/provision-network-slice: false/provision-network-slice: true/' $(5G_CORE_VALUES)
567 sed -i 's/ syncUrl/ # syncUrl/' $(5G_CORE_VALUES)
Amit Wankhedefdf10ff2022-02-16 08:37:20 -0600568 sed -i 's/ sub-proxy-endpt:/ # sub-proxy-endpt:/' $(5G_CORE_VALUES)
569 sed -i 's/ addr: sub/ # addr: sub/' $(5G_CORE_VALUES)
Arrobo, Gabriel492fe1f2023-03-02 01:39:04 +0000570 sed -i 's/ port: 5000/ # port: 5000/' $(5G_CORE_VALUES)
Andy Bavierebf479c2021-09-08 15:47:58 -0700571 kubectl delete namespace aether-roc || true
572 rm -rf $(M)/roc
Arrobo, Gabriel6e54e952022-06-23 21:36:00 +0000573 rm -f ${GET_HELM}
Andy Bavierebf479c2021-09-08 15:47:58 -0700574
Andy Bavier7d5f0552022-05-23 16:01:45 -0700575monitoring: $(M)/monitoring
576$(M)/monitoring: $(M)/helm-ready
577 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
578 --namespace=cattle-monitoring-system \
579 --create-namespace \
580 --values=$(MONITORING_VALUES) \
581 rancher-monitoring-crd \
582 $(RANCHER_MONITORING_CRD_CHART)
583 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
584 --namespace=cattle-monitoring-system \
585 --create-namespace \
586 --values=$(MONITORING_VALUES) \
587 rancher-monitoring \
588 $(RANCHER_MONITORING_CHART)
589 touch $(M)/monitoring
590
591monitoring-4g: $(M)/monitoring
592 kubectl create namespace omec || true
593 kubectl create namespace cattle-dashboards || true
594 kubectl apply -k resources/4g-monitoring
595
Ankur Upadhyaya9b9707a2022-11-24 10:48:33 -0600596monitoring-5g: $(M)/monitoring
597 kubectl create namespace omec || true
598 kubectl create namespace cattle-dashboards || true
599 kubectl apply -k resources/5g-monitoring
600
Wei-Yu Chena6ae6e22022-06-08 18:15:30 +0800601enodebd:
602 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
603 --namespace=aether-apps \
604 --create-namespace \
605 enodebd \
606 ${ENODEBD_CHART}
607 touch $(M)/enodebd
608
609enodebd-clean:
610 helm -n aether-apps delete enodebd || true
611 rm $(M)/enodebd
Andy Bavier7d5f0552022-05-23 16:01:45 -0700612
613monitoring-clean:
614 helm -n cattle-monitoring-system delete rancher-monitoring || true
615 helm -n cattle-monitoring-system delete rancher-monitoring-crd || true
616 kubectl delete namespace cattle-dashboards cattle-monitoring-system || true
617 rm $(M)/monitoring
618
Arrobo, Gabriela5366e12023-03-02 12:10:47 -0800619upf-clean:
620 $(eval TO_REMOVE=$(shell echo $$(($(UPF_NUMBER)-1))))
621 @echo Removing $(TO_REMOVE) additional UPFs
622 @number=$(UPF_NUMBER) ; \
623 while [[ $$number -gt 1 ]] ; do \
624 ((number = number - 1)) ; \
625 ((addr = 250 - number)) ; \
626 helm delete -n upf-$$number $$(helm -n upf-$$number ls -qa) || true ; \
627 echo "Wait for all pods to terminate..." ; \
628 kubectl wait -n upf-$$number --for=delete --all=true -l app!=ue pod --timeout=180s || true ; \
629 kubectl delete namespace upf-$$number || true ; \
630 kubectl -n default exec -ti router -- ip route delete 172.$$addr.0.0/16 || true ; \
631 echo "" ; \
632 done
633 @echo "1" > ${UPF_COUNT}
634
635omec-clean: upf-clean
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600636 helm delete -n omec $$(helm -n omec ls -qa) || true
Arrobo, Gabriela5366e12023-03-02 12:10:47 -0800637 kubectl delete namespace omec || true
638 @rm -f $(UPF_COUNT)
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600639 @echo ""
640 @echo "Wait for all pods to terminate..."
641 kubectl wait -n omec --for=delete --all=true -l app!=ue pod --timeout=180s || true
642
643router-clean:
644 @kubectl delete net-attach-def router-net 2>/dev/null || true
645 @kubectl delete po router 2>/dev/null || true
646 kubectl wait --for=delete -l app=router pod --timeout=180s 2>/dev/null || true
647 sudo ip link del access || true
648 sudo ip link del core || true
649 $(eval oiface := $(shell ip route list default | awk -F 'dev' '{ print $$2; exit }' | awk '{ print $$1 }'))
650 sudo iptables -t nat -D POSTROUTING -s 172.250.0.0/16 -o $(oiface) -j MASQUERADE || true
651 @sudo ip link del data 2>/dev/null || true
652 @cd $(M); rm -f router-pod router-host
653
654oaisim-clean: reset-ue
655 @sudo ip addr del 127.0.0.2/8 dev lo 2>/dev/null || true
656 @sudo ip link del enb 2>/dev/null || true
657 @sudo ip route del 192.168.252.0/24 || true
658 @cd $(M); rm -f oaisim-lo
659
Andy Bavier7d5f0552022-05-23 16:01:45 -07006604g-test: test
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600661test: | 4g-core $(M)/oaisim
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700662 @sleep 5
663 @echo "Test1: ping from UE to SGI network gateway"
Hyunsun Moon0bd8cec2020-09-28 00:38:26 -0500664 ping -I oip1 192.168.250.1 -c 15
Fatemeh Rouzbeh85654e72022-05-23 09:26:12 -0700665 @if [ "${PROXY_ENABLED}" == "false" ] ; then \
666 @echo "Test2: ping from UE to 8.8.8.8" ; \
667 ping -I oip1 8.8.8.8 -c 3 ; \
668 @echo "Test3: ping from UE to google.com" ; \
669 ping -I oip1 google.com -c 3 ; \
670 fi
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700671 @echo "Finished to test"
672
Hyunsun Mooncbdac112022-03-19 22:01:27 -06006735g-test: | 5g-core
Andy Bavier31dfb9e2022-02-15 15:24:57 -0700674 @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 -0700675 @echo "Test: Registration + UE initiated PDU Session Establishment + User Data packets"
Andy Bavier0e4906f2022-03-03 15:31:48 -0700676 @sleep 60
Andy Bavier0a055a52022-01-07 10:46:17 -0700677 @rm -f /tmp/gnbsim.out
Andy Baviercd93a202022-01-10 18:03:26 -0800678 @if [[ ${GNBSIM_COLORS} == "true" ]]; then \
679 kubectl -n omec exec gnbsim-0 -- ./gnbsim 2>&1 | tee /tmp/gnbsim.out; \
680 else \
681 kubectl -n omec exec gnbsim-0 -- ./gnbsim 2>&1 | sed -u "s,\x1B\[[0-9;]*[a-zA-Z],,g" | tee /tmp/gnbsim.out; \
682 fi
Andy Bavier025874a2022-07-29 13:20:04 -0700683 @grep -q "Simulation Result: PASS\|Profile Status: PASS" /tmp/gnbsim.out
Andy Bavier0a055a52022-01-07 10:46:17 -0700684
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600685reset-test: | oaisim-clean omec-clean router-clean
686 @cd $(M); rm -f omec oaisim 5g-core
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700687
Andy Bavier8819b9f2022-01-28 16:54:06 -0700688reset-ue:
689 helm delete -n omec oaisim || true
690 kubectl wait -n omec --for=delete pod enb-0 || true
691 kubectl wait -n omec --for=delete pod ue-0 || true
692 cd $(M); rm -f oaisim
693
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600694reset-5g-test: omec-clean
Badhrinath3e081e22020-12-02 15:02:08 -0600695 cd $(M); rm -f 5g-core
696
Osman Amjad488a0222022-01-12 11:58:43 -0600697reset-dbtestapp:
698 helm uninstall --namespace omec 5g-test-app
699
Andy Bavier99f31c82022-04-14 16:16:26 -0700700refresh-4g: reset-ue
701 kubectl -n omec delete pod mme-0
702 kubectl wait -n omec --for='condition=ready' pod mme-0 --timeout=300s
703
Osman Amjad488a0222022-01-12 11:58:43 -0600704dbtestapp:
705 helm repo update
706 if [ "$(CHARTS)" == "local" ]; then helm dep up $(5G_TEST_APPS_CHART); fi
707 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
708 --namespace omec \
709 5g-test-app \
710 --values $(TEST_APP_VALUES) \
711 $(5G_TEST_APPS_CHART)
712 @echo "Finished to dbtestapp"
713
Andy Bavier99f31c82022-04-14 16:16:26 -0700714clean-systemd:
715 cd /etc/systemd/network && sudo rm -f 10-aiab* 20-aiab* */macvlan.conf
716 cd /etc/systemd/system && sudo rm -f aiab*.service && sudo systemctl daemon-reload
717
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700718ifeq ($(K8S_INSTALL),rke2)
Andy Bavier5b5ad562022-04-19 13:02:31 -0700719clean: | roc-clean oaisim-clean router-clean clean-systemd
Andy Bavier99f31c82022-04-14 16:16:26 -0700720 sudo /usr/local/bin/rke2-uninstall.sh || true
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700721 sudo rm -rf /usr/local/bin/kubectl
722 rm -rf $(M)
723endif
724
725ifeq ($(K8S_INSTALL),kubespray)
Andy Bavier5b5ad562022-04-19 13:02:31 -0700726clean: | roc-clean oaisim-clean router-clean clean-systemd
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700727 source "$(VENV)/bin/activate" && cd $(BUILD)/kubespray; \
Andy Bavier125baa02021-10-26 16:26:44 -0700728 ansible-playbook -b -i inventory/local/hosts.ini reset.yml --extra-vars "reset_confirmation=yes"
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700729 @if [ -d /usr/local/etc/emulab ]; then \
730 mount | grep /mnt/extra/kubelet/pods | cut -d" " -f3 | sudo xargs umount; \
731 sudo rm -rf /mnt/extra/kubelet; \
732 fi
733 rm -rf $(M)
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700734endif