Skip to content

Commit

Permalink
allow automatic power on/off of board using PDU during enabling/disab…
Browse files Browse the repository at this point in the history
…ling in netbox

Signed-off-by: kimpaller <[email protected]>
  • Loading branch information
kimpaller committed Oct 24, 2024
1 parent f511993 commit 646f4b2
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions nebula/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1435,6 +1435,7 @@ def check_board_booted(
"yamlfilename": "Path to yaml config file. Default: /etc/default/nebula",
"board_name": "Name of DUT design (Ex: zynq-zc706-adv7511-fmcdaq2). Require for multi-device config files",
"load_config": "Load configuration parameters from yamlfilename. Default: true",
"power_off": "Power off the board using PDU. Default: False",
}
)
def disable_board(
Expand All @@ -1448,6 +1449,7 @@ def disable_board(
yamlfilename="/etc/default/nebula",
board_name=None,
load_config=True,
power_off=False,
):
"""Change status to offline and log reason to journal"""
nb = nebula.netbox(
Expand All @@ -1462,6 +1464,14 @@ def disable_board(
device = nebula.NetboxDevice(nb)
device.disable(reason, failure)

# power off board
if power_off:
p = nebula.pdu(
yamlfilename=yamlfilename,
board_name=board_name,
)
p.power_down_board()


@task(
help={
Expand All @@ -1473,6 +1483,7 @@ def disable_board(
"yamlfilename": "Path to yaml config file. Default: /etc/default/nebula",
"board_name": "Name of DUT design (Ex: zynq-zc706-adv7511-fmcdaq2). Require for multi-device config files",
"load_config": "Load configuration parameters from yamlfilename. Default: true",
"power_on": "Power on the board using PDU. Default: False",
}
)
def enable_board(
Expand All @@ -1485,6 +1496,7 @@ def enable_board(
yamlfilename="/etc/default/nebula",
board_name=None,
load_config=True,
power_on=False,
):
"""Change status to active and log reason to journal"""
nb = nebula.netbox(
Expand All @@ -1499,6 +1511,14 @@ def enable_board(
device = nebula.NetboxDevice(nb)
device.enable(reason)

# power on board
if power_on:
p = nebula.pdu(
yamlfilename=yamlfilename,
board_name=board_name,
)
p.power_up_board()


@task(
help={
Expand Down

0 comments on commit 646f4b2

Please sign in to comment.