38 ):
39 """
40 Here the configuration for an entire daq_application instance using DAQModules from hermesmodules is generated.
41 """
42
43
44 UDP_PORT=0x4444
45
46
47
48
49 tx_infos = list(set([
50 (
51 s.geo_id.det_id,
52 s.geo_id.crate_id,
53 s.geo_id.slot_id,
54 s.parameters.tx_host,
55 int(s.geo_id.stream_id > 63),
56 s.parameters.tx_ip,
57 s.parameters.tx_mac,
58 s.parameters.rx_ip,
59 s.parameters.rx_mac
60 ) for s in dro_map.streams if s.kind == 'eth'
61 ]))
62
63
64 hermes_cores = group_by_key(tx_infos, lambda x: (x[0], x[1], x[2], x[3]))
65
66 modules = []
67 for (det, crate, slot, ctrl_ept), links in hermes_cores.items():
68 d = hermescontroller.Device(name=f"hermes_{det}_{crate}_{slot}", uri=f"ipbusudp-2.0://{ctrl_ept}:50001", addrtab=addrtab)
69 g = hermescontroller.GeoInfo(det_id=det, crate_id=crate, slot_id=slot)
70 lm = hermescontroller.LinkConfMap(
71 [hermescontroller.LinkConf(
72 id=link,
73 src_mac = tx_mac,
74 src_ip = tx_ip,
75 dst_mac = rx_mac,
76 dst_ip= rx_ip
77 ) for _,_,_,_,link,tx_ip,tx_mac,rx_ip,rx_mac in links]
78 )
79
80 modules += [DAQModule(name = f"hermes_{det}_{crate}_{slot}",
81 plugin = "HermesModule",
82 conf = hermescontroller.Conf(
83 device = d,
84 geo_info = g,
85 port = UDP_PORT,
86 links = lm
87 )
88 )]
89
90 mgraph = ModuleGraph(modules)
91 hermesmodules_app = App(modulegraph = mgraph, host = host, name = name)
92
93 return hermesmodules_app