In Python3, set operations seem to result in indeterministic order.
+ Remove verbose logging from topology.py
Change-Id: I47cc90637a0b2969e1686b4216b7d8fe4fe2aaab
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
-# 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:
# 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:
f"No link between {node1[u'host']} and {node2[u'host']}"
)
f"No link between {node1[u'host']} and {node2[u'host']}"
)
+ # Not using set operations, as we need deterministic order.
- l_set = set(links).intersection(self._links)
+ l_set = [link for link in links if link in self._links]
- 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 "
if not l_set:
raise RuntimeError(
f"No free link between {node1[u'host']} and "
self._links.append(link)
interface1 = topo.get_interface_by_link_name(node1, link)
self._links.append(link)
interface1 = topo.get_interface_by_link_name(node1, link)
- logger.trace(f"node1: {str(node1)}")
- logger.trace(f"node2: {str(node2)}")
node1_links = self._get_node_active_link_names(
node1, filter_list=filter_list_node1
)
node1_links = self._get_node_active_link_names(
node1, filter_list=filter_list_node1
)
elif node2_links is None:
logger.error(u"Unable to find active links for node2")
else:
elif node2_links is None:
logger.error(u"Unable to find active links for node2")
else:
- connecting_links = list(set(node1_links).intersection(node2_links))
+ # Not using set operations, as we need deterministic order.
+ connecting_links = [
+ link for link in node1_links if link in node2_links
+ ]