From e217a4ecc1f93aff7403fb0bb48ddeab6ec95b09 Mon Sep 17 00:00:00 2001 From: Larry Peterson Date: Thu, 12 Dec 2024 13:15:30 -0700 Subject: [PATCH 1/4] subnet variables Signed-off-by: Larry Peterson --- roles/simulator/tasks/install.yml | 6 +++--- roles/simulator/tasks/start.yml | 2 +- roles/simulator/tasks/uninstall.yml | 2 +- roles/simulator/{template => templates}/iperf-server.yaml | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) rename roles/simulator/{template => templates}/iperf-server.yaml (86%) diff --git a/roles/simulator/tasks/install.yml b/roles/simulator/tasks/install.yml index b8d5a24..2df34c7 100644 --- a/roles/simulator/tasks/install.yml +++ b/roles/simulator/tasks/install.yml @@ -54,7 +54,7 @@ - name: configure static route for upf traffic on ueransim node shell: | - ip route add {{ core.upf.ip_prefix }} via {{ core.amf.ip }} + ip route add {{ core.upf.access_subnet }} via {{ core.amf.ip }} become: true when: (inventory_hostname in groups['ueransim_nodes']) and (inventory_hostname not in groups['master_nodes']) @@ -62,12 +62,12 @@ # - name: copy iperf server deployment files to aether host # template: -# src: "{{ ROOT_DIR }}/deps/ueransim/roles/simulator/template/iperf-server.yaml" +# src: "{{ ROOT_DIR }}/deps/ueransim/roles/simulator/templates/iperf-server.yaml" # dest: /tmp/iperf-server.yaml # become: true # when: inventory_hostname in groups['master_nodes'] -# - name: Create iperf-server pod in omec namespace +# - name: Create iperf-server pod in aether-5gc namespace # kubernetes.core.k8s: # kubeconfig: "{{ ansible_user_dir }}/.kube/config" # state: present diff --git a/roles/simulator/tasks/start.yml b/roles/simulator/tasks/start.yml index c9cd5f4..e6d7d60 100644 --- a/roles/simulator/tasks/start.yml +++ b/roles/simulator/tasks/start.yml @@ -71,7 +71,7 @@ # - name: Get information about the pod # kubernetes.core.k8s_info: # kind: Pod -# namespace: omec +# namespace: aether-5gc # name: iperf-server # when: inventory_hostname in groups['master_nodes'][0] # register: iperf_server_pod_info diff --git a/roles/simulator/tasks/uninstall.yml b/roles/simulator/tasks/uninstall.yml index 6ca6a63..3e9c755 100644 --- a/roles/simulator/tasks/uninstall.yml +++ b/roles/simulator/tasks/uninstall.yml @@ -21,7 +21,7 @@ - name: configure static route for upf traffic on ueransim node shell: | - ip route del {{ core.upf.ip_prefix }} via {{ core.amf.ip }} + ip route del {{ core.upf.access_subnet }} via {{ core.amf.ip }} when: (inventory_hostname in groups['ueransim_nodes']) and (inventory_hostname not in groups['master_nodes']) become: true ignore_errors: yes diff --git a/roles/simulator/template/iperf-server.yaml b/roles/simulator/templates/iperf-server.yaml similarity index 86% rename from roles/simulator/template/iperf-server.yaml rename to roles/simulator/templates/iperf-server.yaml index fb29663..a961bea 100644 --- a/roles/simulator/template/iperf-server.yaml +++ b/roles/simulator/templates/iperf-server.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Pod metadata: name: iperf-server - namespace: omec + namespace: aether-5gc labels: app: iperf-server spec: @@ -19,7 +19,7 @@ apiVersion: v1 kind: Service metadata: name: iperf-service - namespace: omec # Change this if your pod is in a different namespace + namespace: aether-5gc # Change if iperf is to run in a different namespace spec: selector: app: iperf-server # Ensure this matches the labels of the Pod From 5ea653916f844a0a5ef204f3bc19c36fe896c07d Mon Sep 17 00:00:00 2001 From: Larry Peterson Date: Fri, 13 Dec 2024 12:49:22 -0700 Subject: [PATCH 2/4] fix subnet addr Signed-off-by: Larry Peterson --- roles/simulator/tasks/install.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/roles/simulator/tasks/install.yml b/roles/simulator/tasks/install.yml index 2df34c7..cdc4bab 100644 --- a/roles/simulator/tasks/install.yml +++ b/roles/simulator/tasks/install.yml @@ -52,9 +52,13 @@ mode: u+x when: inventory_hostname in groups['ueransim_nodes'] +- set_fact: + subnet: "{{ core.upf.access_subnet | regex_replace('[0-9]/24', '0/24') }}" + when: inventory_hostname in groups['master_nodes'] + - name: configure static route for upf traffic on ueransim node shell: | - ip route add {{ core.upf.access_subnet }} via {{ core.amf.ip }} + ip route add {{ subnet }} via {{ core.amf.ip }} become: true when: (inventory_hostname in groups['ueransim_nodes']) and (inventory_hostname not in groups['master_nodes']) From 5a7d5c87b22693c7f3c369963c83a1f02c2efb92 Mon Sep 17 00:00:00 2001 From: Larry Peterson Date: Fri, 13 Dec 2024 13:32:40 -0700 Subject: [PATCH 3/4] fixed typo Signed-off-by: Larry Peterson --- roles/simulator/tasks/install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/simulator/tasks/install.yml b/roles/simulator/tasks/install.yml index cdc4bab..010790c 100644 --- a/roles/simulator/tasks/install.yml +++ b/roles/simulator/tasks/install.yml @@ -54,7 +54,7 @@ - set_fact: subnet: "{{ core.upf.access_subnet | regex_replace('[0-9]/24', '0/24') }}" - when: inventory_hostname in groups['master_nodes'] + when: inventory_hostname in groups['ueransim_nodes'] - name: configure static route for upf traffic on ueransim node shell: | From a4d870caf20615265be47f24a8d7a7de33e7c6ae Mon Sep 17 00:00:00 2001 From: Larry Peterson Date: Sun, 15 Dec 2024 12:27:27 -0700 Subject: [PATCH 4/4] fix static route Signed-off-by: Larry Peterson --- roles/simulator/tasks/install.yml | 2 +- roles/simulator/tasks/uninstall.yml | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/roles/simulator/tasks/install.yml b/roles/simulator/tasks/install.yml index 010790c..6e70883 100644 --- a/roles/simulator/tasks/install.yml +++ b/roles/simulator/tasks/install.yml @@ -53,7 +53,7 @@ when: inventory_hostname in groups['ueransim_nodes'] - set_fact: - subnet: "{{ core.upf.access_subnet | regex_replace('[0-9]/24', '0/24') }}" + subnet: "{{ core.upf.access_subnet | regex_replace('[0-9]+/24', '0/24') }}" when: inventory_hostname in groups['ueransim_nodes'] - name: configure static route for upf traffic on ueransim node diff --git a/roles/simulator/tasks/uninstall.yml b/roles/simulator/tasks/uninstall.yml index 3e9c755..1428f80 100644 --- a/roles/simulator/tasks/uninstall.yml +++ b/roles/simulator/tasks/uninstall.yml @@ -19,9 +19,13 @@ become: true when: inventory_hostname in groups['ueransim_nodes'] -- name: configure static route for upf traffic on ueransim node +- set_fact: + subnet: "{{ core.upf.access_subnet | regex_replace('[0-9]+/24', '0/24') }}" + when: inventory_hostname in groups['ueransim_nodes'] + +- name: remove static route for upf traffic on ueransim node shell: | - ip route del {{ core.upf.access_subnet }} via {{ core.amf.ip }} + ip route del {{ subnet }} via {{ core.amf.ip }} when: (inventory_hostname in groups['ueransim_nodes']) and (inventory_hostname not in groups['master_nodes']) become: true ignore_errors: yes