DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
tde_amc_reboot.py
Go to the documentation of this file.
1#!/usr/bin/env python3
2"""
3Created on: 16/10/2025 18:27
4
5Author: Shyam Bhuller
6
7Description: Script to reboot AMCs from a TDE crate.
8"""
9import os
10import time
11import click
12
13def card_slot(slotnum : int):
14 return "0x%x" % (0x70+0x2*slotnum)
15
16
17def reboot(mch_ip : str, slot_xp : str):
18 icmd = f"ipmitool -v -I lan -H {mch_ip} -U root -P root -T 0x82 -B0 -b7"
19 icard = icmd + f" -t {slot_xp} raw 0x2E 0x03 0x00 0x00 0x60"
20
21 #? Do we ever need to use select_dune_fw and disable_flash_access?
22 cmds = {
23 "select_dune_fw" : " 0x40 0x40",
24 "reconfigure" : " 0x8 0x8",
25 "disable_flash_access" : " 0x1 0x1",
26 "reboot" : " 0x8 0x0",
27 }
28
29 for c in (cmds["reconfigure"], cmds["reboot"]):
30 cmd = icard + c
31 print(cmd)
32 os.system(cmd)
33 time.sleep(1) # could make a configurable delay
34 return
35
36
37@click.command()
38@click.argument('crate_ip', type=str)
39@click.option('-s', '--slots', type=int, multiple=True, default=[i for i in range(1,13)])
40def main(crate_ip : int, slots : list[int]):
41 print(f"boot cards in slots {slots} in crate at {crate_ip}")
42
43 for s in slots:
44 reboot(crate_ip, card_slot(s))
45 return
46
47
48if __name__=='__main__':
49 main()
main(int crate_ip, list[int] slots)
card_slot(int slotnum)
reboot(str mch_ip, str slot_xp)