Jeremy Ronquillo | 5263c73 | 2020-10-13 09:42:19 -0700 | [diff] [blame] | 1 | # Copyright 2018-present Open Networking Foundation |
| 2 | # |
Andy Bavier | 2c42773 | 2022-02-03 15:16:46 -0700 | [diff] [blame] | 3 | # SPDX-License-Identifier: Apache-2.0 |
Jeremy Ronquillo | 5263c73 | 2020-10-13 09:42:19 -0700 | [diff] [blame] | 4 | |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 5 | SHELL := /bin/bash |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 6 | MAKEDIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST)))) |
Andy Bavier | 99f31c8 | 2022-04-14 16:16:26 -0700 | [diff] [blame] | 7 | BUILD ?= $(MAKEDIR)/build |
| 8 | M ?= $(BUILD)/milestones |
Jeremy Ronquillo | af084f3 | 2020-08-24 13:18:47 -0700 | [diff] [blame] | 9 | SCRIPTDIR := $(MAKEDIR)/scripts |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 10 | RESOURCEDIR := $(MAKEDIR)/resources |
| 11 | WORKSPACE ?= $(HOME) |
Jeremy Ronquillo | d3cab74 | 2020-08-24 11:49:00 -0700 | [diff] [blame] | 12 | VENV ?= $(BUILD)/venv/aiab |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame] | 13 | |
Andy Bavier | 31dfb9e | 2022-02-15 15:24:57 -0700 | [diff] [blame] | 14 | 4G_CORE_VALUES ?= $(MAKEDIR)/sd-core-4g-values.yaml |
| 15 | 5G_CORE_VALUES ?= $(MAKEDIR)/sd-core-5g-values.yaml |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame] | 16 | OAISIM_VALUES ?= $(MAKEDIR)/oaisim-values.yaml |
Andy Bavier | 794566f | 2022-02-04 16:10:18 -0700 | [diff] [blame] | 17 | ROC_VALUES ?= $(MAKEDIR)/roc-values.yaml |
Andy Bavier | 794566f | 2022-02-04 16:10:18 -0700 | [diff] [blame] | 18 | ROC_4G_MODELS ?= $(MAKEDIR)/roc-4g-models.json |
| 19 | ROC_5G_MODELS ?= $(MAKEDIR)/roc-5g-models.json |
Osman Amjad | 488a022 | 2022-01-12 11:58:43 -0600 | [diff] [blame] | 20 | TEST_APP_VALUES?= $(MAKEDIR)/5g-test-apps-values.yaml |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 21 | |
Hyunsun Moon | 8c3fe40 | 2021-10-04 18:06:07 -0700 | [diff] [blame] | 22 | KUBESPRAY_VERSION ?= release-2.17 |
Fatemeh Rouzbeh | a0b26e2 | 2022-04-07 12:45:12 -0700 | [diff] [blame] | 23 | DOCKER_VERSION ?= '20.10' |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 24 | HELM_VERSION ?= v3.6.3 |
Fatemeh Rouzbeh | a0b26e2 | 2022-04-07 12:45:12 -0700 | [diff] [blame] | 25 | KUBECTL_VERSION ?= v1.23.0 |
| 26 | |
| 27 | RKE2_K8S_VERSION ?= v1.23.4+rke2r1 |
| 28 | K8S_VERSION ?= v1.20.11 |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 29 | |
| 30 | ENABLE_ROUTER ?= true |
| 31 | ENABLE_OAISIM ?= true |
| 32 | ENABLE_GNBSIM ?= true |
Amit Wankhede | 01b20c3 | 2021-12-01 12:45:58 +0530 | [diff] [blame] | 33 | ENABLE_SUBSCRIBER_PROXY ?= false |
Andy Bavier | cd93a20 | 2022-01-10 18:03:26 -0800 | [diff] [blame] | 34 | GNBSIM_COLORS ?= true |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 35 | |
Fatemeh Rouzbeh | 85654e7 | 2022-05-23 09:26:12 -0700 | [diff] [blame] | 36 | K8S_INSTALL ?= rke2 |
Andy Bavier | 99f31c8 | 2022-04-14 16:16:26 -0700 | [diff] [blame] | 37 | CTR_CMD := sudo /var/lib/rancher/rke2/bin/ctr --address /run/k3s/containerd/containerd.sock --namespace k8s.io |
Fatemeh Rouzbeh | a0b26e2 | 2022-04-07 12:45:12 -0700 | [diff] [blame] | 38 | |
Fatemeh Rouzbeh | 85654e7 | 2022-05-23 09:26:12 -0700 | [diff] [blame] | 39 | PROXY_ENABLED ?= false |
| 40 | HTTP_PROXY ?= ${http_proxy} |
| 41 | HTTPS_PROXY ?= ${https_proxy} |
| 42 | NO_PROXY ?= ${no_proxy} |
| 43 | |
| 44 | ONECLOUD ?= false |
| 45 | |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 46 | DATA_IFACE ?= data |
| 47 | ifeq ($(DATA_IFACE), data) |
| 48 | RAN_SUBNET := 192.168.251.0/24 |
| 49 | else |
| 50 | RAN_SUBNET := $(shell ip route | grep $${DATA_IFACE} | awk '/kernel/ {print $$1}') |
Andy Bavier | 99f31c8 | 2022-04-14 16:16:26 -0700 | [diff] [blame] | 51 | DATA_IFACE_PATH := $(shell find /*/systemd/network -maxdepth 1 -not -type d -name '*$(DATA_IFACE).network' -print) |
| 52 | DATA_IFACE_CONF ?= $(shell basename $(DATA_IFACE_PATH)).d |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 53 | endif |
Hyunsun Moon | 4e5795a | 2022-04-07 09:27:12 -0700 | [diff] [blame] | 54 | |
Andy Bavier | 99f31c8 | 2022-04-14 16:16:26 -0700 | [diff] [blame] | 55 | # systemd-networkd and systemd configs |
| 56 | LO_NETCONF := /etc/systemd/network/20-aiab-lo.network |
| 57 | OAISIM_NETCONF := $(LO_NETCONF) /etc/systemd/network/10-aiab-enb.netdev /etc/systemd/network/20-aiab-enb.network |
| 58 | ROUTER_POD_NETCONF := /etc/systemd/network/10-aiab-dummy.netdev /etc/systemd/network/20-aiab-dummy.network |
| 59 | ROUTER_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 |
| 60 | UE_NAT_CONF := /etc/systemd/system/aiab-ue-nat.service |
| 61 | |
Andy Bavier | 7d5f055 | 2022-05-23 16:01:45 -0700 | [diff] [blame] | 62 | # monitoring |
| 63 | RANCHER_MONITORING_CRD_CHART := rancher/rancher-monitoring-crd |
| 64 | RANCHER_MONITORING_CHART := rancher/rancher-monitoring |
| 65 | MONITORING_VALUES ?= $(MAKEDIR)/monitoring.yaml |
| 66 | |
Hyunsun Moon | 4e5795a | 2022-04-07 09:27:12 -0700 | [diff] [blame] | 67 | NODE_IP ?= $(shell ip route get 8.8.8.8 | grep -oP 'src \K\S+') |
| 68 | ifndef NODE_IP |
| 69 | $(error NODE_IP is not set) |
| 70 | endif |
| 71 | |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 72 | MME_IP ?= |
| 73 | |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 74 | HELM_GLOBAL_ARGS ?= |
Andy Bavier | eda466b | 2021-08-27 15:00:36 -0700 | [diff] [blame] | 75 | |
| 76 | # Allow installing local charts or specific versions of published charts. |
| 77 | # E.g., to install the Aether 1.5 release: |
| 78 | # CHARTS=release-1.5 make test |
| 79 | # Default is to install from the local charts. |
| 80 | CHARTS ?= local |
| 81 | CONFIGFILE := configs/$(CHARTS) |
| 82 | include $(CONFIGFILE) |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 83 | |
| 84 | cpu_family := $(shell lscpu | grep 'CPU family:' | awk '{print $$3}') |
| 85 | cpu_model := $(shell lscpu | grep 'Model:' | awk '{print $$2}') |
| 86 | os_vendor := $(shell lsb_release -i -s) |
| 87 | os_release := $(shell lsb_release -r -s) |
Andy Bavier | 9ee69d0 | 2022-02-11 10:31:21 -0700 | [diff] [blame] | 88 | USER := $(shell whoami) |
| 89 | |
Fatemeh Rouzbeh | a0b26e2 | 2022-04-07 12:45:12 -0700 | [diff] [blame] | 90 | .PHONY: 4g-core 5g-core oaisim test reset-test reset-ue reset-5g-test node-prep clean |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 91 | |
| 92 | $(M): |
| 93 | mkdir -p $(M) |
| 94 | |
| 95 | $(M)/system-check: | $(M) |
| 96 | @if [[ $(cpu_family) -eq 6 ]]; then \ |
| 97 | if [[ $(cpu_model) -lt 60 ]]; then \ |
| 98 | echo "FATAL: haswell CPU or newer is required."; \ |
| 99 | exit 1; \ |
| 100 | fi \ |
| 101 | else \ |
| 102 | echo "FATAL: unsupported CPU family."; \ |
| 103 | exit 1; \ |
| 104 | fi |
| 105 | @if [[ $(os_vendor) =~ (Ubuntu) ]]; then \ |
Hyunsun | 7b64051 | 2020-10-27 19:49:51 -0500 | [diff] [blame] | 106 | if [[ ! $(os_release) =~ (18.04) ]]; then \ |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 107 | echo "WARN: $(os_vendor) $(os_release) has not been tested."; \ |
| 108 | fi; \ |
| 109 | if dpkg --compare-versions 4.15 gt $(shell uname -r); then \ |
| 110 | echo "FATAL: kernel 4.15 or later is required."; \ |
| 111 | echo "Please upgrade your kernel by running" \ |
| 112 | "apt install --install-recommends linux-generic-hwe-$(os_release)"; \ |
| 113 | exit 1; \ |
| 114 | fi \ |
| 115 | else \ |
| 116 | echo "FAIL: unsupported OS."; \ |
| 117 | exit 1; \ |
| 118 | fi |
| 119 | touch $@ |
| 120 | |
Andy Bavier | 99f31c8 | 2022-04-14 16:16:26 -0700 | [diff] [blame] | 121 | $(M)/interface-check: | $(M) |
| 122 | ifeq ($(DATA_IFACE_CONF), .d) |
| 123 | @echo |
| 124 | @echo FATAL: Could not find systemd-networkd config for interface $(DATA_IFACE), exiting now!; exit 1 |
| 125 | endif |
Fatemeh Rouzbeh | 85654e7 | 2022-05-23 09:26:12 -0700 | [diff] [blame] | 126 | @echo "Add network configuration for enb interface" |
| 127 | @if [[ "${ONECLOUD}" == "true" ]]; then \ |
| 128 | sudo cp netplan/01-enb-static-config.yaml /etc/netplan ; \ |
| 129 | sudo netplan apply ; \ |
| 130 | sleep 1 ; \ |
| 131 | fi |
Andy Bavier | 99f31c8 | 2022-04-14 16:16:26 -0700 | [diff] [blame] | 132 | touch $@ |
| 133 | |
Fatemeh Rouzbeh | a0b26e2 | 2022-04-07 12:45:12 -0700 | [diff] [blame] | 134 | ifeq ($(K8S_INSTALL),kubespray) |
Andy Bavier | 99f31c8 | 2022-04-14 16:16:26 -0700 | [diff] [blame] | 135 | $(M)/setup: | $(M) $(M)/interface-check |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 136 | sudo $(SCRIPTDIR)/cloudlab-disksetup.sh |
Hyunsun Moon | 82e47c2 | 2021-06-28 12:30:20 -0500 | [diff] [blame] | 137 | sudo apt update; sudo apt install -y software-properties-common python3 python3-pip python3-venv jq httpie ipvsadm |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 138 | touch $@ |
Fatemeh Rouzbeh | a0b26e2 | 2022-04-07 12:45:12 -0700 | [diff] [blame] | 139 | endif |
| 140 | |
| 141 | ifeq ($(K8S_INSTALL),rke2) |
Fatemeh Rouzbeh | 85654e7 | 2022-05-23 09:26:12 -0700 | [diff] [blame] | 142 | $(M)/initial-setup: | $(M) $(M)/interface-check |
Fatemeh Rouzbeh | a0b26e2 | 2022-04-07 12:45:12 -0700 | [diff] [blame] | 143 | sudo $(SCRIPTDIR)/cloudlab-disksetup.sh |
| 144 | sudo apt update; sudo apt install -y software-properties-common python3 python3-pip python3-venv jq httpie ipvsadm apparmor apparmor-utils |
| 145 | systemctl list-units --full -all | grep "docker.service" || sudo apt install -y docker.io |
| 146 | sudo adduser $(USER) docker || true |
Fatemeh Rouzbeh | 85654e7 | 2022-05-23 09:26:12 -0700 | [diff] [blame] | 147 | |
| 148 | ifeq ($(PROXY_ENABLED),true) |
| 149 | $(M)/proxy-setting: | $(M) |
| 150 | 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 |
| 151 | echo "HTTP_PROXY=$(HTTP_PROXY)" >> rke2-server |
| 152 | echo "HTTPS_PROXY=$(HTTPS_PROXY)" >> rke2-server |
| 153 | echo "NO_PROXY=$(NO_PROXY),.cluster.local,.svc,$(NODE_IP),192.168.84.0/24,192.168.85.0/24,$(RAN_SUBNET)" >> rke2-server |
| 154 | sudo mv rke2-server /etc/default/ |
| 155 | echo "[Service]" >> http-proxy.conf |
| 156 | echo "Environment='HTTP_PROXY=$(HTTP_PROXY)'" >> http-proxy.conf |
| 157 | echo "Environment='HTTPS_PROXY=$(HTTPS_PROXY)'" >> http-proxy.conf |
| 158 | echo "Environment='NO_PROXY=$(NO_PROXY)'" >> http-proxy.conf |
| 159 | sudo mkdir -p /etc/systemd/system/docker.service.d |
| 160 | sudo mv http-proxy.conf /etc/systemd/system/docker.service.d |
| 161 | sudo systemctl daemon-reload |
| 162 | sudo systemctl restart docker |
| 163 | touch $(M)/proxy-setting |
| 164 | else |
| 165 | $(M)/proxy-setting: | $(M) |
| 166 | @echo -n "" |
| 167 | touch $(M)/proxy-setting |
| 168 | endif |
| 169 | |
| 170 | $(M)/setup: | $(M)/initial-setup $(M)/proxy-setting |
Fatemeh Rouzbeh | a0b26e2 | 2022-04-07 12:45:12 -0700 | [diff] [blame] | 171 | touch $@ |
| 172 | endif |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 173 | |
| 174 | $(BUILD)/kubespray: | $(M)/setup |
| 175 | mkdir -p $(BUILD) |
| 176 | cd $(BUILD); git clone https://github.com/kubernetes-incubator/kubespray.git -b $(KUBESPRAY_VERSION) |
| 177 | |
| 178 | $(VENV)/bin/activate: | $(M)/setup |
Hyunsun Moon | 82e47c2 | 2021-06-28 12:30:20 -0500 | [diff] [blame] | 179 | python3 -m venv $(VENV) |
Wei-Yu Chen | 7edb7e7 | 2021-07-28 11:37:55 +0800 | [diff] [blame] | 180 | source "$(VENV)/bin/activate" && \ |
| 181 | python -m pip install -U pip && \ |
| 182 | deactivate |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 183 | |
| 184 | $(M)/kubespray-requirements: $(BUILD)/kubespray | $(VENV)/bin/activate |
| 185 | source "$(VENV)/bin/activate" && \ |
| 186 | pip install -r $(BUILD)/kubespray/requirements.txt |
| 187 | touch $@ |
| 188 | |
Fatemeh Rouzbeh | a0b26e2 | 2022-04-07 12:45:12 -0700 | [diff] [blame] | 189 | ifeq ($(K8S_INSTALL),kubespray) |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 190 | $(M)/k8s-ready: | $(M)/setup $(BUILD)/kubespray $(VENV)/bin/activate $(M)/kubespray-requirements |
| 191 | source "$(VENV)/bin/activate" && cd $(BUILD)/kubespray; \ |
| 192 | ansible-playbook -b -i inventory/local/hosts.ini \ |
Fatemeh Rouzbeh | 85654e7 | 2022-05-23 09:26:12 -0700 | [diff] [blame] | 193 | -e "{'http_proxy' : $(HTTP_PROXY)}" \ |
| 194 | -e "{'https_proxy' : $(HTTPS_PROXY)}" \ |
| 195 | -e "{'no_proxy' : $(NO_PROXY)}" \ |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 196 | -e "{'override_system_hostname' : False, 'disable_swap' : True}" \ |
| 197 | -e "{'docker_version' : $(DOCKER_VERSION)}" \ |
| 198 | -e "{'docker_iptables_enabled' : True}" \ |
| 199 | -e "{'kube_version' : $(K8S_VERSION)}" \ |
Hyunsun | 84f0f17 | 2020-09-23 15:40:08 -0500 | [diff] [blame] | 200 | -e "{'kube_network_plugin_multus' : True, 'multus_version' : stable, 'multus_cni_version' : 0.3.1}" \ |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 201 | -e "{'kube_proxy_metrics_bind_address' : 0.0.0.0:10249}" \ |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 202 | -e "{'kube_pods_subnet' : 192.168.84.0/24, 'kube_service_addresses' : 192.168.85.0/24}" \ |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 203 | -e "{'kube_apiserver_node_port_range' : 2000-36767}" \ |
| 204 | -e "{'kubeadm_enabled': True}" \ |
| 205 | -e "{'kube_feature_gates' : [SCTPSupport=True]}" \ |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 206 | -e "{'kubelet_custom_flags' : [--allowed-unsafe-sysctls=net.*, --node-ip=$(NODE_IP)]}" \ |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 207 | -e "{'dns_min_replicas' : 1}" \ |
| 208 | -e "{'helm_enabled' : True, 'helm_version' : $(HELM_VERSION)}" \ |
| 209 | cluster.yml |
| 210 | mkdir -p $(HOME)/.kube |
| 211 | sudo cp -f /etc/kubernetes/admin.conf $(HOME)/.kube/config |
| 212 | sudo chown $(shell id -u):$(shell id -g) $(HOME)/.kube/config |
| 213 | kubectl wait pod -n kube-system --for=condition=Ready --all |
Andy Bavier | 9ee69d0 | 2022-02-11 10:31:21 -0700 | [diff] [blame] | 214 | sudo adduser $(USER) docker |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 215 | touch $@ |
| 216 | |
| 217 | $(M)/helm-ready: | $(M)/k8s-ready |
Woojoong Kim | 8425cb3 | 2021-01-08 16:18:53 -0800 | [diff] [blame] | 218 | helm repo add incubator https://charts.helm.sh/incubator |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 219 | helm repo add cord https://charts.opencord.org |
Andy Bavier | eda466b | 2021-08-27 15:00:36 -0700 | [diff] [blame] | 220 | helm repo add atomix https://charts.atomix.io |
| 221 | helm repo add onosproject https://charts.onosproject.org |
Andy Bavier | 9ee69d0 | 2022-02-11 10:31:21 -0700 | [diff] [blame] | 222 | helm repo add aether https://charts.aetherproject.org |
Andy Bavier | 7d5f055 | 2022-05-23 16:01:45 -0700 | [diff] [blame] | 223 | helm repo add rancher http://charts.rancher.io/ |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 224 | touch $@ |
Fatemeh Rouzbeh | a0b26e2 | 2022-04-07 12:45:12 -0700 | [diff] [blame] | 225 | endif |
| 226 | |
| 227 | ifeq ($(K8S_INSTALL),rke2) |
| 228 | $(M)/k8s-ready: | $(M)/setup |
| 229 | sudo mkdir -p /etc/rancher/rke2/ |
| 230 | [ -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 |
| 231 | echo "cni: multus,calico" >> config.yaml |
| 232 | echo "cluster-cidr: 192.168.84.0/24" >> config.yaml |
| 233 | echo "service-cidr: 192.168.85.0/24" >> config.yaml |
| 234 | echo "kubelet-arg:" >> config.yaml |
| 235 | echo "- --allowed-unsafe-sysctls="net.*"" >> config.yaml |
| 236 | echo "- --node-ip="$(NODE_IP)"" >> config.yaml |
| 237 | echo "pause-image: k8s.gcr.io/pause:3.3" >> config.yaml |
| 238 | echo "kube-proxy-arg:" >> config.yaml |
| 239 | echo "- --metrics-bind-address="0.0.0.0:10249"" >> config.yaml |
| 240 | echo "- --proxy-mode="ipvs"" >> config.yaml |
| 241 | echo "kube-apiserver-arg:" >> config.yaml |
| 242 | echo "- --service-node-port-range="2000-36767"" >> config.yaml |
| 243 | sudo mv config.yaml /etc/rancher/rke2/ |
| 244 | curl -sfL https://get.rke2.io | sudo INSTALL_RKE2_VERSION=$(RKE2_K8S_VERSION) sh - |
| 245 | sudo systemctl enable rke2-server.service |
| 246 | sudo systemctl start rke2-server.service |
| 247 | sudo /var/lib/rancher/rke2/bin/kubectl --kubeconfig /etc/rancher/rke2/rke2.yaml wait nodes --for=condition=Ready --all --timeout=300s |
| 248 | sudo /var/lib/rancher/rke2/bin/kubectl --kubeconfig /etc/rancher/rke2/rke2.yaml wait deployment -n kube-system --for=condition=available --all --timeout=300s |
| 249 | curl -LO "https://dl.k8s.io/release/$(KUBECTL_VERSION)/bin/linux/amd64/kubectl" |
| 250 | sudo chmod +x kubectl |
| 251 | sudo mv kubectl /usr/local/bin/ |
| 252 | kubectl version --client |
| 253 | mkdir -p $(HOME)/.kube |
| 254 | sudo cp /etc/rancher/rke2/rke2.yaml $(HOME)/.kube/config |
| 255 | sudo chown -R $(shell id -u):$(shell id -g) $(HOME)/.kube |
| 256 | touch $@ |
| 257 | |
| 258 | $(M)/helm-ready: | $(M)/k8s-ready |
| 259 | curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 |
| 260 | chmod 700 get_helm.sh |
| 261 | sudo DESIRED_VERSION=$(HELM_VERSION) ./get_helm.sh |
| 262 | helm repo add incubator https://charts.helm.sh/incubator |
| 263 | helm repo add cord https://charts.opencord.org |
| 264 | helm repo add atomix https://charts.atomix.io |
| 265 | helm repo add onosproject https://charts.onosproject.org |
| 266 | helm repo add aether https://charts.aetherproject.org |
Andy Bavier | 7d5f055 | 2022-05-23 16:01:45 -0700 | [diff] [blame] | 267 | helm repo add rancher http://charts.rancher.io/ |
Fatemeh Rouzbeh | a0b26e2 | 2022-04-07 12:45:12 -0700 | [diff] [blame] | 268 | touch $@ |
| 269 | endif |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 270 | |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 271 | /opt/cni/bin/static: | $(M)/k8s-ready |
| 272 | mkdir -p $(BUILD)/cni-plugins; cd $(BUILD)/cni-plugins; \ |
| 273 | wget https://github.com/containernetworking/plugins/releases/download/v0.8.2/cni-plugins-linux-amd64-v0.8.2.tgz && \ |
| 274 | tar xvfz cni-plugins-linux-amd64-v0.8.2.tgz |
| 275 | sudo cp $(BUILD)/cni-plugins/static /opt/cni/bin/ |
| 276 | |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 277 | node-prep: | $(M)/helm-ready /opt/cni/bin/static |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 278 | |
Andy Bavier | 99f31c8 | 2022-04-14 16:16:26 -0700 | [diff] [blame] | 279 | $(M)/router-pod: $(ROUTER_POD_NETCONF) |
| 280 | sudo systemctl restart systemd-networkd |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 281 | DATA_IFACE=$(DATA_IFACE) envsubst < $(RESOURCEDIR)/router.yaml | kubectl apply -f - |
| 282 | kubectl wait pod -n default --for=condition=Ready -l app=router --timeout=300s |
| 283 | @touch $@ |
| 284 | |
Andy Bavier | 99f31c8 | 2022-04-14 16:16:26 -0700 | [diff] [blame] | 285 | $(M)/router-host: $(ROUTER_HOST_NETCONF) $(UE_NAT_CONF) |
| 286 | sudo systemctl daemon-reload |
| 287 | sudo systemctl enable aiab-ue-nat.service |
| 288 | sudo systemctl start aiab-ue-nat.service |
| 289 | sudo systemctl restart systemd-networkd |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 290 | $(eval oiface := $(shell ip route list default | awk -F 'dev' '{ print $$2; exit }' | awk '{ print $$1 }')) |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 291 | @touch $@ |
| 292 | |
| 293 | 4g-core: node-prep |
| 294 | ifeq ($(ENABLE_ROUTER),true) |
| 295 | ifeq ($(ENABLE_OAISIM),true) |
| 296 | 4g-core: $(M)/router-pod |
| 297 | else |
| 298 | 4g-core: $(M)/router-host |
| 299 | endif |
| 300 | endif |
| 301 | 4g-core: $(M)/omec |
| 302 | $(M)/omec: |
| 303 | @if [[ "${CHARTS}" == "local" || "${CHARTS}" == "local-sdcore" ]]; then \ |
| 304 | helm dep up $(SD_CORE_CHART); \ |
| 305 | else \ |
| 306 | helm repo update; \ |
| 307 | fi |
| 308 | NODE_IP=${NODE_IP} DATA_IFACE=${DATA_IFACE} RAN_SUBNET=${RAN_SUBNET} envsubst < $(4G_CORE_VALUES) | \ |
| 309 | helm upgrade --create-namespace --install --wait $(HELM_GLOBAL_ARGS) \ |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 310 | --namespace omec \ |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 311 | --values - \ |
Andy Bavier | 31dfb9e | 2022-02-15 15:24:57 -0700 | [diff] [blame] | 312 | sd-core \ |
| 313 | $(SD_CORE_CHART) |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 314 | @if [[ "${ENABLE_OAISIM}" == "false" ]]; then \ |
| 315 | $(eval mme_ip := $(shell ip -4 -o addr show $${DATA_IFACE} | awk '{print $$4}' | cut -d'/' -f1)) \ |
| 316 | echo "Your MME IP is $(mme_ip)"; \ |
| 317 | fi |
| 318 | @touch $@ |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 319 | |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 320 | 5g-core: node-prep |
| 321 | ifeq ($(ENABLE_ROUTER),true) |
| 322 | ifeq ($(ENABLE_GNBSIM),true) |
| 323 | 5g-core: $(M)/router-pod |
| 324 | else |
| 325 | 5g-core: $(M)/router-host |
| 326 | endif |
| 327 | endif |
| 328 | 5g-core: $(M)/5g-core |
| 329 | $(M)/5g-core: |
| 330 | @if [[ "${CHARTS}" == "local" || "${CHARTS}" == "local-sdcore" ]]; then \ |
| 331 | helm dep up $(SD_CORE_CHART); \ |
| 332 | else \ |
| 333 | helm repo update; \ |
| 334 | fi |
| 335 | NODE_IP=${NODE_IP} DATA_IFACE=${DATA_IFACE} RAN_SUBNET=${RAN_SUBNET} envsubst < $(5G_CORE_VALUES) | \ |
| 336 | helm upgrade --create-namespace --install --wait $(HELM_GLOBAL_ARGS) \ |
Badhrinath | 3e081e2 | 2020-12-02 15:02:08 -0600 | [diff] [blame] | 337 | --namespace omec \ |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 338 | --values - \ |
Andy Bavier | 31dfb9e | 2022-02-15 15:24:57 -0700 | [diff] [blame] | 339 | sd-core \ |
| 340 | $(SD_CORE_CHART) |
Badhrinath | 3e081e2 | 2020-12-02 15:02:08 -0600 | [diff] [blame] | 341 | touch $@ |
| 342 | |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 343 | # UE images includes kernel module, ue_ip.ko |
| 344 | # which should be built in the exactly same kernel version of the host machine |
| 345 | $(BUILD)/openairinterface: | $(M)/setup |
| 346 | mkdir -p $(BUILD) |
| 347 | cd $(BUILD); git clone https://github.com/opencord/openairinterface.git |
| 348 | |
Fatemeh Rouzbeh | a0b26e2 | 2022-04-07 12:45:12 -0700 | [diff] [blame] | 349 | ifeq ($(K8S_INSTALL),kubespray) |
| 350 | download-ue-image: | $(M)/k8s-ready $(BUILD)/openairinterface |
Andy Bavier | 9ee69d0 | 2022-02-11 10:31:21 -0700 | [diff] [blame] | 351 | sg docker -c "docker pull ${OAISIM_UE_IMAGE} && \ |
| 352 | docker tag ${OAISIM_UE_IMAGE} omecproject/lte-uesoftmodem:1.1.0" |
Andy Bavier | d6de561 | 2021-11-08 10:39:17 -0700 | [diff] [blame] | 353 | touch $(M)/ue-image |
| 354 | |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 355 | $(M)/ue-image: | $(M)/k8s-ready $(BUILD)/openairinterface |
| 356 | cd $(BUILD)/openairinterface; \ |
Andy Bavier | 9ee69d0 | 2022-02-11 10:31:21 -0700 | [diff] [blame] | 357 | sg docker -c "docker build . --target lte-uesoftmodem \ |
Fatemeh Rouzbeh | 85654e7 | 2022-05-23 09:26:12 -0700 | [diff] [blame] | 358 | --build-arg http_proxy=$(HTTP_PROXY)/ \ |
Hyunsun | 7b64051 | 2020-10-27 19:49:51 -0500 | [diff] [blame] | 359 | --build-arg build_base=omecproject/oai-base:1.1.0 \ |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 360 | --file Dockerfile.ue \ |
Andy Bavier | 9ee69d0 | 2022-02-11 10:31:21 -0700 | [diff] [blame] | 361 | --tag omecproject/lte-uesoftmodem:1.1.0" |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 362 | touch $@ |
Fatemeh Rouzbeh | a0b26e2 | 2022-04-07 12:45:12 -0700 | [diff] [blame] | 363 | endif |
| 364 | |
| 365 | ifeq ($(K8S_INSTALL),rke2) |
| 366 | download-ue-image: | $(M)/k8s-ready $(BUILD)/openairinterface |
| 367 | sg docker -c "docker pull ${OAISIM_UE_IMAGE} && \ |
| 368 | docker tag ${OAISIM_UE_IMAGE} omecproject/lte-uesoftmodem:1.1.0 && \ |
| 369 | docker save -o /tmp/lte-uesoftmodem.tar omecproject/lte-uesoftmodem:1.1.0" |
| 370 | $(CTR_CMD) images import /tmp/lte-uesoftmodem.tar |
| 371 | touch $(M)/ue-image |
| 372 | |
| 373 | $(M)/ue-image: $(M)/k8s-ready $(BUILD)/openairinterface |
| 374 | cd $(BUILD)/openairinterface; \ |
| 375 | sg docker -c "docker build . --target lte-uesoftmodem \ |
Fatemeh Rouzbeh | 85654e7 | 2022-05-23 09:26:12 -0700 | [diff] [blame] | 376 | --build-arg http_proxy=$(HTTP_PROXY)/ \ |
Fatemeh Rouzbeh | a0b26e2 | 2022-04-07 12:45:12 -0700 | [diff] [blame] | 377 | --build-arg build_base=omecproject/oai-base:1.1.0 \ |
| 378 | --file Dockerfile.ue \ |
| 379 | --tag omecproject/lte-uesoftmodem:1.1.0 && \ |
| 380 | docker save -o /tmp/lte-uesoftmodem.tar omecproject/lte-uesoftmodem:1.1.0" |
| 381 | $(CTR_CMD) images import /tmp/lte-uesoftmodem.tar |
| 382 | touch $@ |
| 383 | endif |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 384 | |
Andy Bavier | 99f31c8 | 2022-04-14 16:16:26 -0700 | [diff] [blame] | 385 | /etc/systemd/%: |
| 386 | @sudo mkdir -p $(@D) |
| 387 | @sed 's/DATA_IFACE/$(DATA_IFACE)/g' $(MAKEDIR)/systemd/$(@F) > /tmp/$(@F) |
| 388 | @sudo cp /tmp/$(@F) $@ |
| 389 | echo "Installed $@" |
Andy Bavier | 9ee69d0 | 2022-02-11 10:31:21 -0700 | [diff] [blame] | 390 | |
Andy Bavier | 99f31c8 | 2022-04-14 16:16:26 -0700 | [diff] [blame] | 391 | oaisim-standalone: | $(M)/helm-ready $(M)/ue-image $(LO_NETCONF) |
| 392 | sudo systemctl restart systemd-networkd |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 393 | @ip link show $(DATA_IFACE) > /dev/null || (echo DATA_IFACE is not set or does not exist; exit 1) |
| 394 | @if [[ "${MME_IP}" == "" ]]; then \ |
| 395 | echo MME_IP is not set; \ |
| 396 | exit 1; \ |
| 397 | else \ |
| 398 | ping -c 3 $(MME_IP) > /dev/null || (echo MME $(MME_IP) is not reachable; exit 1) \ |
| 399 | fi |
| 400 | sudo ip route add 192.168.252.0/24 via $(MME_IP) |
Andy Bavier | 7b01b68 | 2022-03-17 13:26:55 -0700 | [diff] [blame] | 401 | helm repo update |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 402 | helm upgrade --create-namespace --install $(HELM_GLOBAL_ARGS) --namespace omec oaisim cord/oaisim -f $(OAISIM_VALUES) \ |
| 403 | --set config.enb.networks.s1u.interface=$(DATA_IFACE) \ |
| 404 | --set config.enb.networks.s1_mme.interface=$(DATA_IFACE) \ |
| 405 | --set config.enb.mme.address=$(MME_IP) \ |
| 406 | --set config.enb.mme.isLocal=false \ |
| 407 | --set images.pullPolicy=IfNotPresent |
Andy Bavier | 7b01b68 | 2022-03-17 13:26:55 -0700 | [diff] [blame] | 408 | kubectl rollout status -n omec statefulset ue |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 409 | @echo "Test: registration" |
Andy Bavier | 7b01b68 | 2022-03-17 13:26:55 -0700 | [diff] [blame] | 410 | @timeout 60s bash -c \ |
| 411 | "until ip addr show oip1 | grep -q inet; \ |
| 412 | do \ |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 413 | echo 'Waiting for UE 1 gets IP address'; \ |
| 414 | sleep 3; \ |
Andy Bavier | 7b01b68 | 2022-03-17 13:26:55 -0700 | [diff] [blame] | 415 | done" |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 416 | @echo "Test: ping from UE to 8.8.8.8" |
| 417 | ping -I oip1 8.8.8.8 -c 3 |
| 418 | @touch $(M)/oaisim $(M)/omec |
Andy Bavier | 7b01b68 | 2022-03-17 13:26:55 -0700 | [diff] [blame] | 419 | |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 420 | oaisim: | $(M)/oaisim |
Andy Bavier | 99f31c8 | 2022-04-14 16:16:26 -0700 | [diff] [blame] | 421 | $(M)/oaisim: | $(M)/ue-image $(M)/router-pod $(OAISIM_NETCONF) |
| 422 | sudo systemctl restart systemd-networkd |
Fatemeh Rouzbeh | 85654e7 | 2022-05-23 09:26:12 -0700 | [diff] [blame] | 423 | sleep 1 |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 424 | helm upgrade --create-namespace --install $(HELM_GLOBAL_ARGS) --namespace omec oaisim cord/oaisim -f $(OAISIM_VALUES) \ |
Jeremy Ronquillo | af084f3 | 2020-08-24 13:18:47 -0700 | [diff] [blame] | 425 | --set images.pullPolicy=IfNotPresent |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 426 | kubectl rollout status -n omec statefulset ue |
| 427 | @timeout 60s bash -c \ |
| 428 | "until ip addr show oip1 | grep -q inet; \ |
| 429 | do \ |
| 430 | echo 'Waiting for UE 1 gets IP address'; \ |
| 431 | sleep 3; \ |
| 432 | done" |
| 433 | touch $@ |
| 434 | |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame] | 435 | roc: $(M)/roc |
| 436 | $(M)/roc: $(M)/helm-ready |
| 437 | kubectl get namespace aether-roc 2> /dev/null || kubectl create namespace aether-roc |
| 438 | helm repo update |
| 439 | if [ "$(CHARTS)" == "local" ]; then helm dep up $(AETHER_ROC_UMBRELLA_CHART); fi |
| 440 | helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \ |
| 441 | --namespace kube-system \ |
| 442 | --values $(ROC_VALUES) \ |
| 443 | atomix-controller \ |
| 444 | $(ATOMIX_CONTROLLER_CHART) |
| 445 | helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \ |
| 446 | --namespace kube-system \ |
| 447 | --values $(ROC_VALUES) \ |
| 448 | atomix-raft-storage \ |
| 449 | $(ATOMIX_RAFT_STORAGE_CHART) |
| 450 | helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \ |
| 451 | --namespace kube-system \ |
| 452 | --values $(ROC_VALUES) \ |
| 453 | onos-operator \ |
| 454 | $(ONOS_OPERATOR_CHART) |
| 455 | helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \ |
| 456 | --namespace aether-roc \ |
| 457 | --values $(ROC_VALUES) \ |
| 458 | aether-roc-umbrella \ |
| 459 | $(AETHER_ROC_UMBRELLA_CHART) |
| 460 | touch $@ |
| 461 | |
| 462 | # Load the ROC 4G models. Disable loading network slice from SimApp. |
| 463 | roc-4g-models: $(M)/roc |
| 464 | sed -i 's/provision-network-slice: true/provision-network-slice: false/' $(4G_CORE_VALUES) |
| 465 | sed -i 's/# syncUrl/syncUrl/' $(4G_CORE_VALUES) |
Amit Wankhede | 01b20c3 | 2021-12-01 12:45:58 +0530 | [diff] [blame] | 466 | if [ "${ENABLE_SUBSCRIBER_PROXY}" == "true" ] ; then \ |
Amit Wankhede | fdf10ff | 2022-02-16 08:37:20 -0600 | [diff] [blame] | 467 | sed -i 's/# sub-proxy-endpt:/sub-proxy-endpt:/' $(4G_CORE_VALUES) ; \ |
| 468 | sed -i 's/# addr: sub/ addr: sub/' $(4G_CORE_VALUES) ; \ |
| 469 | sed -i 's/# port: 5000/ port: 5000/' $(4G_CORE_VALUES) ; \ |
Amit Wankhede | 01b20c3 | 2021-12-01 12:45:58 +0530 | [diff] [blame] | 470 | fi |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame] | 471 | $(eval ONOS_CLI_POD := $(shell kubectl -n aether-roc get pods -l name=onos-cli -o name)) |
| 472 | echo "ONOS CLI pod: ${ONOS_CLI_POD}" |
| 473 | until kubectl -n aether-roc exec ${ONOS_CLI_POD} -- \ |
| 474 | curl -s -f -L -X PATCH "http://aether-roc-api:8181/aether-roc-api" \ |
| 475 | --header 'Content-Type: application/json' \ |
| 476 | --data-raw "$$(cat ${ROC_4G_MODELS})"; do sleep 5; done |
| 477 | |
| 478 | # Load the ROC 5G models. Disable loading network slice from SimApp. |
| 479 | roc-5g-models: $(M)/roc |
| 480 | sed -i 's/provision-network-slice: true/provision-network-slice: false/' $(5G_CORE_VALUES) |
| 481 | sed -i 's/# syncUrl/syncUrl/' $(5G_CORE_VALUES) |
Amit Wankhede | 01b20c3 | 2021-12-01 12:45:58 +0530 | [diff] [blame] | 482 | if [ "${ENABLE_SUBSCRIBER_PROXY}" == "true" ] ; then \ |
Amit Wankhede | fdf10ff | 2022-02-16 08:37:20 -0600 | [diff] [blame] | 483 | sed -i 's/# sub-proxy-endpt:/sub-proxy-endpt:/' $(5G_CORE_VALUES) ; \ |
| 484 | sed -i 's/# addr: sub/ addr: sub/' $(5G_CORE_VALUES) ; \ |
| 485 | sed -i 's/# port: 5000/ port: 5000/' $(5G_CORE_VALUES) ; \ |
Amit Wankhede | 01b20c3 | 2021-12-01 12:45:58 +0530 | [diff] [blame] | 486 | fi |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame] | 487 | $(eval ONOS_CLI_POD := $(shell kubectl -n aether-roc get pods -l name=onos-cli -o name)) |
| 488 | echo "ONOS CLI pod: ${ONOS_CLI_POD}" |
| 489 | until kubectl -n aether-roc exec ${ONOS_CLI_POD} -- \ |
| 490 | curl -s -f -L -X PATCH "http://aether-roc-api:8181/aether-roc-api" \ |
| 491 | --header 'Content-Type: application/json' \ |
| 492 | --data-raw "$$(cat ${ROC_5G_MODELS})"; do sleep 5; done |
| 493 | |
| 494 | roc-clean: |
| 495 | @echo "This could take 2-3 minutes..." |
| 496 | sed -i 's/provision-network-slice: false/provision-network-slice: true/' $(4G_CORE_VALUES) |
| 497 | sed -i 's/ syncUrl/ # syncUrl/' $(4G_CORE_VALUES) |
Amit Wankhede | fdf10ff | 2022-02-16 08:37:20 -0600 | [diff] [blame] | 498 | sed -i 's/ sub-proxy-endpt:/ # sub-proxy-endpt:/' $(4G_CORE_VALUES) |
| 499 | sed -i 's/ addr: sub/ # addr: sub/' $(4G_CORE_VALUES) |
| 500 | sed -i 's/ port: 5000/ # port: 5000/' $(4G_CORE_VALUES) |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame] | 501 | sed -i 's/provision-network-slice: false/provision-network-slice: true/' $(5G_CORE_VALUES) |
| 502 | sed -i 's/ syncUrl/ # syncUrl/' $(5G_CORE_VALUES) |
Amit Wankhede | fdf10ff | 2022-02-16 08:37:20 -0600 | [diff] [blame] | 503 | sed -i 's/ sub-proxy-endpt:/ # sub-proxy-endpt:/' $(5G_CORE_VALUES) |
| 504 | sed -i 's/ addr: sub/ # addr: sub/' $(5G_CORE_VALUES) |
| 505 | sed -i 's/ port: 5000/ # port: 5000/' $(5G_CORE_VALUES) |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame] | 506 | kubectl delete namespace aether-roc || true |
| 507 | rm -rf $(M)/roc |
| 508 | |
Andy Bavier | 7d5f055 | 2022-05-23 16:01:45 -0700 | [diff] [blame] | 509 | monitoring: $(M)/monitoring |
| 510 | $(M)/monitoring: $(M)/helm-ready |
| 511 | helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \ |
| 512 | --namespace=cattle-monitoring-system \ |
| 513 | --create-namespace \ |
| 514 | --values=$(MONITORING_VALUES) \ |
| 515 | rancher-monitoring-crd \ |
| 516 | $(RANCHER_MONITORING_CRD_CHART) |
| 517 | helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \ |
| 518 | --namespace=cattle-monitoring-system \ |
| 519 | --create-namespace \ |
| 520 | --values=$(MONITORING_VALUES) \ |
| 521 | rancher-monitoring \ |
| 522 | $(RANCHER_MONITORING_CHART) |
| 523 | touch $(M)/monitoring |
| 524 | |
| 525 | monitoring-4g: $(M)/monitoring |
| 526 | kubectl create namespace omec || true |
| 527 | kubectl create namespace cattle-dashboards || true |
| 528 | kubectl apply -k resources/4g-monitoring |
| 529 | |
| 530 | |
| 531 | monitoring-clean: |
| 532 | helm -n cattle-monitoring-system delete rancher-monitoring || true |
| 533 | helm -n cattle-monitoring-system delete rancher-monitoring-crd || true |
| 534 | kubectl delete namespace cattle-dashboards cattle-monitoring-system || true |
| 535 | rm $(M)/monitoring |
| 536 | |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 537 | omec-clean: |
| 538 | helm delete -n omec $$(helm -n omec ls -qa) || true |
| 539 | @echo "" |
| 540 | @echo "Wait for all pods to terminate..." |
| 541 | kubectl wait -n omec --for=delete --all=true -l app!=ue pod --timeout=180s || true |
| 542 | |
| 543 | router-clean: |
| 544 | @kubectl delete net-attach-def router-net 2>/dev/null || true |
| 545 | @kubectl delete po router 2>/dev/null || true |
| 546 | kubectl wait --for=delete -l app=router pod --timeout=180s 2>/dev/null || true |
| 547 | sudo ip link del access || true |
| 548 | sudo ip link del core || true |
| 549 | $(eval oiface := $(shell ip route list default | awk -F 'dev' '{ print $$2; exit }' | awk '{ print $$1 }')) |
| 550 | sudo iptables -t nat -D POSTROUTING -s 172.250.0.0/16 -o $(oiface) -j MASQUERADE || true |
| 551 | @sudo ip link del data 2>/dev/null || true |
| 552 | @cd $(M); rm -f router-pod router-host |
| 553 | |
| 554 | oaisim-clean: reset-ue |
| 555 | @sudo ip addr del 127.0.0.2/8 dev lo 2>/dev/null || true |
| 556 | @sudo ip link del enb 2>/dev/null || true |
| 557 | @sudo ip route del 192.168.252.0/24 || true |
| 558 | @cd $(M); rm -f oaisim-lo |
| 559 | |
Andy Bavier | 7d5f055 | 2022-05-23 16:01:45 -0700 | [diff] [blame] | 560 | 4g-test: test |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 561 | test: | 4g-core $(M)/oaisim |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 562 | @sleep 5 |
| 563 | @echo "Test1: ping from UE to SGI network gateway" |
Hyunsun Moon | 0bd8cec | 2020-09-28 00:38:26 -0500 | [diff] [blame] | 564 | ping -I oip1 192.168.250.1 -c 15 |
Fatemeh Rouzbeh | 85654e7 | 2022-05-23 09:26:12 -0700 | [diff] [blame] | 565 | @if [ "${PROXY_ENABLED}" == "false" ] ; then \ |
| 566 | @echo "Test2: ping from UE to 8.8.8.8" ; \ |
| 567 | ping -I oip1 8.8.8.8 -c 3 ; \ |
| 568 | @echo "Test3: ping from UE to google.com" ; \ |
| 569 | ping -I oip1 google.com -c 3 ; \ |
| 570 | fi |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 571 | @echo "Finished to test" |
| 572 | |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 573 | 5g-test: | 5g-core |
Andy Bavier | 31dfb9e | 2022-02-15 15:24:57 -0700 | [diff] [blame] | 574 | @if [[ "${CHARTS}" == "release-1.6" ]]; then echo "[NOTE] 5G Test not supported for Aether 1.6, exiting..."; exit 1; fi |
Andy Bavier | 0a055a5 | 2022-01-07 10:46:17 -0700 | [diff] [blame] | 575 | @echo "Test: Registration + UE initiated PDU Session Establishment + User Data packets" |
Andy Bavier | 0e4906f | 2022-03-03 15:31:48 -0700 | [diff] [blame] | 576 | @sleep 60 |
Andy Bavier | 0a055a5 | 2022-01-07 10:46:17 -0700 | [diff] [blame] | 577 | @rm -f /tmp/gnbsim.out |
Andy Bavier | cd93a20 | 2022-01-10 18:03:26 -0800 | [diff] [blame] | 578 | @if [[ ${GNBSIM_COLORS} == "true" ]]; then \ |
| 579 | kubectl -n omec exec gnbsim-0 -- ./gnbsim 2>&1 | tee /tmp/gnbsim.out; \ |
| 580 | else \ |
| 581 | kubectl -n omec exec gnbsim-0 -- ./gnbsim 2>&1 | sed -u "s,\x1B\[[0-9;]*[a-zA-Z],,g" | tee /tmp/gnbsim.out; \ |
| 582 | fi |
Andy Bavier | 094d6ef | 2022-03-08 13:21:52 -0700 | [diff] [blame] | 583 | @grep -q "Simulation Result: PASS" /tmp/gnbsim.out |
Andy Bavier | 0a055a5 | 2022-01-07 10:46:17 -0700 | [diff] [blame] | 584 | |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 585 | reset-test: | oaisim-clean omec-clean router-clean |
| 586 | @cd $(M); rm -f omec oaisim 5g-core |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 587 | |
Andy Bavier | 8819b9f | 2022-01-28 16:54:06 -0700 | [diff] [blame] | 588 | reset-ue: |
| 589 | helm delete -n omec oaisim || true |
| 590 | kubectl wait -n omec --for=delete pod enb-0 || true |
| 591 | kubectl wait -n omec --for=delete pod ue-0 || true |
| 592 | cd $(M); rm -f oaisim |
| 593 | |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 594 | reset-5g-test: omec-clean |
Badhrinath | 3e081e2 | 2020-12-02 15:02:08 -0600 | [diff] [blame] | 595 | cd $(M); rm -f 5g-core |
| 596 | |
Osman Amjad | 488a022 | 2022-01-12 11:58:43 -0600 | [diff] [blame] | 597 | reset-dbtestapp: |
| 598 | helm uninstall --namespace omec 5g-test-app |
| 599 | |
Andy Bavier | 99f31c8 | 2022-04-14 16:16:26 -0700 | [diff] [blame] | 600 | refresh-4g: reset-ue |
| 601 | kubectl -n omec delete pod mme-0 |
| 602 | kubectl wait -n omec --for='condition=ready' pod mme-0 --timeout=300s |
| 603 | |
Osman Amjad | 488a022 | 2022-01-12 11:58:43 -0600 | [diff] [blame] | 604 | dbtestapp: |
| 605 | helm repo update |
| 606 | if [ "$(CHARTS)" == "local" ]; then helm dep up $(5G_TEST_APPS_CHART); fi |
| 607 | helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \ |
| 608 | --namespace omec \ |
| 609 | 5g-test-app \ |
| 610 | --values $(TEST_APP_VALUES) \ |
| 611 | $(5G_TEST_APPS_CHART) |
| 612 | @echo "Finished to dbtestapp" |
| 613 | |
Andy Bavier | 99f31c8 | 2022-04-14 16:16:26 -0700 | [diff] [blame] | 614 | clean-systemd: |
| 615 | cd /etc/systemd/network && sudo rm -f 10-aiab* 20-aiab* */macvlan.conf |
| 616 | cd /etc/systemd/system && sudo rm -f aiab*.service && sudo systemctl daemon-reload |
| 617 | |
Fatemeh Rouzbeh | a0b26e2 | 2022-04-07 12:45:12 -0700 | [diff] [blame] | 618 | ifeq ($(K8S_INSTALL),rke2) |
Andy Bavier | 5b5ad56 | 2022-04-19 13:02:31 -0700 | [diff] [blame] | 619 | clean: | roc-clean oaisim-clean router-clean clean-systemd |
Andy Bavier | 99f31c8 | 2022-04-14 16:16:26 -0700 | [diff] [blame] | 620 | sudo /usr/local/bin/rke2-uninstall.sh || true |
Fatemeh Rouzbeh | a0b26e2 | 2022-04-07 12:45:12 -0700 | [diff] [blame] | 621 | sudo rm -rf /usr/local/bin/kubectl |
| 622 | rm -rf $(M) |
| 623 | endif |
| 624 | |
| 625 | ifeq ($(K8S_INSTALL),kubespray) |
Andy Bavier | 5b5ad56 | 2022-04-19 13:02:31 -0700 | [diff] [blame] | 626 | clean: | roc-clean oaisim-clean router-clean clean-systemd |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 627 | source "$(VENV)/bin/activate" && cd $(BUILD)/kubespray; \ |
Andy Bavier | 125baa0 | 2021-10-26 16:26:44 -0700 | [diff] [blame] | 628 | ansible-playbook -b -i inventory/local/hosts.ini reset.yml --extra-vars "reset_confirmation=yes" |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 629 | @if [ -d /usr/local/etc/emulab ]; then \ |
| 630 | mount | grep /mnt/extra/kubelet/pods | cut -d" " -f3 | sudo xargs umount; \ |
| 631 | sudo rm -rf /mnt/extra/kubelet; \ |
| 632 | fi |
| 633 | rm -rf $(M) |
Fatemeh Rouzbeh | a0b26e2 | 2022-04-07 12:45:12 -0700 | [diff] [blame] | 634 | endif |