Forum Discussion

Robert_47833's avatar
Robert_47833
Icon for Altostratus rankAltostratus
Aug 15, 2017

python f5-sdk search node name with ip

there is ip IPA , I need to search its name if this IPA already exists in LTM

currently I am using :

                      nodes = mgmt.tm.ltm.nodes.get_collection()    
                                for m in nodes:
                                    if m.address==IPA:
                                        print(m.name)







   But it is too slow, any one have idea to improve this?

1 Reply

  • Hi Robert, Unfortunately I could not test it, but looking at the documentation quickly, I think it should be like this:

    if mgmt.tm.ltm.nodes.node.exists(partition='Common', address=IPA):
        node = mgmt.tm.ltm.nodes.node.load(partition='Common', address=IPA)
        print(node.name)
    

    Just a shot.

    I hope it helps.