Find Node with a Physical Port or Link in Python4Capella

Hello everyone,

I’m a beginner with Py4C and I need to do a script who re-transcribe a PAB to an Xlxs file.

The script will browse the NodeList (se.get_all_contents_by_type(Node)) Node by Node.
First, it will noted his name and description.
Then, it will describe their physicals ports and physicals link with their property values.
And I need to get PhysicalPort and Node at each End.

Thanks to pl.get_java_object().getSourcePhysicalPort()) and getTargetPhysicalPort() I can find the two physicals ports but I cannot find Nodes.

At this point, I’ve the 1st Node, the physical link which is connected to the two nodes, the two physicals ports (including that of the unknown node)

Do you have track or solution to find the 2nd Node ?

Thanks in advance

Hi Paul,

In your case, I would use the capella_query_by_name method to find the two node PC at the ends of the physical link, like this:

capella_query_by_name(pl, "Physical Link Ends")

This function should return a list of the two components linked by pl, and then, you can find the one that is not your 1st Node.

That’s how I would proceed in your case, but maybe someone has a better idea.

1 Like