Commit e36f09de authored by Andrea Petrucci's avatar Andrea Petrucci
Browse files

references #226: add suport for GEVB in EVB scripts

parent 556052bd
......@@ -107,6 +107,13 @@ class Application:
module = ET.Element(QN(ns,'Module'))
module.text = "$XDAQ_ROOT/lib/libFerol40Controller.so"
context.append(module)
elif self.params['class'].startswith('gevb2g::'):
module = ET.Element(QN(ns,'Module'))
try:
module.text = os.environ["HOME"]+"/git/worksuite/gevb2g/lib/linux/x86_64_centos8/libgevb2g.so"
except KeyError:
module.text = "$XDAQ_ROOT/lib/libgevb2g.so"
context.append(module)
elif self.params['class'].startswith('evb::'):
module = ET.Element(QN(ns,'Module'))
try:
......@@ -119,7 +126,7 @@ class Application:
#module = ET.Element(QN(ns,'Module'))
#module.text = "/opt/dip/lib64/libdip.so"
#context.append(module)
def addTargetElement(self,protocol,ns):
......
......@@ -12,13 +12,14 @@ import XMLtools
class Configuration():
def __init__(self,symbolMap,useNuma):
def __init__(self,symbolMap,useNuma,evbType = 'EVB'):
self.symbolMap = symbolMap
self.useNuma = useNuma
self.contexts = {}
self.ptUtcp = []
self.ptIBV = []
self.applications = {}
self.evbType = evbType
self.xcns = 'http://xdaq.web.cern.ch/xdaq/xsd/2004/XMLConfiguration-30'
......@@ -38,6 +39,14 @@ class Configuration():
self.addAppInfoToApplications('RU',appInfo)
elif app.params['class'] == 'evb::BU':
self.addAppInfoToApplications('BU',appInfo)
elif app.params['class'] == 'gevb2g::EVM':
self.addAppInfoToApplications('EVM',appInfo)
elif app.params['class'] == 'gevb2g::InputEmulator':
self.addAppInfoToApplications('IE',appInfo)
elif app.params['class'] == 'gevb2g::RU':
self.addAppInfoToApplications('RU',appInfo)
elif app.params['class'] == 'gevb2g::BU':
self.addAppInfoToApplications('BU',appInfo)
elif app.params['class'] == 'pt::utcp::Application':
self.ptUtcp.append( copy.deepcopy(appInfo) )
elif app.params['class'] == 'pt::ibv::Application':
......@@ -61,10 +70,16 @@ class Configuration():
return True
if self.contexts[myKey].role in ('EVM','EVMBU') and self.contexts[otherKey].role in ('RU','BU','RUBU'):
return True
if self.contexts[myKey].role == 'RU' and self.contexts[otherKey].role in ('BU','RUBU'):
return True
if self.contexts[myKey].role == 'BU' and self.contexts[otherKey].role in ('EVM','EVMBU'):
return True
if self.contexts[myKey].role == 'RU':
if self.evbType == 'EVB' and self.contexts[otherKey].role in ('BU','RUBU'):
return True
elif self.evbType == 'GEVB' and self.contexts[otherKey].role in ('BU','RUBU','EVM','EVMBU'):
return True
if self.contexts[myKey].role == 'BU':
if self.evbType == 'EVB' and self.contexts[otherKey].role in ('EVM','EVMBU'):
return True
elif self.evbType == 'GEVB' and self.contexts[otherKey].role in ('EVM','EVMBU','RU'):
return True
if self.contexts[myKey].role == 'RUBU' and self.contexts[otherKey].role in ('EVM','EVMBU','BU','RUBU'):
return True
return False
......@@ -216,6 +231,10 @@ class ConfigFromFile(Configuration):
if fixPorts:
self.rewriteFerolProperties(app,hostinfo['frlHostname'])
self.setOperationMode(app,ferolMode)
elif app.params['class'].startswith('gevb2g::'):
app.params['network'] = 'infini'
app.params['tid'] = str(tid)
tid += 1
elif app.params['class'].startswith('evb::'):
app.params['network'] = 'infini'
app.params['tid'] = str(tid)
......
......@@ -11,8 +11,9 @@ import XMLtools
class Context:
ptInstance = 0
def __init__(self,role,hostinfo):
def __init__(self,role,evbType,hostinfo):
self.role = role
self.evbType = evbType
self.hostinfo = hostinfo
if 'd3vrubu-c2e33-06-01' in self.hostinfo['i2oHostname'] or 'd3vrubu-c2e33-08-01' in self.hostinfo['i2oHostname'] or\
'd3vrubu-c2e33-10-01' in self.hostinfo['i2oHostname'] or 'd3vrubu-c2e33-12-01' in self.hostinfo['i2oHostname'] or\
......@@ -41,7 +42,7 @@ class Context:
app.addInContext(context,ns)
else:
app.addI2OEndpointInContext(context,ns)
if app.params['class'].startswith('evb::'):
if app.params['class'].startswith('evb::') or app.params['class'].startswith('gevb2g::'):
context.append( app.getApplicationContext(ns) )
return context
......@@ -93,15 +94,21 @@ class Context:
('GIDType','string','v2'),
('portNumber','unsignedInt','1')
]
properties.extend([
('sendPoolName','string','sudapl'),
('recvPoolName','string','rudapl'),
('deviceMTU','unsignedInt','4096'),
('memAllocTimeout','string','PT1S'),
('sendWithTimeout','boolean','true'),
('useRelay','boolean','false'),
('maxMessageSize','unsignedInt',maxMessageSize)
])
if self.evbType == 'GEVB':
properties.extend([
('deviceMTU','unsignedInt','4096'),
('maxMessageSize','unsignedInt',maxMessageSize)
])
else:
properties.extend([
('sendPoolName','string','sudapl'),
('recvPoolName','string','rudapl'),
('deviceMTU','unsignedInt','4096'),
('memAllocTimeout','string','PT1S'),
('sendWithTimeout','boolean','true'),
('useRelay','boolean','false'),
('maxMessageSize','unsignedInt',maxMessageSize)
])
if self.role == 'EVM':
properties.extend([
('senderPoolSize','unsignedLong','0x2A570C00'),
......@@ -111,37 +118,73 @@ class Context:
('recvQueuePairSize','unsignedInt','80')
])
elif self.role == 'RU':
properties.extend([
('senderPoolSize','unsignedLong','0xBAE14800'),
('receiverPoolSize','unsignedLong','0x5D70A400'),
('completionQueueSize','unsignedInt','23860'),
('sendQueuePairSize','unsignedInt','320'),
('recvQueuePairSize','unsignedInt','500')
])
if self.evbType == 'GEVB':
properties.extend([
('senderPoolSize','unsignedLong','0x4000000'),
('receiverPoolSize','unsignedLong','0x2000000'),
('completionQueueSize','unsignedInt','8192'),
('sendQueuePairSize','unsignedInt','8192'),
('recvQueuePairSize','unsignedInt','64')
])
else:
properties.extend([
('senderPoolSize','unsignedLong','0xBAE14800'),
('receiverPoolSize','unsignedLong','0x5D70A400'),
('completionQueueSize','unsignedInt','23860'),
('sendQueuePairSize','unsignedInt','320'),
('recvQueuePairSize','unsignedInt','500')
])
elif self.role == 'BU':
properties.extend([
('senderPoolSize','unsignedLong','0xA3D800'),
('receiverPoolSize','unsignedLong','0x1788E3800'),
('completionQueueSize','unsignedInt','32400'),
('sendQueuePairSize','unsignedInt','80'),
('recvQueuePairSize','unsignedInt','320')
])
if self.evbType == 'GEVB':
properties.extend([
('senderPoolSize','unsignedLong','0x2000000'),
('receiverPoolSize','unsignedLong','0x80000000'),
('completionQueueSize','unsignedInt','8192'),
('sendQueuePairSize','unsignedInt','64'),
('recvQueuePairSize','unsignedInt','4092')
])
else:
properties.extend([
('senderPoolSize','unsignedLong','0xA3D800'),
('receiverPoolSize','unsignedLong','0x1788E3800'),
('completionQueueSize','unsignedInt','32400'),
('sendQueuePairSize','unsignedInt','80'),
('recvQueuePairSize','unsignedInt','320')
])
elif self.role == 'EVMBU':
properties.extend([
('senderPoolSize','unsignedLong','0x200000000'),
('receiverPoolSize','unsignedLong','0x200000000'), #maximum pool size with 65536 buffers of 131072 bytes
('completionQueueSize','unsignedInt','32400'),
('sendQueuePairSize','unsignedInt','1024'),
('recvQueuePairSize','unsignedInt','1024')
])
if self.evbType == 'GEVB':
properties.extend([
('senderPoolSize','unsignedLong','0xFA7D0000'),
('receiverPoolSize','unsignedLong','0xFA7D0000'), #maximum pool size with 65536 buffers of 131072 bytes
('completionQueueSize','unsignedInt','16384'),
('sendQueuePairSize','unsignedInt','8192'),
('recvQueuePairSize','unsignedInt','4092')
])
else:
properties.extend([
('senderPoolSize','unsignedLong','0x200000000'),
('receiverPoolSize','unsignedLong','0x200000000'), #maximum pool size with 65536 buffers of 131072 bytes
('completionQueueSize','unsignedInt','32400'),
('sendQueuePairSize','unsignedInt','1024'),
('recvQueuePairSize','unsignedInt','1024')
])
elif self.role == 'RUBU':
properties.extend([
('senderPoolSize','unsignedLong','0x200000000'),
('receiverPoolSize','unsignedLong','0x200000000'), #maximum pool size with 65536 buffers of 131072 bytes
('completionQueueSize','unsignedInt','32400'),
('sendQueuePairSize','unsignedInt','1024'),
('recvQueuePairSize','unsignedInt','1024')
])
if self.evbType == 'GEVB':
properties.extend([
('senderPoolSize','unsignedLong','0xFA7D0000'),
('receiverPoolSize','unsignedLong','0xFA7D0000'), #maximum pool size with 65536 buffers of 131072 bytes
('completionQueueSize','unsignedInt','16384'),
('sendQueuePairSize','unsignedInt','8192'),
('recvQueuePairSize','unsignedInt','4092')
])
else:
properties.extend([
('senderPoolSize','unsignedLong','0x200000000'),
('receiverPoolSize','unsignedLong','0x200000000'), #maximum pool size with 65536 buffers of 131072 bytes
('completionQueueSize','unsignedInt','32400'),
('sendQueuePairSize','unsignedInt','1024'),
('recvQueuePairSize','unsignedInt','1024')
])
app = Application.Application('pt::ibv::Application',Context.ptInstance,properties)
app.params['protocol'] = 'ibv'
......@@ -211,15 +254,120 @@ class FEROL(Context):
FEROL.instance = 0
class GEVB_RU(Context):
instance = 0
def __init__(self,symbolMap,properties=[],maxMessageSize='0x40000'):
evbType = 'GEVB'
if RU.instance == 0:
role = 'EVM'
else:
role = 'RU'
Context.__init__(self,role,evbType,symbolMap.getHostInfo('RU'+str(RU.instance)))
self.addPeerTransport(maxMessageSize)
self.addRuApplication(maxMessageSize,properties)
RU.instance += 1
def addRuApplication(self,maxMessageSize,properties):
if self.role in ('EVM','EVMBU'):
app = Application.Application('gevb2g::EVM',RU.instance,properties)
app.params['tid'] = '1'
app.params['id'] = '50'
app.params['network'] = 'evb'
else:
currentInstane = RU.instance-1
app = Application.Application('gevb2g::RU',currentInstane,properties)
app.params['tid'] = str(10+currentInstane)
app.params['id'] = str(50+currentInstane)
app.params['network'] = 'evb'
# Add Input Emulator
inputEmulatorProperties = [
('StdDev','unsignedLong','256'),
('Mean','unsignedLong','12'),
('MinFragmentSize','unsignedLong','16'),
('MaxFragmentSize','unsignedLong',maxMessageSize),
('destinationClassName','string','gevb2g::RU'),
('destinationClassInstance','unsignedLong',str(currentInstane)),
('maxDataFrameSize','unsignedLong',maxMessageSize),
('frameSendCounter','unsignedLong','0'),
('fixedSize','boolean','true'),
('rate','unsignedLong','1000000'),
('createPool','boolean','false'),
('poolName','string','sibv')
]
inputEmulatorApp= Application.Application('gevb2g::InputEmulator',currentInstane,inputEmulatorProperties)
inputEmulatorApp.params['tid'] = str(200+currentInstane)
inputEmulatorApp.params['id'] = str(200+currentInstane)
inputEmulatorApp.params['network'] = 'evb'
self.applications.append(inputEmulatorApp)
self.applications.append(app)
def getPolicyElements(self):
policyElements = []
return policyElements
class GEVB_BU(Context):
instance = 0
def __init__(self,symbolMap,properties=[],maxMessageSize='0x40000'):
evbType = 'GEVB'
role = 'BU'
Context.__init__(self,role,evbType,symbolMap.getHostInfo('BU'+str(BU.instance)))
self.addPeerTransport(maxMessageSize)
self.addBuApplication(properties)
BU.instance += 1
def addBuApplication(self,properties):
app = Application.Application('gevb2g::BU',BU.instance,properties)
app.params['tid'] = str(100+BU.instance)
app.params['id'] = str(100+BU.instance)
app.params['network'] = 'evb'
self.applications.append(app)
def getPolicyElements(self):
policyElements = []
return policyElements
class GEVB_RUBU(GEVB_RU):
def __init__(self,symbolMap,ruProperties=[],buProperties=[],maxMessageSize='0x40000'):
evbType = 'GEVB'
if RU.instance == 0:
role = 'EVMBU'
else:
role = 'RUBU'
Context.__init__(self,role,evbType,symbolMap.getHostInfo('RU'+str(RU.instance)))
self.addPeerTransport(maxMessageSize)
self.addRuApplication(maxMessageSize,ruProperties)
self.addBuApplication(buProperties)
RU.instance += 1
def addBuApplication(self,properties):
currentInstane = RU.instance-1
app = Application.Application('gevb2g::BU',currentInstane,properties)
app.params['tid'] = str(100+currentInstane)
app.params['id'] = str(100+currentInstane)
app.params['network'] = 'evb'
self.applications.append(app)
def getPolicyElements(self):
policyElements = []
return policyElements
class RU(Context):
instance = 0
def __init__(self,symbolMap,properties=[],maxMessageSize='0x40000'):
evbType = 'EVB'
if RU.instance == 0:
role = 'EVM'
else:
role = 'RU'
Context.__init__(self,role,symbolMap.getHostInfo('RU'+str(RU.instance)))
Context.__init__(self,role,evbType,symbolMap.getHostInfo('RU'+str(RU.instance)))
self.addPeerTransport(maxMessageSize)
self.addRuApplication(properties)
RU.instance += 1
......@@ -325,9 +473,10 @@ class RU(Context):
class BU(Context):
instance = 0
def __init__(self,symbolMap,properties=[],maxMessageSize='0x40000'):
Context.__init__(self,'BU',symbolMap.getHostInfo('BU'+str(BU.instance)))
evbType = 'EVB'
role = 'BU'
Context.__init__(self,role,evbType,symbolMap.getHostInfo('BU'+str(BU.instance)))
self.addPeerTransport(maxMessageSize)
self.addBuApplication(properties)
BU.instance += 1
......@@ -380,11 +529,12 @@ class BU(Context):
class RUBU(RU):
def __init__(self,symbolMap,ruProperties=[],buProperties=[],maxMessageSize='0x40000'):
type = 'EVB'
if RU.instance == 0:
role = 'EVMBU'
else:
role = 'RUBU'
Context.__init__(self,role,symbolMap.getHostInfo('RU'+str(RU.instance)))
Context.__init__(self,role,type,symbolMap.getHostInfo('RU'+str(RU.instance)))
self.addPeerTransport(maxMessageSize)
self.addRuApplication(ruProperties)
self.addBuApplication(buProperties)
......
......@@ -324,36 +324,42 @@ class TestCase:
pass
def checkRate(self):
def checkRate(self,args):
print("Checking if rate is >10 Hz:")
try:
evm = self._config.applications["EVM"][0]
dropAtSocket = ( messengers.getParam("dropAtSocket","boolean",**evm) == "true" )
dropAtStream = ( messengers.getParam("dropAtStream","boolean",**evm) == "true" )
dropAtRU = ( messengers.getParam("dropInputData","boolean",**evm) == "true" )
if not dropAtSocket and not dropAtStream:
self.checkAppParam("eventRate","unsignedInt",10,operator.ge,"EVM")
self.checkAppParam("eventRate","unsignedInt",10,operator.ge,"RU")
if not dropAtRU and not dropAtSocket and not dropAtStream:
if args['useGEVB']:
try:
self.checkAppParam("eventRate","unsignedInt",10,operator.ge,"BU")
return
except ValueException as e:
ruCounts = self.getAppParam("eventCount","unsignedLong","RU")
str = ""
for ru in sorted(ruCounts.keys()):
if ruCounts[ru] == 0:
str += " "+ru
if len(str):
print("RUs with no events:"+str)
else:
buCounts = self.getAppParam("nbEventsBuilt","unsignedLong","BU")
for bu in sorted(buCounts.keys()):
if buCounts[bu] == 0:
str += " "+bu
except ValueException as e:
raise e
else:
try:
evm = self._config.applications["EVM"][0]
dropAtSocket = ( messengers.getParam("dropAtSocket","boolean",**evm) == "true" )
dropAtStream = ( messengers.getParam("dropAtStream","boolean",**evm) == "true" )
dropAtRU = ( messengers.getParam("dropInputData","boolean",**evm) == "true" )
if not dropAtSocket and not dropAtStream:
self.checkAppParam("eventRate","unsignedInt",10,operator.ge,"EVM")
self.checkAppParam("eventRate","unsignedInt",10,operator.ge,"RU")
if not dropAtRU and not dropAtSocket and not dropAtStream:
self.checkAppParam("eventRate","unsignedInt",10,operator.ge,"BU")
return
except ValueException as e:
ruCounts = self.getAppParam("eventCount","unsignedLong","RU")
str = ""
for ru in sorted(ruCounts.keys()):
if ruCounts[ru] == 0:
str += " "+ru
if len(str):
print("BUs with no events:"+str)
#input("Press Enter to continue...")
raise e
print("RUs with no events:"+str)
else:
buCounts = self.getAppParam("nbEventsBuilt","unsignedLong","BU")
for bu in sorted(buCounts.keys()):
if buCounts[bu] == 0:
str += " "+bu
if len(str):
print("BUs with no events:"+str)
#input("Press Enter to continue...")
raise e
def getFedParams(self,fedIds,dummyFedSize,dummyFedSizeDev=0):
......@@ -419,26 +425,41 @@ class TestCase:
raise(StateException("Failed to connect pt::ibv for "+str(application)))
def configureEvB(self,maxTries=10):
def configureEvB(self,args,maxTries=10):
sys.stdout.write("Configuring EvB")
sys.stdout.flush()
self.configure('FEROL')
self.waitForAppState(('Ready','Configured'),'FEROL')
self.configure('EVM')
self.configure('RU')
self.configure('BU')
self.waitForState(('Ready','Configured'),maxTries)
if args['useGEVB']:
self.configure('IE')
self.waitForAppState(('Ready','Configured'),'IE')
self.configure('BU')
self.configure('EVM')
self.configure('RU')
self.waitForState(('Ready','Configured'),maxTries)
else:
self.configure('FEROL')
self.waitForAppState(('Ready','Configured'),'FEROL')
self.configure('EVM')
self.configure('RU')
self.configure('BU')
self.waitForState(('Ready','Configured'),maxTries)
print(" done")
def enableEvB(self,sleepTime=5,runNumber=1,maxTries=10):
sys.stdout.write("Enabling EvB with run number "+str(runNumber)+"...")
sys.stdout.flush()
self.setParam("runNumber","unsignedInt",runNumber)
self.enable('EVM')
self.enable('RU')
self.enable('BU')
self.enable('FEROL')
def enableEvB(self,args,sleepTime=5,runNumber=1,maxTries=10):
if args['useGEVB']:
self.enable('EVM')
self.enable('RU')
self.enable('BU')
time.sleep(1)
self.enable('IE')
else:
sys.stdout.write("Enabling EvB with run number "+str(runNumber)+"...")
sys.stdout.flush()
self.setParam("runNumber","unsignedInt",runNumber)
self.enable('EVM')
self.enable('RU')
self.enable('BU')
self.enable('FEROL')
self.waitForState('Enabled',maxTries)
print("done")
if sleepTime > 0:
......@@ -479,14 +500,22 @@ class TestCase:
print(" done")
def haltEvB(self,maxTries=10):
def haltEvB(self,args,maxTries=10):
sys.stdout.write("Halting EvB")
sys.stdout.flush()
self.halt('FEROL')
self.waitForAppState('Halted','FEROL')
self.halt('EVM')
self.halt('RU')
self.halt('BU')
if args['useGEVB']:
self.halt('IE')
time.sleep(1)
self.halt('EVM')
self.halt('RU')
time.sleep(4)
self.halt('BU')
else:
self.halt('FEROL')
self.waitForAppState('Halted','FEROL')
self.halt('EVM')
self.halt('RU')
self.halt('BU')
self.waitForState('Halted',maxTries)
print(" done")
time.sleep(1)
......@@ -677,18 +706,42 @@ class TestCase:
shutil.rmtree(runDir)
def getDataPoint(self):
def getDataPoint(self,args):
"""
retrieves super fragment size from the EVM and RUs,
the event size from the BUs,
and event rate from all EvB applications
"""
sizes = self.getAppParam("superFragmentSize","unsignedInt","EVM")
sizes.update( self.getAppParam("superFragmentSize","unsignedInt","RU") )
sizes.update( self.getAppParam("eventSize","unsignedInt","BU") )
rates = self.getAppParam("eventRate","unsignedInt","EVM")
rates.update( self.getAppParam("eventRate","unsignedInt","RU") )
rates.update( self.getAppParam("eventRate","unsignedInt","BU") )
sizes = {}
rates = {}
if args['useGEVB']:
# size calculation
sizes = {'EVM0':0}
ruSizes = self.getAppParam("Mean","unsignedLong","IE")
eventSize= 0
for key in ruSizes:
eventSize += ruSizes[key]
sizes[key.replace('IE','RU')] = ruSizes[key]
buSizes = self.getAppParam("currentSize","unsignedLong","BU")
for key in buSizes:
sizes[key] = eventSize
# rate calculation
buRates = self.getAppParam("eventRate","unsignedInt","BU")
ruRates = 0
for key in buRates:
ruRates += buRates[key]
rates = {'EVM0':ruRates}
for key in ruSizes:
rates[key.replace('IE','RU')] = ruRates
rates.update(buRates)
else:
sizes = self.getAppParam("superFragmentSize","unsignedInt","EVM")
sizes.update( self.getAppParam("superFragmentSize","unsignedInt","RU") )
sizes.update( self.getAppParam("eventSize","unsignedInt","BU") )
rates = self.getAppParam("eventRate","unsignedInt","EVM")
rates.update( self.getAppParam("eventRate","unsignedInt","RU") )
rates.update( self.getAppParam("eventRate","unsignedInt","BU") )
return {'rates':rates,'sizes':sizes}
......@@ -719,14 +772,27 @@ class TestCase:
"""
configures the fragment size to be generated at the FEROL/FRL or EvB