blob: 37b57909876b29c80564c15c749d748f9cd81abf [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
Bavier, Andya9396a62023-01-21 10:43:40 -0700165G_UPF2_VALUES ?= $(MAKEDIR)/upf2-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
23GET_HELM = get_helm.sh
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070024
Amol Jaikar3d296902023-01-19 00:10:11 -050025KUBESPRAY_VERSION ?= release-2.17
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -070026DOCKER_VERSION ?= '20.10'
Amol Jaikarf7402222023-01-17 15:15:07 -050027HELM_VERSION ?= v3.10.3
Amol Jaikar53325922023-01-18 22:43:26 -050028KUBECTL_VERSION ?= v1.23.15
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -070029
Amol Jaikar53325922023-01-18 22:43:26 -050030RKE2_K8S_VERSION ?= v1.23.15+rke2r1
Amol Jaikare10bbd62023-01-18 23:23:25 -050031K8S_VERSION ?= v1.21.6
Hyunsun Mooncbdac112022-03-19 22:01:27 -060032
Amol Jaikarf2124ed2023-01-20 14:05:16 -050033OAISIM_UE_IMAGE ?= andybavier/lte-uesoftmodem:1.1.0-$(shell uname -r)
Hyunsun Mooncbdac112022-03-19 22:01:27 -060034ENABLE_ROUTER ?= true
35ENABLE_OAISIM ?= true
36ENABLE_GNBSIM ?= true
Amit Wankhede01b20c32021-12-01 12:45:58 +053037ENABLE_SUBSCRIBER_PROXY ?= false
Andy Baviercd93a202022-01-10 18:03:26 -080038GNBSIM_COLORS ?= true
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070039
Fatemeh Rouzbeh85654e72022-05-23 09:26:12 -070040K8S_INSTALL ?= rke2
Andy Bavier99f31c82022-04-14 16:16:26 -070041CTR_CMD := sudo /var/lib/rancher/rke2/bin/ctr --address /run/k3s/containerd/containerd.sock --namespace k8s.io
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -070042
Fatemeh Rouzbeh85654e72022-05-23 09:26:12 -070043PROXY_ENABLED ?= false
44HTTP_PROXY ?= ${http_proxy}
45HTTPS_PROXY ?= ${https_proxy}
46NO_PROXY ?= ${no_proxy}
47
48ONECLOUD ?= false
49
Hyunsun Mooncbdac112022-03-19 22:01:27 -060050DATA_IFACE ?= data
51ifeq ($(DATA_IFACE), data)
52 RAN_SUBNET := 192.168.251.0/24
53else
Ajay Lotan Thakur5ee9e0e2022-09-28 23:34:56 -060054 RAN_SUBNET := $(shell ip route | grep $${DATA_IFACE} | awk '/kernel/ {print $$1}' | head -1)
Andy Bavier99f31c82022-04-14 16:16:26 -070055 DATA_IFACE_PATH := $(shell find /*/systemd/network -maxdepth 1 -not -type d -name '*$(DATA_IFACE).network' -print)
56 DATA_IFACE_CONF ?= $(shell basename $(DATA_IFACE_PATH)).d
Hyunsun Mooncbdac112022-03-19 22:01:27 -060057endif
Hyunsun Moon4e5795a2022-04-07 09:27:12 -070058
Andy Bavier99f31c82022-04-14 16:16:26 -070059# systemd-networkd and systemd configs
60LO_NETCONF := /etc/systemd/network/20-aiab-lo.network
61OAISIM_NETCONF := $(LO_NETCONF) /etc/systemd/network/10-aiab-enb.netdev /etc/systemd/network/20-aiab-enb.network
62ROUTER_POD_NETCONF := /etc/systemd/network/10-aiab-dummy.netdev /etc/systemd/network/20-aiab-dummy.network
63ROUTER_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
64UE_NAT_CONF := /etc/systemd/system/aiab-ue-nat.service
65
Andy Bavier7d5f0552022-05-23 16:01:45 -070066# monitoring
67RANCHER_MONITORING_CRD_CHART := rancher/rancher-monitoring-crd
68RANCHER_MONITORING_CHART := rancher/rancher-monitoring
69MONITORING_VALUES ?= $(MAKEDIR)/monitoring.yaml
70
Hyunsun Moon4e5795a2022-04-07 09:27:12 -070071NODE_IP ?= $(shell ip route get 8.8.8.8 | grep -oP 'src \K\S+')
72ifndef NODE_IP
73$(error NODE_IP is not set)
74endif
75
Hyunsun Mooncbdac112022-03-19 22:01:27 -060076MME_IP ?=
77
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070078HELM_GLOBAL_ARGS ?=
Andy Baviereda466b2021-08-27 15:00:36 -070079
80# Allow installing local charts or specific versions of published charts.
81# E.g., to install the Aether 1.5 release:
82# CHARTS=release-1.5 make test
83# Default is to install from the local charts.
84CHARTS ?= local
85CONFIGFILE := configs/$(CHARTS)
86include $(CONFIGFILE)
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070087
88cpu_family := $(shell lscpu | grep 'CPU family:' | awk '{print $$3}')
89cpu_model := $(shell lscpu | grep 'Model:' | awk '{print $$2}')
90os_vendor := $(shell lsb_release -i -s)
91os_release := $(shell lsb_release -r -s)
Andy Bavier9ee69d02022-02-11 10:31:21 -070092USER := $(shell whoami)
93
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -070094.PHONY: 4g-core 5g-core oaisim test reset-test reset-ue reset-5g-test node-prep clean
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070095
96$(M):
97 mkdir -p $(M)
98
99$(M)/system-check: | $(M)
100 @if [[ $(cpu_family) -eq 6 ]]; then \
101 if [[ $(cpu_model) -lt 60 ]]; then \
102 echo "FATAL: haswell CPU or newer is required."; \
103 exit 1; \
104 fi \
105 else \
106 echo "FATAL: unsupported CPU family."; \
107 exit 1; \
108 fi
109 @if [[ $(os_vendor) =~ (Ubuntu) ]]; then \
Hyunsun7b640512020-10-27 19:49:51 -0500110 if [[ ! $(os_release) =~ (18.04) ]]; then \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700111 echo "WARN: $(os_vendor) $(os_release) has not been tested."; \
112 fi; \
113 if dpkg --compare-versions 4.15 gt $(shell uname -r); then \
114 echo "FATAL: kernel 4.15 or later is required."; \
115 echo "Please upgrade your kernel by running" \
116 "apt install --install-recommends linux-generic-hwe-$(os_release)"; \
117 exit 1; \
118 fi \
119 else \
120 echo "FAIL: unsupported OS."; \
121 exit 1; \
122 fi
123 touch $@
124
Andy Bavier99f31c82022-04-14 16:16:26 -0700125$(M)/interface-check: | $(M)
126ifeq ($(DATA_IFACE_CONF), .d)
127 @echo
128 @echo FATAL: Could not find systemd-networkd config for interface $(DATA_IFACE), exiting now!; exit 1
129endif
Fatemeh Rouzbeh85654e72022-05-23 09:26:12 -0700130 @echo "Add network configuration for enb interface"
131 @if [[ "${ONECLOUD}" == "true" ]]; then \
132 sudo cp netplan/01-enb-static-config.yaml /etc/netplan ; \
133 sudo netplan apply ; \
134 sleep 1 ; \
135 fi
Andy Bavier99f31c82022-04-14 16:16:26 -0700136 touch $@
137
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700138ifeq ($(K8S_INSTALL),kubespray)
Andy Bavier99f31c82022-04-14 16:16:26 -0700139$(M)/setup: | $(M) $(M)/interface-check
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700140 sudo $(SCRIPTDIR)/cloudlab-disksetup.sh
Hyunsun Moon82e47c22021-06-28 12:30:20 -0500141 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 -0700142 touch $@
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700143endif
144
145ifeq ($(K8S_INSTALL),rke2)
Fatemeh Rouzbeh85654e72022-05-23 09:26:12 -0700146$(M)/initial-setup: | $(M) $(M)/interface-check
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700147 sudo $(SCRIPTDIR)/cloudlab-disksetup.sh
148 sudo apt update; sudo apt install -y software-properties-common python3 python3-pip python3-venv jq httpie ipvsadm apparmor apparmor-utils
149 systemctl list-units --full -all | grep "docker.service" || sudo apt install -y docker.io
150 sudo adduser $(USER) docker || true
Andy Bavier23024432022-05-26 10:10:50 -0700151 touch $(M)/initial-setup
Fatemeh Rouzbeh85654e72022-05-23 09:26:12 -0700152
153ifeq ($(PROXY_ENABLED),true)
154$(M)/proxy-setting: | $(M)
155 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
156 echo "HTTP_PROXY=$(HTTP_PROXY)" >> rke2-server
157 echo "HTTPS_PROXY=$(HTTPS_PROXY)" >> rke2-server
158 echo "NO_PROXY=$(NO_PROXY),.cluster.local,.svc,$(NODE_IP),192.168.84.0/24,192.168.85.0/24,$(RAN_SUBNET)" >> rke2-server
159 sudo mv rke2-server /etc/default/
160 echo "[Service]" >> http-proxy.conf
161 echo "Environment='HTTP_PROXY=$(HTTP_PROXY)'" >> http-proxy.conf
162 echo "Environment='HTTPS_PROXY=$(HTTPS_PROXY)'" >> http-proxy.conf
163 echo "Environment='NO_PROXY=$(NO_PROXY)'" >> http-proxy.conf
164 sudo mkdir -p /etc/systemd/system/docker.service.d
165 sudo mv http-proxy.conf /etc/systemd/system/docker.service.d
166 sudo systemctl daemon-reload
167 sudo systemctl restart docker
168 touch $(M)/proxy-setting
169else
170$(M)/proxy-setting: | $(M)
171 @echo -n ""
172 touch $(M)/proxy-setting
173endif
174
175$(M)/setup: | $(M)/initial-setup $(M)/proxy-setting
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700176 touch $@
177endif
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700178
179$(BUILD)/kubespray: | $(M)/setup
180 mkdir -p $(BUILD)
181 cd $(BUILD); git clone https://github.com/kubernetes-incubator/kubespray.git -b $(KUBESPRAY_VERSION)
182
183$(VENV)/bin/activate: | $(M)/setup
Hyunsun Moon82e47c22021-06-28 12:30:20 -0500184 python3 -m venv $(VENV)
Wei-Yu Chen7edb7e72021-07-28 11:37:55 +0800185 source "$(VENV)/bin/activate" && \
186 python -m pip install -U pip && \
187 deactivate
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700188
189$(M)/kubespray-requirements: $(BUILD)/kubespray | $(VENV)/bin/activate
190 source "$(VENV)/bin/activate" && \
191 pip install -r $(BUILD)/kubespray/requirements.txt
192 touch $@
193
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700194ifeq ($(K8S_INSTALL),kubespray)
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700195$(M)/k8s-ready: | $(M)/setup $(BUILD)/kubespray $(VENV)/bin/activate $(M)/kubespray-requirements
196 source "$(VENV)/bin/activate" && cd $(BUILD)/kubespray; \
197 ansible-playbook -b -i inventory/local/hosts.ini \
Fatemeh Rouzbeh85654e72022-05-23 09:26:12 -0700198 -e "{'http_proxy' : $(HTTP_PROXY)}" \
199 -e "{'https_proxy' : $(HTTPS_PROXY)}" \
200 -e "{'no_proxy' : $(NO_PROXY)}" \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700201 -e "{'override_system_hostname' : False, 'disable_swap' : True}" \
202 -e "{'docker_version' : $(DOCKER_VERSION)}" \
203 -e "{'docker_iptables_enabled' : True}" \
204 -e "{'kube_version' : $(K8S_VERSION)}" \
Hyunsun84f0f172020-09-23 15:40:08 -0500205 -e "{'kube_network_plugin_multus' : True, 'multus_version' : stable, 'multus_cni_version' : 0.3.1}" \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700206 -e "{'kube_proxy_metrics_bind_address' : 0.0.0.0:10249}" \
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600207 -e "{'kube_pods_subnet' : 192.168.84.0/24, 'kube_service_addresses' : 192.168.85.0/24}" \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700208 -e "{'kube_apiserver_node_port_range' : 2000-36767}" \
209 -e "{'kubeadm_enabled': True}" \
210 -e "{'kube_feature_gates' : [SCTPSupport=True]}" \
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600211 -e "{'kubelet_custom_flags' : [--allowed-unsafe-sysctls=net.*, --node-ip=$(NODE_IP)]}" \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700212 -e "{'dns_min_replicas' : 1}" \
213 -e "{'helm_enabled' : True, 'helm_version' : $(HELM_VERSION)}" \
214 cluster.yml
215 mkdir -p $(HOME)/.kube
216 sudo cp -f /etc/kubernetes/admin.conf $(HOME)/.kube/config
217 sudo chown $(shell id -u):$(shell id -g) $(HOME)/.kube/config
218 kubectl wait pod -n kube-system --for=condition=Ready --all
Andy Bavier9ee69d02022-02-11 10:31:21 -0700219 sudo adduser $(USER) docker
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700220 touch $@
221
222$(M)/helm-ready: | $(M)/k8s-ready
Woojoong Kim8425cb32021-01-08 16:18:53 -0800223 helm repo add incubator https://charts.helm.sh/incubator
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700224 helm repo add cord https://charts.opencord.org
Andy Baviereda466b2021-08-27 15:00:36 -0700225 helm repo add atomix https://charts.atomix.io
226 helm repo add onosproject https://charts.onosproject.org
Andy Bavier9ee69d02022-02-11 10:31:21 -0700227 helm repo add aether https://charts.aetherproject.org
Andy Bavier7d5f0552022-05-23 16:01:45 -0700228 helm repo add rancher http://charts.rancher.io/
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700229 touch $@
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700230endif
231
232ifeq ($(K8S_INSTALL),rke2)
233$(M)/k8s-ready: | $(M)/setup
234 sudo mkdir -p /etc/rancher/rke2/
235 [ -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
236 echo "cni: multus,calico" >> config.yaml
237 echo "cluster-cidr: 192.168.84.0/24" >> config.yaml
238 echo "service-cidr: 192.168.85.0/24" >> config.yaml
239 echo "kubelet-arg:" >> config.yaml
240 echo "- --allowed-unsafe-sysctls="net.*"" >> config.yaml
241 echo "- --node-ip="$(NODE_IP)"" >> config.yaml
242 echo "pause-image: k8s.gcr.io/pause:3.3" >> config.yaml
243 echo "kube-proxy-arg:" >> config.yaml
244 echo "- --metrics-bind-address="0.0.0.0:10249"" >> config.yaml
245 echo "- --proxy-mode="ipvs"" >> config.yaml
246 echo "kube-apiserver-arg:" >> config.yaml
247 echo "- --service-node-port-range="2000-36767"" >> config.yaml
248 sudo mv config.yaml /etc/rancher/rke2/
249 curl -sfL https://get.rke2.io | sudo INSTALL_RKE2_VERSION=$(RKE2_K8S_VERSION) sh -
250 sudo systemctl enable rke2-server.service
251 sudo systemctl start rke2-server.service
252 sudo /var/lib/rancher/rke2/bin/kubectl --kubeconfig /etc/rancher/rke2/rke2.yaml wait nodes --for=condition=Ready --all --timeout=300s
253 sudo /var/lib/rancher/rke2/bin/kubectl --kubeconfig /etc/rancher/rke2/rke2.yaml wait deployment -n kube-system --for=condition=available --all --timeout=300s
254 curl -LO "https://dl.k8s.io/release/$(KUBECTL_VERSION)/bin/linux/amd64/kubectl"
255 sudo chmod +x kubectl
256 sudo mv kubectl /usr/local/bin/
257 kubectl version --client
258 mkdir -p $(HOME)/.kube
259 sudo cp /etc/rancher/rke2/rke2.yaml $(HOME)/.kube/config
260 sudo chown -R $(shell id -u):$(shell id -g) $(HOME)/.kube
261 touch $@
262
263$(M)/helm-ready: | $(M)/k8s-ready
Arrobo, Gabriel6e54e952022-06-23 21:36:00 +0000264 curl -fsSL -o ${GET_HELM} https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
265 chmod 700 ${GET_HELM}
266 sudo DESIRED_VERSION=$(HELM_VERSION) ./${GET_HELM}
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700267 helm repo add incubator https://charts.helm.sh/incubator
268 helm repo add cord https://charts.opencord.org
269 helm repo add atomix https://charts.atomix.io
270 helm repo add onosproject https://charts.onosproject.org
271 helm repo add aether https://charts.aetherproject.org
Andy Bavier7d5f0552022-05-23 16:01:45 -0700272 helm repo add rancher http://charts.rancher.io/
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700273 touch $@
274endif
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700275
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700276/opt/cni/bin/static: | $(M)/k8s-ready
277 mkdir -p $(BUILD)/cni-plugins; cd $(BUILD)/cni-plugins; \
278 wget https://github.com/containernetworking/plugins/releases/download/v0.8.2/cni-plugins-linux-amd64-v0.8.2.tgz && \
279 tar xvfz cni-plugins-linux-amd64-v0.8.2.tgz
280 sudo cp $(BUILD)/cni-plugins/static /opt/cni/bin/
281
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600282node-prep: | $(M)/helm-ready /opt/cni/bin/static
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700283
Bavier, Andya1377572023-01-10 12:06:52 -0700284router-pod: | $(M)/router-pod
Andy Bavier99f31c82022-04-14 16:16:26 -0700285$(M)/router-pod: $(ROUTER_POD_NETCONF)
286 sudo systemctl restart systemd-networkd
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600287 DATA_IFACE=$(DATA_IFACE) envsubst < $(RESOURCEDIR)/router.yaml | kubectl apply -f -
288 kubectl wait pod -n default --for=condition=Ready -l app=router --timeout=300s
289 @touch $@
290
Andy Bavier99f31c82022-04-14 16:16:26 -0700291$(M)/router-host: $(ROUTER_HOST_NETCONF) $(UE_NAT_CONF)
292 sudo systemctl daemon-reload
293 sudo systemctl enable aiab-ue-nat.service
294 sudo systemctl start aiab-ue-nat.service
295 sudo systemctl restart systemd-networkd
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600296 $(eval oiface := $(shell ip route list default | awk -F 'dev' '{ print $$2; exit }' | awk '{ print $$1 }'))
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600297 @touch $@
298
2994g-core: node-prep
300ifeq ($(ENABLE_ROUTER),true)
301ifeq ($(ENABLE_OAISIM),true)
3024g-core: $(M)/router-pod
303else
3044g-core: $(M)/router-host
305endif
306endif
3074g-core: $(M)/omec
308$(M)/omec:
309 @if [[ "${CHARTS}" == "local" || "${CHARTS}" == "local-sdcore" ]]; then \
310 helm dep up $(SD_CORE_CHART); \
311 else \
312 helm repo update; \
313 fi
314 NODE_IP=${NODE_IP} DATA_IFACE=${DATA_IFACE} RAN_SUBNET=${RAN_SUBNET} envsubst < $(4G_CORE_VALUES) | \
315 helm upgrade --create-namespace --install --wait $(HELM_GLOBAL_ARGS) \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700316 --namespace omec \
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600317 --values - \
Andy Bavier31dfb9e2022-02-15 15:24:57 -0700318 sd-core \
319 $(SD_CORE_CHART)
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600320 @if [[ "${ENABLE_OAISIM}" == "false" ]]; then \
321 $(eval mme_ip := $(shell ip -4 -o addr show $${DATA_IFACE} | awk '{print $$4}' | cut -d'/' -f1)) \
322 echo "Your MME IP is $(mme_ip)"; \
323 fi
324 @touch $@
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700325
Hyunsun Mooncbdac112022-03-19 22:01:27 -06003265g-core: node-prep
327ifeq ($(ENABLE_ROUTER),true)
328ifeq ($(ENABLE_GNBSIM),true)
3295g-core: $(M)/router-pod
330else
3315g-core: $(M)/router-host
332endif
333endif
3345g-core: $(M)/5g-core
335$(M)/5g-core:
336 @if [[ "${CHARTS}" == "local" || "${CHARTS}" == "local-sdcore" ]]; then \
337 helm dep up $(SD_CORE_CHART); \
338 else \
339 helm repo update; \
340 fi
Andy Baviera0c15d92022-06-13 12:55:48 -0700341 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 -0600342 helm upgrade --create-namespace --install --wait $(HELM_GLOBAL_ARGS) \
Badhrinath3e081e22020-12-02 15:02:08 -0600343 --namespace omec \
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600344 --values - \
Andy Bavier31dfb9e2022-02-15 15:24:57 -0700345 sd-core \
346 $(SD_CORE_CHART)
Badhrinath3e081e22020-12-02 15:02:08 -0600347 touch $@
348
Bavier, Andya9396a62023-01-21 10:43:40 -0700349# Install second UPF
3505g-upf2: $(M)/5g-upf2
351$(M)/5g-upf2:
352 NODE_IP=${NODE_IP} DATA_IFACE=${DATA_IFACE} RAN_SUBNET=${RAN_SUBNET} envsubst < $(5G_UPF2_VALUES) | \
353 helm upgrade --create-namespace --install --wait $(HELM_GLOBAL_ARGS) \
354 --namespace upf2 \
355 --values - \
356 bess-upf \
357 $(UPF_CHART)
358 touch $@
359
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700360# UE images includes kernel module, ue_ip.ko
361# which should be built in the exactly same kernel version of the host machine
362$(BUILD)/openairinterface: | $(M)/setup
363 mkdir -p $(BUILD)
364 cd $(BUILD); git clone https://github.com/opencord/openairinterface.git
365
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700366ifeq ($(K8S_INSTALL),kubespray)
367download-ue-image: | $(M)/k8s-ready $(BUILD)/openairinterface
Andy Bavier9ee69d02022-02-11 10:31:21 -0700368 sg docker -c "docker pull ${OAISIM_UE_IMAGE} && \
369 docker tag ${OAISIM_UE_IMAGE} omecproject/lte-uesoftmodem:1.1.0"
Andy Bavierd6de5612021-11-08 10:39:17 -0700370 touch $(M)/ue-image
371
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700372$(M)/ue-image: | $(M)/k8s-ready $(BUILD)/openairinterface
373 cd $(BUILD)/openairinterface; \
Andy Bavier9ee69d02022-02-11 10:31:21 -0700374 sg docker -c "docker build . --target lte-uesoftmodem \
Andy Bavier4db21452022-06-21 16:13:31 -0700375 --network=host \
Fatemeh Rouzbeh85654e72022-05-23 09:26:12 -0700376 --build-arg http_proxy=$(HTTP_PROXY)/ \
Hyunsun7b640512020-10-27 19:49:51 -0500377 --build-arg build_base=omecproject/oai-base:1.1.0 \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700378 --file Dockerfile.ue \
Andy Bavier9ee69d02022-02-11 10:31:21 -0700379 --tag omecproject/lte-uesoftmodem:1.1.0"
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700380 touch $@
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700381endif
382
383ifeq ($(K8S_INSTALL),rke2)
384download-ue-image: | $(M)/k8s-ready $(BUILD)/openairinterface
385 sg docker -c "docker pull ${OAISIM_UE_IMAGE} && \
386 docker tag ${OAISIM_UE_IMAGE} omecproject/lte-uesoftmodem:1.1.0 && \
387 docker save -o /tmp/lte-uesoftmodem.tar omecproject/lte-uesoftmodem:1.1.0"
388 $(CTR_CMD) images import /tmp/lte-uesoftmodem.tar
389 touch $(M)/ue-image
390
391$(M)/ue-image: $(M)/k8s-ready $(BUILD)/openairinterface
392 cd $(BUILD)/openairinterface; \
393 sg docker -c "docker build . --target lte-uesoftmodem \
Andy Bavier4db21452022-06-21 16:13:31 -0700394 --network=host \
Fatemeh Rouzbeh85654e72022-05-23 09:26:12 -0700395 --build-arg http_proxy=$(HTTP_PROXY)/ \
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700396 --build-arg build_base=omecproject/oai-base:1.1.0 \
397 --file Dockerfile.ue \
398 --tag omecproject/lte-uesoftmodem:1.1.0 && \
399 docker save -o /tmp/lte-uesoftmodem.tar omecproject/lte-uesoftmodem:1.1.0"
400 $(CTR_CMD) images import /tmp/lte-uesoftmodem.tar
401 touch $@
402endif
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700403
Andy Bavier99f31c82022-04-14 16:16:26 -0700404/etc/systemd/%:
405 @sudo mkdir -p $(@D)
406 @sed 's/DATA_IFACE/$(DATA_IFACE)/g' $(MAKEDIR)/systemd/$(@F) > /tmp/$(@F)
407 @sudo cp /tmp/$(@F) $@
408 echo "Installed $@"
Andy Bavier9ee69d02022-02-11 10:31:21 -0700409
Andy Bavier99f31c82022-04-14 16:16:26 -0700410oaisim-standalone: | $(M)/helm-ready $(M)/ue-image $(LO_NETCONF)
411 sudo systemctl restart systemd-networkd
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600412 @ip link show $(DATA_IFACE) > /dev/null || (echo DATA_IFACE is not set or does not exist; exit 1)
413 @if [[ "${MME_IP}" == "" ]]; then \
414 echo MME_IP is not set; \
415 exit 1; \
416 else \
417 ping -c 3 $(MME_IP) > /dev/null || (echo MME $(MME_IP) is not reachable; exit 1) \
418 fi
419 sudo ip route add 192.168.252.0/24 via $(MME_IP)
Andy Bavier7b01b682022-03-17 13:26:55 -0700420 helm repo update
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600421 helm upgrade --create-namespace --install $(HELM_GLOBAL_ARGS) --namespace omec oaisim cord/oaisim -f $(OAISIM_VALUES) \
422 --set config.enb.networks.s1u.interface=$(DATA_IFACE) \
423 --set config.enb.networks.s1_mme.interface=$(DATA_IFACE) \
424 --set config.enb.mme.address=$(MME_IP) \
425 --set config.enb.mme.isLocal=false \
426 --set images.pullPolicy=IfNotPresent
Andy Bavier7b01b682022-03-17 13:26:55 -0700427 kubectl rollout status -n omec statefulset ue
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600428 @echo "Test: registration"
Andy Bavier7b01b682022-03-17 13:26:55 -0700429 @timeout 60s bash -c \
430 "until ip addr show oip1 | grep -q inet; \
431 do \
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600432 echo 'Waiting for UE 1 gets IP address'; \
433 sleep 3; \
Andy Bavier7b01b682022-03-17 13:26:55 -0700434 done"
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600435 @echo "Test: ping from UE to 8.8.8.8"
436 ping -I oip1 8.8.8.8 -c 3
437 @touch $(M)/oaisim $(M)/omec
Andy Bavier7b01b682022-03-17 13:26:55 -0700438
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600439oaisim: | $(M)/oaisim
Andy Bavier99f31c82022-04-14 16:16:26 -0700440$(M)/oaisim: | $(M)/ue-image $(M)/router-pod $(OAISIM_NETCONF)
441 sudo systemctl restart systemd-networkd
Fatemeh Rouzbeh85654e72022-05-23 09:26:12 -0700442 sleep 1
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600443 helm upgrade --create-namespace --install $(HELM_GLOBAL_ARGS) --namespace omec oaisim cord/oaisim -f $(OAISIM_VALUES) \
Jeremy Ronquilloaf084f32020-08-24 13:18:47 -0700444 --set images.pullPolicy=IfNotPresent
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700445 kubectl rollout status -n omec statefulset ue
446 @timeout 60s bash -c \
447 "until ip addr show oip1 | grep -q inet; \
448 do \
449 echo 'Waiting for UE 1 gets IP address'; \
450 sleep 3; \
451 done"
452 touch $@
453
Andy Bavierebf479c2021-09-08 15:47:58 -0700454roc: $(M)/roc
455$(M)/roc: $(M)/helm-ready
456 kubectl get namespace aether-roc 2> /dev/null || kubectl create namespace aether-roc
457 helm repo update
458 if [ "$(CHARTS)" == "local" ]; then helm dep up $(AETHER_ROC_UMBRELLA_CHART); fi
SeanCondon254f6ce2022-12-01 09:22:13 +0000459 if [ "$(CHARTS)" == "release-2.0" -o "$(CHARTS)" == "release-1.6" ]; then \
460 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
461 --namespace kube-system \
462 --values $(ROC_VALUES) \
463 atomix-controller \
464 $(ATOMIX_CONTROLLER_CHART); \
465 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
466 --namespace kube-system \
467 --values $(ROC_VALUES) \
468 atomix-raft-storage \
469 $(ATOMIX_RAFT_STORAGE_CHART); \
470 else \
471 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
472 --namespace kube-system \
473 --values $(ROC_VALUES) \
474 atomix-runtime \
475 $(ATOMIX_RUNTIME_CHART); \
476 fi
Andy Bavierebf479c2021-09-08 15:47:58 -0700477 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
478 --namespace kube-system \
479 --values $(ROC_VALUES) \
480 onos-operator \
481 $(ONOS_OPERATOR_CHART)
482 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
483 --namespace aether-roc \
484 --values $(ROC_VALUES) \
485 aether-roc-umbrella \
486 $(AETHER_ROC_UMBRELLA_CHART)
487 touch $@
488
489# Load the ROC 4G models. Disable loading network slice from SimApp.
490roc-4g-models: $(M)/roc
491 sed -i 's/provision-network-slice: true/provision-network-slice: false/' $(4G_CORE_VALUES)
492 sed -i 's/# syncUrl/syncUrl/' $(4G_CORE_VALUES)
Amit Wankhede01b20c32021-12-01 12:45:58 +0530493 if [ "${ENABLE_SUBSCRIBER_PROXY}" == "true" ] ; then \
Amit Wankhedefdf10ff2022-02-16 08:37:20 -0600494 sed -i 's/# sub-proxy-endpt:/sub-proxy-endpt:/' $(4G_CORE_VALUES) ; \
495 sed -i 's/# addr: sub/ addr: sub/' $(4G_CORE_VALUES) ; \
496 sed -i 's/# port: 5000/ port: 5000/' $(4G_CORE_VALUES) ; \
Amit Wankhede01b20c32021-12-01 12:45:58 +0530497 fi
Sean Condone184e6e2023-01-12 09:59:40 +0000498 @$(eval ONOS_CLI_POD := $(shell kubectl -n aether-roc get pods -l name=onos-cli -o name))
Andy Bavierebf479c2021-09-08 15:47:58 -0700499 echo "ONOS CLI pod: ${ONOS_CLI_POD}"
Sean Condone184e6e2023-01-12 09:59:40 +0000500 @$(eval API_SERVICE := $(shell kubectl -n aether-roc get --no-headers=true services -l app.kubernetes.io/name=aether-roc-api | awk '{print $$1}'))
501 echo "API SERVICE : ${API_SERVICE}"
SeanCondon47660272023-01-15 22:24:24 +0000502 if [ "$(CHARTS)" != "release-2.0" -a "$(CHARTS)" != "release-1.6" ]; then \
503 until kubectl -n aether-roc exec ${ONOS_CLI_POD} -- \
504 curl -s -f -L -X PATCH "http://${API_SERVICE}:8181/aether-roc-api" \
505 --header 'Content-Type: application/json' \
506 --data-raw "$$(cat ${ROC_DEFAULTENT_MODEL})"; do sleep 5; done; \
507 fi
Sean Condone184e6e2023-01-12 09:59:40 +0000508 until kubectl -n aether-roc exec ${ONOS_CLI_POD} -- \
509 curl -s -f -L -X PATCH "http://${API_SERVICE}:8181/aether-roc-api" \
Andy Bavierebf479c2021-09-08 15:47:58 -0700510 --header 'Content-Type: application/json' \
511 --data-raw "$$(cat ${ROC_4G_MODELS})"; do sleep 5; done
512
513# Load the ROC 5G models. Disable loading network slice from SimApp.
514roc-5g-models: $(M)/roc
515 sed -i 's/provision-network-slice: true/provision-network-slice: false/' $(5G_CORE_VALUES)
516 sed -i 's/# syncUrl/syncUrl/' $(5G_CORE_VALUES)
Amit Wankhede01b20c32021-12-01 12:45:58 +0530517 if [ "${ENABLE_SUBSCRIBER_PROXY}" == "true" ] ; then \
Amit Wankhedefdf10ff2022-02-16 08:37:20 -0600518 sed -i 's/# sub-proxy-endpt:/sub-proxy-endpt:/' $(5G_CORE_VALUES) ; \
519 sed -i 's/# addr: sub/ addr: sub/' $(5G_CORE_VALUES) ; \
520 sed -i 's/# port: 5000/ port: 5000/' $(5G_CORE_VALUES) ; \
Amit Wankhede01b20c32021-12-01 12:45:58 +0530521 fi
Sean Condone184e6e2023-01-12 09:59:40 +0000522 @$(eval ONOS_CLI_POD := $(shell kubectl -n aether-roc get pods -l name=onos-cli -o name))
Andy Bavierebf479c2021-09-08 15:47:58 -0700523 echo "ONOS CLI pod: ${ONOS_CLI_POD}"
Sean Condone184e6e2023-01-12 09:59:40 +0000524 @$(eval API_SERVICE := $(shell kubectl -n aether-roc get --no-headers=true services -l app.kubernetes.io/name=aether-roc-api | awk '{print $$1}'))
525 echo "API SERVICE : ${API_SERVICE}"
SeanCondon47660272023-01-15 22:24:24 +0000526 if [ "$(CHARTS)" != "release-2.0" -a "$(CHARTS)" != "release-1.6" ]; then \
527 until kubectl -n aether-roc exec ${ONOS_CLI_POD} -- \
528 curl -s -f -L -X PATCH "http://${API_SERVICE}:8181/aether-roc-api" \
529 --header 'Content-Type: application/json' \
530 --data-raw "$$(cat ${ROC_DEFAULTENT_MODEL})"; do sleep 5; done; \
531 fi
Sean Condone184e6e2023-01-12 09:59:40 +0000532 until kubectl -n aether-roc exec ${ONOS_CLI_POD} -- \
533 curl -s -f -L -X PATCH "http://${API_SERVICE}:8181/aether-roc-api" \
Andy Bavierebf479c2021-09-08 15:47:58 -0700534 --header 'Content-Type: application/json' \
535 --data-raw "$$(cat ${ROC_5G_MODELS})"; do sleep 5; done
536
537roc-clean:
538 @echo "This could take 2-3 minutes..."
539 sed -i 's/provision-network-slice: false/provision-network-slice: true/' $(4G_CORE_VALUES)
540 sed -i 's/ syncUrl/ # syncUrl/' $(4G_CORE_VALUES)
Amit Wankhedefdf10ff2022-02-16 08:37:20 -0600541 sed -i 's/ sub-proxy-endpt:/ # sub-proxy-endpt:/' $(4G_CORE_VALUES)
542 sed -i 's/ addr: sub/ # addr: sub/' $(4G_CORE_VALUES)
543 sed -i 's/ port: 5000/ # port: 5000/' $(4G_CORE_VALUES)
Andy Bavierebf479c2021-09-08 15:47:58 -0700544 sed -i 's/provision-network-slice: false/provision-network-slice: true/' $(5G_CORE_VALUES)
545 sed -i 's/ syncUrl/ # syncUrl/' $(5G_CORE_VALUES)
Amit Wankhedefdf10ff2022-02-16 08:37:20 -0600546 sed -i 's/ sub-proxy-endpt:/ # sub-proxy-endpt:/' $(5G_CORE_VALUES)
547 sed -i 's/ addr: sub/ # addr: sub/' $(5G_CORE_VALUES)
548 sed -i 's/ port: 5000/ # port: 5000/' $(5G_CORE_VALUES)
Andy Bavierebf479c2021-09-08 15:47:58 -0700549 kubectl delete namespace aether-roc || true
550 rm -rf $(M)/roc
Arrobo, Gabriel6e54e952022-06-23 21:36:00 +0000551 rm -f ${GET_HELM}
Andy Bavierebf479c2021-09-08 15:47:58 -0700552
Andy Bavier7d5f0552022-05-23 16:01:45 -0700553monitoring: $(M)/monitoring
554$(M)/monitoring: $(M)/helm-ready
555 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
556 --namespace=cattle-monitoring-system \
557 --create-namespace \
558 --values=$(MONITORING_VALUES) \
559 rancher-monitoring-crd \
560 $(RANCHER_MONITORING_CRD_CHART)
561 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
562 --namespace=cattle-monitoring-system \
563 --create-namespace \
564 --values=$(MONITORING_VALUES) \
565 rancher-monitoring \
566 $(RANCHER_MONITORING_CHART)
567 touch $(M)/monitoring
568
569monitoring-4g: $(M)/monitoring
570 kubectl create namespace omec || true
571 kubectl create namespace cattle-dashboards || true
572 kubectl apply -k resources/4g-monitoring
573
Ankur Upadhyaya9b9707a2022-11-24 10:48:33 -0600574monitoring-5g: $(M)/monitoring
575 kubectl create namespace omec || true
576 kubectl create namespace cattle-dashboards || true
577 kubectl apply -k resources/5g-monitoring
578
Wei-Yu Chena6ae6e22022-06-08 18:15:30 +0800579enodebd:
580 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
581 --namespace=aether-apps \
582 --create-namespace \
583 enodebd \
584 ${ENODEBD_CHART}
585 touch $(M)/enodebd
586
587enodebd-clean:
588 helm -n aether-apps delete enodebd || true
589 rm $(M)/enodebd
Andy Bavier7d5f0552022-05-23 16:01:45 -0700590
591monitoring-clean:
592 helm -n cattle-monitoring-system delete rancher-monitoring || true
593 helm -n cattle-monitoring-system delete rancher-monitoring-crd || true
594 kubectl delete namespace cattle-dashboards cattle-monitoring-system || true
595 rm $(M)/monitoring
596
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600597omec-clean:
598 helm delete -n omec $$(helm -n omec ls -qa) || true
599 @echo ""
600 @echo "Wait for all pods to terminate..."
601 kubectl wait -n omec --for=delete --all=true -l app!=ue pod --timeout=180s || true
602
603router-clean:
604 @kubectl delete net-attach-def router-net 2>/dev/null || true
605 @kubectl delete po router 2>/dev/null || true
606 kubectl wait --for=delete -l app=router pod --timeout=180s 2>/dev/null || true
607 sudo ip link del access || true
608 sudo ip link del core || true
609 $(eval oiface := $(shell ip route list default | awk -F 'dev' '{ print $$2; exit }' | awk '{ print $$1 }'))
610 sudo iptables -t nat -D POSTROUTING -s 172.250.0.0/16 -o $(oiface) -j MASQUERADE || true
611 @sudo ip link del data 2>/dev/null || true
612 @cd $(M); rm -f router-pod router-host
613
614oaisim-clean: reset-ue
615 @sudo ip addr del 127.0.0.2/8 dev lo 2>/dev/null || true
616 @sudo ip link del enb 2>/dev/null || true
617 @sudo ip route del 192.168.252.0/24 || true
618 @cd $(M); rm -f oaisim-lo
619
Andy Bavier7d5f0552022-05-23 16:01:45 -07006204g-test: test
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600621test: | 4g-core $(M)/oaisim
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700622 @sleep 5
623 @echo "Test1: ping from UE to SGI network gateway"
Hyunsun Moon0bd8cec2020-09-28 00:38:26 -0500624 ping -I oip1 192.168.250.1 -c 15
Fatemeh Rouzbeh85654e72022-05-23 09:26:12 -0700625 @if [ "${PROXY_ENABLED}" == "false" ] ; then \
626 @echo "Test2: ping from UE to 8.8.8.8" ; \
627 ping -I oip1 8.8.8.8 -c 3 ; \
628 @echo "Test3: ping from UE to google.com" ; \
629 ping -I oip1 google.com -c 3 ; \
630 fi
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700631 @echo "Finished to test"
632
Hyunsun Mooncbdac112022-03-19 22:01:27 -06006335g-test: | 5g-core
Andy Bavier31dfb9e2022-02-15 15:24:57 -0700634 @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 -0700635 @echo "Test: Registration + UE initiated PDU Session Establishment + User Data packets"
Andy Bavier0e4906f2022-03-03 15:31:48 -0700636 @sleep 60
Andy Bavier0a055a52022-01-07 10:46:17 -0700637 @rm -f /tmp/gnbsim.out
Andy Baviercd93a202022-01-10 18:03:26 -0800638 @if [[ ${GNBSIM_COLORS} == "true" ]]; then \
639 kubectl -n omec exec gnbsim-0 -- ./gnbsim 2>&1 | tee /tmp/gnbsim.out; \
640 else \
641 kubectl -n omec exec gnbsim-0 -- ./gnbsim 2>&1 | sed -u "s,\x1B\[[0-9;]*[a-zA-Z],,g" | tee /tmp/gnbsim.out; \
642 fi
Andy Bavier025874a2022-07-29 13:20:04 -0700643 @grep -q "Simulation Result: PASS\|Profile Status: PASS" /tmp/gnbsim.out
Andy Bavier0a055a52022-01-07 10:46:17 -0700644
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600645reset-test: | oaisim-clean omec-clean router-clean
646 @cd $(M); rm -f omec oaisim 5g-core
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700647
Andy Bavier8819b9f2022-01-28 16:54:06 -0700648reset-ue:
649 helm delete -n omec oaisim || true
650 kubectl wait -n omec --for=delete pod enb-0 || true
651 kubectl wait -n omec --for=delete pod ue-0 || true
652 cd $(M); rm -f oaisim
653
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600654reset-5g-test: omec-clean
Badhrinath3e081e22020-12-02 15:02:08 -0600655 cd $(M); rm -f 5g-core
656
Osman Amjad488a0222022-01-12 11:58:43 -0600657reset-dbtestapp:
658 helm uninstall --namespace omec 5g-test-app
659
Andy Bavier99f31c82022-04-14 16:16:26 -0700660refresh-4g: reset-ue
661 kubectl -n omec delete pod mme-0
662 kubectl wait -n omec --for='condition=ready' pod mme-0 --timeout=300s
663
Osman Amjad488a0222022-01-12 11:58:43 -0600664dbtestapp:
665 helm repo update
666 if [ "$(CHARTS)" == "local" ]; then helm dep up $(5G_TEST_APPS_CHART); fi
667 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
668 --namespace omec \
669 5g-test-app \
670 --values $(TEST_APP_VALUES) \
671 $(5G_TEST_APPS_CHART)
672 @echo "Finished to dbtestapp"
673
Andy Bavier99f31c82022-04-14 16:16:26 -0700674clean-systemd:
675 cd /etc/systemd/network && sudo rm -f 10-aiab* 20-aiab* */macvlan.conf
676 cd /etc/systemd/system && sudo rm -f aiab*.service && sudo systemctl daemon-reload
677
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700678ifeq ($(K8S_INSTALL),rke2)
Andy Bavier5b5ad562022-04-19 13:02:31 -0700679clean: | roc-clean oaisim-clean router-clean clean-systemd
Andy Bavier99f31c82022-04-14 16:16:26 -0700680 sudo /usr/local/bin/rke2-uninstall.sh || true
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700681 sudo rm -rf /usr/local/bin/kubectl
682 rm -rf $(M)
683endif
684
685ifeq ($(K8S_INSTALL),kubespray)
Andy Bavier5b5ad562022-04-19 13:02:31 -0700686clean: | roc-clean oaisim-clean router-clean clean-systemd
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700687 source "$(VENV)/bin/activate" && cd $(BUILD)/kubespray; \
Andy Bavier125baa02021-10-26 16:26:44 -0700688 ansible-playbook -b -i inventory/local/hosts.ini reset.yml --extra-vars "reset_confirmation=yes"
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700689 @if [ -d /usr/local/etc/emulab ]; then \
690 mount | grep /mnt/extra/kubelet/pods | cut -d" " -f3 | sudo xargs umount; \
691 sudo rm -rf /mnt/extra/kubelet; \
692 fi
693 rm -rf $(M)
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700694endif