Skip to content
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

Support VLAN links network_info.json #11

Merged
merged 1 commit into from Sep 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 13 additions & 1 deletion templates/network_info.json.j2
Expand Up @@ -4,12 +4,24 @@
{%- set device_list=configdrive_network_device_list | map(attribute='device') | list %}
"links": [
{%- for dev in configdrive_network_device_list %}
{%- if dev.type | default == "vlan" and dev.backend is defined and dev.backend[0] not in device_list %}
{
"name": "{{ dev.backend[0] }}",
"id": "{{ dev.backend[0] }}",
"type": "phy"
},
{%- endif %}
{
"name": "{{ dev.device }}",
"id": "{{ dev.device }}",
"type": "{{ dev.type | default('phy') }}",
{%- if dev.mac is defined %}
{%- if dev.type | default == "vlan" and dev.backend is defined %}
"vlan_id": {{ dev.device.split('.')[1] }},
"vlan_link": "{{ dev.backend[0] }}",
"vlan_mac_address": {% if dev.mac is defined %}"{{ dev.mac }}"{% else %}null{% endif %},
{%- elif dev.mac is defined %}
"ethernet_mac_address": "{{ dev.mac }}",
{%- endif %}
{%- endif %}
"mtu": "{{ dev.mtu | default(1500) }}"
}{% if not loop.last %},{% endif %}
Expand Down