- This topic has 2 replies, 2 voices, and was last updated 2 years, 5 months ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.
Home › Forums › FABRIC General Questions and Discussion › get_interface by name
Hi!
The get_interface function in fablib allows retrieving an interface by name. However, it’s not the same name you specify when you add an interface with add_component. The interface name ends up as {{node name}}-{{component name}}-p1 (as far as I can tell). Is this documented? will the interface name always be {{node name}}-{{component name}}-p1?
Thank you!
Yeah, this is all correct. The issue here is that some components have multiple interfaces. At the same time, interfaces need unique names. When you name a component that has interfaces, the interface names will be {{node name}}-{{component name}}-p1, {{node name}}-{{component name}}-p2, …
Also, components need unique names so the specified component name is prepended with the node name.
This is all a bit awkward but its a trade off between this and requiring the user to navigate a bunch of errors when trying to assign names to all their objects.
We are considering adding some additional methods that automatically create/parse the names so that the user can use only the names they specified. Of course this would mean that if you issued a mySlice.get_interface(name=”myInterface”) there may be a list of interfaces with that name but from different components and nodes. This may be a better way to go.
Your input on the topic would be welcome.
Paul
I think it’s easier if all of the get_x functions behave in a similar way. What happens with add_node/get_node or add_network/get_network if you try to use the same name more than once?