X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2Ftopology.py;h=c39e5afabb97c17c89bca4d3469f556da5e77ece;hp=454692807cd4e6026401435eabf839b8ce855aed;hb=HEAD;hpb=b33b1461fe815b1a09267118644538a5b9351c60 diff --git a/resources/libraries/python/topology.py b/resources/libraries/python/topology.py index 454692807c..22ed3666c3 100644 --- a/resources/libraries/python/topology.py +++ b/resources/libraries/python/topology.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Cisco and/or its affiliates. +# Copyright (c) 2024 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -766,7 +766,9 @@ class Topology: # find link for node_data in nodes_info.values(): # skip self - if node_data[u"host"] == node[u"host"]: + l_hash = node_data[u"host"]+str(node_data[u"port"]) + r_hash = node[u"host"]+str(node[u"port"]) + if l_hash == r_hash: continue for if_key, if_val \ in node_data[u"interfaces"].items(): @@ -1085,6 +1087,19 @@ class Topology: except KeyError: return None + def get_bus(node): + """Return bus configuration of the node. + + :param node: Node created from topology. + :type node: dict + :returns: bus configuration string. + :rtype: str + """ + try: + return node[u"bus"] + except KeyError: + return None + @staticmethod def get_uio_driver(node): """Return uio-driver configuration of the node.