-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add templating support for nmstate defined networking configuration
* Added `edpm_network_config_nmstate_template` variable * Added sample `templates/system_role_nmstate/single_nic_vlans.j2` template file * Fixed `nmstate` molecule scenario for `edpm_network_config` role Signed-off-by: Roberto Alfieri <[email protected]>
- Loading branch information
Showing
5 changed files
with
70 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
interfaces: | ||
- name: dummy0 | ||
type: dummy | ||
state: down | ||
ipv4: | ||
enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
roles/edpm_network_config/templates/system_role_nmstate/single_nic_vlans.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--- | ||
{% set mtu_list = [ctlplane_mtu] %} | ||
{% for network in role_networks %} | ||
{{ mtu_list.append(lookup('vars', networks_lower[network] ~ '_mtu')) }} | ||
{%- endfor %} | ||
{% set min_viable_mtu = mtu_list | max %} | ||
dns-resolver: | ||
config: | ||
search: {{ dns_search_domains }} | ||
server: {{ ctlplane_dns_nameservers }} | ||
interfaces: | ||
- name: {{ neutron_public_interface_name }} | ||
type: ethernet | ||
state: up | ||
- name: {{ neutron_physical_bridge_name }} | ||
type: ovs-interface | ||
state: up | ||
mtu: {{ min_viable_mtu }} | ||
ipv4: | ||
enabled: true | ||
address: | ||
- ip: {{ ctlplane_ip }} | ||
prefix-length: {{ ctlplane_subnet_cidr }} | ||
{% for network in role_networks %} | ||
- name: {{ "vlan" ~ lookup('vars', networks_lower[network] ~ '_vlan_id') }} | ||
type: ovs-interface | ||
state: up | ||
mtu: {{ lookup('vars', networks_lower[network] ~ '_mtu') }} | ||
ipv4: | ||
enabled: true | ||
address: | ||
- ip: {{ lookup('vars', networks_lower[network] ~ '_ip') }} | ||
prefix-length: {{ lookup('vars', networks_lower[network] ~ '_cidr') }} | ||
{% endfor %} | ||
- name: {{ neutron_physical_bridge_name }} | ||
type: ovs-bridge | ||
bridge: | ||
options: | ||
fail-mode: standalone | ||
port: | ||
- name: {{ neutron_public_interface_name }} | ||
- name: {{ neutron_physical_bridge_name }} | ||
{% for network in role_networks %} | ||
- name: {{ "vlan" ~ lookup('vars', networks_lower[network] ~ '_vlan_id') }} | ||
vlan: | ||
mode: access | ||
tag: {{ lookup('vars', networks_lower[network] ~ '_vlan_id') }} | ||
{% endfor %} | ||
routes: | ||
config: | ||
- destination: {{ ctlplane_host_routes.ip_netmask }} | ||
next-hop-address: {{ ctlplane_host_routes.next_hop }} | ||
next-hop-interface: {{ neutron_physical_bridge_name }} | ||
{% for network in role_neworks %} | ||
- destination: {{ lookup('vars', networks_lower[network] ~ '_host_routes').ip_netmask }} | ||
next-hop-address: {{ lookup('vars', networks_lower[network] ~ '_host_routes').next_hop }} | ||
next-hop-interface: {{ "vlan" ~ lookup('vars', networks_lower[network] ~ '_vlan_id') }} | ||
{% endfor %} |