Пример #1
0
    def makeClient(self, index):
        fragmentname = 'msio/client_context.xml'
        context = elementFromFile(os.path.join(self.fragmentdir, fragmentname))

        ## Add policy
        addFragmentFromFile(target=context,
                            filename=os.path.join(
                                self.fragmentdir,
                                'msio/client_policy_%s.xml' % self.ptprot),
                            index=0)
        polns = "http://xdaq.web.cern.ch/xdaq/xsd/2013/XDAQPolicy-10"
        for element in context.findall(
                QN(polns, "policy").text + '/' + QN(polns, "element").text):
            if 'RU%d' in element.get('pattern'):
                element.set(
                    'pattern',
                    element.get('pattern').replace('RU%d', 'RU%d' % (index)))
        ## Add pt application
        addFragmentFromFile(
            target=context,
            filename=os.path.join(
                self.fragmentdir,
                'msio/client_%s_application.xml' % self.ptprot),
            index=2)  ## add after policy and endpoint

        ## Configure IBV application:
        if self.setDynamicIBVConfig:
            self.configureIBVApplication(context, self.RUIBVConfig)

        ## Add corresponding module
        module = Element(QN(self.xdaqns, 'Module').text)
        module.text = "$XDAQ_ROOT/lib/libpt%s.so" % self.ptprot
        context.insert(3, module)

        ## Add corresponding module
        module = Element(QN(self.xdaqns, 'Module').text)
        module.text = "$XDAQ_ROOT/lib/libxdaq2rc.so"
        context.insert(4, module)

        ## Client application
        ru_app = elementFromFile(filename=os.path.join(
            self.fragmentdir, 'msio/client_application.xml'))
        context.insert(5, ru_app)
        ru_app.set('instance', str(index))

        ## Add corresponding module
        module = Element(QN(self.xdaqns, 'Module').text)
        if self.evbns == 'msio':
            module.text = "$XDAQ_ROOT/lib/libmstreamio2g.so"
        context.insert(6, module)

        ## Set instance and url
        for app in context.findall(QN(self.xdaqns, 'Endpoint').text):
            if 'RU%d' in app.attrib['hostname']:
                app.set('hostname', app.get('hostname') % index)
            if 'RU%d' in app.attrib['port']:
                app.set('port', app.get('port') % index)
        context.set('url', context.get('url') % (index, index))

        return context
Пример #2
0
	def makeServer(self, index):
		fragmentname = 'msio/server_context.xml'
		context = elementFromFile(os.path.join(self.fragmentdir,
			                                      fragmentname))

		## Add policy
		addFragmentFromFile(target=context,
			                filename=os.path.join(self.fragmentdir,
			                	     'msio/server_policy_%s.xml'%(
			                	      self.ptprot)),
			                index=0)
		## Add pt application
		addFragmentFromFile(target=context,
		                    filename=os.path.join(self.fragmentdir,
		                             'msio/server_%s_application.xml'%(
		                             self.ptprot)),
		                    index=2) ## add after the two endpoints

		## Configure IBV application:
		if self.setDynamicIBVConfig:
			self.configureIBVApplication(context, self.BUIBVConfig)

		## Add corresponding module
		module = Element(QN(self.xdaqns, 'Module').text)
		module.text = "$XDAQ_ROOT/lib/libpt%s.so"%self.ptprot
		context.insert(3,module)

		## Add corresponding module
		module = Element(QN(self.xdaqns, 'Module').text)
		module.text = "$XDAQ_ROOT/lib/libxdaq2rc.so"
		context.insert(4,module)

		## Server application
		bu_app = elementFromFile(filename=os.path.join(self.fragmentdir,
			                     'msio/server_application.xml'))
		context.insert(5,bu_app)
		bu_app.set('instance',str(index))

		## Add corresponding module
		module = Element(QN(self.xdaqns, 'Module').text)
		if self.evbns == 'msio':
			module.text = "$XDAQ_ROOT/lib/libmstreamio2g.so"
		context.insert(6,module)

		## Set instance and url
		for app in context.findall(QN(self.xdaqns, 'Endpoint').text):
			if 'BU%d' in app.attrib['hostname']:
				app.set('hostname', app.get('hostname')%index)
			if 'BU%d' in app.attrib['port']:
				app.set('port', app.get('port')%index)
		context.set('url', context.get('url')%(index, index))

		## Set instance and url
		for app in context.findall(QN(self.xdaqns, 'Application').text):
			if app.attrib['class'] != "%s::BU"%self.evbns: continue
			app.set('instance', str(index))
			break

		return context
Пример #3
0
    def makeServer(self, index):
        fragmentname = 'msio/server_context.xml'
        context = elementFromFile(os.path.join(self.fragmentdir, fragmentname))

        ## Add policy
        addFragmentFromFile(target=context,
                            filename=os.path.join(
                                self.fragmentdir,
                                'msio/server_policy_%s.xml' % (self.ptprot)),
                            index=0)
        ## Add pt application
        addFragmentFromFile(
            target=context,
            filename=os.path.join(
                self.fragmentdir,
                'msio/server_%s_application.xml' % (self.ptprot)),
            index=2)  ## add after the two endpoints

        ## Configure IBV application:
        if self.setDynamicIBVConfig:
            self.configureIBVApplication(context, self.BUIBVConfig)

        ## Add corresponding module
        module = Element(QN(self.xdaqns, 'Module').text)
        module.text = "$XDAQ_ROOT/lib/libpt%s.so" % self.ptprot
        context.insert(3, module)

        ## Add corresponding module
        module = Element(QN(self.xdaqns, 'Module').text)
        module.text = "$XDAQ_ROOT/lib/libxdaq2rc.so"
        context.insert(4, module)

        ## Server application
        bu_app = elementFromFile(filename=os.path.join(
            self.fragmentdir, 'msio/server_application.xml'))
        context.insert(5, bu_app)
        bu_app.set('instance', str(index))

        ## Add corresponding module
        module = Element(QN(self.xdaqns, 'Module').text)
        if self.evbns == 'msio':
            module.text = "$XDAQ_ROOT/lib/libmstreamio2g.so"
        context.insert(6, module)

        ## Set instance and url
        for app in context.findall(QN(self.xdaqns, 'Endpoint').text):
            if 'BU%d' in app.attrib['hostname']:
                app.set('hostname', app.get('hostname') % index)
            if 'BU%d' in app.attrib['port']:
                app.set('port', app.get('port') % index)
        context.set('url', context.get('url') % (index, index))

        ## Set instance and url
        for app in context.findall(QN(self.xdaqns, 'Application').text):
            if app.attrib['class'] != "%s::BU" % self.evbns: continue
            app.set('instance', str(index))
            break

        return context
Пример #4
0
	def makeClient(self, index):
		fragmentname = 'msio/client_context.xml'
		context = elementFromFile(os.path.join(self.fragmentdir,
			                                      fragmentname))

		## Add policy
		addFragmentFromFile(target=context, filename=
			                os.path.join(self.fragmentdir,
			                	'msio/client_policy_%s.xml'% self.ptprot),
			                index=0)
		polns = "http://xdaq.web.cern.ch/xdaq/xsd/2013/XDAQPolicy-10"
		for element in context.findall(QN(polns,"policy").text+'/'+
			                              QN(polns,"element").text):
			if 'RU%d' in element.get('pattern'):
				element.set('pattern',element.get('pattern').replace(
					                         'RU%d', 'RU%d'%(index)))
		## Add pt application
		addFragmentFromFile(target=context, filename=
			                os.path.join(self.fragmentdir,
		                    'msio/client_%s_application.xml'% self.ptprot),
		                    index=2) ## add after policy and endpoint

		## Configure IBV application:
		if self.setDynamicIBVConfig:
			self.configureIBVApplication(context, self.RUIBVConfig)

		## Add corresponding module
		module = Element(QN(self.xdaqns, 'Module').text)
		module.text = "$XDAQ_ROOT/lib/libpt%s.so"%self.ptprot
		context.insert(3,module)

		## Add corresponding module
		module = Element(QN(self.xdaqns, 'Module').text)
		module.text = "$XDAQ_ROOT/lib/libxdaq2rc.so"
		context.insert(4,module)

		## Client application
		ru_app = elementFromFile(filename=os.path.join(self.fragmentdir,
			                     'msio/client_application.xml'))
		context.insert(5,ru_app)
		ru_app.set('instance',str(index))

		## Add corresponding module
		module = Element(QN(self.xdaqns, 'Module').text)
		if self.evbns == 'msio':
			module.text = "$XDAQ_ROOT/lib/libmstreamio2g.so"
		context.insert(6,module)

		## Set instance and url
		for app in context.findall(QN(self.xdaqns, 'Endpoint').text):
			if 'RU%d' in app.attrib['hostname']:
				app.set('hostname', app.get('hostname')%index)
			if 'RU%d' in app.attrib['port']:
				app.set('port', app.get('port')%index)
		context.set('url', context.get('url')%(index, index))

		return context
Пример #5
0
	def makeBU(self, index):
		fragmentname = 'BU/BU_context.xml'
		context = elementFromFile(os.path.join(self.fragmentdir,
			                                      fragmentname))

		## Add policy
		addFragmentFromFile(target=context,
			                filename=os.path.join(self.fragmentdir,
			                	'BU/gevb2g/msio/BU_policy_%s_msio.xml'%(
			                	self.ptprot)),
			                index=0)
		## Add builder network endpoint
		context.insert(1,Element(QN(self.xdaqns, 'Endpoint').text, {
			                        'protocol':'%s'%self.ptprot ,
			                        'service':'i2o',
			                        'hostname':'BU%d_I2O_HOST_NAME'%(index),
			                        'port':'BU%d_I2O_PORT'%(index),
			                        'network':'infini'}))
		## Add builder network pt application
		addFragmentFromFile(target=context,
		                    filename=os.path.join(self.fragmentdir,
		                        'BU/gevb2g/msio/BU_%s_application_msio.xml'%(
		                        self.ptprot)),
		                    index=2) ## add after the two endpoints

		## Configure IBV application:
		if self.setDynamicIBVConfig:
			self.configureIBVApplication(context, self.BUIBVConfig)

		## Add corresponding module
		module = Element(QN(self.xdaqns, 'Module').text)
		module.text = "$XDAQ_ROOT/lib/libpt%s.so"%self.ptprot
		context.insert(3,module)

		## Add corresponding module
		module = Element(QN(self.xdaqns, 'Module').text)
		module.text = "$XDAQ_ROOT/lib/libxdaq2rc.so"
		context.insert(4,module)

		## BU application
		bu_app = elementFromFile(filename=os.path.join(self.fragmentdir,
			                     'BU/gevb2g/msio/BU_application_msio.xml'))
		context.insert(5,bu_app)
		bu_app.set('instance',str(index))

		## Set instance and url
		for app in context.findall(QN(self.xdaqns, 'Application').text):
			if app.attrib['class'] != "%s::BU"%self.evbns: continue
			app.set('instance', str(index))
			break
		context.set('url', context.get('url')%(index, index))

		module = Element(QN(self.xdaqns, 'Module').text)
		module.text = "$XDAQ_ROOT/lib/libgevb2g.so"
		context.insert(6,module)

		return context
Пример #6
0
    def makeEVM(self):
        index = 0
        fragmentname = 'EVM/EVM_context.xml'
        context = elementFromFile(os.path.join(self.fragmentdir, fragmentname))

        ## Add policy
        addFragmentFromFile(
            target=context,
            filename=os.path.join(
                self.fragmentdir,
                'EVM/msio/EVM_policy_msio_%s.xml' % (self.ptprot)),
            index=0)
        ## Add builder network endpoint
        context.insert(
            3,
            Element(
                QN(self.xdaqns, 'Endpoint').text, {
                    'protocol': '%s' % self.ptprot,
                    'service': "i2o",
                    'hostname': 'EVM%d_I2O_HOST_NAME' % (index),
                    'port': 'EVM%d_I2O_PORT' % (index),
                    'network': 'infini'
                }))
        ## Add builder network pt application
        addFragmentFromFile(
            target=context,
            filename=os.path.join(
                self.fragmentdir,
                'EVM/msio/EVM_%s_application_msio.xml' % (self.ptprot)),
            index=4)  ## add after the two endpoints

        ## Configure IBV application:
        if self.setDynamicIBVConfig:
            self.configureIBVApplication(context, self.EVMIBVConfig)

        ## Add corresponding module
        module = Element(QN(self.xdaqns, 'Module').text)
        module.text = "$XDAQ_ROOT/lib/libpt%s.so" % self.ptprot
        context.insert(5, module)

        ## Add corresponding module
        module = Element(QN(self.xdaqns, 'Module').text)
        module.text = "$XDAQ_ROOT/lib/libxdaq2rc.so"
        context.insert(6, module)

        ## Set instance and url
        for app in context.findall(QN(self.xdaqns, 'Application').text):
            if app.attrib['class'] != "%s::EVM" % self.evbns: continue
            app.set('instance', str(index))
            break
        context.set('url', context.get('url') % (index, index))

        ## Change poolName in EVM application:
        self.setPropertyInAppInContext(context, 'gevb2g::EVM', 'poolName',
                                       'sibv')

        return context
Пример #7
0
	def makeEVM(self):
		index = 0
		fragmentname = 'EVM/EVM_context.xml'
		context = elementFromFile(os.path.join(self.fragmentdir,
			                                       fragmentname))

		## Add policy
		addFragmentFromFile(target=context,
			                filename=os.path.join(self.fragmentdir,
			                         'EVM/msio/EVM_policy_msio_%s.xml'%(
			                         self.ptprot)),
			                index=0)
		## Add builder network endpoint
		context.insert(3,Element(QN(self.xdaqns, 'Endpoint').text, {
			               'protocol':'%s'%self.ptprot ,
			               'service':"i2o",
			               'hostname':'EVM%d_I2O_HOST_NAME'%(index),
			               'port':'EVM%d_I2O_PORT'%(index),
			               'network':'infini'}))
		## Add builder network pt application
		addFragmentFromFile(target=context,
		                    filename=os.path.join(self.fragmentdir,
		                        'EVM/msio/EVM_%s_application_msio.xml'%(
		                        	                           self.ptprot)),
		                    index=4) ## add after the two endpoints

		## Configure IBV application:
		if self.setDynamicIBVConfig:
			self.configureIBVApplication(context, self.EVMIBVConfig)

		## Add corresponding module
		module = Element(QN(self.xdaqns, 'Module').text)
		module.text = "$XDAQ_ROOT/lib/libpt%s.so"%self.ptprot
		context.insert(5,module)

		## Add corresponding module
		module = Element(QN(self.xdaqns, 'Module').text)
		module.text = "$XDAQ_ROOT/lib/libxdaq2rc.so"
		context.insert(6,module)

		## Set instance and url
		for app in context.findall(QN(self.xdaqns, 'Application').text):
			if app.attrib['class'] != "%s::EVM"%self.evbns: continue
			app.set('instance', str(index))
			break
		context.set('url', context.get('url')%(index, index))

		## Change poolName in EVM application:
		self.setPropertyInAppInContext(context, 'gevb2g::EVM',
			                  'poolName', 'sibv')

		return context
Пример #8
0
	def makeRU(self, ruindex):
		fragmentname = 'RU/gevb2g/msio/RU_context_msio.xml'
		context = elementFromFile(os.path.join(self.fragmentdir,fragmentname))

		## Add policy
		addFragmentFromFile(target=context,
			                filename=os.path.join(self.fragmentdir,
			                'RU/gevb2g/msio/RU_policy_%s_msio.xml'%
			                self.ptprot),
			                index=0)
		polns = "http://xdaq.web.cern.ch/xdaq/xsd/2013/XDAQPolicy-10"
		for element in context.findall(QN(polns,"policy").text+'/'+
			                              QN(polns,"element").text):
			if 'RU%d' in element.get('pattern'):
				element.set('pattern',element.get('pattern').replace(
					                         'RU%d', 'RU%d'%(ruindex)))
		## Add builder network endpoint
		context.insert(1,Element(QN(self.xdaqns, 'Endpoint').text,
			              {'protocol':'%s'%self.ptprot ,
			               'service':"i2o",
			               'hostname':'RU%d_I2O_HOST_NAME'%(ruindex),
			               'port':'RU%d_I2O_PORT'%(ruindex),
			               'network':"infini"}))
		## Add builder network pt application
		addFragmentFromFile(target=context,
		                    filename=os.path.join(self.fragmentdir,
		                    'RU/gevb2g/msio/RU_%s_application_msio.xml'%
		                    self.ptprot),
		                    index=2) ## add after the two endpoints

		## Configure IBV application:
		if self.setDynamicIBVConfig:
			self.configureIBVApplication(context, self.RUIBVConfig)

		## Add corresponding module
		module = Element(QN(self.xdaqns, 'Module').text)
		module.text = "$XDAQ_ROOT/lib/libpt%s.so"%self.ptprot
		context.insert(3,module)

		## Add corresponding module
		module = Element(QN(self.xdaqns, 'Module').text)
		module.text = "$XDAQ_ROOT/lib/libxdaq2rc.so"
		context.insert(4,module)

		## Add Inputemulator application
		inputemu_app = elementFromFile(filename=os.path.join(
			                    self.fragmentdir,
		                       'RU/gevb2g/msio/RU_inputemulator.xml'))
		inputemu_app.set('instance',str(ruindex))
		context.insert(5,inputemu_app)

		## RU application
		ru_app = elementFromFile(filename=os.path.join(self.fragmentdir,
			                     'RU/gevb2g/msio/RU_application_msio.xml'))
		context.insert(6,ru_app)
		ru_app.set('instance',str(ruindex))

		## Set instance and url
		for app in context.findall(QN(self.xdaqns, 'Endpoint').text):
			if 'RU%d' in app.attrib['hostname']:
				app.set('hostname', app.get('hostname')%ruindex)
			if 'RU%d' in app.attrib['port']:
				app.set('port', app.get('port')%ruindex)
		context.set('url', context.get('url')%(ruindex, ruindex))

		self.setPropertyInAppInContext(context, 'gevb2g::InputEmulator',
			                  'destinationClassInstance', str(ruindex),
			                  instance=ruindex)

		return context
Пример #9
0
	def configureIBVforGevb2gIE(self):
		RUFragmentPath = os.path.join(self.fragmentdir,
                           'RU/gevb2g/msio/RU_ibv_application_msio.xml')
		BUFragmentPath = os.path.join(self.fragmentdir,
                           'BU/gevb2g/msio/BU_ibv_application_msio.xml')
		EVMFragmentPath = os.path.join(self.fragmentdir,
                           'EVM/msio/EVM_ibv_application_msio.xml')

		RUIBVApp = elementFromFile(filename=RUFragmentPath)
		BUIBVApp = elementFromFile(filename=BUFragmentPath)
		EVMIBVApp = elementFromFile(filename=EVMFragmentPath)

		BUApp = elementFromFile(filename=os.path.join(self.fragmentdir,
				                  'BU/gevb2g/msio/BU_application_msio.xml'))
		maxResources = int(self.readPropertyFromApp(
		                        application=BUApp,
		                        prop_name="maxResources"))

		RUMaxMSize = int(self.readPropertyFromApp(
			                        application=RUIBVApp,
			                        prop_name="maxMessageSize"))

		BUMaxMSize = int(self.readPropertyFromApp(
			                        application=BUIBVApp,
			                        prop_name="maxMessageSize"))
		self.maxMessageSize = RUMaxMSize if RUMaxMSize == BUMaxMSize else None

		# RU/Client:
		if self.clientSendQPSize is not None:
			sendQPSize = self.clientSendQPSize
		else:
			sendQPSize = maxResources*self.nbus

		if self.clientSendPoolSize is not None:
			sendPoolSize = 1024*1024*self.clientSendPoolSize
		else:
			sendPoolSize = sendQPSize*RUMaxMSize

		if self.clientComplQPSize is not None:
			complQPSize = self.clientComplQPSize
		else:
			complQPSize = 8192

		recvPoolSize = 0x2000000
		recvQPSize = 64

		self.RUIBVConfig = (sendPoolSize, recvPoolSize,
			                complQPSize, sendQPSize, recvQPSize)

		# BU/Server:
		if self.serverRecvQPSize is not None:
			recvQPSize = self.serverRecvQPSize
		else:
			recvQPSize = int(self.RUIBVConfig[0]*2/self.nrus/BUMaxMSize)

		if self.serverRecvPoolSize is not None:
			recvPoolSize = 1024*1024*self.serverRecvPoolSize
		else:
			recvPoolSize = int((recvQPSize+maxResources)*self.nrus*BUMaxMSize)
			# recvPoolSize = int(recvQPSize*self.nrus*BUMaxMSize*1.4)

		if self.serverComplQPSize is not None:
			complQPSize = self.serverComplQPSize
		else:
			complQPSize = recvQPSize*self.nrus

		sendPoolSize = 0x2000000
		sendQPSize = 64


		self.BUIBVConfig = (sendPoolSize, recvPoolSize,
			                complQPSize, sendQPSize, recvQPSize)

		# EVM:
		sendPoolSize = maxResources*256*1024*self.nbus*2
		recvPoolSize = maxResources*256*1024*self.nbus*2
		recvQPSize = maxResources*2
		sendQPSize = maxResources
		complQPSize = maxResources*2*self.nbus


		self.EVMIBVConfig = (sendPoolSize, recvPoolSize,
			                complQPSize, sendQPSize, recvQPSize)
Пример #10
0
    def configureIBVforMSIO(self):
        fragmentPath = os.path.join(self.fragmentdir,
                                    'msio/%s_ibv_application.xml')
        RUIBVApp = elementFromFile(filename=fragmentPath % 'client')
        BUIBVApp = elementFromFile(filename=fragmentPath % 'server')

        BUApp = elementFromFile(filename=os.path.join(
            self.fragmentdir, 'BU/gevb2g/msio/BU_application_msio.xml'))

        RUMaxMSize = int(
            self.readPropertyFromApp(application=RUIBVApp,
                                     prop_name="maxMessageSize"))

        BUMaxMSize = int(
            self.readPropertyFromApp(application=BUIBVApp,
                                     prop_name="maxMessageSize"))
        self.maxMessageSize = RUMaxMSize if RUMaxMSize == BUMaxMSize else None

        # Client:
        if self.clientSendQPSize is not None:
            sendQPSize = self.clientSendQPSize
        else:
            sendQPSize = int(
                self.readPropertyFromApp(application=RUIBVApp,
                                         prop_name="sendQueuePairSize"))

        if self.clientSendPoolSize is not None:
            sendPoolSize = 1024 * 1024 * self.clientSendPoolSize
        else:
            sendPoolSize = (sendQPSize / 16) * RUMaxMSize * self.nrus

        if self.clientComplQPSize is not None:
            complQPSize = self.clientComplQPSize
        else:
            complQPSize = (sendQPSize / 16) * self.nrus

        recvPoolSize = 0x800000
        recvQPSize = 1

        self.RUIBVConfig = (sendPoolSize, recvPoolSize, complQPSize,
                            sendQPSize, recvQPSize)

        # Server:
        if self.serverRecvPoolSize is not None:
            recvPoolSize = 1024 * 1024 * self.serverRecvPoolSize
        else:
            recvPoolSize = (recvQPSize * 2) * self.nrus * BUMaxMSize

        if self.serverRecvQPSize is not None:
            recvQPSize = self.serverRecvQPSize
        else:
            recvQPSize = int(self.RUIBVConfig[0] * 2 / self.nrus / BUMaxMSize)

        if self.serverComplQPSize is not None:
            complQPSize = self.serverComplQPSize
        else:
            complQPSize = recvQPSize * self.nrus

        sendPoolSize = 0x800000
        sendQPSize = 1
        self.BUIBVConfig = (sendPoolSize, recvPoolSize, complQPSize,
                            sendQPSize, recvQPSize)
Пример #11
0
	def makeBU(self, index):
		fragmentname = 'BU/BU_context.xml'
		context = elementFromFile(os.path.join(self.fragmentdir,
			                                      fragmentname))

		## Add policy
		addFragmentFromFile(target=context,
			                filename=os.path.join(self.fragmentdir,
			                	'BU/evb/BU_policy_%s.xml'%(
			                	self.ptprot)),
			                index=0)
		## Add builder network endpoint
		context.insert(1,Element(QN(self.xdaqns, 'Endpoint').text, {
			                        'protocol':'%s'%self.ptprot ,
			                        'service':'i2o',
			                        'hostname':'BU%d_I2O_HOST_NAME'%(index),
			                        'port':'BU%d_I2O_PORT'%(index),
			                        'network':'infini'}))
		## Add builder network pt application
		addFragmentFromFile(target=context,
		                    filename=os.path.join(self.fragmentdir,
		                        'BU/BU_%s_application.xml'%(
		                        self.ptprot)),
		                    index=2) ## add after the two endpoints

		## Configure IBV application:
		if self.setDynamicIBVConfig:
			self.configureIBVApplication(context, self.BUIBVConfig,
				                         maxMessageSize=self.maxMessageSize)

		## Add corresponding module
		module = Element(QN(self.xdaqns, 'Module').text)
		module.text = "$XDAQ_ROOT/lib/libpt%s.so"%self.ptprot
		context.insert(3,module)

		## BU application
		bu_app = elementFromFile(filename=os.path.join(self.fragmentdir,
			                     'BU/evb/BU_application.xml'))
		# self.removePropertyInApp(bu_app, 'maxEvtsUnderConstruction')
		# self.removePropertyInApp(bu_app, 'eventsPerRequest')
		if self.maxEvtsUnderConstruction is not None:
			self.setPropertyInApp(bu_app, 'maxEvtsUnderConstruction',
				                  self.maxEvtsUnderConstruction)
		if self.numberOfBuilders is not None:
			self.setPropertyInApp(bu_app, 'numberOfBuilders',
				                  self.numberOfBuilders)

		context.insert(4,bu_app)
		bu_app.set('instance',str(index))

		## Set instance and url
		for app in context.findall(QN(self.xdaqns, 'Application').text):
			if app.attrib['class'] != "%s::BU"%self.evbns: continue
			app.set('instance', str(index))
			break
		context.set('url', context.get('url')%(index, index))

		module = Element(QN(self.xdaqns, 'Module').text)
		module.text = "$XDAQ_ROOT/lib/libevb.so"
		context.insert(5,module)

		return context
Пример #12
0
    def makeRU(self, ruindex):
        fragmentname = 'RU/gevb2g/msio/RU_context_msio.xml'
        context = elementFromFile(os.path.join(self.fragmentdir, fragmentname))

        ## Add policy
        addFragmentFromFile(
            target=context,
            filename=os.path.join(
                self.fragmentdir,
                'RU/gevb2g/msio/RU_policy_%s_msio.xml' % self.ptprot),
            index=0)
        polns = "http://xdaq.web.cern.ch/xdaq/xsd/2013/XDAQPolicy-10"
        for element in context.findall(
                QN(polns, "policy").text + '/' + QN(polns, "element").text):
            if 'RU%d' in element.get('pattern'):
                element.set(
                    'pattern',
                    element.get('pattern').replace('RU%d', 'RU%d' % (ruindex)))
        ## Add builder network endpoint
        context.insert(
            1,
            Element(
                QN(self.xdaqns, 'Endpoint').text, {
                    'protocol': '%s' % self.ptprot,
                    'service': "i2o",
                    'hostname': 'RU%d_I2O_HOST_NAME' % (ruindex),
                    'port': 'RU%d_I2O_PORT' % (ruindex),
                    'network': "infini"
                }))
        ## Add builder network pt application
        addFragmentFromFile(
            target=context,
            filename=os.path.join(
                self.fragmentdir,
                'RU/gevb2g/msio/RU_%s_application_msio.xml' % self.ptprot),
            index=2)  ## add after the two endpoints

        ## Configure IBV application:
        if self.setDynamicIBVConfig:
            self.configureIBVApplication(context, self.RUIBVConfig)

        ## Add corresponding module
        module = Element(QN(self.xdaqns, 'Module').text)
        module.text = "$XDAQ_ROOT/lib/libpt%s.so" % self.ptprot
        context.insert(3, module)

        ## Add corresponding module
        module = Element(QN(self.xdaqns, 'Module').text)
        module.text = "$XDAQ_ROOT/lib/libxdaq2rc.so"
        context.insert(4, module)

        ## Add Inputemulator application
        inputemu_app = elementFromFile(filename=os.path.join(
            self.fragmentdir, 'RU/gevb2g/msio/RU_inputemulator.xml'))
        inputemu_app.set('instance', str(ruindex))
        context.insert(5, inputemu_app)

        ## RU application
        ru_app = elementFromFile(filename=os.path.join(
            self.fragmentdir, 'RU/gevb2g/msio/RU_application_msio.xml'))
        context.insert(6, ru_app)
        ru_app.set('instance', str(ruindex))

        ## Set instance and url
        for app in context.findall(QN(self.xdaqns, 'Endpoint').text):
            if 'RU%d' in app.attrib['hostname']:
                app.set('hostname', app.get('hostname') % ruindex)
            if 'RU%d' in app.attrib['port']:
                app.set('port', app.get('port') % ruindex)
        context.set('url', context.get('url') % (ruindex, ruindex))

        self.setPropertyInAppInContext(context,
                                       'gevb2g::InputEmulator',
                                       'destinationClassInstance',
                                       str(ruindex),
                                       instance=ruindex)

        return context
Пример #13
0
    def configureIBVforGevb2gIE(self):
        RUFragmentPath = os.path.join(
            self.fragmentdir, 'RU/gevb2g/msio/RU_ibv_application_msio.xml')
        BUFragmentPath = os.path.join(
            self.fragmentdir, 'BU/gevb2g/msio/BU_ibv_application_msio.xml')
        EVMFragmentPath = os.path.join(
            self.fragmentdir, 'EVM/msio/EVM_ibv_application_msio.xml')

        RUIBVApp = elementFromFile(filename=RUFragmentPath)
        BUIBVApp = elementFromFile(filename=BUFragmentPath)
        EVMIBVApp = elementFromFile(filename=EVMFragmentPath)

        BUApp = elementFromFile(filename=os.path.join(
            self.fragmentdir, 'BU/gevb2g/msio/BU_application_msio.xml'))
        maxResources = int(
            self.readPropertyFromApp(application=BUApp,
                                     prop_name="maxResources"))

        RUMaxMSize = int(
            self.readPropertyFromApp(application=RUIBVApp,
                                     prop_name="maxMessageSize"))

        BUMaxMSize = int(
            self.readPropertyFromApp(application=BUIBVApp,
                                     prop_name="maxMessageSize"))
        self.maxMessageSize = RUMaxMSize if RUMaxMSize == BUMaxMSize else None

        # RU/Client:
        if self.clientSendQPSize is not None:
            sendQPSize = self.clientSendQPSize
        else:
            sendQPSize = maxResources * self.nbus

        if self.clientSendPoolSize is not None:
            sendPoolSize = 1024 * 1024 * self.clientSendPoolSize
        else:
            sendPoolSize = sendQPSize * RUMaxMSize

        if self.clientComplQPSize is not None:
            complQPSize = self.clientComplQPSize
        else:
            complQPSize = 8192

        recvPoolSize = 0x2000000
        recvQPSize = 64

        self.RUIBVConfig = (sendPoolSize, recvPoolSize, complQPSize,
                            sendQPSize, recvQPSize)

        # BU/Server:
        if self.serverRecvQPSize is not None:
            recvQPSize = self.serverRecvQPSize
        else:
            recvQPSize = int(self.RUIBVConfig[0] * 2 / self.nrus / BUMaxMSize)

        if self.serverRecvPoolSize is not None:
            recvPoolSize = 1024 * 1024 * self.serverRecvPoolSize
        else:
            recvPoolSize = int(
                (recvQPSize + maxResources) * self.nrus * BUMaxMSize)
            # recvPoolSize = int(recvQPSize*self.nrus*BUMaxMSize*1.4)

        if self.serverComplQPSize is not None:
            complQPSize = self.serverComplQPSize
        else:
            complQPSize = recvQPSize * self.nrus

        sendPoolSize = 0x2000000
        sendQPSize = 64

        self.BUIBVConfig = (sendPoolSize, recvPoolSize, complQPSize,
                            sendQPSize, recvQPSize)

        # EVM:
        sendPoolSize = maxResources * 256 * 1024 * self.nbus * 2
        recvPoolSize = maxResources * 256 * 1024 * self.nbus * 2
        recvQPSize = maxResources * 2
        sendQPSize = maxResources
        complQPSize = maxResources * 2 * self.nbus

        self.EVMIBVConfig = (sendPoolSize, recvPoolSize, complQPSize,
                             sendQPSize, recvQPSize)
Пример #14
0
	def configureIBVforEvBIE(self):
		## TODO: Update!
		RUFragmentPath = os.path.join(self.fragmentdir,
                           'RU/evb/RU_ibv_application.xml')
		BUFragmentPath = os.path.join(self.fragmentdir,
                           'BU/BU_ibv_application.xml')

		RUIBVApp = elementFromFile(filename=RUFragmentPath)
		BUIBVApp = elementFromFile(filename=BUFragmentPath)

		BUApp = elementFromFile(filename=os.path.join(self.fragmentdir,
				                  'BU/evb/BU_application.xml'))
		maxResources = int(self.readPropertyFromApp(
		                        application=BUApp,
		                        prop_name="maxEvtsUnderConstruction")) #??

		if not self.maxMessageSize:
			RUMaxMSize = int(self.readPropertyFromApp(
				                        application=RUIBVApp,
				                        prop_name="maxMessageSize"))

			BUMaxMSize = int(self.readPropertyFromApp(
				                        application=BUIBVApp,
				                        prop_name="maxMessageSize"))

			if not RUMaxMSize == BUMaxMSize:
				printWarningWithWait('Differing maxMessageSize on RU and BU',
					                 waittime=2)
			else:
				self.maxMessageSize = RUMaxMSize

		# RU:
		if self.RUSendQPSize is not None:
			sendQPSize = self.RUSendQPSize
		else:
			sendQPSize = 1024

		if self.RUSendPoolSize is not None:
			sendPoolSize = 1024*1024*self.RUSendPoolSize
		else:
			sendPoolSize = 7*1024**3

		if self.RUComplQPSize is not None:
			complQPSize = self.RUComplQPSize
		else:
			complQPSize = 64*1024

		recvPoolSize = 1*1024**3
		recvQPSize = 2048

		self.RUIBVConfig = (sendPoolSize, recvPoolSize,
			                complQPSize, sendQPSize, recvQPSize)

		# BU:
		if self.BURecvQPSize is not None:
			recvQPSize = self.BURecvQPSize
		else:
			recvQPSize = 512

		if self.BURecvPoolSize is not None:
			recvPoolSize = 1024*1024*self.BURecvPoolSize
		else:
			recvPoolSize = 10*1024**3

		if self.BUComplQPSize is not None:
			complQPSize = self.BUComplQPSize
		else:
			complQPSize = 64*1024

		sendPoolSize = 1536*1024**2
		sendQPSize = 128

		self.BUIBVConfig = (sendPoolSize, recvPoolSize,
			                complQPSize, sendQPSize, recvQPSize)

		# EVM
		sendPoolSize = 10*1024**3
		recvPoolSize = 4*1024**3
		recvQPSize   = 256
		sendQPSize   = 1024
		complQPSize  = 64*1024

		self.EVMIBVConfig = (sendPoolSize, recvPoolSize,
			                complQPSize, sendQPSize, recvQPSize)
Пример #15
0
    def makeBU(self, index):
        fragmentname = 'BU/BU_context.xml'
        context = elementFromFile(os.path.join(self.fragmentdir, fragmentname))

        ## Add policy
        addFragmentFromFile(
            target=context,
            filename=os.path.join(
                self.fragmentdir,
                'BU/gevb2g/msio/BU_policy_%s_msio.xml' % (self.ptprot)),
            index=0)
        ## Add builder network endpoint
        context.insert(
            1,
            Element(
                QN(self.xdaqns, 'Endpoint').text, {
                    'protocol': '%s' % self.ptprot,
                    'service': 'i2o',
                    'hostname': 'BU%d_I2O_HOST_NAME' % (index),
                    'port': 'BU%d_I2O_PORT' % (index),
                    'network': 'infini'
                }))
        ## Add builder network pt application
        addFragmentFromFile(
            target=context,
            filename=os.path.join(
                self.fragmentdir,
                'BU/gevb2g/msio/BU_%s_application_msio.xml' % (self.ptprot)),
            index=2)  ## add after the two endpoints

        ## Configure IBV application:
        if self.setDynamicIBVConfig:
            self.configureIBVApplication(context, self.BUIBVConfig)

        ## Add corresponding module
        module = Element(QN(self.xdaqns, 'Module').text)
        module.text = "$XDAQ_ROOT/lib/libpt%s.so" % self.ptprot
        context.insert(3, module)

        ## Add corresponding module
        module = Element(QN(self.xdaqns, 'Module').text)
        module.text = "$XDAQ_ROOT/lib/libxdaq2rc.so"
        context.insert(4, module)

        ## BU application
        bu_app = elementFromFile(filename=os.path.join(
            self.fragmentdir, 'BU/gevb2g/msio/BU_application_msio.xml'))
        context.insert(5, bu_app)
        bu_app.set('instance', str(index))

        ## Set instance and url
        for app in context.findall(QN(self.xdaqns, 'Application').text):
            if app.attrib['class'] != "%s::BU" % self.evbns: continue
            app.set('instance', str(index))
            break
        context.set('url', context.get('url') % (index, index))

        module = Element(QN(self.xdaqns, 'Module').text)
        module.text = "$XDAQ_ROOT/lib/libgevb2g.so"
        context.insert(6, module)

        return context
Пример #16
0
	def configureIBVforMSIO(self):
		fragmentPath = os.path.join(self.fragmentdir,
                          'msio/%s_ibv_application.xml')
		RUIBVApp = elementFromFile(filename=fragmentPath%'client')
		BUIBVApp = elementFromFile(filename=fragmentPath%'server')

		BUApp = elementFromFile(filename=os.path.join(self.fragmentdir,
				                  'BU/gevb2g/msio/BU_application_msio.xml'))

		RUMaxMSize = int(self.readPropertyFromApp(
			                        application=RUIBVApp,
			                        prop_name="maxMessageSize"))

		BUMaxMSize = int(self.readPropertyFromApp(
			                        application=BUIBVApp,
			                        prop_name="maxMessageSize"))
		self.maxMessageSize = RUMaxMSize if RUMaxMSize == BUMaxMSize else None

		# Client:
		if self.clientSendQPSize is not None:
			sendQPSize = self.clientSendQPSize
		else:
			sendQPSize = int(self.readPropertyFromApp(
		                              application=RUIBVApp,
		                              prop_name="sendQueuePairSize"))

		if self.clientSendPoolSize is not None:
			sendPoolSize = 1024*1024*self.clientSendPoolSize
		else:
			sendPoolSize = (sendQPSize/16)*RUMaxMSize*self.nrus

		if self.clientComplQPSize is not None:
			complQPSize = self.clientComplQPSize
		else:
			complQPSize = (sendQPSize/16)*self.nrus

		recvPoolSize = 0x800000
		recvQPSize = 1

		self.RUIBVConfig = (sendPoolSize, recvPoolSize,
			                complQPSize, sendQPSize, recvQPSize)

		# Server:
		if self.serverRecvPoolSize is not None:
			recvPoolSize = 1024*1024*self.serverRecvPoolSize
		else:
			recvPoolSize = (recvQPSize*2)*self.nrus*BUMaxMSize


		if self.serverRecvQPSize is not None:
			recvQPSize = self.serverRecvQPSize
		else:
			recvQPSize = int(self.RUIBVConfig[0]*2/self.nrus/BUMaxMSize)

		if self.serverComplQPSize is not None:
			complQPSize = self.serverComplQPSize
		else:
			complQPSize = recvQPSize*self.nrus

		sendPoolSize = 0x800000
		sendQPSize = 1
		self.BUIBVConfig = (sendPoolSize, recvPoolSize,
			                complQPSize, sendQPSize, recvQPSize)
Пример #17
0
	def makeRU(self, ruindex):
		fragmentname = 'RU/evb/RU_context_bare.xml'
		context = elementFromFile(os.path.join(self.fragmentdir,fragmentname))

		## Add policy
		addFragmentFromFile(target=context,
			                filename=os.path.join(self.fragmentdir,
			                'RU/evb/RU_policy_%s.xml'%
			                self.ptprot),
			                index=0)
		polns = "http://xdaq.web.cern.ch/xdaq/xsd/2013/XDAQPolicy-10"
		for element in context.findall(QN(polns,"policy").text+'/'+
			                              QN(polns,"element").text):
			if 'RU%d' in element.get('pattern'):
				element.set('pattern',element.get('pattern').replace(
					                         'RU%d', 'RU%d'%(ruindex)))
		## Add builder network endpoint
		context.insert(1,Element(QN(self.xdaqns, 'Endpoint').text,
			              {'protocol':'%s'%self.ptprot ,
			               'service':"i2o",
			               'hostname':'RU%d_I2O_HOST_NAME'%(ruindex),
			               'port':'RU%d_I2O_PORT'%(ruindex),
			               'network':"infini"}))
		## Add builder network pt application
		addFragmentFromFile(target=context,
		                    filename=os.path.join(self.fragmentdir,
		                    'RU/evb/RU_%s_application.xml'%
		                    self.ptprot),
		                    index=2) ## add after the two endpoints

		## Configure IBV application:
		if self.setDynamicIBVConfig:
			if ruindex == 0:
				self.configureIBVApplication(context, self.EVMIBVConfig,
					                         maxMessageSize=self.maxMessageSize)
			else:
				self.configureIBVApplication(context, self.RUIBVConfig,
					                         maxMessageSize=self.maxMessageSize)

		## Add corresponding module
		module = Element(QN(self.xdaqns, 'Module').text)
		module.text = "$XDAQ_ROOT/lib/libpt%s.so"%self.ptprot
		context.insert(3,module)

		## RU application
		ru_app_filename = os.path.join(self.fragmentdir,
			                  'RU/evb/RU_application.xml')
		if ruindex == 0:
			ru_app_filename = os.path.join(self.fragmentdir,
				              'RU/evb/RU_application_EVM.xml')

		ru_app = elementFromFile(filename=ru_app_filename)

		## Remove numberOfResponders, fragmentFIFOCapacity:
		self.removePropertyInApp(ru_app, 'numberOfResponders')
		self.removePropertyInApp(ru_app, 'fragmentFIFOCapacity')

		## Set inputSource to Local:
		self.setPropertyInApp(ru_app, 'inputSource', 'Local')

		## Set blockSize
		if self.maxMessageSize:
			newBlockSize = self.maxMessageSize/2**10*1000
			self.setPropertyInApp(ru_app, 'blockSize', str(newBlockSize))

		## Set maxTriggerRate (in Hz, 0 is unlimited):
		if not self.setRate == 0:
			self.setPropertyInApp(ru_app, 'maxTriggerRate', self.setRate)

		## fedSourceIds are created automatically, remove them
		# self.removePropertyInApp(ru_app, 'fedSourceIds')

		## Put one fedSourceId
		ruevbappns = (self.xdaqappns%'evb::RU' if
			          ruindex>0 else self.xdaqappns%'evb::EVM')
		fedSourceIds = ru_app.find(QN(ruevbappns, 'properties').text+'/'+
			                       QN(ruevbappns, 'fedSourceIds').text)
		fedSourceIds.attrib[QN(self.soapencns, 'arrayType').text] = (
			                       "xsd:ur-type[1]")
		item_element = fedSourceIds.find(QN(ruevbappns,'item').text)
		item_element.text = str(ruindex)

		# ## In case of EvB, add expected fedids
		# if self.evbns == 'evb':
		# 	ruevbappns = (self.xdaqappns%'evb::RU' if
		# 		          ru.index>0 else self.xdaqappns%'evb::EVM')
		# 	fedSourceIds = ru_app.find(QN(ruevbappns, 'properties').text+'/'+
		# 		                       QN(ruevbappns, 'fedSourceIds').text)
		# 	fedSourceIds.attrib[QN(self.soapencns, 'arrayType').text] = (
		# 		                       "xsd:ur-type[%d]"%(len(feds_to_add)))
		# 	item_element = fedSourceIds.find(QN(ruevbappns,'item').text)
		# 	fedSourceIds.remove(item_element)
		# 	for n,fed in enumerate(feds_to_add):
		# 		item_to_add = deepcopy(item_element)
		# 		item_to_add.attrib[QN(self.soapencns, 'position').text] = (
		# 			                                                '[%d]'%n)
		# 		item_to_add.text = str(fed)
		# 		fedSourceIds.append(item_to_add)

		context.insert(5,ru_app)
		ru_app.set('instance',str(ruindex))


		## Set instance and url
		for app in context.findall(QN(self.xdaqns, 'Endpoint').text):
			if 'RU%d' in app.attrib['hostname']:
				app.set('hostname', app.get('hostname')%ruindex)
			if 'RU%d' in app.attrib['port']:
				app.set('port', app.get('port')%ruindex)
		context.set('url', context.get('url')%(ruindex, ruindex))

		return context