[CORD-1505]
Support multiple external interface names on compute nodes managed by VTN
Change-Id: I01f21a778bba60f8f040d714e4b3ec776557af19
diff --git a/profile_manifests/opencloud.yml b/profile_manifests/opencloud.yml
index dd549ee..95ddd93 100644
--- a/profile_manifests/opencloud.yml
+++ b/profile_manifests/opencloud.yml
@@ -133,8 +133,9 @@
management_network_ip: 172.27.0.1/24
data_plane_ip: 10.168.0.253/24
-# External interface name on compute nodes
-compute_external_interface: eth0
+# External interface names on compute nodes
+compute_external_interfaces:
+ - eth0
# ONOS version
onos_docker_image: "onosproject/onos:1.8.7"
diff --git a/roles/compute-node-config/defaults/main.yml b/roles/compute-node-config/defaults/main.yml
index cfbaa76..b8fed3c 100644
--- a/roles/compute-node-config/defaults/main.yml
+++ b/roles/compute-node-config/defaults/main.yml
@@ -9,8 +9,10 @@
head_cord_profile_dir: /opt/cord_profile
# name of the external interface on compute nodes
-# `fabric` is default in R-CORD
-compute_external_interface: fabric
+# `fabric` is default in R-CORD, VTN adds it to `br-int`
+compute_external_interfaces:
+ - fabric
+ - br-int
# service configs referenced here are likely located in cord-profile/templates
# used in openstack-compute-vtn.yaml.j2, referencing network in management-net.yaml.j2
diff --git a/roles/compute-node-config/templates/openstack-compute-vtn.yaml.j2 b/roles/compute-node-config/templates/openstack-compute-vtn.yaml.j2
index 88ab8d1..a61c54f 100644
--- a/roles/compute-node-config/templates/openstack-compute-vtn.yaml.j2
+++ b/roles/compute-node-config/templates/openstack-compute-vtn.yaml.j2
@@ -28,10 +28,12 @@
# VTN networking for OpenStack Compute Nodes
{% for node in groups['compute'] %}
-{% if 'ipv4' in hostvars[node]['ansible_' ~ compute_external_interface] %}
-{% set node_interface = hostvars[node]['ansible_' ~ compute_external_interface] %}
+{% for ext_if in compute_external_interfaces %}
+{% set ansible_ext_if = 'ansible_' ~ ext_if | regex_replace('\W', '_') %}
+{% if hostvars[node][ansible_ext_if] is defined and 'ipv4' in hostvars[node][ansible_ext_if] %}
+{% set node_interface = hostvars[node][ansible_ext_if] %}
-# Compute node, fully defined in compute-nodes.yaml
+# Compute node: {{ node }}, with interface {{ ansible_ext_if }}
{{ hostvars[node]['ansible_hostname'] }}:
type: tosca.nodes.Node
properties:
@@ -112,6 +114,8 @@
node: service#ONOS_Fabric
relationship: tosca.relationships.MemberOfService
{% endif %}
+
{% endif %}
{% endfor %}
+{% endfor %}
diff --git a/roles/compute-node-config/templates/openstack-compute.yaml.j2 b/roles/compute-node-config/templates/openstack-compute.yaml.j2
index 0a4fb9c..6e76a43 100644
--- a/roles/compute-node-config/templates/openstack-compute.yaml.j2
+++ b/roles/compute-node-config/templates/openstack-compute.yaml.j2
@@ -25,7 +25,12 @@
# OpenStack compute nodes
{% for node in groups['compute'] %}
-{% if 'ipv4' in hostvars[node]['ansible_' ~ compute_external_interface] %}
+{% for ext_if in compute_external_interfaces %}
+{% set ansible_ext_if = 'ansible_' ~ ext_if | regex_replace('\W', '_') %}
+{% if hostvars[node][ansible_ext_if] is defined and 'ipv4' in hostvars[node][ansible_ext_if] %}
+{% set node_interface = hostvars[node][ansible_ext_if] %}
+
+# Compute node: {{ node }}, with interface {{ ansible_ext_if }}
{{ hostvars[node]['ansible_hostname'] }}:
type: tosca.nodes.Node
requirements:
@@ -38,4 +43,5 @@
{% endif %}
{% endfor %}
+{% endfor %}