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 |
| 6 | BUILD ?= /tmp/build |
| 7 | M ?= $(BUILD)/milestones |
| 8 | MAKEDIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST)))) |
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 |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 23 | DOCKER_VERSION ?= '20.10' |
| 24 | K8S_VERSION ?= v1.20.11 |
| 25 | HELM_VERSION ?= v3.6.3 |
| 26 | |
| 27 | ENABLE_ROUTER ?= true |
| 28 | ENABLE_OAISIM ?= true |
| 29 | ENABLE_GNBSIM ?= true |
Amit Wankhede | 01b20c3 | 2021-12-01 12:45:58 +0530 | [diff] [blame] | 30 | ENABLE_SUBSCRIBER_PROXY ?= false |
Andy Bavier | cd93a20 | 2022-01-10 18:03:26 -0800 | [diff] [blame] | 31 | GNBSIM_COLORS ?= true |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 32 | |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 33 | DATA_IFACE ?= data |
| 34 | ifeq ($(DATA_IFACE), data) |
| 35 | RAN_SUBNET := 192.168.251.0/24 |
| 36 | else |
| 37 | RAN_SUBNET := $(shell ip route | grep $${DATA_IFACE} | awk '/kernel/ {print $$1}') |
| 38 | endif |
Hyunsun Moon | 4e5795a | 2022-04-07 09:27:12 -0700 | [diff] [blame^] | 39 | |
| 40 | NODE_IP ?= $(shell ip route get 8.8.8.8 | grep -oP 'src \K\S+') |
| 41 | ifndef NODE_IP |
| 42 | $(error NODE_IP is not set) |
| 43 | endif |
| 44 | |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 45 | MME_IP ?= |
| 46 | |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 47 | HELM_GLOBAL_ARGS ?= |
Andy Bavier | eda466b | 2021-08-27 15:00:36 -0700 | [diff] [blame] | 48 | |
| 49 | # Allow installing local charts or specific versions of published charts. |
| 50 | # E.g., to install the Aether 1.5 release: |
| 51 | # CHARTS=release-1.5 make test |
| 52 | # Default is to install from the local charts. |
| 53 | CHARTS ?= local |
| 54 | CONFIGFILE := configs/$(CHARTS) |
| 55 | include $(CONFIGFILE) |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 56 | |
| 57 | cpu_family := $(shell lscpu | grep 'CPU family:' | awk '{print $$3}') |
| 58 | cpu_model := $(shell lscpu | grep 'Model:' | awk '{print $$2}') |
| 59 | os_vendor := $(shell lsb_release -i -s) |
| 60 | os_release := $(shell lsb_release -r -s) |
Andy Bavier | 9ee69d0 | 2022-02-11 10:31:21 -0700 | [diff] [blame] | 61 | USER := $(shell whoami) |
| 62 | |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 63 | .PHONY: 4g-core 5g-core oaisim test reset-test reset-ue reset-5g-test clean |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 64 | |
| 65 | $(M): |
| 66 | mkdir -p $(M) |
| 67 | |
| 68 | $(M)/system-check: | $(M) |
| 69 | @if [[ $(cpu_family) -eq 6 ]]; then \ |
| 70 | if [[ $(cpu_model) -lt 60 ]]; then \ |
| 71 | echo "FATAL: haswell CPU or newer is required."; \ |
| 72 | exit 1; \ |
| 73 | fi \ |
| 74 | else \ |
| 75 | echo "FATAL: unsupported CPU family."; \ |
| 76 | exit 1; \ |
| 77 | fi |
| 78 | @if [[ $(os_vendor) =~ (Ubuntu) ]]; then \ |
Hyunsun | 7b64051 | 2020-10-27 19:49:51 -0500 | [diff] [blame] | 79 | if [[ ! $(os_release) =~ (18.04) ]]; then \ |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 80 | echo "WARN: $(os_vendor) $(os_release) has not been tested."; \ |
| 81 | fi; \ |
| 82 | if dpkg --compare-versions 4.15 gt $(shell uname -r); then \ |
| 83 | echo "FATAL: kernel 4.15 or later is required."; \ |
| 84 | echo "Please upgrade your kernel by running" \ |
| 85 | "apt install --install-recommends linux-generic-hwe-$(os_release)"; \ |
| 86 | exit 1; \ |
| 87 | fi \ |
| 88 | else \ |
| 89 | echo "FAIL: unsupported OS."; \ |
| 90 | exit 1; \ |
| 91 | fi |
| 92 | touch $@ |
| 93 | |
| 94 | $(M)/setup: | $(M) |
| 95 | sudo $(SCRIPTDIR)/cloudlab-disksetup.sh |
Hyunsun Moon | 82e47c2 | 2021-06-28 12:30:20 -0500 | [diff] [blame] | 96 | 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] | 97 | touch $@ |
| 98 | |
| 99 | $(BUILD)/kubespray: | $(M)/setup |
| 100 | mkdir -p $(BUILD) |
| 101 | cd $(BUILD); git clone https://github.com/kubernetes-incubator/kubespray.git -b $(KUBESPRAY_VERSION) |
| 102 | |
| 103 | $(VENV)/bin/activate: | $(M)/setup |
Hyunsun Moon | 82e47c2 | 2021-06-28 12:30:20 -0500 | [diff] [blame] | 104 | python3 -m venv $(VENV) |
Wei-Yu Chen | 7edb7e7 | 2021-07-28 11:37:55 +0800 | [diff] [blame] | 105 | source "$(VENV)/bin/activate" && \ |
| 106 | python -m pip install -U pip && \ |
| 107 | deactivate |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 108 | |
| 109 | $(M)/kubespray-requirements: $(BUILD)/kubespray | $(VENV)/bin/activate |
| 110 | source "$(VENV)/bin/activate" && \ |
| 111 | pip install -r $(BUILD)/kubespray/requirements.txt |
| 112 | touch $@ |
| 113 | |
| 114 | $(M)/k8s-ready: | $(M)/setup $(BUILD)/kubespray $(VENV)/bin/activate $(M)/kubespray-requirements |
| 115 | source "$(VENV)/bin/activate" && cd $(BUILD)/kubespray; \ |
| 116 | ansible-playbook -b -i inventory/local/hosts.ini \ |
| 117 | -e "{'override_system_hostname' : False, 'disable_swap' : True}" \ |
| 118 | -e "{'docker_version' : $(DOCKER_VERSION)}" \ |
| 119 | -e "{'docker_iptables_enabled' : True}" \ |
| 120 | -e "{'kube_version' : $(K8S_VERSION)}" \ |
Hyunsun | 84f0f17 | 2020-09-23 15:40:08 -0500 | [diff] [blame] | 121 | -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] | 122 | -e "{'kube_proxy_metrics_bind_address' : 0.0.0.0:10249}" \ |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 123 | -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] | 124 | -e "{'kube_apiserver_node_port_range' : 2000-36767}" \ |
| 125 | -e "{'kubeadm_enabled': True}" \ |
| 126 | -e "{'kube_feature_gates' : [SCTPSupport=True]}" \ |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 127 | -e "{'kubelet_custom_flags' : [--allowed-unsafe-sysctls=net.*, --node-ip=$(NODE_IP)]}" \ |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 128 | -e "{'dns_min_replicas' : 1}" \ |
| 129 | -e "{'helm_enabled' : True, 'helm_version' : $(HELM_VERSION)}" \ |
| 130 | cluster.yml |
| 131 | mkdir -p $(HOME)/.kube |
| 132 | sudo cp -f /etc/kubernetes/admin.conf $(HOME)/.kube/config |
| 133 | sudo chown $(shell id -u):$(shell id -g) $(HOME)/.kube/config |
| 134 | kubectl wait pod -n kube-system --for=condition=Ready --all |
Andy Bavier | 9ee69d0 | 2022-02-11 10:31:21 -0700 | [diff] [blame] | 135 | sudo adduser $(USER) docker |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 136 | touch $@ |
| 137 | |
| 138 | $(M)/helm-ready: | $(M)/k8s-ready |
Woojoong Kim | 8425cb3 | 2021-01-08 16:18:53 -0800 | [diff] [blame] | 139 | helm repo add incubator https://charts.helm.sh/incubator |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 140 | helm repo add cord https://charts.opencord.org |
Andy Bavier | eda466b | 2021-08-27 15:00:36 -0700 | [diff] [blame] | 141 | helm repo add atomix https://charts.atomix.io |
| 142 | helm repo add onosproject https://charts.onosproject.org |
Andy Bavier | 9ee69d0 | 2022-02-11 10:31:21 -0700 | [diff] [blame] | 143 | helm repo add aether https://charts.aetherproject.org |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 144 | touch $@ |
| 145 | |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 146 | /opt/cni/bin/static: | $(M)/k8s-ready |
| 147 | mkdir -p $(BUILD)/cni-plugins; cd $(BUILD)/cni-plugins; \ |
| 148 | wget https://github.com/containernetworking/plugins/releases/download/v0.8.2/cni-plugins-linux-amd64-v0.8.2.tgz && \ |
| 149 | tar xvfz cni-plugins-linux-amd64-v0.8.2.tgz |
| 150 | sudo cp $(BUILD)/cni-plugins/static /opt/cni/bin/ |
| 151 | |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 152 | node-prep: | $(M)/helm-ready /opt/cni/bin/static |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 153 | |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 154 | $(M)/router-pod: |
| 155 | sudo ip link add $(DATA_IFACE) type dummy || true; |
| 156 | sudo ip link set $(DATA_IFACE) up || true; |
| 157 | DATA_IFACE=$(DATA_IFACE) envsubst < $(RESOURCEDIR)/router.yaml | kubectl apply -f - |
| 158 | kubectl wait pod -n default --for=condition=Ready -l app=router --timeout=300s |
| 159 | @touch $@ |
| 160 | |
| 161 | $(M)/router-host: |
| 162 | sudo ip link add core link $(DATA_IFACE) type macvlan mode bridge |
| 163 | sudo ip link set core up |
| 164 | sudo ip addr add 192.168.250.1/24 dev core |
| 165 | sudo ip link add access link $(DATA_IFACE) type macvlan mode bridge |
| 166 | sudo ip link set access up |
| 167 | sudo ip addr add 192.168.252.1/24 dev access |
| 168 | sudo sysctl -w net.ipv4.ip_forward=1; |
| 169 | $(eval oiface := $(shell ip route list default | awk -F 'dev' '{ print $$2; exit }' | awk '{ print $$1 }')) |
| 170 | sudo ip route add 172.250.0.0/16 via 192.168.250.3 |
| 171 | sudo iptables -t nat -A POSTROUTING -s 172.250.0.0/16 -o $(oiface) -j MASQUERADE |
| 172 | @touch $@ |
| 173 | |
| 174 | 4g-core: node-prep |
| 175 | ifeq ($(ENABLE_ROUTER),true) |
| 176 | ifeq ($(ENABLE_OAISIM),true) |
| 177 | 4g-core: $(M)/router-pod |
| 178 | else |
| 179 | 4g-core: $(M)/router-host |
| 180 | endif |
| 181 | endif |
| 182 | 4g-core: $(M)/omec |
| 183 | $(M)/omec: |
| 184 | @if [[ "${CHARTS}" == "local" || "${CHARTS}" == "local-sdcore" ]]; then \ |
| 185 | helm dep up $(SD_CORE_CHART); \ |
| 186 | else \ |
| 187 | helm repo update; \ |
| 188 | fi |
| 189 | NODE_IP=${NODE_IP} DATA_IFACE=${DATA_IFACE} RAN_SUBNET=${RAN_SUBNET} envsubst < $(4G_CORE_VALUES) | \ |
| 190 | helm upgrade --create-namespace --install --wait $(HELM_GLOBAL_ARGS) \ |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 191 | --namespace omec \ |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 192 | --values - \ |
Andy Bavier | 31dfb9e | 2022-02-15 15:24:57 -0700 | [diff] [blame] | 193 | sd-core \ |
| 194 | $(SD_CORE_CHART) |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 195 | @if [[ "${ENABLE_OAISIM}" == "false" ]]; then \ |
| 196 | $(eval mme_ip := $(shell ip -4 -o addr show $${DATA_IFACE} | awk '{print $$4}' | cut -d'/' -f1)) \ |
| 197 | echo "Your MME IP is $(mme_ip)"; \ |
| 198 | fi |
| 199 | @touch $@ |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 200 | |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 201 | 5g-core: node-prep |
| 202 | ifeq ($(ENABLE_ROUTER),true) |
| 203 | ifeq ($(ENABLE_GNBSIM),true) |
| 204 | 5g-core: $(M)/router-pod |
| 205 | else |
| 206 | 5g-core: $(M)/router-host |
| 207 | endif |
| 208 | endif |
| 209 | 5g-core: $(M)/5g-core |
| 210 | $(M)/5g-core: |
| 211 | @if [[ "${CHARTS}" == "local" || "${CHARTS}" == "local-sdcore" ]]; then \ |
| 212 | helm dep up $(SD_CORE_CHART); \ |
| 213 | else \ |
| 214 | helm repo update; \ |
| 215 | fi |
| 216 | NODE_IP=${NODE_IP} DATA_IFACE=${DATA_IFACE} RAN_SUBNET=${RAN_SUBNET} envsubst < $(5G_CORE_VALUES) | \ |
| 217 | helm upgrade --create-namespace --install --wait $(HELM_GLOBAL_ARGS) \ |
Badhrinath | 3e081e2 | 2020-12-02 15:02:08 -0600 | [diff] [blame] | 218 | --namespace omec \ |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 219 | --values - \ |
Andy Bavier | 31dfb9e | 2022-02-15 15:24:57 -0700 | [diff] [blame] | 220 | sd-core \ |
| 221 | $(SD_CORE_CHART) |
Badhrinath | 3e081e2 | 2020-12-02 15:02:08 -0600 | [diff] [blame] | 222 | touch $@ |
| 223 | |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 224 | # UE images includes kernel module, ue_ip.ko |
| 225 | # which should be built in the exactly same kernel version of the host machine |
| 226 | $(BUILD)/openairinterface: | $(M)/setup |
| 227 | mkdir -p $(BUILD) |
| 228 | cd $(BUILD); git clone https://github.com/opencord/openairinterface.git |
| 229 | |
Andy Bavier | d6de561 | 2021-11-08 10:39:17 -0700 | [diff] [blame] | 230 | download-ue-image: | $(M)/k8s-ready |
Andy Bavier | 9ee69d0 | 2022-02-11 10:31:21 -0700 | [diff] [blame] | 231 | sg docker -c "docker pull ${OAISIM_UE_IMAGE} && \ |
| 232 | docker tag ${OAISIM_UE_IMAGE} omecproject/lte-uesoftmodem:1.1.0" |
Andy Bavier | d6de561 | 2021-11-08 10:39:17 -0700 | [diff] [blame] | 233 | touch $(M)/ue-image |
| 234 | |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 235 | $(M)/ue-image: | $(M)/k8s-ready $(BUILD)/openairinterface |
| 236 | cd $(BUILD)/openairinterface; \ |
Andy Bavier | 9ee69d0 | 2022-02-11 10:31:21 -0700 | [diff] [blame] | 237 | sg docker -c "docker build . --target lte-uesoftmodem \ |
Hyunsun | 7b64051 | 2020-10-27 19:49:51 -0500 | [diff] [blame] | 238 | --build-arg build_base=omecproject/oai-base:1.1.0 \ |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 239 | --file Dockerfile.ue \ |
Andy Bavier | 9ee69d0 | 2022-02-11 10:31:21 -0700 | [diff] [blame] | 240 | --tag omecproject/lte-uesoftmodem:1.1.0" |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 241 | touch $@ |
| 242 | |
Andy Bavier | 9ee69d0 | 2022-02-11 10:31:21 -0700 | [diff] [blame] | 243 | $(M)/oaisim-lo: |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 244 | @sudo ip addr add 127.0.0.2/8 dev lo || true |
| 245 | @touch $@ |
Andy Bavier | 9ee69d0 | 2022-02-11 10:31:21 -0700 | [diff] [blame] | 246 | |
Andy Bavier | 7b01b68 | 2022-03-17 13:26:55 -0700 | [diff] [blame] | 247 | oaisim-standalone: | $(M)/helm-ready $(M)/ue-image $(M)/oaisim-lo |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 248 | @ip link show $(DATA_IFACE) > /dev/null || (echo DATA_IFACE is not set or does not exist; exit 1) |
| 249 | @if [[ "${MME_IP}" == "" ]]; then \ |
| 250 | echo MME_IP is not set; \ |
| 251 | exit 1; \ |
| 252 | else \ |
| 253 | ping -c 3 $(MME_IP) > /dev/null || (echo MME $(MME_IP) is not reachable; exit 1) \ |
| 254 | fi |
| 255 | sudo ip route add 192.168.252.0/24 via $(MME_IP) |
Andy Bavier | 7b01b68 | 2022-03-17 13:26:55 -0700 | [diff] [blame] | 256 | helm repo update |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 257 | helm upgrade --create-namespace --install $(HELM_GLOBAL_ARGS) --namespace omec oaisim cord/oaisim -f $(OAISIM_VALUES) \ |
| 258 | --set config.enb.networks.s1u.interface=$(DATA_IFACE) \ |
| 259 | --set config.enb.networks.s1_mme.interface=$(DATA_IFACE) \ |
| 260 | --set config.enb.mme.address=$(MME_IP) \ |
| 261 | --set config.enb.mme.isLocal=false \ |
| 262 | --set images.pullPolicy=IfNotPresent |
Andy Bavier | 7b01b68 | 2022-03-17 13:26:55 -0700 | [diff] [blame] | 263 | kubectl rollout status -n omec statefulset ue |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 264 | @echo "Test: registration" |
Andy Bavier | 7b01b68 | 2022-03-17 13:26:55 -0700 | [diff] [blame] | 265 | @timeout 60s bash -c \ |
| 266 | "until ip addr show oip1 | grep -q inet; \ |
| 267 | do \ |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 268 | echo 'Waiting for UE 1 gets IP address'; \ |
| 269 | sleep 3; \ |
Andy Bavier | 7b01b68 | 2022-03-17 13:26:55 -0700 | [diff] [blame] | 270 | done" |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 271 | @echo "Test: ping from UE to 8.8.8.8" |
| 272 | ping -I oip1 8.8.8.8 -c 3 |
| 273 | @touch $(M)/oaisim $(M)/omec |
Andy Bavier | 7b01b68 | 2022-03-17 13:26:55 -0700 | [diff] [blame] | 274 | |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 275 | oaisim: | $(M)/oaisim |
| 276 | $(M)/oaisim: | $(M)/ue-image $(M)/router-pod $(M)/oaisim-lo |
| 277 | sudo ip link add enb link $(DATA_IFACE) type macvlan mode bridge || true |
| 278 | sudo ip link set enb up || true |
| 279 | sudo ip addr add 192.168.251.3/24 dev enb || true |
| 280 | sudo ip route add 192.168.252.0/24 via 192.168.251.1 || true |
| 281 | 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] | 282 | --set images.pullPolicy=IfNotPresent |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 283 | kubectl rollout status -n omec statefulset ue |
| 284 | @timeout 60s bash -c \ |
| 285 | "until ip addr show oip1 | grep -q inet; \ |
| 286 | do \ |
| 287 | echo 'Waiting for UE 1 gets IP address'; \ |
| 288 | sleep 3; \ |
| 289 | done" |
| 290 | touch $@ |
| 291 | |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame] | 292 | roc: $(M)/roc |
| 293 | $(M)/roc: $(M)/helm-ready |
| 294 | kubectl get namespace aether-roc 2> /dev/null || kubectl create namespace aether-roc |
| 295 | helm repo update |
| 296 | if [ "$(CHARTS)" == "local" ]; then helm dep up $(AETHER_ROC_UMBRELLA_CHART); fi |
| 297 | helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \ |
| 298 | --namespace kube-system \ |
| 299 | --values $(ROC_VALUES) \ |
| 300 | atomix-controller \ |
| 301 | $(ATOMIX_CONTROLLER_CHART) |
| 302 | helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \ |
| 303 | --namespace kube-system \ |
| 304 | --values $(ROC_VALUES) \ |
| 305 | atomix-raft-storage \ |
| 306 | $(ATOMIX_RAFT_STORAGE_CHART) |
| 307 | helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \ |
| 308 | --namespace kube-system \ |
| 309 | --values $(ROC_VALUES) \ |
| 310 | onos-operator \ |
| 311 | $(ONOS_OPERATOR_CHART) |
| 312 | helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \ |
| 313 | --namespace aether-roc \ |
| 314 | --values $(ROC_VALUES) \ |
| 315 | aether-roc-umbrella \ |
| 316 | $(AETHER_ROC_UMBRELLA_CHART) |
| 317 | touch $@ |
| 318 | |
| 319 | # Load the ROC 4G models. Disable loading network slice from SimApp. |
| 320 | roc-4g-models: $(M)/roc |
| 321 | sed -i 's/provision-network-slice: true/provision-network-slice: false/' $(4G_CORE_VALUES) |
| 322 | sed -i 's/# syncUrl/syncUrl/' $(4G_CORE_VALUES) |
Amit Wankhede | 01b20c3 | 2021-12-01 12:45:58 +0530 | [diff] [blame] | 323 | if [ "${ENABLE_SUBSCRIBER_PROXY}" == "true" ] ; then \ |
Amit Wankhede | fdf10ff | 2022-02-16 08:37:20 -0600 | [diff] [blame] | 324 | sed -i 's/# sub-proxy-endpt:/sub-proxy-endpt:/' $(4G_CORE_VALUES) ; \ |
| 325 | sed -i 's/# addr: sub/ addr: sub/' $(4G_CORE_VALUES) ; \ |
| 326 | sed -i 's/# port: 5000/ port: 5000/' $(4G_CORE_VALUES) ; \ |
Amit Wankhede | 01b20c3 | 2021-12-01 12:45:58 +0530 | [diff] [blame] | 327 | fi |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame] | 328 | $(eval ONOS_CLI_POD := $(shell kubectl -n aether-roc get pods -l name=onos-cli -o name)) |
| 329 | echo "ONOS CLI pod: ${ONOS_CLI_POD}" |
| 330 | until kubectl -n aether-roc exec ${ONOS_CLI_POD} -- \ |
| 331 | curl -s -f -L -X PATCH "http://aether-roc-api:8181/aether-roc-api" \ |
| 332 | --header 'Content-Type: application/json' \ |
| 333 | --data-raw "$$(cat ${ROC_4G_MODELS})"; do sleep 5; done |
| 334 | |
| 335 | # Load the ROC 5G models. Disable loading network slice from SimApp. |
| 336 | roc-5g-models: $(M)/roc |
| 337 | sed -i 's/provision-network-slice: true/provision-network-slice: false/' $(5G_CORE_VALUES) |
| 338 | sed -i 's/# syncUrl/syncUrl/' $(5G_CORE_VALUES) |
Amit Wankhede | 01b20c3 | 2021-12-01 12:45:58 +0530 | [diff] [blame] | 339 | if [ "${ENABLE_SUBSCRIBER_PROXY}" == "true" ] ; then \ |
Amit Wankhede | fdf10ff | 2022-02-16 08:37:20 -0600 | [diff] [blame] | 340 | sed -i 's/# sub-proxy-endpt:/sub-proxy-endpt:/' $(5G_CORE_VALUES) ; \ |
| 341 | sed -i 's/# addr: sub/ addr: sub/' $(5G_CORE_VALUES) ; \ |
| 342 | sed -i 's/# port: 5000/ port: 5000/' $(5G_CORE_VALUES) ; \ |
Amit Wankhede | 01b20c3 | 2021-12-01 12:45:58 +0530 | [diff] [blame] | 343 | fi |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame] | 344 | $(eval ONOS_CLI_POD := $(shell kubectl -n aether-roc get pods -l name=onos-cli -o name)) |
| 345 | echo "ONOS CLI pod: ${ONOS_CLI_POD}" |
| 346 | until kubectl -n aether-roc exec ${ONOS_CLI_POD} -- \ |
| 347 | curl -s -f -L -X PATCH "http://aether-roc-api:8181/aether-roc-api" \ |
| 348 | --header 'Content-Type: application/json' \ |
| 349 | --data-raw "$$(cat ${ROC_5G_MODELS})"; do sleep 5; done |
| 350 | |
| 351 | roc-clean: |
| 352 | @echo "This could take 2-3 minutes..." |
| 353 | sed -i 's/provision-network-slice: false/provision-network-slice: true/' $(4G_CORE_VALUES) |
| 354 | sed -i 's/ syncUrl/ # syncUrl/' $(4G_CORE_VALUES) |
Amit Wankhede | fdf10ff | 2022-02-16 08:37:20 -0600 | [diff] [blame] | 355 | sed -i 's/ sub-proxy-endpt:/ # sub-proxy-endpt:/' $(4G_CORE_VALUES) |
| 356 | sed -i 's/ addr: sub/ # addr: sub/' $(4G_CORE_VALUES) |
| 357 | sed -i 's/ port: 5000/ # port: 5000/' $(4G_CORE_VALUES) |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame] | 358 | sed -i 's/provision-network-slice: false/provision-network-slice: true/' $(5G_CORE_VALUES) |
| 359 | sed -i 's/ syncUrl/ # syncUrl/' $(5G_CORE_VALUES) |
Amit Wankhede | fdf10ff | 2022-02-16 08:37:20 -0600 | [diff] [blame] | 360 | sed -i 's/ sub-proxy-endpt:/ # sub-proxy-endpt:/' $(5G_CORE_VALUES) |
| 361 | sed -i 's/ addr: sub/ # addr: sub/' $(5G_CORE_VALUES) |
| 362 | sed -i 's/ port: 5000/ # port: 5000/' $(5G_CORE_VALUES) |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame] | 363 | kubectl delete namespace aether-roc || true |
| 364 | rm -rf $(M)/roc |
| 365 | |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 366 | omec-clean: |
| 367 | helm delete -n omec $$(helm -n omec ls -qa) || true |
| 368 | @echo "" |
| 369 | @echo "Wait for all pods to terminate..." |
| 370 | kubectl wait -n omec --for=delete --all=true -l app!=ue pod --timeout=180s || true |
| 371 | |
| 372 | router-clean: |
| 373 | @kubectl delete net-attach-def router-net 2>/dev/null || true |
| 374 | @kubectl delete po router 2>/dev/null || true |
| 375 | kubectl wait --for=delete -l app=router pod --timeout=180s 2>/dev/null || true |
| 376 | sudo ip link del access || true |
| 377 | sudo ip link del core || true |
| 378 | $(eval oiface := $(shell ip route list default | awk -F 'dev' '{ print $$2; exit }' | awk '{ print $$1 }')) |
| 379 | sudo iptables -t nat -D POSTROUTING -s 172.250.0.0/16 -o $(oiface) -j MASQUERADE || true |
| 380 | @sudo ip link del data 2>/dev/null || true |
| 381 | @cd $(M); rm -f router-pod router-host |
| 382 | |
| 383 | oaisim-clean: reset-ue |
| 384 | @sudo ip addr del 127.0.0.2/8 dev lo 2>/dev/null || true |
| 385 | @sudo ip link del enb 2>/dev/null || true |
| 386 | @sudo ip route del 192.168.252.0/24 || true |
| 387 | @cd $(M); rm -f oaisim-lo |
| 388 | |
| 389 | test: | 4g-core $(M)/oaisim |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 390 | @sleep 5 |
| 391 | @echo "Test1: ping from UE to SGI network gateway" |
Hyunsun Moon | 0bd8cec | 2020-09-28 00:38:26 -0500 | [diff] [blame] | 392 | ping -I oip1 192.168.250.1 -c 15 |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 393 | @echo "Test2: ping from UE to 8.8.8.8" |
| 394 | ping -I oip1 8.8.8.8 -c 3 |
Hyunsun Moon | 0bd8cec | 2020-09-28 00:38:26 -0500 | [diff] [blame] | 395 | @echo "Test3: ping from UE to google.com" |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 396 | ping -I oip1 google.com -c 3 |
| 397 | @echo "Finished to test" |
| 398 | |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 399 | 5g-test: | 5g-core |
Andy Bavier | 31dfb9e | 2022-02-15 15:24:57 -0700 | [diff] [blame] | 400 | @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] | 401 | @echo "Test: Registration + UE initiated PDU Session Establishment + User Data packets" |
Andy Bavier | 0e4906f | 2022-03-03 15:31:48 -0700 | [diff] [blame] | 402 | @sleep 60 |
Andy Bavier | 0a055a5 | 2022-01-07 10:46:17 -0700 | [diff] [blame] | 403 | @rm -f /tmp/gnbsim.out |
Andy Bavier | cd93a20 | 2022-01-10 18:03:26 -0800 | [diff] [blame] | 404 | @if [[ ${GNBSIM_COLORS} == "true" ]]; then \ |
| 405 | kubectl -n omec exec gnbsim-0 -- ./gnbsim 2>&1 | tee /tmp/gnbsim.out; \ |
| 406 | else \ |
| 407 | kubectl -n omec exec gnbsim-0 -- ./gnbsim 2>&1 | sed -u "s,\x1B\[[0-9;]*[a-zA-Z],,g" | tee /tmp/gnbsim.out; \ |
| 408 | fi |
Andy Bavier | 094d6ef | 2022-03-08 13:21:52 -0700 | [diff] [blame] | 409 | @grep -q "Simulation Result: PASS" /tmp/gnbsim.out |
Andy Bavier | 0a055a5 | 2022-01-07 10:46:17 -0700 | [diff] [blame] | 410 | |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 411 | reset-test: | oaisim-clean omec-clean router-clean |
| 412 | @cd $(M); rm -f omec oaisim 5g-core |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 413 | |
Andy Bavier | 8819b9f | 2022-01-28 16:54:06 -0700 | [diff] [blame] | 414 | reset-ue: |
| 415 | helm delete -n omec oaisim || true |
| 416 | kubectl wait -n omec --for=delete pod enb-0 || true |
| 417 | kubectl wait -n omec --for=delete pod ue-0 || true |
| 418 | cd $(M); rm -f oaisim |
| 419 | |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 420 | reset-5g-test: omec-clean |
Badhrinath | 3e081e2 | 2020-12-02 15:02:08 -0600 | [diff] [blame] | 421 | cd $(M); rm -f 5g-core |
| 422 | |
Osman Amjad | 488a022 | 2022-01-12 11:58:43 -0600 | [diff] [blame] | 423 | reset-dbtestapp: |
| 424 | helm uninstall --namespace omec 5g-test-app |
| 425 | |
| 426 | dbtestapp: |
| 427 | helm repo update |
| 428 | if [ "$(CHARTS)" == "local" ]; then helm dep up $(5G_TEST_APPS_CHART); fi |
| 429 | helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \ |
| 430 | --namespace omec \ |
| 431 | 5g-test-app \ |
| 432 | --values $(TEST_APP_VALUES) \ |
| 433 | $(5G_TEST_APPS_CHART) |
| 434 | @echo "Finished to dbtestapp" |
| 435 | |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 436 | clean: | oaisim-clean router-clean |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 437 | source "$(VENV)/bin/activate" && cd $(BUILD)/kubespray; \ |
Andy Bavier | 125baa0 | 2021-10-26 16:26:44 -0700 | [diff] [blame] | 438 | 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] | 439 | @if [ -d /usr/local/etc/emulab ]; then \ |
| 440 | mount | grep /mnt/extra/kubelet/pods | cut -d" " -f3 | sudo xargs umount; \ |
| 441 | sudo rm -rf /mnt/extra/kubelet; \ |
| 442 | fi |
| 443 | rm -rf $(M) |