def find_port(rtc, port, tree=None, orb=None): '''Get a rtctree.Port object from an rtctree.RTCTree. Get the port object by searching the RTCTree for the specified RTC, then looking for the specified port on that component. @param rtc Path to the component that should have a port. This should be in the format used by rtctree, i.e. a list of path entries, with the first being a /. e.g. ['/', 'localhost', 'comp0.rtc']. @param port Name of the port. @param tree An already-populated rtctree.RTCTree object, or None if one should be created. @param orb An ORB to use if the tree must be created, or None to make one. ''' comp = get_comp(rtc, tree=tree, orb=orb) port_obj = comp.get_port_by_name(port) if not port_obj: raise rts_exceptions.PortNotFoundError(rtc, port) return port_obj
def find_local_port(name, ports): for p in ports: if p.get_port_profile().name.split('.')[-1] == name: return p raise rts_exceptions.PortNotFoundError(comp.getTypeName(), name)