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

minigraph: Add the ability to set a per-port speed in the minigraph #3527

Merged
merged 2 commits into from
May 28, 2021
Merged
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
5 changes: 5 additions & 0 deletions ansible/config_sonic_basedon_testbed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@
- topo_facts: topo={{ topo }} hwsku={{ hwsku }}
delegate_to: localhost

- name: get connection graph if defined for dut (ignore any errors)
conn_graph_facts: host="{{ inventory_hostname }}" ignore_errors=true
delegate_to: localhost
ignore_errors: true

- name: find interface name mapping and individual interface speed if defined from dut
port_alias: hwsku="{{ hwsku }}"
when: deploy is defined and deploy|bool == true
Expand Down
3 changes: 2 additions & 1 deletion ansible/library/conn_graph_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ def main():
filename=dict(required=False),
filepath=dict(required=False),
anchor=dict(required=False, type='list'),
ignore_errors=dict(required=False, type='bool', default=False),
),
mutually_exclusive=[['host', 'hosts', 'anchor']],
supports_check_mode=True
Expand Down Expand Up @@ -565,7 +566,7 @@ def main():
'device_port_vlans': lab_graph.vlanport,
}
module.exit_json(ansible_facts=results)
succeed, results = build_results(lab_graph, hostnames)
succeed, results = build_results(lab_graph, hostnames, m_args['ignore_errors'])
if succeed:
module.exit_json(ansible_facts=results)
else:
Expand Down
9 changes: 5 additions & 4 deletions ansible/templates/minigraph_device.j2
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
{% set speed_option = port_speed | length %}
{% if speed_option == 0 %}
<Speed>{{ iface_speed }}</Speed>
{% else %}
{% if port_speed[port_alias[index]] is defined %}
<Speed>{{ port_speed[port_alias[index]] }}</Speed>
{% elif device_conn[inventory_hostname][port_alias[index]] is defined %}
<Speed>{{ device_conn[inventory_hostname][port_alias[index]]['speed'] }}</Speed>
{% else %}
<Speed>{{ iface_speed }}</Speed>
{% endif %}
</a:EthernetInterface>
{% endfor %}
Expand Down