Skip to content
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
1 change: 1 addition & 0 deletions ansible/group_vars/sonic_latest/package_versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ image_id_fpm: docker-fpm:{{ dockers_tag }}
image_id_snmp_sv2: docker-snmp-sv2:{{ dockers_tag }}
image_id_lldp_sv2: docker-lldp-sv2:{{ dockers_tag }}
image_id_teamd: docker-teamd:{{ dockers_tag }}
image_id_dhcp_relay: docker-dhcp-relay:{{ dockers_tag }}
34 changes: 31 additions & 3 deletions ansible/library/minigraph_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import copy
import ipaddr as ipaddress
from collections import defaultdict
from natsort import natsort


from lxml import etree as ET
Expand Down Expand Up @@ -327,7 +328,6 @@ def reconcile_mini_graph_locations(filename, hostname):

return mini_graph_path, root


def parse_xml(filename, hostname):
mini_graph_path, root = reconcile_mini_graph_locations(filename, hostname)

Expand Down Expand Up @@ -356,7 +356,7 @@ def parse_xml(filename, hostname):
elif hwsku == "Force10-S6100":
for i in range(0, 4):
for j in range(0, 16):
port_alias_map["fortyGigE1/%d/%d" % (i+1, j+1)] = "Ethernet%d" % (i * 16 + j + 1)
port_alias_map["fortyGigE1/%d/%d" % (i+1, j+1)] = "Ethernet%d" % (i * 16 + j)
elif hwsku == "Arista-7050-QX32":
for i in range(1, 25):
port_alias_map["Ethernet%d/1" % i] = "Ethernet%d" % ((i - 1) * 4)
Expand Down Expand Up @@ -390,6 +390,34 @@ def parse_xml(filename, hostname):
for i,member in enumerate(pc['members']):
pc['members'][i] = port_alias_map[member]


# Create port index map. Since we currently output a mix of NGS names
# and SONiC mapped names, we include both in this map.
# SONiC aliases, when sorted in natural sort order, match the phyical port
# index order, so we sort by SONiC port alias, and map
# back to NGS names after sorting using this inverted map
#
# TODO: Move all alias-related code out of minigraph_facts.py and into
# its own module to be used as another layer after parsing the minigraph.
inverted_port_alias_map = {v: k for k, v in port_alias_map.iteritems()}

# Start by creating a list of all port aliases
port_alias_list = []
for k, v in port_alias_map.iteritems():
port_alias_list.append(v)

# Sort the list in natural order
port_alias_list_sorted = natsort(port_alias_list)

# Create map from SONiC alias to physical index and NGS name to physical index
port_index_map = {}
for idx, val in enumerate(port_alias_list_sorted):
port_index_map[val] = idx
port_index_map[inverted_port_alias_map[val]] = idx



# Generate results
Tree = lambda: defaultdict(Tree)

results = Tree()
Expand All @@ -414,6 +442,7 @@ def parse_xml(filename, hostname):
results['minigraph_as_xml'] = mini_graph_path
results['minigraph_console'] = get_console_info(devices, console_dev, console_port)
results['minigraph_mgmt'] = get_mgmt_info(devices, mgmt_dev, mgmt_port)
results['minigraph_port_indices'] = port_index_map

return results

Expand Down Expand Up @@ -468,5 +497,4 @@ def print_parse_xml(hostname):

if __name__ == "__main__":
main()
#debug_main()

6 changes: 6 additions & 0 deletions ansible/minigraph/OCPSCH01040AALF.xml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@
<StartPort>Ethernet4</StartPort>
</DeviceLinkBase>
</DeviceInterfaceLinks>
<Devices>
<Device i:type="LeafRouter">
<Hostname>OCPSCH01040AALF</Hostname>
<HwSku>ACS-S6000</HwSku>
</Device>
</Devices>
</PngDec>
<MetadataDeclaration>
<Devices xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
Expand Down
26 changes: 26 additions & 0 deletions ansible/minigraph/OCPSCH01040BBLF.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,32 @@
<DownstreamSummarySet xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
</DeviceDataPlaneInfo>
</DpgDec>
<PngDec>
<DeviceInterfaceLinks>
<DeviceLinkBase i:type="DeviceInterfaceLink">
<Bandwidth>40000</Bandwidth>
<ElementType>DeviceInterfaceLink</ElementType>
<EndDevice>OCPSCH0104001MS</EndDevice>
<EndPort>Ethernet0</EndPort>
<StartDevice>OCPSCH01040BBLF</StartDevice>
<StartPort>Ethernet0</StartPort>
</DeviceLinkBase>
<DeviceLinkBase i:type="DeviceInterfaceLink">
<Bandwidth>40000</Bandwidth>
<ElementType>DeviceInterfaceLink</ElementType>
<EndDevice>OCPSCH0104002MS</EndDevice>
<EndPort>Ethernet0</EndPort>
<StartDevice>OCPSCH01040BBLF</StartDevice>
<StartPort>Ethernet4</StartPort>
</DeviceLinkBase>
</DeviceInterfaceLinks>
<Devices>
<Device i:type="LeafRouter">
<Hostname>OCPSCH01040BBLF</Hostname>
<HwSku>ACS-MSN2700</HwSku>
</Device>
</Devices>
</PngDec>
<Hostname>OCPSCH01040BBLF</Hostname>
<HwSku>ACS-MSN2700</HwSku>
</DeviceMiniGraph>
26 changes: 26 additions & 0 deletions ansible/minigraph/OCPSCH01040CCLF.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,32 @@
<DownstreamSummarySet xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
</DeviceDataPlaneInfo>
</DpgDec>
<PngDec>
<DeviceInterfaceLinks>
<DeviceLinkBase i:type="DeviceInterfaceLink">
<Bandwidth>40000</Bandwidth>
<ElementType>DeviceInterfaceLink</ElementType>
<EndDevice>OCPSCH0104001MS</EndDevice>
<EndPort>Ethernet0</EndPort>
<StartDevice>OCPSCH01040CCLF</StartDevice>
<StartPort>Ethernet0</StartPort>
</DeviceLinkBase>
<DeviceLinkBase i:type="DeviceInterfaceLink">
<Bandwidth>40000</Bandwidth>
<ElementType>DeviceInterfaceLink</ElementType>
<EndDevice>OCPSCH0104002MS</EndDevice>
<EndPort>Ethernet0</EndPort>
<StartDevice>OCPSCH01040CCLF</StartDevice>
<StartPort>Ethernet4</StartPort>
</DeviceLinkBase>
</DeviceInterfaceLinks>
<Devices>
<Device i:type="LeafRouter">
<Hostname>OCPSCH01040CCLF</Hostname>
<HwSku>ACS-CAVM</HwSku>
</Device>
</Devices>
</PngDec>
<Hostname>OCPSCH01040CCLF</Hostname>
<HwSku>ACS-CAVM</HwSku>
</DeviceMiniGraph>
26 changes: 26 additions & 0 deletions ansible/minigraph/OCPSCH01040EELF.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,32 @@
<DownstreamSummarySet xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
</DeviceDataPlaneInfo>
</DpgDec>
<PngDec>
<DeviceInterfaceLinks>
<DeviceLinkBase i:type="DeviceInterfaceLink">
<Bandwidth>40000</Bandwidth>
<ElementType>DeviceInterfaceLink</ElementType>
<EndDevice>OCPSCH0104001MS</EndDevice>
<EndPort>Ethernet0</EndPort>
<StartDevice>OCPSCH01040EELF</StartDevice>
<StartPort>Ethernet0</StartPort>
</DeviceLinkBase>
<DeviceLinkBase i:type="DeviceInterfaceLink">
<Bandwidth>40000</Bandwidth>
<ElementType>DeviceInterfaceLink</ElementType>
<EndDevice>OCPSCH0104002MS</EndDevice>
<EndPort>Ethernet0</EndPort>
<StartDevice>OCPSCH01040EELF</StartDevice>
<StartPort>Ethernet4</StartPort>
</DeviceLinkBase>
</DeviceInterfaceLinks>
<Devices>
<Device i:type="LeafRouter">
<Hostname>OCPSCH01040EELF</Hostname>
<HwSku>ACS-BF</HwSku>
</Device>
</Devices>
</PngDec>
<Hostname>OCPSCH01040EELF</Hostname>
<HwSku>ACS-BF</HwSku>
</DeviceMiniGraph>
26 changes: 26 additions & 0 deletions ansible/minigraph/OCPSCH01040FFLF.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,32 @@
<DownstreamSummarySet xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
</DeviceDataPlaneInfo>
</DpgDec>
<PngDec>
<DeviceInterfaceLinks>
<DeviceLinkBase i:type="DeviceInterfaceLink">
<Bandwidth>40000</Bandwidth>
<ElementType>DeviceInterfaceLink</ElementType>
<EndDevice>OCPSCH0104001MS</EndDevice>
<EndPort>Ethernet0</EndPort>
<StartDevice>OCPSCH01040FFLF</StartDevice>
<StartPort>Ethernet0</StartPort>
</DeviceLinkBase>
<DeviceLinkBase i:type="DeviceInterfaceLink">
<Bandwidth>40000</Bandwidth>
<ElementType>DeviceInterfaceLink</ElementType>
<EndDevice>OCPSCH0104002MS</EndDevice>
<EndPort>Ethernet0</EndPort>
<StartDevice>OCPSCH01040FFLF</StartDevice>
<StartPort>Ethernet4</StartPort>
</DeviceLinkBase>
</DeviceInterfaceLinks>
<Devices>
<Device i:type="LeafRouter">
<Hostname>OCPSCH01040FFLF</Hostname>
<HwSku>ACS-A7050-QX32</HwSku>
</Device>
</Devices>
</PngDec>
<Hostname>OCPSCH01040FFLF</Hostname>
<HwSku>ACS-A7050-QX32</HwSku>
</DeviceMiniGraph>
26 changes: 26 additions & 0 deletions ansible/minigraph/OCPSCH01040GGLF.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,32 @@
<DownstreamSummarySet xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
</DeviceDataPlaneInfo>
</DpgDec>
<PngDec>
<DeviceInterfaceLinks>
<DeviceLinkBase i:type="DeviceInterfaceLink">
<Bandwidth>40000</Bandwidth>
<ElementType>DeviceInterfaceLink</ElementType>
<EndDevice>OCPSCH0104001MS</EndDevice>
<EndPort>Ethernet0</EndPort>
<StartDevice>OCPSCH01040GGLF</StartDevice>
<StartPort>Ethernet0</StartPort>
</DeviceLinkBase>
<DeviceLinkBase i:type="DeviceInterfaceLink">
<Bandwidth>40000</Bandwidth>
<ElementType>DeviceInterfaceLink</ElementType>
<EndDevice>OCPSCH0104002MS</EndDevice>
<EndPort>Ethernet0</EndPort>
<StartDevice>OCPSCH01040GGLF</StartDevice>
<StartPort>Ethernet4</StartPort>
</DeviceLinkBase>
</DeviceInterfaceLinks>
<Devices>
<Device i:type="LeafRouter">
<Hostname>OCPSCH01040GGLF</Hostname>
<HwSku>ACS-BF</HwSku>
</Device>
</Devices>
</PngDec>
<Hostname>OCPSCH01040GGLF</Hostname>
<HwSku>ACS-BF</HwSku>
</DeviceMiniGraph>
26 changes: 26 additions & 0 deletions ansible/minigraph/OCPSCH01040HHLF.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,32 @@
<DownstreamSummarySet xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
</DeviceDataPlaneInfo>
</DpgDec>
<PngDec>
<DeviceInterfaceLinks>
<DeviceLinkBase i:type="DeviceInterfaceLink">
<Bandwidth>40000</Bandwidth>
<ElementType>DeviceInterfaceLink</ElementType>
<EndDevice>OCPSCH0104001MS</EndDevice>
<EndPort>Ethernet0</EndPort>
<StartDevice>OCPSCH01040HHLF</StartDevice>
<StartPort>Ethernet0</StartPort>
</DeviceLinkBase>
<DeviceLinkBase i:type="DeviceInterfaceLink">
<Bandwidth>40000</Bandwidth>
<ElementType>DeviceInterfaceLink</ElementType>
<EndDevice>OCPSCH0104002MS</EndDevice>
<EndPort>Ethernet0</EndPort>
<StartDevice>OCPSCH01040HHLF</StartDevice>
<StartPort>Ethernet4</StartPort>
</DeviceLinkBase>
</DeviceInterfaceLinks>
<Devices>
<Device i:type="LeafRouter">
<Hostname>OCPSCH01040HHLF</Hostname>
<HwSku>ACS-BF</HwSku>
</Device>
</Devices>
</PngDec>
<Hostname>OCPSCH01040HHLF</Hostname>
<HwSku>ACS-BF</HwSku>
</DeviceMiniGraph>
Loading