blob: 29e7243e7349ad675aee4c11dcfd4baf43199cf2 [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
Hyunsun Mooncbdac112022-03-19 22:01:27 -060033
Amol Jaikarf2124ed2023-01-20 14:05:16 -050034OAISIM_UE_IMAGE ?= andybavier/lte-uesoftmodem:1.1.0-$(shell uname -r)
Hyunsun Mooncbdac112022-03-19 22:01:27 -060035ENABLE_ROUTER ?= true
36ENABLE_OAISIM ?= true
37ENABLE_GNBSIM ?= true
Amit Wankhede01b20c32021-12-01 12:45:58 +053038ENABLE_SUBSCRIBER_PROXY ?= false
Andy Baviercd93a202022-01-10 18:03:26 -080039GNBSIM_COLORS ?= true
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070040
Fatemeh Rouzbeh85654e72022-05-23 09:26:12 -070041K8S_INSTALL ?= rke2
Andy Bavier99f31c82022-04-14 16:16:26 -070042CTR_CMD := sudo /var/lib/rancher/rke2/bin/ctr --address /run/k3s/containerd/containerd.sock --namespace k8s.io
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -070043
Fatemeh Rouzbeh85654e72022-05-23 09:26:12 -070044PROXY_ENABLED ?= false
45HTTP_PROXY ?= ${http_proxy}
46HTTPS_PROXY ?= ${https_proxy}
47NO_PROXY ?= ${no_proxy}
48
49ONECLOUD ?= false
50
Hyunsun Mooncbdac112022-03-19 22:01:27 -060051DATA_IFACE ?= data
52ifeq ($(DATA_IFACE), data)
53 RAN_SUBNET := 192.168.251.0/24
54else
Ajay Lotan Thakur5ee9e0e2022-09-28 23:34:56 -060055 RAN_SUBNET := $(shell ip route | grep $${DATA_IFACE} | awk '/kernel/ {print $$1}' | head -1)
Andy Bavier99f31c82022-04-14 16:16:26 -070056 DATA_IFACE_PATH := $(shell find /*/systemd/network -maxdepth 1 -not -type d -name '*$(DATA_IFACE).network' -print)
57 DATA_IFACE_CONF ?= $(shell basename $(DATA_IFACE_PATH)).d
Hyunsun Mooncbdac112022-03-19 22:01:27 -060058endif
Hyunsun Moon4e5795a2022-04-07 09:27:12 -070059
Andy Bavier99f31c82022-04-14 16:16:26 -070060# systemd-networkd and systemd configs
61LO_NETCONF := /etc/systemd/network/20-aiab-lo.network
62OAISIM_NETCONF := $(LO_NETCONF) /etc/systemd/network/10-aiab-enb.netdev /etc/systemd/network/20-aiab-enb.network
63ROUTER_POD_NETCONF := /etc/systemd/network/10-aiab-dummy.netdev /etc/systemd/network/20-aiab-dummy.network
64ROUTER_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
65UE_NAT_CONF := /etc/systemd/system/aiab-ue-nat.service
66
Andy Bavier7d5f0552022-05-23 16:01:45 -070067# monitoring
68RANCHER_MONITORING_CRD_CHART := rancher/rancher-monitoring-crd
69RANCHER_MONITORING_CHART := rancher/rancher-monitoring
70MONITORING_VALUES ?= $(MAKEDIR)/monitoring.yaml
71
Hyunsun Moon4e5795a2022-04-07 09:27:12 -070072NODE_IP ?= $(shell ip route get 8.8.8.8 | grep -oP 'src \K\S+')
73ifndef NODE_IP
74$(error NODE_IP is not set)
75endif
76
Hyunsun Mooncbdac112022-03-19 22:01:27 -060077MME_IP ?=
78
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070079HELM_GLOBAL_ARGS ?=
Andy Baviereda466b2021-08-27 15:00:36 -070080
Arrobo, Gabriela5366e12023-03-02 12:10:47 -080081ifneq ("$(wildcard $(UPF_COUNT))","")
82 UPF_NUMBER = $(shell cat $(UPF_COUNT))
83else
84 UPF_NUMBER = 0
85endif
86
Andy Baviereda466b2021-08-27 15:00:36 -070087# Allow installing local charts or specific versions of published charts.
88# E.g., to install the Aether 1.5 release:
89# CHARTS=release-1.5 make test
90# Default is to install from the local charts.
91CHARTS ?= local
92CONFIGFILE := configs/$(CHARTS)
93include $(CONFIGFILE)
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -070094
95cpu_family := $(shell lscpu | grep 'CPU family:' | awk '{print $$3}')
96cpu_model := $(shell lscpu | grep 'Model:' | awk '{print $$2}')
97os_vendor := $(shell lsb_release -i -s)
98os_release := $(shell lsb_release -r -s)
Andy Bavier9ee69d02022-02-11 10:31:21 -070099USER := $(shell whoami)
100
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700101.PHONY: 4g-core 5g-core oaisim test reset-test reset-ue reset-5g-test node-prep clean
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700102
103$(M):
104 mkdir -p $(M)
105
106$(M)/system-check: | $(M)
107 @if [[ $(cpu_family) -eq 6 ]]; then \
108 if [[ $(cpu_model) -lt 60 ]]; then \
109 echo "FATAL: haswell CPU or newer is required."; \
110 exit 1; \
111 fi \
112 else \
113 echo "FATAL: unsupported CPU family."; \
114 exit 1; \
115 fi
116 @if [[ $(os_vendor) =~ (Ubuntu) ]]; then \
Hyunsun7b640512020-10-27 19:49:51 -0500117 if [[ ! $(os_release) =~ (18.04) ]]; then \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700118 echo "WARN: $(os_vendor) $(os_release) has not been tested."; \
119 fi; \
120 if dpkg --compare-versions 4.15 gt $(shell uname -r); then \
121 echo "FATAL: kernel 4.15 or later is required."; \
122 echo "Please upgrade your kernel by running" \
123 "apt install --install-recommends linux-generic-hwe-$(os_release)"; \
124 exit 1; \
125 fi \
126 else \
127 echo "FAIL: unsupported OS."; \
128 exit 1; \
129 fi
130 touch $@
131
Andy Bavier99f31c82022-04-14 16:16:26 -0700132$(M)/interface-check: | $(M)
133ifeq ($(DATA_IFACE_CONF), .d)
134 @echo
135 @echo FATAL: Could not find systemd-networkd config for interface $(DATA_IFACE), exiting now!; exit 1
136endif
Fatemeh Rouzbeh85654e72022-05-23 09:26:12 -0700137 @echo "Add network configuration for enb interface"
138 @if [[ "${ONECLOUD}" == "true" ]]; then \
139 sudo cp netplan/01-enb-static-config.yaml /etc/netplan ; \
140 sudo netplan apply ; \
141 sleep 1 ; \
142 fi
Andy Bavier99f31c82022-04-14 16:16:26 -0700143 touch $@
144
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700145ifeq ($(K8S_INSTALL),kubespray)
Andy Bavier99f31c82022-04-14 16:16:26 -0700146$(M)/setup: | $(M) $(M)/interface-check
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700147 sudo $(SCRIPTDIR)/cloudlab-disksetup.sh
Hyunsun Moon82e47c22021-06-28 12:30:20 -0500148 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 -0700149 touch $@
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700150endif
151
152ifeq ($(K8S_INSTALL),rke2)
Fatemeh Rouzbeh85654e72022-05-23 09:26:12 -0700153$(M)/initial-setup: | $(M) $(M)/interface-check
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700154 sudo $(SCRIPTDIR)/cloudlab-disksetup.sh
155 sudo apt update; sudo apt install -y software-properties-common python3 python3-pip python3-venv jq httpie ipvsadm apparmor apparmor-utils
156 systemctl list-units --full -all | grep "docker.service" || sudo apt install -y docker.io
157 sudo adduser $(USER) docker || true
Andy Bavier23024432022-05-26 10:10:50 -0700158 touch $(M)/initial-setup
Fatemeh Rouzbeh85654e72022-05-23 09:26:12 -0700159
160ifeq ($(PROXY_ENABLED),true)
161$(M)/proxy-setting: | $(M)
162 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
163 echo "HTTP_PROXY=$(HTTP_PROXY)" >> rke2-server
164 echo "HTTPS_PROXY=$(HTTPS_PROXY)" >> rke2-server
165 echo "NO_PROXY=$(NO_PROXY),.cluster.local,.svc,$(NODE_IP),192.168.84.0/24,192.168.85.0/24,$(RAN_SUBNET)" >> rke2-server
166 sudo mv rke2-server /etc/default/
167 echo "[Service]" >> http-proxy.conf
168 echo "Environment='HTTP_PROXY=$(HTTP_PROXY)'" >> http-proxy.conf
169 echo "Environment='HTTPS_PROXY=$(HTTPS_PROXY)'" >> http-proxy.conf
170 echo "Environment='NO_PROXY=$(NO_PROXY)'" >> http-proxy.conf
171 sudo mkdir -p /etc/systemd/system/docker.service.d
172 sudo mv http-proxy.conf /etc/systemd/system/docker.service.d
173 sudo systemctl daemon-reload
174 sudo systemctl restart docker
175 touch $(M)/proxy-setting
176else
177$(M)/proxy-setting: | $(M)
178 @echo -n ""
179 touch $(M)/proxy-setting
180endif
181
182$(M)/setup: | $(M)/initial-setup $(M)/proxy-setting
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700183 touch $@
184endif
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700185
186$(BUILD)/kubespray: | $(M)/setup
187 mkdir -p $(BUILD)
188 cd $(BUILD); git clone https://github.com/kubernetes-incubator/kubespray.git -b $(KUBESPRAY_VERSION)
189
190$(VENV)/bin/activate: | $(M)/setup
Hyunsun Moon82e47c22021-06-28 12:30:20 -0500191 python3 -m venv $(VENV)
Wei-Yu Chen7edb7e72021-07-28 11:37:55 +0800192 source "$(VENV)/bin/activate" && \
193 python -m pip install -U pip && \
194 deactivate
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700195
196$(M)/kubespray-requirements: $(BUILD)/kubespray | $(VENV)/bin/activate
197 source "$(VENV)/bin/activate" && \
198 pip install -r $(BUILD)/kubespray/requirements.txt
199 touch $@
200
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700201ifeq ($(K8S_INSTALL),kubespray)
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700202$(M)/k8s-ready: | $(M)/setup $(BUILD)/kubespray $(VENV)/bin/activate $(M)/kubespray-requirements
203 source "$(VENV)/bin/activate" && cd $(BUILD)/kubespray; \
204 ansible-playbook -b -i inventory/local/hosts.ini \
Fatemeh Rouzbeh85654e72022-05-23 09:26:12 -0700205 -e "{'http_proxy' : $(HTTP_PROXY)}" \
206 -e "{'https_proxy' : $(HTTPS_PROXY)}" \
207 -e "{'no_proxy' : $(NO_PROXY)}" \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700208 -e "{'override_system_hostname' : False, 'disable_swap' : True}" \
209 -e "{'docker_version' : $(DOCKER_VERSION)}" \
210 -e "{'docker_iptables_enabled' : True}" \
211 -e "{'kube_version' : $(K8S_VERSION)}" \
Hyunsun84f0f172020-09-23 15:40:08 -0500212 -e "{'kube_network_plugin_multus' : True, 'multus_version' : stable, 'multus_cni_version' : 0.3.1}" \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700213 -e "{'kube_proxy_metrics_bind_address' : 0.0.0.0:10249}" \
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600214 -e "{'kube_pods_subnet' : 192.168.84.0/24, 'kube_service_addresses' : 192.168.85.0/24}" \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700215 -e "{'kube_apiserver_node_port_range' : 2000-36767}" \
216 -e "{'kubeadm_enabled': True}" \
217 -e "{'kube_feature_gates' : [SCTPSupport=True]}" \
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600218 -e "{'kubelet_custom_flags' : [--allowed-unsafe-sysctls=net.*, --node-ip=$(NODE_IP)]}" \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700219 -e "{'dns_min_replicas' : 1}" \
220 -e "{'helm_enabled' : True, 'helm_version' : $(HELM_VERSION)}" \
221 cluster.yml
222 mkdir -p $(HOME)/.kube
223 sudo cp -f /etc/kubernetes/admin.conf $(HOME)/.kube/config
224 sudo chown $(shell id -u):$(shell id -g) $(HOME)/.kube/config
225 kubectl wait pod -n kube-system --for=condition=Ready --all
Andy Bavier9ee69d02022-02-11 10:31:21 -0700226 sudo adduser $(USER) docker
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700227 touch $@
228
229$(M)/helm-ready: | $(M)/k8s-ready
Woojoong Kim8425cb32021-01-08 16:18:53 -0800230 helm repo add incubator https://charts.helm.sh/incubator
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700231 helm repo add cord https://charts.opencord.org
Andy Baviereda466b2021-08-27 15:00:36 -0700232 helm repo add atomix https://charts.atomix.io
233 helm repo add onosproject https://charts.onosproject.org
Andy Bavier9ee69d02022-02-11 10:31:21 -0700234 helm repo add aether https://charts.aetherproject.org
Andy Bavier7d5f0552022-05-23 16:01:45 -0700235 helm repo add rancher http://charts.rancher.io/
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700236 touch $@
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700237endif
238
239ifeq ($(K8S_INSTALL),rke2)
240$(M)/k8s-ready: | $(M)/setup
241 sudo mkdir -p /etc/rancher/rke2/
242 [ -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
243 echo "cni: multus,calico" >> config.yaml
244 echo "cluster-cidr: 192.168.84.0/24" >> config.yaml
245 echo "service-cidr: 192.168.85.0/24" >> config.yaml
246 echo "kubelet-arg:" >> config.yaml
247 echo "- --allowed-unsafe-sysctls="net.*"" >> config.yaml
248 echo "- --node-ip="$(NODE_IP)"" >> config.yaml
249 echo "pause-image: k8s.gcr.io/pause:3.3" >> config.yaml
250 echo "kube-proxy-arg:" >> config.yaml
251 echo "- --metrics-bind-address="0.0.0.0:10249"" >> config.yaml
252 echo "- --proxy-mode="ipvs"" >> config.yaml
253 echo "kube-apiserver-arg:" >> config.yaml
254 echo "- --service-node-port-range="2000-36767"" >> config.yaml
255 sudo mv config.yaml /etc/rancher/rke2/
256 curl -sfL https://get.rke2.io | sudo INSTALL_RKE2_VERSION=$(RKE2_K8S_VERSION) sh -
257 sudo systemctl enable rke2-server.service
258 sudo systemctl start rke2-server.service
259 sudo /var/lib/rancher/rke2/bin/kubectl --kubeconfig /etc/rancher/rke2/rke2.yaml wait nodes --for=condition=Ready --all --timeout=300s
260 sudo /var/lib/rancher/rke2/bin/kubectl --kubeconfig /etc/rancher/rke2/rke2.yaml wait deployment -n kube-system --for=condition=available --all --timeout=300s
261 curl -LO "https://dl.k8s.io/release/$(KUBECTL_VERSION)/bin/linux/amd64/kubectl"
262 sudo chmod +x kubectl
263 sudo mv kubectl /usr/local/bin/
264 kubectl version --client
265 mkdir -p $(HOME)/.kube
266 sudo cp /etc/rancher/rke2/rke2.yaml $(HOME)/.kube/config
267 sudo chown -R $(shell id -u):$(shell id -g) $(HOME)/.kube
268 touch $@
269
270$(M)/helm-ready: | $(M)/k8s-ready
Arrobo, Gabriel6e54e952022-06-23 21:36:00 +0000271 curl -fsSL -o ${GET_HELM} https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
272 chmod 700 ${GET_HELM}
273 sudo DESIRED_VERSION=$(HELM_VERSION) ./${GET_HELM}
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700274 helm repo add incubator https://charts.helm.sh/incubator
275 helm repo add cord https://charts.opencord.org
276 helm repo add atomix https://charts.atomix.io
277 helm repo add onosproject https://charts.onosproject.org
278 helm repo add aether https://charts.aetherproject.org
Andy Bavier7d5f0552022-05-23 16:01:45 -0700279 helm repo add rancher http://charts.rancher.io/
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700280 touch $@
281endif
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700282
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700283/opt/cni/bin/static: | $(M)/k8s-ready
284 mkdir -p $(BUILD)/cni-plugins; cd $(BUILD)/cni-plugins; \
285 wget https://github.com/containernetworking/plugins/releases/download/v0.8.2/cni-plugins-linux-amd64-v0.8.2.tgz && \
286 tar xvfz cni-plugins-linux-amd64-v0.8.2.tgz
287 sudo cp $(BUILD)/cni-plugins/static /opt/cni/bin/
288
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600289node-prep: | $(M)/helm-ready /opt/cni/bin/static
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700290
Bavier, Andya1377572023-01-10 12:06:52 -0700291router-pod: | $(M)/router-pod
Andy Bavier99f31c82022-04-14 16:16:26 -0700292$(M)/router-pod: $(ROUTER_POD_NETCONF)
293 sudo systemctl restart systemd-networkd
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600294 DATA_IFACE=$(DATA_IFACE) envsubst < $(RESOURCEDIR)/router.yaml | kubectl apply -f -
295 kubectl wait pod -n default --for=condition=Ready -l app=router --timeout=300s
296 @touch $@
297
Andy Bavier99f31c82022-04-14 16:16:26 -0700298$(M)/router-host: $(ROUTER_HOST_NETCONF) $(UE_NAT_CONF)
299 sudo systemctl daemon-reload
300 sudo systemctl enable aiab-ue-nat.service
301 sudo systemctl start aiab-ue-nat.service
302 sudo systemctl restart systemd-networkd
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600303 $(eval oiface := $(shell ip route list default | awk -F 'dev' '{ print $$2; exit }' | awk '{ print $$1 }'))
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600304 @touch $@
305
3064g-core: node-prep
307ifeq ($(ENABLE_ROUTER),true)
308ifeq ($(ENABLE_OAISIM),true)
3094g-core: $(M)/router-pod
310else
3114g-core: $(M)/router-host
312endif
313endif
3144g-core: $(M)/omec
315$(M)/omec:
316 @if [[ "${CHARTS}" == "local" || "${CHARTS}" == "local-sdcore" ]]; then \
317 helm dep up $(SD_CORE_CHART); \
318 else \
319 helm repo update; \
320 fi
321 NODE_IP=${NODE_IP} DATA_IFACE=${DATA_IFACE} RAN_SUBNET=${RAN_SUBNET} envsubst < $(4G_CORE_VALUES) | \
322 helm upgrade --create-namespace --install --wait $(HELM_GLOBAL_ARGS) \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700323 --namespace omec \
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600324 --values - \
Andy Bavier31dfb9e2022-02-15 15:24:57 -0700325 sd-core \
326 $(SD_CORE_CHART)
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600327 @if [[ "${ENABLE_OAISIM}" == "false" ]]; then \
328 $(eval mme_ip := $(shell ip -4 -o addr show $${DATA_IFACE} | awk '{print $$4}' | cut -d'/' -f1)) \
329 echo "Your MME IP is $(mme_ip)"; \
330 fi
331 @touch $@
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700332
Hyunsun Mooncbdac112022-03-19 22:01:27 -06003335g-core: node-prep
334ifeq ($(ENABLE_ROUTER),true)
335ifeq ($(ENABLE_GNBSIM),true)
3365g-core: $(M)/router-pod
337else
3385g-core: $(M)/router-host
339endif
340endif
3415g-core: $(M)/5g-core
342$(M)/5g-core:
343 @if [[ "${CHARTS}" == "local" || "${CHARTS}" == "local-sdcore" ]]; then \
344 helm dep up $(SD_CORE_CHART); \
345 else \
346 helm repo update; \
347 fi
Andy Baviera0c15d92022-06-13 12:55:48 -0700348 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 -0600349 helm upgrade --create-namespace --install --wait $(HELM_GLOBAL_ARGS) \
Badhrinath3e081e22020-12-02 15:02:08 -0600350 --namespace omec \
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600351 --values - \
Andy Bavier31dfb9e2022-02-15 15:24:57 -0700352 sd-core \
353 $(SD_CORE_CHART)
Arrobo, Gabriela5366e12023-03-02 12:10:47 -0800354 @echo "1" > ${UPF_COUNT}
Badhrinath3e081e22020-12-02 15:02:08 -0600355 touch $@
356
Arrobo, Gabriela5366e12023-03-02 12:10:47 -0800357# Install additional UPF(s)
3585g-upf:
359 @if [[ $(UPF_NUMBER) -lt 1 ]]; then \
360 echo "Deploy '5g-core' before adding additional UPF(s)"; \
361 exit 1; \
362 fi
363 $(eval IP_ID=$(shell echo $$((3+$(UPF_NUMBER)))))
364 $(eval IP_UE_ID=$(shell echo $$((250-$(UPF_NUMBER)))))
365 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) | \
366 helm upgrade --create-namespace --install --wait $(HELM_GLOBAL_ARGS) \
367 --namespace upf-${UPF_NUMBER} \
368 --values - \
369 bess-upf \
370 $(UPF_CHART)
371 kubectl -n default exec -ti router -- ip route add 172.$(IP_UE_ID).0.0/16 via 192.168.250.$(IP_ID)
372 $(eval UPF_NUMBER=$(shell echo $$(($(UPF_NUMBER)+1))))
373 @echo $(UPF_NUMBER) > ${UPF_COUNT}
374
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700375# UE images includes kernel module, ue_ip.ko
376# which should be built in the exactly same kernel version of the host machine
377$(BUILD)/openairinterface: | $(M)/setup
378 mkdir -p $(BUILD)
379 cd $(BUILD); git clone https://github.com/opencord/openairinterface.git
380
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700381ifeq ($(K8S_INSTALL),kubespray)
382download-ue-image: | $(M)/k8s-ready $(BUILD)/openairinterface
Andy Bavier9ee69d02022-02-11 10:31:21 -0700383 sg docker -c "docker pull ${OAISIM_UE_IMAGE} && \
384 docker tag ${OAISIM_UE_IMAGE} omecproject/lte-uesoftmodem:1.1.0"
Andy Bavierd6de5612021-11-08 10:39:17 -0700385 touch $(M)/ue-image
386
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700387$(M)/ue-image: | $(M)/k8s-ready $(BUILD)/openairinterface
388 cd $(BUILD)/openairinterface; \
Andy Bavier9ee69d02022-02-11 10:31:21 -0700389 sg docker -c "docker build . --target lte-uesoftmodem \
Andy Bavier4db21452022-06-21 16:13:31 -0700390 --network=host \
Fatemeh Rouzbeh85654e72022-05-23 09:26:12 -0700391 --build-arg http_proxy=$(HTTP_PROXY)/ \
Hyunsun7b640512020-10-27 19:49:51 -0500392 --build-arg build_base=omecproject/oai-base:1.1.0 \
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700393 --file Dockerfile.ue \
Andy Bavier9ee69d02022-02-11 10:31:21 -0700394 --tag omecproject/lte-uesoftmodem:1.1.0"
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700395 touch $@
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700396endif
397
398ifeq ($(K8S_INSTALL),rke2)
399download-ue-image: | $(M)/k8s-ready $(BUILD)/openairinterface
400 sg docker -c "docker pull ${OAISIM_UE_IMAGE} && \
401 docker tag ${OAISIM_UE_IMAGE} omecproject/lte-uesoftmodem:1.1.0 && \
402 docker save -o /tmp/lte-uesoftmodem.tar omecproject/lte-uesoftmodem:1.1.0"
403 $(CTR_CMD) images import /tmp/lte-uesoftmodem.tar
404 touch $(M)/ue-image
405
406$(M)/ue-image: $(M)/k8s-ready $(BUILD)/openairinterface
407 cd $(BUILD)/openairinterface; \
408 sg docker -c "docker build . --target lte-uesoftmodem \
Andy Bavier4db21452022-06-21 16:13:31 -0700409 --network=host \
Fatemeh Rouzbeh85654e72022-05-23 09:26:12 -0700410 --build-arg http_proxy=$(HTTP_PROXY)/ \
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700411 --build-arg build_base=omecproject/oai-base:1.1.0 \
412 --file Dockerfile.ue \
413 --tag omecproject/lte-uesoftmodem:1.1.0 && \
414 docker save -o /tmp/lte-uesoftmodem.tar omecproject/lte-uesoftmodem:1.1.0"
415 $(CTR_CMD) images import /tmp/lte-uesoftmodem.tar
416 touch $@
417endif
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700418
Andy Bavier99f31c82022-04-14 16:16:26 -0700419/etc/systemd/%:
420 @sudo mkdir -p $(@D)
421 @sed 's/DATA_IFACE/$(DATA_IFACE)/g' $(MAKEDIR)/systemd/$(@F) > /tmp/$(@F)
422 @sudo cp /tmp/$(@F) $@
423 echo "Installed $@"
Andy Bavier9ee69d02022-02-11 10:31:21 -0700424
Andy Bavier99f31c82022-04-14 16:16:26 -0700425oaisim-standalone: | $(M)/helm-ready $(M)/ue-image $(LO_NETCONF)
426 sudo systemctl restart systemd-networkd
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600427 @ip link show $(DATA_IFACE) > /dev/null || (echo DATA_IFACE is not set or does not exist; exit 1)
428 @if [[ "${MME_IP}" == "" ]]; then \
429 echo MME_IP is not set; \
430 exit 1; \
431 else \
432 ping -c 3 $(MME_IP) > /dev/null || (echo MME $(MME_IP) is not reachable; exit 1) \
433 fi
434 sudo ip route add 192.168.252.0/24 via $(MME_IP)
Andy Bavier7b01b682022-03-17 13:26:55 -0700435 helm repo update
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600436 helm upgrade --create-namespace --install $(HELM_GLOBAL_ARGS) --namespace omec oaisim cord/oaisim -f $(OAISIM_VALUES) \
437 --set config.enb.networks.s1u.interface=$(DATA_IFACE) \
438 --set config.enb.networks.s1_mme.interface=$(DATA_IFACE) \
439 --set config.enb.mme.address=$(MME_IP) \
440 --set config.enb.mme.isLocal=false \
441 --set images.pullPolicy=IfNotPresent
Andy Bavier7b01b682022-03-17 13:26:55 -0700442 kubectl rollout status -n omec statefulset ue
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600443 @echo "Test: registration"
Andy Bavier7b01b682022-03-17 13:26:55 -0700444 @timeout 60s bash -c \
445 "until ip addr show oip1 | grep -q inet; \
446 do \
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600447 echo 'Waiting for UE 1 gets IP address'; \
448 sleep 3; \
Andy Bavier7b01b682022-03-17 13:26:55 -0700449 done"
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600450 @echo "Test: ping from UE to 8.8.8.8"
451 ping -I oip1 8.8.8.8 -c 3
452 @touch $(M)/oaisim $(M)/omec
Andy Bavier7b01b682022-03-17 13:26:55 -0700453
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600454oaisim: | $(M)/oaisim
Andy Bavier99f31c82022-04-14 16:16:26 -0700455$(M)/oaisim: | $(M)/ue-image $(M)/router-pod $(OAISIM_NETCONF)
456 sudo systemctl restart systemd-networkd
Fatemeh Rouzbeh85654e72022-05-23 09:26:12 -0700457 sleep 1
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600458 helm upgrade --create-namespace --install $(HELM_GLOBAL_ARGS) --namespace omec oaisim cord/oaisim -f $(OAISIM_VALUES) \
Jeremy Ronquilloaf084f32020-08-24 13:18:47 -0700459 --set images.pullPolicy=IfNotPresent
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700460 kubectl rollout status -n omec statefulset ue
461 @timeout 60s bash -c \
462 "until ip addr show oip1 | grep -q inet; \
463 do \
464 echo 'Waiting for UE 1 gets IP address'; \
465 sleep 3; \
466 done"
467 touch $@
468
Andy Bavierebf479c2021-09-08 15:47:58 -0700469roc: $(M)/roc
470$(M)/roc: $(M)/helm-ready
471 kubectl get namespace aether-roc 2> /dev/null || kubectl create namespace aether-roc
472 helm repo update
473 if [ "$(CHARTS)" == "local" ]; then helm dep up $(AETHER_ROC_UMBRELLA_CHART); fi
SeanCondon254f6ce2022-12-01 09:22:13 +0000474 if [ "$(CHARTS)" == "release-2.0" -o "$(CHARTS)" == "release-1.6" ]; then \
475 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
476 --namespace kube-system \
477 --values $(ROC_VALUES) \
478 atomix-controller \
479 $(ATOMIX_CONTROLLER_CHART); \
480 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
481 --namespace kube-system \
482 --values $(ROC_VALUES) \
483 atomix-raft-storage \
484 $(ATOMIX_RAFT_STORAGE_CHART); \
485 else \
486 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
487 --namespace kube-system \
488 --values $(ROC_VALUES) \
Sean Condon3ed79bd2023-05-25 17:16:53 +0100489 atomix \
490 $(ATOMIX_CHART); \
SeanCondon254f6ce2022-12-01 09:22:13 +0000491 fi
Andy Bavierebf479c2021-09-08 15:47:58 -0700492 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
493 --namespace kube-system \
494 --values $(ROC_VALUES) \
495 onos-operator \
496 $(ONOS_OPERATOR_CHART)
497 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
498 --namespace aether-roc \
499 --values $(ROC_VALUES) \
500 aether-roc-umbrella \
501 $(AETHER_ROC_UMBRELLA_CHART)
502 touch $@
503
504# Load the ROC 4G models. Disable loading network slice from SimApp.
505roc-4g-models: $(M)/roc
506 sed -i 's/provision-network-slice: true/provision-network-slice: false/' $(4G_CORE_VALUES)
507 sed -i 's/# syncUrl/syncUrl/' $(4G_CORE_VALUES)
Amit Wankhede01b20c32021-12-01 12:45:58 +0530508 if [ "${ENABLE_SUBSCRIBER_PROXY}" == "true" ] ; then \
Amit Wankhedefdf10ff2022-02-16 08:37:20 -0600509 sed -i 's/# sub-proxy-endpt:/sub-proxy-endpt:/' $(4G_CORE_VALUES) ; \
510 sed -i 's/# addr: sub/ addr: sub/' $(4G_CORE_VALUES) ; \
511 sed -i 's/# port: 5000/ port: 5000/' $(4G_CORE_VALUES) ; \
Amit Wankhede01b20c32021-12-01 12:45:58 +0530512 fi
Sean Condone184e6e2023-01-12 09:59:40 +0000513 @$(eval ONOS_CLI_POD := $(shell kubectl -n aether-roc get pods -l name=onos-cli -o name))
Andy Bavierebf479c2021-09-08 15:47:58 -0700514 echo "ONOS CLI pod: ${ONOS_CLI_POD}"
Sean Condone184e6e2023-01-12 09:59:40 +0000515 @$(eval API_SERVICE := $(shell kubectl -n aether-roc get --no-headers=true services -l app.kubernetes.io/name=aether-roc-api | awk '{print $$1}'))
516 echo "API SERVICE : ${API_SERVICE}"
SeanCondon47660272023-01-15 22:24:24 +0000517 if [ "$(CHARTS)" != "release-2.0" -a "$(CHARTS)" != "release-1.6" ]; then \
518 until kubectl -n aether-roc exec ${ONOS_CLI_POD} -- \
519 curl -s -f -L -X PATCH "http://${API_SERVICE}:8181/aether-roc-api" \
520 --header 'Content-Type: application/json' \
521 --data-raw "$$(cat ${ROC_DEFAULTENT_MODEL})"; do sleep 5; done; \
522 fi
Sean Condone184e6e2023-01-12 09:59:40 +0000523 until kubectl -n aether-roc exec ${ONOS_CLI_POD} -- \
524 curl -s -f -L -X PATCH "http://${API_SERVICE}:8181/aether-roc-api" \
Andy Bavierebf479c2021-09-08 15:47:58 -0700525 --header 'Content-Type: application/json' \
526 --data-raw "$$(cat ${ROC_4G_MODELS})"; do sleep 5; done
527
528# Load the ROC 5G models. Disable loading network slice from SimApp.
529roc-5g-models: $(M)/roc
530 sed -i 's/provision-network-slice: true/provision-network-slice: false/' $(5G_CORE_VALUES)
531 sed -i 's/# syncUrl/syncUrl/' $(5G_CORE_VALUES)
Amit Wankhede01b20c32021-12-01 12:45:58 +0530532 if [ "${ENABLE_SUBSCRIBER_PROXY}" == "true" ] ; then \
Amit Wankhedefdf10ff2022-02-16 08:37:20 -0600533 sed -i 's/# sub-proxy-endpt:/sub-proxy-endpt:/' $(5G_CORE_VALUES) ; \
534 sed -i 's/# addr: sub/ addr: sub/' $(5G_CORE_VALUES) ; \
535 sed -i 's/# port: 5000/ port: 5000/' $(5G_CORE_VALUES) ; \
Amit Wankhede01b20c32021-12-01 12:45:58 +0530536 fi
Sean Condone184e6e2023-01-12 09:59:40 +0000537 @$(eval ONOS_CLI_POD := $(shell kubectl -n aether-roc get pods -l name=onos-cli -o name))
Andy Bavierebf479c2021-09-08 15:47:58 -0700538 echo "ONOS CLI pod: ${ONOS_CLI_POD}"
Sean Condone184e6e2023-01-12 09:59:40 +0000539 @$(eval API_SERVICE := $(shell kubectl -n aether-roc get --no-headers=true services -l app.kubernetes.io/name=aether-roc-api | awk '{print $$1}'))
540 echo "API SERVICE : ${API_SERVICE}"
SeanCondon47660272023-01-15 22:24:24 +0000541 if [ "$(CHARTS)" != "release-2.0" -a "$(CHARTS)" != "release-1.6" ]; then \
542 until kubectl -n aether-roc exec ${ONOS_CLI_POD} -- \
543 curl -s -f -L -X PATCH "http://${API_SERVICE}:8181/aether-roc-api" \
544 --header 'Content-Type: application/json' \
545 --data-raw "$$(cat ${ROC_DEFAULTENT_MODEL})"; do sleep 5; done; \
546 fi
Sean Condone184e6e2023-01-12 09:59:40 +0000547 until kubectl -n aether-roc exec ${ONOS_CLI_POD} -- \
548 curl -s -f -L -X PATCH "http://${API_SERVICE}:8181/aether-roc-api" \
Andy Bavierebf479c2021-09-08 15:47:58 -0700549 --header 'Content-Type: application/json' \
550 --data-raw "$$(cat ${ROC_5G_MODELS})"; do sleep 5; done
551
552roc-clean:
553 @echo "This could take 2-3 minutes..."
554 sed -i 's/provision-network-slice: false/provision-network-slice: true/' $(4G_CORE_VALUES)
555 sed -i 's/ syncUrl/ # syncUrl/' $(4G_CORE_VALUES)
Amit Wankhedefdf10ff2022-02-16 08:37:20 -0600556 sed -i 's/ sub-proxy-endpt:/ # sub-proxy-endpt:/' $(4G_CORE_VALUES)
557 sed -i 's/ addr: sub/ # addr: sub/' $(4G_CORE_VALUES)
558 sed -i 's/ port: 5000/ # port: 5000/' $(4G_CORE_VALUES)
Andy Bavierebf479c2021-09-08 15:47:58 -0700559 sed -i 's/provision-network-slice: false/provision-network-slice: true/' $(5G_CORE_VALUES)
560 sed -i 's/ syncUrl/ # syncUrl/' $(5G_CORE_VALUES)
Amit Wankhedefdf10ff2022-02-16 08:37:20 -0600561 sed -i 's/ sub-proxy-endpt:/ # sub-proxy-endpt:/' $(5G_CORE_VALUES)
562 sed -i 's/ addr: sub/ # addr: sub/' $(5G_CORE_VALUES)
Arrobo, Gabriel492fe1f2023-03-02 01:39:04 +0000563 sed -i 's/ port: 5000/ # port: 5000/' $(5G_CORE_VALUES)
Andy Bavierebf479c2021-09-08 15:47:58 -0700564 kubectl delete namespace aether-roc || true
565 rm -rf $(M)/roc
Arrobo, Gabriel6e54e952022-06-23 21:36:00 +0000566 rm -f ${GET_HELM}
Andy Bavierebf479c2021-09-08 15:47:58 -0700567
Andy Bavier7d5f0552022-05-23 16:01:45 -0700568monitoring: $(M)/monitoring
569$(M)/monitoring: $(M)/helm-ready
570 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
571 --namespace=cattle-monitoring-system \
572 --create-namespace \
573 --values=$(MONITORING_VALUES) \
574 rancher-monitoring-crd \
575 $(RANCHER_MONITORING_CRD_CHART)
576 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
577 --namespace=cattle-monitoring-system \
578 --create-namespace \
579 --values=$(MONITORING_VALUES) \
580 rancher-monitoring \
581 $(RANCHER_MONITORING_CHART)
582 touch $(M)/monitoring
583
584monitoring-4g: $(M)/monitoring
585 kubectl create namespace omec || true
586 kubectl create namespace cattle-dashboards || true
587 kubectl apply -k resources/4g-monitoring
588
Ankur Upadhyaya9b9707a2022-11-24 10:48:33 -0600589monitoring-5g: $(M)/monitoring
590 kubectl create namespace omec || true
591 kubectl create namespace cattle-dashboards || true
592 kubectl apply -k resources/5g-monitoring
593
Wei-Yu Chena6ae6e22022-06-08 18:15:30 +0800594enodebd:
595 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
596 --namespace=aether-apps \
597 --create-namespace \
598 enodebd \
599 ${ENODEBD_CHART}
600 touch $(M)/enodebd
601
602enodebd-clean:
603 helm -n aether-apps delete enodebd || true
604 rm $(M)/enodebd
Andy Bavier7d5f0552022-05-23 16:01:45 -0700605
606monitoring-clean:
607 helm -n cattle-monitoring-system delete rancher-monitoring || true
608 helm -n cattle-monitoring-system delete rancher-monitoring-crd || true
609 kubectl delete namespace cattle-dashboards cattle-monitoring-system || true
610 rm $(M)/monitoring
611
Arrobo, Gabriela5366e12023-03-02 12:10:47 -0800612upf-clean:
613 $(eval TO_REMOVE=$(shell echo $$(($(UPF_NUMBER)-1))))
614 @echo Removing $(TO_REMOVE) additional UPFs
615 @number=$(UPF_NUMBER) ; \
616 while [[ $$number -gt 1 ]] ; do \
617 ((number = number - 1)) ; \
618 ((addr = 250 - number)) ; \
619 helm delete -n upf-$$number $$(helm -n upf-$$number ls -qa) || true ; \
620 echo "Wait for all pods to terminate..." ; \
621 kubectl wait -n upf-$$number --for=delete --all=true -l app!=ue pod --timeout=180s || true ; \
622 kubectl delete namespace upf-$$number || true ; \
623 kubectl -n default exec -ti router -- ip route delete 172.$$addr.0.0/16 || true ; \
624 echo "" ; \
625 done
626 @echo "1" > ${UPF_COUNT}
627
628omec-clean: upf-clean
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600629 helm delete -n omec $$(helm -n omec ls -qa) || true
Arrobo, Gabriela5366e12023-03-02 12:10:47 -0800630 kubectl delete namespace omec || true
631 @rm -f $(UPF_COUNT)
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600632 @echo ""
633 @echo "Wait for all pods to terminate..."
634 kubectl wait -n omec --for=delete --all=true -l app!=ue pod --timeout=180s || true
635
636router-clean:
637 @kubectl delete net-attach-def router-net 2>/dev/null || true
638 @kubectl delete po router 2>/dev/null || true
639 kubectl wait --for=delete -l app=router pod --timeout=180s 2>/dev/null || true
640 sudo ip link del access || true
641 sudo ip link del core || true
642 $(eval oiface := $(shell ip route list default | awk -F 'dev' '{ print $$2; exit }' | awk '{ print $$1 }'))
643 sudo iptables -t nat -D POSTROUTING -s 172.250.0.0/16 -o $(oiface) -j MASQUERADE || true
644 @sudo ip link del data 2>/dev/null || true
645 @cd $(M); rm -f router-pod router-host
646
647oaisim-clean: reset-ue
648 @sudo ip addr del 127.0.0.2/8 dev lo 2>/dev/null || true
649 @sudo ip link del enb 2>/dev/null || true
650 @sudo ip route del 192.168.252.0/24 || true
651 @cd $(M); rm -f oaisim-lo
652
Andy Bavier7d5f0552022-05-23 16:01:45 -07006534g-test: test
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600654test: | 4g-core $(M)/oaisim
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700655 @sleep 5
656 @echo "Test1: ping from UE to SGI network gateway"
Hyunsun Moon0bd8cec2020-09-28 00:38:26 -0500657 ping -I oip1 192.168.250.1 -c 15
Fatemeh Rouzbeh85654e72022-05-23 09:26:12 -0700658 @if [ "${PROXY_ENABLED}" == "false" ] ; then \
659 @echo "Test2: ping from UE to 8.8.8.8" ; \
660 ping -I oip1 8.8.8.8 -c 3 ; \
661 @echo "Test3: ping from UE to google.com" ; \
662 ping -I oip1 google.com -c 3 ; \
663 fi
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700664 @echo "Finished to test"
665
Hyunsun Mooncbdac112022-03-19 22:01:27 -06006665g-test: | 5g-core
Andy Bavier31dfb9e2022-02-15 15:24:57 -0700667 @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 -0700668 @echo "Test: Registration + UE initiated PDU Session Establishment + User Data packets"
Andy Bavier0e4906f2022-03-03 15:31:48 -0700669 @sleep 60
Andy Bavier0a055a52022-01-07 10:46:17 -0700670 @rm -f /tmp/gnbsim.out
Andy Baviercd93a202022-01-10 18:03:26 -0800671 @if [[ ${GNBSIM_COLORS} == "true" ]]; then \
672 kubectl -n omec exec gnbsim-0 -- ./gnbsim 2>&1 | tee /tmp/gnbsim.out; \
673 else \
674 kubectl -n omec exec gnbsim-0 -- ./gnbsim 2>&1 | sed -u "s,\x1B\[[0-9;]*[a-zA-Z],,g" | tee /tmp/gnbsim.out; \
675 fi
Andy Bavier025874a2022-07-29 13:20:04 -0700676 @grep -q "Simulation Result: PASS\|Profile Status: PASS" /tmp/gnbsim.out
Andy Bavier0a055a52022-01-07 10:46:17 -0700677
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600678reset-test: | oaisim-clean omec-clean router-clean
679 @cd $(M); rm -f omec oaisim 5g-core
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700680
Andy Bavier8819b9f2022-01-28 16:54:06 -0700681reset-ue:
682 helm delete -n omec oaisim || true
683 kubectl wait -n omec --for=delete pod enb-0 || true
684 kubectl wait -n omec --for=delete pod ue-0 || true
685 cd $(M); rm -f oaisim
686
Hyunsun Mooncbdac112022-03-19 22:01:27 -0600687reset-5g-test: omec-clean
Badhrinath3e081e22020-12-02 15:02:08 -0600688 cd $(M); rm -f 5g-core
689
Osman Amjad488a0222022-01-12 11:58:43 -0600690reset-dbtestapp:
691 helm uninstall --namespace omec 5g-test-app
692
Andy Bavier99f31c82022-04-14 16:16:26 -0700693refresh-4g: reset-ue
694 kubectl -n omec delete pod mme-0
695 kubectl wait -n omec --for='condition=ready' pod mme-0 --timeout=300s
696
Osman Amjad488a0222022-01-12 11:58:43 -0600697dbtestapp:
698 helm repo update
699 if [ "$(CHARTS)" == "local" ]; then helm dep up $(5G_TEST_APPS_CHART); fi
700 helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
701 --namespace omec \
702 5g-test-app \
703 --values $(TEST_APP_VALUES) \
704 $(5G_TEST_APPS_CHART)
705 @echo "Finished to dbtestapp"
706
Andy Bavier99f31c82022-04-14 16:16:26 -0700707clean-systemd:
708 cd /etc/systemd/network && sudo rm -f 10-aiab* 20-aiab* */macvlan.conf
709 cd /etc/systemd/system && sudo rm -f aiab*.service && sudo systemctl daemon-reload
710
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700711ifeq ($(K8S_INSTALL),rke2)
Andy Bavier5b5ad562022-04-19 13:02:31 -0700712clean: | roc-clean oaisim-clean router-clean clean-systemd
Andy Bavier99f31c82022-04-14 16:16:26 -0700713 sudo /usr/local/bin/rke2-uninstall.sh || true
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700714 sudo rm -rf /usr/local/bin/kubectl
715 rm -rf $(M)
716endif
717
718ifeq ($(K8S_INSTALL),kubespray)
Andy Bavier5b5ad562022-04-19 13:02:31 -0700719clean: | roc-clean oaisim-clean router-clean clean-systemd
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700720 source "$(VENV)/bin/activate" && cd $(BUILD)/kubespray; \
Andy Bavier125baa02021-10-26 16:26:44 -0700721 ansible-playbook -b -i inventory/local/hosts.ini reset.yml --extra-vars "reset_confirmation=yes"
Jeremy Ronquillo6be909e2020-08-24 09:36:13 -0700722 @if [ -d /usr/local/etc/emulab ]; then \
723 mount | grep /mnt/extra/kubelet/pods | cut -d" " -f3 | sudo xargs umount; \
724 sudo rm -rf /mnt/extra/kubelet; \
725 fi
726 rm -rf $(M)
Fatemeh Rouzbeha0b26e22022-04-07 12:45:12 -0700727endif