X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2FNodePath.py;h=ec84a8b08bab281a56bc0bf2c1ae5315fd0c6133;hb=ada7009a3c826430e83a29c31bdf9a5973986ad9;hp=8ee29b234d383325c9a55430af2b4e93fa00b8a9;hpb=cf561a6e3d4c4fbd78ab6c9d0a9aa817bb3300fc;p=csit.git diff --git a/resources/libraries/python/NodePath.py b/resources/libraries/python/NodePath.py index 8ee29b234d..ec84a8b08b 100644 --- a/resources/libraries/python/NodePath.py +++ b/resources/libraries/python/NodePath.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016 Cisco and/or its affiliates. +# Copyright (c) 2018 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: @@ -93,12 +93,13 @@ class NodePath(object): def compute_path(self, always_same_link=True): """Compute path for added nodes. + .. note:: First add at least two nodes to the topology. + :param always_same_link: If True use always same link between two nodes - in path. If False use different link (if available) between two - nodes if one link was used before. + in path. If False use different link (if available) + between two nodes if one link was used before. :type always_same_link: bool - - .. note:: First add at least two nodes to the topology. + :raises RuntimeError: If not enough nodes for path. """ nodes = self._nodes if len(nodes) < 2: @@ -150,8 +151,7 @@ class NodePath(object): """ if not self._path_iter: return None, None - else: - return self._path_iter.pop() + return self._path_iter.pop() def first_interface(self): """Return first interface on the path.