X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2FNodePath.py;fp=resources%2Flibraries%2Fpython%2FNodePath.py;h=6f08be491b6f84fb9110d4fd82f3a3e866f5be2f;hp=e97bde87ad1aacbcc04c31124a69895eb5251149;hb=11e9514af6e6d9e993b469fae3ce6671c3d3e536;hpb=54ff8d827f0aa3c689e26583952d04d86be503e7 diff --git a/resources/libraries/python/NodePath.py b/resources/libraries/python/NodePath.py index e97bde87ad..6f08be491b 100644 --- a/resources/libraries/python/NodePath.py +++ b/resources/libraries/python/NodePath.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 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: @@ -120,10 +120,11 @@ class NodePath: f"No link between {node1[u'host']} and {node2[u'host']}" ) + # Not using set operations, as we need deterministic order. if always_same_link: - l_set = set(links).intersection(self._links) + l_set = [link for link in links if link in self._links] else: - l_set = set(links).difference(self._links) + l_set = [link for link in links if link not in self._links] if not l_set: raise RuntimeError( f"No free link between {node1[u'host']} and " @@ -131,9 +132,9 @@ class NodePath: ) if not l_set: - link = links.pop() + link = links[0] else: - link = l_set.pop() + link = l_set[0] self._links.append(link) interface1 = topo.get_interface_by_link_name(node1, link)