def attach(self, streamDef, userid): if self.logger: self.logger.trace("bulkio::InAttachablePort attach ENTER (port=" + str(self.name) + ")") self.logger.debug( "InAttachablePort.attach() - ATTACH REQUEST, STREAM/USER" + str(streamDef) + '/' + str(userid)) attachId = None self.port_lock.acquire() try: try: if self.logger: self.logger.debug( "InAttachablePort.attach() - CALLING ATTACH CALLBACK, STREAM/USER" + str(streamDef) + '/' + str(userid)) if self._attach_cb != None: attachId = self._attach_cb(streamDef, userid) except Exception, e: if self.logger: self.logger.error( "InAttachablePort.attach() - ATTACH CALLBACK EXCEPTION : " + str(e) + " STREAM/USER" + str(streamDef) + '/' + str(userid)) raise self.interface.AttachError(str(e)) if attachId == None: attachId = str(uuid.uuid4()) self._attachedStreams[attachId] = (streamDef, userid)
def connect( a1, c1, p1, a2, c2, p2 ): src = get_port( a1, c1, p1 ) if src : dest = get_port( a2, c2, p2 ) if dest : print "Connect:" + str(a1.name) + ":" + str(c1) + ":" + str(p1) + " TO " + str(a2.name) + ":" + str(c2) + ":" + str(p2) src.connectPort( dest, str(uuid.uuid4()))
def _generateAlloc(self,tuner_type='RX_DIGITIZER', cf=100e6,sr=25e6,bw=20e6,rf_flow_id=''): value = {} value['ALLOC_ID'] = str(uuid.uuid4()) value['TYPE'] = tuner_type value['BW_TOLERANCE'] = 100.0 value['SR_TOLERANCE'] = 100.0 value['RF_FLOW_ID'] = rf_flow_id value['GROUP_ID'] = '' value['CONTROL'] = True value['CF'] = cf value['SR'] = sr value['BW'] = bw #generate the allocation allocationPropDict = {'FRONTEND::tuner_allocation':{ 'FRONTEND::tuner_allocation::tuner_type': value['TYPE'], 'FRONTEND::tuner_allocation::allocation_id': value['ALLOC_ID'], 'FRONTEND::tuner_allocation::center_frequency': float(value['CF']), 'FRONTEND::tuner_allocation::bandwidth': float(value['BW']), 'FRONTEND::tuner_allocation::bandwidth_tolerance': float(value['BW_TOLERANCE']), 'FRONTEND::tuner_allocation::sample_rate': float(value['SR']), 'FRONTEND::tuner_allocation::sample_rate_tolerance': float(value['SR_TOLERANCE']), 'FRONTEND::tuner_allocation::device_control': value['CONTROL'], 'FRONTEND::tuner_allocation::group_id': value['GROUP_ID'], 'FRONTEND::tuner_allocation::rf_flow_id': value['RF_FLOW_ID'], }} return properties.props_from_dict(allocationPropDict)
def connect(self, domain): log.trace('Connecting %s', self.CHANNEL_NAME) # Generate a unique identifier for each event channel connection to prevent # collisions if multiple instances are running. self.__identifier = str(uuid4()) self.__consumer = events.GenericEventConsumer(weakobj.boundmethod(self.push), keep_structs=True) self.__domainManager = domain self.__domainManager.registerWithEventChannel(self.__consumer._this(), self.__identifier, self.CHANNEL_NAME)
def connect(a1, c1, p1, a2, c2, p2): src = get_port(a1, c1, p1) if src: dest = get_port(a2, c2, p2) if dest: print "Connect:" + str( a1.name) + ":" + str(c1) + ":" + str(p1) + " TO " + str( a2.name) + ":" + str(c2) + ":" + str(p2) src.connectPort(dest, str(uuid.uuid4()))
def __init__(self, porttype): """ Instantiates a new object and generates a default StreamSRI. The porttype parameter corresponds to the type of data contained in the array of data being sent. The porttype is also used in the connectPort() method to narrow the connection """ self.port_type = porttype self.byte_per_sample = 1 self.structFormat = "B" if(porttype == BULKIO__POA.dataShort): self.byte_per_sample = 2 self.structFormat = "h" elif(porttype == BULKIO__POA.dataFloat): self.byte_per_sample = 4 self.structFormat = "f" elif(porttype == BULKIO__POA.dataDouble): self.byte_per_sample = 8 self.structFormat = "D" elif(porttype == BULKIO__POA.dataChar): self.byte_per_sample = 1 self.structFormat = "B" elif(porttype == BULKIO__POA.dataOctet): self.byte_per_sample = 1 self.structFormat = "B" elif(porttype == BULKIO__POA.dataUlong): self.byte_per_sample = 4 self.structFormat = "L" elif(porttype == BULKIO__POA.dataUshort): self.byte_per_sample = 2 self.structFormat = "H" elif(porttype == BULKIO__POA.dataLong): self.byte_per_sample = 4 self.structFormat = "l" elif(porttype == BULKIO__POA.dataLongLong): self.byte_per_sample = 8 self.structFormat = "q" elif(porttype == BULKIO__POA.dataUlongLong): self.byte_per_sample = 8 self.structFormat = "Q" elif(porttype == BULKIO__POA.dataXML): self.byte_per_sample = 1 self.structFormat = "c" self.outPorts = {} self.refreshSRI = False self.sri = BULKIO.StreamSRI(1, 0.0, 0.001, 1, 200, 0.0, 0.001, 1, 1, "defStream", []) self.stream_id = str(uuid.uuid4()) self.port_lock = threading.Lock()
def launch(self, descriptor, instanceName=None, refid=None, impl=None, debugger=None, window=None, execparams={}, configure={}, initialize=True, timeout=None, objType=None): sdrRoot = self.getSdrRoot() # Parse the component XML profile. profile = sdrRoot.findProfile(descriptor, objType) if not profile: return None spd, scd, prf = sdrRoot.readProfile(profile) name = spd.get_name() if not scd: raise RuntimeError, 'Cannot launch softpkg with no SCD' # Check that we can launch the component. comptype = scd.get_componenttype() if comptype not in self.__comptypes__: raise NotImplementedError, "No support for component type '%s'" % comptype if not instanceName: instanceName = self._createInstanceName(name, comptype) elif not self._checkInstanceName(instanceName, comptype): raise ValueError, "User-specified instance name '%s' already in use" % (instanceName,) if not refid: refid = str(uuid4()) elif not self._checkInstanceId(refid, comptype): raise ValueError, "User-specified identifier '%s' already in use" % (refid,) # Determine the class for the component type and create a new instance. clazz = self.__comptypes__[comptype] comp = clazz(self, profile, spd, scd, prf, instanceName, refid, impl, execparams, debugger, window, timeout) # Services don't get initialized or configured if comptype == 'service': return comp # Initialize the component unless asked not to (if the subclass has not # disabled automatic initialization). if initialize and self._autoInit: comp.initialize() # Configure component with default values unless requested not to (e.g., # when launched from a SAD file). if configure is not None: # Make a copy of the default properties, and update with the passed-in # properties initvals = copy.deepcopy(comp._configRef) initvals.update(configure) try: comp.configure(initvals) except: log.exception('Failure in component configuration') return comp
def launch(self, descriptor, instanceName=None, refid=None, impl=None, debugger=None, window=None, execparams={}, configure={}, initialize=True, timeout=None, objType=None): sdrRoot = self.getSdrRoot() # Parse the component XML profile. profile = sdrRoot.findProfile(descriptor, objType) if not profile: return None spd, scd, prf = sdrRoot.readProfile(profile) name = spd.get_name() if not scd: raise RuntimeError, 'Cannot launch softpkg with no SCD' # Check that we can launch the component. comptype = scd.get_componenttype() if comptype not in self.__comptypes__: raise NotImplementedError, "No support for component type '%s'" % comptype # Generate/check instance name. if not instanceName: instanceName = self._createInstanceName(name, comptype) elif not self._checkInstanceName(instanceName, comptype): raise ValueError, "User-specified instance name '%s' already in use" % ( instanceName, ) # Generate/check identifier. if not refid: refid = str(uuid4()) elif not self._checkInstanceId(refid, comptype): raise ValueError, "User-specified identifier '%s' already in use" % ( refid, ) # If possible, determine the correct placement of properties execparams, initProps, configure = self._sortOverrides( prf, execparams, configure) # Determine the class for the component type and create a new instance. return self._launch(profile, spd, scd, prf, instanceName, refid, impl, execparams, initProps, initialize, configure, debugger, window, timeout)
def __init__(self, porttype): """ Instantiates a new object and generates a default StreamSRI. The porttype parameter corresponds to the type of data contained in the array of data being sent. The porttype is also used in the connectPort() method to narrow the connection """ self.port_type = porttype self.outPorts = {} self.refreshSRI = False self.sri = BULKIO.StreamSRI(1, 0.0, 0.001, 1, 200, 0.0, 0.001, 1, 1, "defStream", []) self.stream_id = str(uuid.uuid4()) self.port_lock = threading.Lock()
def configureVideoSRI(self, sri, channels, frame_height, frame_width, fps): if sri == None: return #Create new streamID streamID = "video_freq_" + str(fps) + "_FPS_" + str(uuid.uuid4()) sri.mode = mode sri.hversion = 0 sri.xstart = 0.0 sri.xdelta = 1.0 / (sample_rate / (frame_height * frame_width * channels)) sri.subsize = 0 # 1-dimensional data sri.xunits = 1 sri.ystart = 0 sri.ydelta = 0.001 sri.yunits = 1 sri.streamID = streamID sri.blocking = False
def _launchComponentHost(self, instanceName=None): # Directly create the sandbox object instead of going through launch() profile = self._sdrroot.domPath( '/mgr/rh/ComponentHost/ComponentHost.spd.xml') spd, scd, prf = self._sdrroot.readProfile(profile) if instanceName is None: instanceName = self._createInstanceName('ComponentHost', 'resource') refid = str(uuid4()) comp = ComponentHost(self, profile, spd, scd, prf, instanceName, refid, None) # Likewise, since the specific component type is known, create the # launcher directly. The deployment root is overridden to point to the # root of the local filesystem; all component paths provided to the # component host will be absolute. execparams = {'RH::DEPLOYMENT_ROOT': '/'} comp._launcher = LocalComponentLauncher(execparams, {}, True, {}, None, None, None, False) comp._kick() return comp
def attach(self, streamDef, userid): if self.logger: self.logger.trace("bulkio::InAttachablePort attach ENTER (port=" + str(self.name) +")" ) self.logger.debug("InAttachablePort.attach() - ATTACH REQUEST, STREAM/USER" + str(streamDef) + '/' + str(userid)) attachId = None self.port_lock.acquire() try: try: if self.logger: self.logger.debug("InAttachablePort.attach() - CALLING ATTACH CALLBACK, STREAM/USER" + str(streamDef) + '/' + str(userid) ) if self._attach_cb != None: attachId = self._attach_cb(streamDef, userid) except Exception, e: if self.logger: self.logger.error("InAttachablePort.attach() - ATTACH CALLBACK EXCEPTION : " + str(e) + " STREAM/USER" + str(streamDef) + '/' + str(userid) ) raise self.interface.AttachError(str(e)) if attachId == None: attachId = str(uuid.uuid4()) self._attachedStreams[attachId] = (streamDef, userid)
def launch(self, descriptor, instanceName=None, refid=None, impl=None, debugger=None, window=None, execparams={}, configure={}, initialize=True, timeout=None, objType=None): sdrRoot = self.getSdrRoot() # Parse the component XML profile. profile = sdrRoot.findProfile(descriptor, objType) if not profile: return None spd, scd, prf = sdrRoot.readProfile(profile) name = spd.get_name() if not scd: raise RuntimeError, 'Cannot launch softpkg with no SCD' # Check that we can launch the component. comptype = scd.get_componenttype() if comptype not in self.__comptypes__: raise NotImplementedError, "No support for component type '%s'" % comptype # Generate/check instance name. if not instanceName: instanceName = self._createInstanceName(name, comptype) elif not self._checkInstanceName(instanceName, comptype): raise ValueError, "User-specified instance name '%s' already in use" % (instanceName,) # Generate/check identifier. if not refid: refid = str(uuid4()) elif not self._checkInstanceId(refid, comptype): raise ValueError, "User-specified identifier '%s' already in use" % (refid,) # If possible, determine the correct placement of properties execparams, initProps, configure = self._sortOverrides(prf, execparams, configure) # Determine the class for the component type and create a new instance. return self._launch(profile, spd, scd, prf, instanceName, refid, impl, execparams, initProps, initialize, configure, debugger, window, timeout)
def generateSADXML(waveform_name): ''' generate a SAD XML string describing the current sandbox ''' import ossie.utils.redhawk.sad_template as sad_template if _DEBUG == True: print "generateSadFileString(): generating SAD XML string for given waveform name " + str(waveform_name) sandbox = _getSandbox() Sad_template = sad_template.sad() initial_file = Sad_template.template with_id = initial_file.replace('@__UUID__@', str(uuid4())) # Need waveform name with_name = with_id.replace('@__NAME__@',waveform_name) # Loop over components to define individual componentfile and componentplacement entries componentfiles = '' partitioning = '' assemblycontroller = '' spdFileIds = {} for component in sandbox.getComponents(): # Exclude local input file , output file , and output array components from the sad file if component._instanceName.find("__localFileSource") == -1 and \ component._instanceName.find("__localFileSink") == -1 and \ component._instanceName.find("__localDataSource") == -1 and \ component._instanceName.find("__localDataSink") == -1: relativePathIndex = component._profile.find("/components") if relativePathIndex != -1: relativePathFilename = component._profile[relativePathIndex:] else: relativePathFilename = component._profile if relativePathFilename in spdFileIds: spdFileId = spdFileIds[relativePathFilename] else: spdFileId = '%s_%s' % (component._spd.get_name(), str(uuid4())) spdFileIds[relativePathFilename] = spdFileId componentfiles += Sad_template.componentfile.replace('@__SPDFILE__@',relativePathFilename) componentfiles = componentfiles.replace('@__SPDFILEID__@', spdFileId) partitioning += Sad_template.componentplacement.replace('@__COMPONENTNAME__@',component._instanceName) partitioning = partitioning.replace('@__COMPONENTINSTANCE__@',component._refid) partitioning = partitioning.replace('@__SPDFILEID__@', spdFileId) # Set Assembly Controller to first component in list if not assemblycontroller: assemblycontroller = Sad_template.assemblycontroller.replace('@__COMPONENTINSTANCE__@',component._refid) with_componentfiles = with_name.replace('@__COMPONENTFILE__@',componentfiles) with_partitioning = with_componentfiles.replace('@__COMPONENTPLACEMENT__@',partitioning) with_ac = with_partitioning.replace('@__ASSEMBLYCONTROLLER__@', assemblycontroller) # Loop over connections connectinterface = '' for connection in _currentState['Component Connections'].values(): usesport = Sad_template.usesport.replace('@__PORTNAME__@',connection['Uses Port Name']) usesport = usesport.replace('@__COMPONENTINSTANCE__@',connection['Uses Component']._refid) if connection['Provides Port Name'] == "CF:Resource": # component support interface providesport = Sad_template.componentsupportedinterface.replace('@__PORTINTERFACE__@',connection['Provides Port Interface']) providesport = providesport.replace('@__COMPONENTINSTANCE__@',connection['Provides Component']._refid) else: providesport = Sad_template.providesport.replace('@__PORTNAME__@',connection['Provides Port Name']) providesport = providesport.replace('@__COMPONENTINSTANCE__@',connection['Provides Component']._refid) connectinterface += Sad_template.connectinterface.replace('@__USESPORT__@',usesport) connectinterface = connectinterface.replace('@__PROVIDESPORT__@',providesport) connectinterface = connectinterface.replace('@__CONNECTID__@',str(uuid4())) with_connections = with_ac.replace('@__CONNECTINTERFACE__@',connectinterface) # External ports are ignored with_connections = with_connections.replace('@__EXTERNALPORTS__@',"") sadString = with_connections if _DEBUG == True: print "generateSadFileString(): returning SAD XML string " + str(sadString) return sadString
def process(self): """ Basic functionality: The process method should process a single "chunk" of data and then return. This method will be called from the processing thread again, and again, and again until it returns FINISH or stop() is called on the component. If no work is performed, then return NOOP. """ if self.stream_id == None: self.stream_id = str(uuid.uuid4()) self.sri.streamID = self.stream_id if self.xfer_len != self.last_xfer_len: self.last_xfer_len = self.xfer_len self.sriUpdate = True self.sample_time_delta = 1.0/self.sample_rate if self.sample_time_delta != self.sri.xdelta: self.sri.xdelta = self.sample_time_delta self.sriUpdate = True if self.sriUpdate or not self.port_out.sriDict.has_key(self.stream_id): self.port_out.pushSRI(self.sri) self.sriUpdate = False self.delta_phase = self.frequency * self.sample_time_delta self.delta_phase_offset = self.chirp * self.sample_time_delta * self.sample_time_delta if ((self.delta_phase < 0) and (not self.shape == "sine")): self.delta_phase = -self.delta_phase # Generate the Waveform data = [] if self.shape == "sine": data = self._waveform.sincos(self.magnitude, self.phase, self.delta_phase, self.xfer_len, 1) elif self.shape == "square": data = self._waveform.square(self.magnitude, self.phase, self.delta_phase, self.xfer_len, 1) elif self.shape == "triangle": data = self._waveform.triangle(self.magnitude, self.phase, self.delta_phase, self.xfer_len, 1) elif self.shape == "sawtooth": data = self._waveform.sawtooth(self.magnitude, self.phase, self.delta_phase, self.xfer_len, 1) elif self.shape == "pulse": data = self._waveform.pulse(self.magnitude, self.phase, self.delta_phase, self.xfer_len, 1) elif self.shape == "constant": data = self._waveform.constant(self.magnitude, self.xfer_len, 1) elif self.shape == "whitenoise": data = self._waveform.whitenoise(self.magnitude, self.xfer_len, 1) elif self.shape == "lrs": data = self._waveform.lrs(self.magnitude, self.xfer_len, 1, 1) else: return NOOP self.phase += self.delta_phase*self.xfer_len # increment phase self.phase -= math.floor(self.phase) # module 1.0 # Create a CPU time-stamp tmp_time = time.time() wsec = math.modf(tmp_time)[1] fsec = math.modf(tmp_time)[0] tstamp = BULKIO.PrecisionUTCTime(BULKIO.TCM_CPU, BULKIO.TCS_VALID, 0, wsec, fsec) # Push the data self.port_out.pushPacket(data, tstamp, False, self.stream_id) # If we are throttling, wait...otherwise run at full speed if self.throttle: wait_amt = self.xfer_len * self.sample_time_delta try: time.sleep(wait_amt) finally: return NORMAL return NORMAL
def launch(self, descriptor, instanceName=None, refid=None, impl=None, debugger=None, window=None, properties={}, configure=True, initialize=True, timeout=None, objType=None, shared=True, stdout=None): sdrRoot = self.getSdrRoot() # Parse the component XML profile. profile = sdrRoot.findProfile(descriptor, objType) if not profile: return None spd, scd, prf = sdrRoot.readProfile(profile) name = spd.get_name() if not scd: raise RuntimeError, 'Cannot launch softpkg with no SCD' # Check that we can launch the component. comptype = scd.get_componenttype() if comptype == 'resource': clazz = SandboxComponent elif comptype in ('device', 'loadabledevice', 'executabledevice'): clazz = SandboxDevice elif comptype == 'service': clazz = SandboxService else: raise NotImplementedError("No support for component type '%s'" % comptype) # Generate/check instance name. if not instanceName: instanceName = self._createInstanceName(name, comptype) elif not self._checkInstanceName(instanceName, comptype): raise ValueError, "User-specified instance name '%s' already in use" % ( instanceName, ) # Generate/check identifier. if not refid: refid = 'DCE:' + str(uuid4()) elif not self._checkInstanceId(refid, comptype): raise ValueError, "User-specified identifier '%s' already in use" % ( refid, ) # If possible, determine the correct placement of properties execparams, initProps, configProps = self._sortOverrides( prf, properties) if not configure: configProps = None # Determine the class for the component type and create a new instance. comp = clazz(self, profile, spd, scd, prf, instanceName, refid, impl) launcher = self._createLauncher(comptype, execparams, initProps, initialize, configProps, debugger, window, timeout, shared, stdout) if not launcher: raise NotImplementedError("No support for component type '%s'" % comptype) comp._launcher = launcher # Launch the component comp._kick() return comp
def __init__(self, name): self._name = name self._identifier = 'DCE:%s' % (uuid.uuid4(),)
def launch(self, descriptor, instanceName=None, refid=None, impl=None, debugger=None, window=None, execparams={}, configure={}, initialize=True, timeout=None, objType=None): sdrRoot = self.getSdrRoot() # Parse the component XML profile. profile = sdrRoot.findProfile(descriptor, objType) if not profile: return None spd, scd, prf = sdrRoot.readProfile(profile) name = spd.get_name() if not scd: raise RuntimeError, 'Cannot launch softpkg with no SCD' # Check that we can launch the component. comptype = scd.get_componenttype() if comptype not in self.__comptypes__: raise NotImplementedError, "No support for component type '%s'" % comptype if not instanceName: instanceName = self._createInstanceName(name, comptype) elif not self._checkInstanceName(instanceName, comptype): raise ValueError, "User-specified instance name '%s' already in use" % ( instanceName, ) if not refid: refid = str(uuid4()) elif not self._checkInstanceId(refid, comptype): raise ValueError, "User-specified identifier '%s' already in use" % ( refid, ) # Determine the class for the component type and create a new instance. clazz = self.__comptypes__[comptype] comp = clazz(self, profile, spd, scd, prf, instanceName, refid, impl, execparams, debugger, window, timeout) # Services don't get initialized or configured if comptype == 'service': return comp # Initialize the component unless asked not to (if the subclass has not # disabled automatic initialization). if initialize and self._autoInit: comp.initialize() # Configure component with default values unless requested not to (e.g., # when launched from a SAD file). if configure is not None: # Make a copy of the default properties, and update with the passed-in # properties initvals = copy.deepcopy(comp._configRef) initvals.update(configure) try: comp.configure(initvals) except: log.exception('Failure in component configuration') return comp
def generateSADXML(waveform_name): ''' generate a SAD XML string describing the current sandbox ''' import ossie.utils.redhawk.sad_template as sad_template if _DEBUG == True: print "generateSadFileString(): generating SAD XML string for given waveform name " + str( waveform_name) sandbox = _getSandbox() Sad_template = sad_template.sad() initial_file = Sad_template.template with_id = initial_file.replace('@__UUID__@', str(uuid4())) # Need waveform name with_name = with_id.replace('@__NAME__@', waveform_name) # Loop over components to define individual componentfile and componentplacement entries componentfiles = '' partitioning = '' assemblycontroller = '' spdFileIds = {} for component in sandbox.getComponents(): # Exclude local input file , output file , and output array components from the sad file if component._instanceName.find("__localFileSource") == -1 and \ component._instanceName.find("__localFileSink") == -1 and \ component._instanceName.find("__localDataSource") == -1 and \ component._instanceName.find("__localDataSink") == -1: relativePathIndex = component._profile.find("/components") if relativePathIndex != -1: relativePathFilename = component._profile[relativePathIndex:] else: relativePathFilename = component._profile if relativePathFilename in spdFileIds: spdFileId = spdFileIds[relativePathFilename] else: spdFileId = '%s_%s' % (component._spd.get_name(), str(uuid4())) spdFileIds[relativePathFilename] = spdFileId componentfiles += Sad_template.componentfile.replace( '@__SPDFILE__@', relativePathFilename) componentfiles = componentfiles.replace( '@__SPDFILEID__@', spdFileId) partitioning += Sad_template.componentplacement.replace( '@__COMPONENTNAME__@', component._instanceName) partitioning = partitioning.replace('@__COMPONENTINSTANCE__@', component._refid) partitioning = partitioning.replace('@__SPDFILEID__@', spdFileId) # Set Assembly Controller to first component in list if not assemblycontroller: assemblycontroller = Sad_template.assemblycontroller.replace( '@__COMPONENTINSTANCE__@', component._refid) with_componentfiles = with_name.replace('@__COMPONENTFILE__@', componentfiles) with_partitioning = with_componentfiles.replace('@__COMPONENTPLACEMENT__@', partitioning) with_ac = with_partitioning.replace('@__ASSEMBLYCONTROLLER__@', assemblycontroller) # Loop over connections connectinterface = '' for connection in _currentState['Component Connections'].values(): usesport = Sad_template.usesport.replace('@__PORTNAME__@', connection['Uses Port Name']) usesport = usesport.replace('@__COMPONENTINSTANCE__@', connection['Uses Component']._refid) if connection['Provides Port Name'] == "CF:Resource": # component support interface providesport = Sad_template.componentsupportedinterface.replace( '@__PORTINTERFACE__@', connection['Provides Port Interface']) providesport = providesport.replace( '@__COMPONENTINSTANCE__@', connection['Provides Component']._refid) else: providesport = Sad_template.providesport.replace( '@__PORTNAME__@', connection['Provides Port Name']) providesport = providesport.replace( '@__COMPONENTINSTANCE__@', connection['Provides Component']._refid) connectinterface += Sad_template.connectinterface.replace( '@__USESPORT__@', usesport) connectinterface = connectinterface.replace('@__PROVIDESPORT__@', providesport) connectinterface = connectinterface.replace('@__CONNECTID__@', str(uuid4())) with_connections = with_ac.replace('@__CONNECTINTERFACE__@', connectinterface) # External ports are ignored with_connections = with_connections.replace('@__EXTERNALPORTS__@', "") sadString = with_connections if _DEBUG == True: print "generateSadFileString(): returning SAD XML string " + str( sadString) return sadString
def __init__(self, name): self._name = name self._identifier = 'DCE:%s' % (uuid.uuid4(), )
def __init__(self): PortSupplier.__init__(self) self._refid = str(uuid4()) self._port = None self._started = False
def attach(self, streamDef, user): self.parent.callback_stats.num_vita49_attaches += 1 aid = str(uuid.uuid4()) newAttachment = self.parent.Vita49Attachment(streamDef.id, aid, streamDef.port) self.parent.received_vita49_attachments.append(newAttachment) return aid
def _uuidgen(): return str(_uuid.uuid4())