Skip to content

Commit

Permalink
Add support for ipv6 underlay
Browse files Browse the repository at this point in the history
Change-Id: I71a36da158153bd737ede867ce74b7b19de0f2a6
Reviewed-on: https://review.cloud.anr.ion.nokia.net/c/OpenStack/topology-collector/+/5102
Workflow: Vlad Gridin <[email protected]>
Reviewed-by: Vlad Gridin <[email protected]>
Tested-by: Vlad Gridin <[email protected]>
(cherry picked from commit 2f7527a)
Reviewed-on: https://review.cloud.anr.ion.nokia.net/c/OpenStack/topology-collector/+/5495
  • Loading branch information
Vlad Gridin committed Nov 12, 2024
1 parent f6cf199 commit d1969f8
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
13 changes: 13 additions & 0 deletions nuage_topology_collector/filter_plugins/ipv4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/python
from netaddr import valid_ipv4

def ipv4(addr):
return valid_ipv4(addr)

class FilterModule(object):
''' Query filter '''

def filters(self):
return {
'ipv4': ipv4,
}
22 changes: 19 additions & 3 deletions nuage_topology_collector/roles/topology/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,30 @@

- name: Set interfaces fact from OVS agent
block:
- name: Set facts for ipv4
set_fact:
ipversion: 'ipv4'
iptables: 'iptables'
iphost: "{{ hostvars[inventory_hostname]['ansible_host'] }}"
when: hostvars[inventory_hostname]['ansible_host'] | ipv4

- name: set facts for ipv6
set_fact:
ipversion: 'ipv6'
iptables: 'ip6tables'
iphost: "[{{ hostvars[inventory_hostname]['ansible_host'] }}]"
when: not hostvars[inventory_hostname]['ansible_host'] | ipv4

- name: Compute iptables rule number
become: yes
shell: >
iptables -L INPUT -n --line-numbers | awk '/DROP/{print $1}'
{{ iptables }} -L INPUT -n --line-numbers | awk '/DROP/{print $1}'
register: rulenum

- name: Allow incoming ovsdb connections
become: yes
iptables:
ip_version: "{{ ipversion }}"
chain: INPUT
protocol: tcp
destination: "{{ hostvars[inventory_hostname]['ansible_host'] }}"
Expand All @@ -42,7 +57,7 @@
become: yes
command: >
ovs-vsctl --timeout=5 --id=@manager -- create Manager
"target=\"ptcp:{{ ovs_manager_port | default(6640) }}:{{ hostvars[inventory_hostname]['ansible_host'] }}\""
"target=\"ptcp:{{ ovs_manager_port | default(6640) }}:{{ iphost }}\""
-- add Open_vSwitch . manager_options @manager
register: mgr_id

Expand All @@ -58,7 +73,7 @@

- name: Execute brinfo script
become: yes
command: podman exec -it neutron_ovs_agent /tmp/brinfo.py -h {{ hostvars[inventory_hostname]['ansible_host'] }} \
command: podman exec -it neutron_ovs_agent /tmp/brinfo.py -h {{ iphost }} \
-p {{ ovs_manager_port | default(6640) }} -m '{{ agents[inventory_hostname]["configurations"]["bridge_mappings"] | to_json }}'
register: brinfo

Expand Down Expand Up @@ -87,6 +102,7 @@
- name: Remove proviously installed iptables rule
become: yes
iptables:
ip_version: "{{ ipversion }}"
chain: INPUT
protocol: tcp
destination: "{{ hostvars[inventory_hostname]['ansible_host'] }}"
Expand Down

0 comments on commit d1969f8

Please sign in to comment.