Skip to content

Update blueprint to properly work in simulation mode #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 0 additions & 48 deletions roles/router/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,54 +36,6 @@
when: inventory_hostname in groups['oai_nodes'][0]
become: true

- name: create {{ oai.docker.network.name }} network
community.docker.docker_network:
name: "{{ oai.docker.network.name }}"
driver: bridge
ipam_config:
- subnet: "{{ oai.docker.network.subnet }}"
state: present
driver_options:
com.docker.network.bridge.name: "{{ oai.docker.network.bridge.name }}"
when: inventory_hostname in groups['oai_nodes'][0] and oai.simulation == true
become: true

- name: "add iptable rule: forward from {{ oai.docker.network.data_iface }} to {{ oai.docker.network.bridge.name }}"
iptables:
chain: FORWARD
in_interface: "{{ oai.docker.network.data_iface }}"
out_interface: "{{ oai.docker.network.bridge.name }}"
jump: ACCEPT
when: inventory_hostname in groups['oai_nodes'][0] and oai.simulation == true
become: true

- name: "add iptable rule: forward from {{ oai.docker.network.bridge.name }} to {{ oai.docker.network.data_iface }}"
iptables:
chain: FORWARD
in_interface: "{{ oai.docker.network.bridge.name }}"
out_interface: "{{ oai.docker.network.data_iface }}"
jump: ACCEPT
when: inventory_hostname in groups['oai_nodes'][0] and oai.simulation == true
become: true

- name: "add iptable rule: forward from {{ oai.docker.network.bridge.name }} to access"
iptables:
chain: FORWARD
in_interface: "{{ oai.docker.network.bridge.name }}"
out_interface: "access"
jump: ACCEPT
when: (inventory_hostname in groups['oai_nodes'][0]) and (inventory_hostname in groups['master_nodes']) and oai.simulation == true
become: true

- name: "add iptable rule: forward from access to {{ oai.docker.network.bridge.name }}"
iptables:
chain: FORWARD
in_interface: "access"
out_interface: "{{ oai.docker.network.bridge.name }}"
jump: ACCEPT
when: (inventory_hostname in groups['oai_nodes'][0]) and (inventory_hostname in groups['master_nodes']) and oai.simulation == true
become: true

# TODO: use ansible's net_static_route module
- name: configure static route for upf traffic on oai node
shell: |
Expand Down
58 changes: 0 additions & 58 deletions roles/router/tasks/uninstall.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,64 +7,6 @@
become: true
ignore_errors: yes

- name: "remove a static route on core host for {{ oai.docker.network.subnet }} via {{ hostvars[item]['ansible_default_ipv4']['address'] }}"
shell: |
ip route del {{ oai.docker.network.subnet }} via {{ hostvars[item]['ansible_default_ipv4']['address'] }}
with_items: "{{ play_hosts | intersect(groups['oai_nodes'][0]) | difference(groups['master_nodes']) }}"
when: (inventory_hostname in groups['master_nodes']) and oai.simulation == true
become: true
ignore_errors: yes

- name: "remove iptable rule: forward from access to {{ oai.docker.network.bridge.name }}"
iptables:
chain: FORWARD
in_interface: "access"
out_interface: "{{ oai.docker.network.bridge.name }}"
jump: ACCEPT
state: absent
when: (inventory_hostname in groups['oai_nodes'][0]) and (inventory_hostname in groups['master_nodes']) and oai.simulation == true
become: true
ignore_errors: yes

- name: "remove iptable rule: forward from {{ oai.docker.network.bridge.name }} to access"
iptables:
chain: FORWARD
in_interface: "{{ oai.docker.network.bridge.name }}"
out_interface: "access"
jump: ACCEPT
state: absent
when: (inventory_hostname in groups['oai_nodes'][0]) and (inventory_hostname in groups['master_nodes']) and oai.simulation == true
become: true
ignore_errors: yes

- name: "remove iptable rule: forward from {{ oai.docker.network.data_iface }} to {{ oai.docker.network.bridge.name }} "
iptables:
chain: FORWARD
in_interface: "{{ oai.docker.network.data_iface }}"
out_interface: "{{ oai.docker.network.bridge.name }}"
jump: ACCEPT
state: absent
when: inventory_hostname in groups['oai_nodes'][0] and oai.simulation == true
become: true

- name: "delete iptable rule: forward from {{ oai.docker.network.bridge.name }} to {{ oai.docker.network.data_iface }}"
iptables:
chain: FORWARD
in_interface: "{{ oai.docker.network.bridge.name }}"
out_interface: "{{ oai.docker.network.data_iface }}"
jump: ACCEPT
state: absent
when: inventory_hostname in groups['oai_nodes'][0] and oai.simulation == true
become: true

- name: delete {{ oai.docker.network.name }} network
community.docker.docker_network:
name: "{{ oai.docker.network.name }}"
state: absent
force: yes
when: inventory_hostname in groups['oai_nodes'][0] and oai.simulation == true
become: true

- name: set net.ipv4.conf.all.arp_filter to 0
ansible.posix.sysctl:
name: net.ipv4.conf.all.arp_filter
Expand Down