Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

acibaseobject issue #396

Open
lukaszszopa opened this issue Aug 10, 2023 · 0 comments
Open

acibaseobject issue #396

lukaszszopa opened this issue Aug 10, 2023 · 0 comments

Comments

@lukaszszopa
Copy link

Hi,
Ii found one problem in acitoolkit acibaseobject currently working on cable plan application, and noticed that target node is not same format as node in for loop. List self._parent.get_children(Node) have nodes names rather then nodes numbers so each time it throws None and nothing appears not sure how to change this list to include list o nodes number, will you be so kind and help me to change list to be nodes number representation?
Below part of code:

def get_node2(self):

    """Returns the Node object that corresponds to the

    second node of the link.  The Node must be a child of

    the Pod that this link is a member of, i.e. it must

    already have been read from the APIC.  This can

    most easily be done by populating the entire physical

    heirarchy from the Pod down.



    :returns: Node object at second end of link

    """

    return self._get_node(2)



def _get_target_node(self, node_number):

    """Common implementation of get_node1() and get_node2()"""

    if not self._parent:

        raise TypeError("Parent pod must be specified in order to get node")

    target_node = {1: self.node1, 2: self.node2}[node_number]

    return target_node



def _get_node(self, node_number):

    """Common implementation of get_node1() and get_node2()"""

    if not self._parent:

        raise TypeError("Parent pod must be specified in order to get node")

    target_node = {1: self.node1, 2: self.node2}[node_number]

    matching_nodes = (

        node for node in self._parent.get_children(Node)

        if node == target_node

    )


    return next(matching_nodes, None)`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant