Skip to content

Commit 948ec92

Browse files
committed
[ansible][minigraph] Fix minigraph template for devices which have autoneg enabled but the topo file does not contain autoneg interfaces (sonic-net#15134)
This pull request updates the Jinja2 template minigraph_link_meta.j2 by modifying the generation of the section. Key Changes: * The condition has been changed from simply checking if msft_an_enabled is defined to also checking if vm_topo_config.get('autoneg_interfaces') is not None. * This ensures that the section is only included if both msft_an_enabled is defined and the autoneg_interfaces attribute in vm_topo_config exists and is not None. This ensures if some testbeds/devices have msft_an_enabled they do not end up treated as autoneg devices unless the topo file contains the AN interface list Signed-off-by: Vaibhav Dahiya <[email protected]>
1 parent 053e802 commit 948ec92

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

ansible/library/conn_graph_facts.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,11 @@ def parse_graph(self):
214214
if start_dev:
215215
self.links[start_dev][link.attrib['StartPort']] = {
216216
'peerdevice': link.attrib['EndDevice'], 'peerport': link.attrib['EndPort'],
217-
'speed': link.attrib['BandWidth'], 'autoneg' : autoneg_mode}
217+
'speed': link.attrib['BandWidth'], 'autoneg': autoneg_mode}
218218
if end_dev:
219219
self.links[end_dev][link.attrib['EndPort']] = {
220220
'peerdevice': link.attrib['StartDevice'], 'peerport': link.attrib['StartPort'],
221-
'speed': link.attrib['BandWidth'], 'autoneg' : autoneg_mode}
221+
'speed': link.attrib['BandWidth'], 'autoneg': autoneg_mode}
222222
console_root = self.root.find(self.csgtag)
223223
if console_root:
224224
devicecsgroot = console_root.find('DevicesConsoleInfo')

ansible/templates/minigraph_link_meta.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
</LinkMetadataDeclaration>
2929
{% endif %}
3030

31-
{% if msft_an_enabled is defined %}
31+
{% if msft_an_enabled is defined and vm_topo_config.get('autoneg_interfaces') is not none %}
3232
<LinkMetadataDeclaration>
3333
<Link xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
3434
{% for if_index in vm_topo_config['autoneg_interfaces']['intfs'] %}

0 commit comments

Comments
 (0)