[CORD-1650]
Refactor interface/bridge handling
Change-Id: I83fd9eb3e8440ba277b7b4d1ed41cb18347b6916
diff --git a/roles/compute-node-config/defaults/main.yml b/roles/compute-node-config/defaults/main.yml
index b722208..fcef5a4 100644
--- a/roles/compute-node-config/defaults/main.yml
+++ b/roles/compute-node-config/defaults/main.yml
@@ -1,4 +1,4 @@
-
+---
# Copyright 2017-present Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,8 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-
----
# compute-node-config/defaults/main.yml
# default site/deployment placeholder names
@@ -24,17 +22,28 @@
# location of cord_profile on head node
head_cord_profile_dir: /opt/cord_profile
-# name of the external interface on compute nodes
-# `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
-use_management_hosts: False
-vtn_management_host_net_interface: veth3
# used in openstack-compute-vtn.yaml.j2, referencing service in fabric.yaml.j2
use_fabric: False
+# name of the fabric interface on compute nodes,
+# VTN adds it to `br-int`, when provided as the `dataPlaneIntf`
+# default values:
+# - `fabric` is default when using MaaS
+# - `vethfabric1` is default for OpenCloud (setup with interface-config role)
+
+vtn_integration_bridge_interface: fabric
+
+computenode_fabric_interfaces:
+ - "{{ vtn_integration_bridge_interface }}"
+ - br-int
+
+# used in openstack-compute-vtn.yaml.j2, referencing network in management-net.yaml.j2
+# default values:
+# - 'veth3' default with MaaS
+# - 'vethmgmt1' with OpenCloud
+
+use_vtn_net_management_host: False
+vtn_net_management_host_interface: veth3
+
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 e8eafb0..fd53c82 100644
--- a/roles/compute-node-config/templates/openstack-compute-vtn.yaml.j2
+++ b/roles/compute-node-config/templates/openstack-compute-vtn.yaml.j2
@@ -1,4 +1,3 @@
-
{#
Copyright 2017-present Open Networking Foundation
@@ -15,7 +14,6 @@
limitations under the License.
#}
-
tosca_definitions_version: tosca_simple_yaml_1_0
imports:
@@ -46,7 +44,7 @@
# VTN networking for OpenStack Compute Nodes
{% for node in groups['compute'] %}
-{% for ext_if in compute_external_interfaces %}
+{% for ext_if in computenode_fabric_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] %}
@@ -58,12 +56,12 @@
must-exist: true
name: {{ hostvars[node]['ansible_hostname'] }}
bridgeId: of:0000{{ node_interface['macaddress'] | hwaddr('bare') }}
- dataPlaneIntf: fabric
+ dataPlaneIntf: {{ vtn_integration_bridge_interface }}
dataPlaneIp: {{ ( node_interface['ipv4']['address'] ~ '/' ~ node_interface['ipv4']['netmask'] ) | ipaddr('cidr') }}
-{% if use_management_hosts %}
- hostManagementIface: {{ vtn_management_host_net_interface }}
+{% if use_vtn_net_management_host %}
+ hostManagementIface: {{ vtn_net_management_host_interface }}
{% 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 d5340f7..5e0b69a 100644
--- a/roles/compute-node-config/templates/openstack-compute.yaml.j2
+++ b/roles/compute-node-config/templates/openstack-compute.yaml.j2
@@ -1,4 +1,3 @@
-
{#
Copyright 2017-present Open Networking Foundation
@@ -15,7 +14,6 @@
limitations under the License.
#}
-
tosca_definitions_version: tosca_simple_yaml_1_0
imports:
@@ -44,7 +42,7 @@
# OpenStack compute nodes
{% for node in groups['compute'] %}
-{% for ext_if in compute_external_interfaces %}
+{% for ext_if in computenode_fabric_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] %}