Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,17 @@ def prepare(self):
elif found_switch.get('management').get('management_ipv6_address'):
switch['mgmt_ip_address'] = found_switch['management']['management_ipv6_address']

# Remove network_attach_group from net if the group_name is not defined
# Remove network_attach_group or attach_groups from net if the group_name is not defined
for net in data_model['vxlan']['overlay']['networks']:
if 'network_attach_group' in net:
if net.get('network_attach_group') not in net_grp_name_list:
del net['network_attach_group']
elif 'attach_groups' in net:
for grp in net.get('attach_groups'):
if grp not in net_grp_name_list:
net['attach_groups'].remove(grp)
if net.get('attach_groups') == []:
del net['attach_groups']

if data_model['vxlan']['fabric']['type'] in ('MSD', 'MCFG'):
# Rebuild sm_data['vxlan']['multisite']['overlay']['vrf_attach_groups'] into
Expand Down Expand Up @@ -136,11 +142,17 @@ def prepare(self):
# does not include one of these switches.
data_model['vxlan']['multisite']['overlay']['network_attach_switches_list'].append(switch['hostname'])

# Remove network_attach_group from net if the group_name is not defined
# Remove network_attach_group or attach_groups from net if the group_name is not defined
for net in data_model['vxlan']['multisite']['overlay']['networks']:
if 'network_attach_group' in net:
if net.get('network_attach_group') not in net_grp_name_list:
del net['network_attach_group']
elif 'attach_groups' in net:
for grp in net.get('attach_groups'):
if grp not in net_grp_name_list:
net['attach_groups'].remove(grp)
if net.get('attach_groups') == []:
del net['attach_groups']

self.kwargs['results']['model_extended'] = data_model
return self.kwargs['results']
8 changes: 7 additions & 1 deletion plugins/action/dtc/prepare_msite_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,17 @@ def run(self, tmp=None, task_vars=None):
# does not include one of these switches.
data_model['vxlan']['multisite']['overlay']['network_attach_switches_list'].append(switch['hostname'])

# Remove network_attach_group from net if the group_name is not defined
# Remove network_attach_group or attach_groups from net if the group_name is not defined
for net in data_model['vxlan']['multisite']['overlay']['networks']:
if 'network_attach_group' in net:
if net.get('network_attach_group') not in net_grp_name_list:
del net['network_attach_group']
elif 'attach_groups' in net:
for grp in net.get('attach_groups'):
if grp not in net_grp_name_list:
net['attach_groups'].remove(grp)
if net.get('attach_groups') == []:
del net['attach_groups']

results['overlay_attach_groups'] = data_model['vxlan']['multisite']['overlay']

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,27 @@
{# ------------------------------------------------------ #}
{# Attach Group Section #}
{# ------------------------------------------------------ #}
{% if net['network_attach_group'] is defined %}
attach:
{% if data_model_extended.vxlan.overlay.network_attach_groups_dict is defined and data_model_extended.vxlan.overlay.network_attach_groups_dict %}
{% set network_attach_groups_dict = data_model_extended.vxlan.overlay.network_attach_groups_dict %}
{% endif %}
{% if net['network_attach_group'] is defined %}
attach:
{% for attach in network_attach_groups_dict[net['network_attach_group']] %}
- ip_address: {{ attach['mgmt_ip_address'] }}
{% if attach['ports'] is defined %}
ports: {{ attach['ports'] }}
{% endif %}
{% endfor %}
{% elif net['attach_groups'] is defined and net['attach_groups'] | length >= 1 %}
attach:
{% for group in net['attach_groups'] %}
{% for attach in network_attach_groups_dict[group] %}
- ip_address: {{ attach['mgmt_ip_address'] }}
{% if attach['ports'] is defined %}
ports: {{ attach['ports'] }}
{% endif %}
{% endfor %}
{% endfor %}
{% endif %}
deploy: false
{% endif %}

{% endfor %}
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,27 @@
{# Attach Group Section #}
{# ------------------------------------------------------ #}
{# Don't need to attach vrfs if there are no msd_switches #}
{% if net['network_attach_group'] is defined %}
attach:
{% if data_model_multisite.overlay_attach_groups.network_attach_groups_dict is defined and data_model_multisite.overlay_attach_groups.network_attach_groups_dict %}
{% set network_attach_groups_dict = data_model_multisite.overlay_attach_groups.network_attach_groups_dict %}
{% endif %}
{% if net['network_attach_group'] is defined %}
attach:
{% for attach in network_attach_groups_dict[net['network_attach_group']] %}
- ip_address: {{ attach['mgmt_ip_address'] }}
{% if attach['ports'] is defined %}
ports: {{ attach['ports'] }}
{% endif %}
{% endfor %}
{% elif net['attach_groups'] is defined and net['attach_groups'] | length >= 1 %}
attach:
{% for group in net['attach_groups'] %}
{% for attach in network_attach_groups_dict[group] %}
- ip_address: {{ attach['mgmt_ip_address'] }}
{% if attach['ports'] is defined %}
ports: {{ attach['ports'] }}
{% endif %}
{% endfor %}
{% endfor %}
{% endif %}
deploy: false
{% endif %}
{% endfor %}