hookspecs
Boardfarm plugin hookspecs.
Modules:
| Name | Description |
|---|---|
core |
Boardfarm main hook specifications. |
devices |
Boardfarm device hook specifications. |
core
Boardfarm main hook specifications.
Functions:
| Name | Description |
|---|---|
boardfarm_add_cmdline_args |
Add new command line argument(s). |
boardfarm_add_devices |
Add devices to known devices list. |
boardfarm_add_hookspecs |
Add new hookspecs to extend and/or update the framework. |
boardfarm_cmdline_parse |
Parse command line arguments. |
boardfarm_configure |
Configure boardfarm based on command line arguments or environment config. |
boardfarm_parse_config |
Parse the config. |
boardfarm_post_setup_env |
Call after the environment setup is completed for all the devices. |
boardfarm_register_devices |
Register device to plugin manager. |
boardfarm_release_devices |
Release reserved devices after use. |
boardfarm_reserve_devices |
Reserve devices before starting the deployment. |
boardfarm_setup_env |
Boardfarm environment setup for all the devices. |
boardfarm_shutdown_device |
Shutdown boardfarm device after use. |
boardfarm_add_cmdline_args
boardfarm_add_cmdline_args(argparser: ArgumentParser) -> None
Add new command line argument(s).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ArgumentParser
|
argument parser |
required |
Source code in boardfarm3/plugins/hookspecs/core.py
25 26 27 28 29 30 31 | |
boardfarm_add_devices
boardfarm_add_devices() -> dict[str, type[BoardfarmDevice]]
Add devices to known devices list.
This hook is used to let boardfarm know the devices which are configured in the inventory config. Each repo with a boardfarm device should implement this hook to add each devices to the list of known devices.
Returns:
| Type | Description |
|---|---|
dict[str, type[BoardfarmDevice]]
|
dictionary with device name and class |
Source code in boardfarm3/plugins/hookspecs/core.py
187 188 189 190 191 192 193 194 195 196 197 198 | |
boardfarm_add_hookspecs
boardfarm_add_hookspecs(plugin_manager: PluginManager) -> None
Add new hookspecs to extend and/or update the framework.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
PluginManager
|
plugin manager |
required |
Source code in boardfarm3/plugins/hookspecs/core.py
16 17 18 19 20 21 22 | |
boardfarm_cmdline_parse
boardfarm_cmdline_parse(
argparser: ArgumentParser, cmdline_args: list[str]
) -> Namespace
Parse command line arguments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ArgumentParser
|
argument parser |
required |
|
list[str]
|
command line arguments |
required |
Returns:
| Type | Description |
|---|---|
Namespace
|
command line arguments |
Source code in boardfarm3/plugins/hookspecs/core.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
boardfarm_configure
boardfarm_configure(cmdline_args: Namespace, plugin_manager: PluginManager) -> None
Configure boardfarm based on command line arguments or environment config.
This hook allows to register/deregister boardfarm plugins when you pass a command line argument. This way a plugin will be registered to boardfarm only when required.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Namespace
|
command line arguments |
required |
|
PluginManager
|
plugin manager |
required |
Source code in boardfarm3/plugins/hookspecs/core.py
72 73 74 75 76 77 78 79 80 81 82 83 84 | |
boardfarm_parse_config
boardfarm_parse_config(
cmdline_args: Namespace,
inventory_config: dict[str, Any],
env_config: dict[str, Any],
) -> BoardfarmConfig
Parse the config.
This hook allows for the modification (if needed) of the configuration files, like inventory and environment, by using cmd line overrides.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Namespace
|
command line arguments |
required |
|
dict[str, Any]
|
inventory json |
required |
|
dict[str, Any]
|
environment json |
required |
Returns:
| Type | Description |
|---|---|
BoardfarmConfig
|
a BoardfarmConfig object |
Source code in boardfarm3/plugins/hookspecs/core.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
boardfarm_post_setup_env
boardfarm_post_setup_env(
cmdline_args: Namespace, device_manager: DeviceManager
) -> None
Call after the environment setup is completed for all the devices.
This hook is used to perform required operations after the board is deployed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Namespace
|
command line arguments |
required |
|
DeviceManager
|
device manager instance |
required |
Source code in boardfarm3/plugins/hookspecs/core.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 | |
boardfarm_register_devices
boardfarm_register_devices(
config: BoardfarmConfig, cmdline_args: Namespace, plugin_manager: PluginManager
) -> DeviceManager
Register device to plugin manager.
This hook is responsible to register devices to the device manager after initialization based on the given inventory and environment config.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
BoardfarmConfig
|
boardfarm config instance |
required |
|
Namespace
|
command line arguments |
required |
|
PluginManager
|
plugin manager instance |
required |
Returns:
| Type | Description |
|---|---|
DeviceManager
|
device manager with all registered devices |
Source code in boardfarm3/plugins/hookspecs/core.py
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | |
boardfarm_release_devices
boardfarm_release_devices(
config: BoardfarmConfig,
cmdline_args: Namespace,
plugin_manager: PluginManager,
deployment_status: dict[str, Any],
) -> None
Release reserved devices after use.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
BoardfarmConfig
|
boardfarm config instance |
required |
|
Namespace
|
command line arguments |
required |
|
PluginManager
|
plugin manager instance |
required |
|
dict[str, Any]
|
deployment status data |
required |
Source code in boardfarm3/plugins/hookspecs/core.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | |
boardfarm_reserve_devices
boardfarm_reserve_devices(
cmdline_args: Namespace, plugin_manager: PluginManager
) -> dict[str, Any]
Reserve devices before starting the deployment.
This hook is used to reserve devices before deployment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Namespace
|
command line arguments |
required |
|
PluginManager
|
plugin manager instance |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
inventory configuration |
Source code in boardfarm3/plugins/hookspecs/core.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | |
boardfarm_setup_env
boardfarm_setup_env(
config: BoardfarmConfig,
cmdline_args: Namespace,
plugin_manager: PluginManager,
device_manager: DeviceManager,
) -> DeviceManager
Boardfarm environment setup for all the devices.
This hook is used to deploy boardfarm devices.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
BoardfarmConfig
|
boardfarm config |
required |
|
Namespace
|
command line arguments |
required |
|
PluginManager
|
plugin manager instance |
required |
|
DeviceManager
|
device manager instance |
required |
Returns:
| Type | Description |
|---|---|
DeviceManager
|
device manager with all devices in the environment |
Source code in boardfarm3/plugins/hookspecs/core.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | |
boardfarm_shutdown_device
boardfarm_shutdown_device() -> None
Shutdown boardfarm device after use.
This hook should be used by a device to perform a clean shutdown of a device after releasing all the resources (e.g. close all of the open ssh connections) before the shutdown of the framework.
Source code in boardfarm3/plugins/hookspecs/core.py
201 202 203 204 205 206 207 208 | |
devices
Boardfarm device hook specifications.
A Boardfarm device should belong to one of the following categories:
1. server, i.e. DHCP, ACS...
2. device, i.e. a connectivity CPE
3. attached device, i.e. a LAN client
Every device should fulfill the following responsibilities at different stages of the deployment.
Hook responsibilities:
1. skip boot
- device can be interacted with as it is without making
any changes to it
2. boot
- device is running with required software
- device can be interacted with, e.g. via console
- device has a management IP address or direct console access
if the device has a console
3. configure
- all of the points from boot
- user driven configurations are applied to the device
- device has a service IP address if applicable
Eg: A CPE device has access network IP address,
eRouter IP, except in disabled mode, eMTA IP
- for Wi-Fi clients, no connection to the Wi-Fi network
is made and no IP address on service interface is assigned
Functions:
| Name | Description |
|---|---|
boardfarm_attached_device_boot |
Boot boardfarm attached device. |
boardfarm_attached_device_boot_async |
Boot boardfarm attached device leveraging the asyncio library. |
boardfarm_attached_device_configure |
Configure boardfarm attached device. |
boardfarm_attached_device_configure_async |
Configure boardfarm attached device. |
boardfarm_device_boot |
Boot boardfarm device. |
boardfarm_device_configure |
Configure boardfarm device. |
boardfarm_device_configure_async |
Configure boardfarm device. |
boardfarm_server_boot |
Boot boardfarm server device. |
boardfarm_server_configure |
Configure boardfarm server device. |
boardfarm_server_configure_async |
Configure boardfarm server device leveraging the asyncio library. |
boardfarm_skip_boot |
Skips the booting for the device connected. |
boardfarm_skip_boot_async |
Skips the booting for the device connected. |
contingency_check |
Perform contingency check to make sure the device is working fine before use. |
validate_device_requirements |
Validate device requirements. |
validate_device_requirements_async |
Validate device requirements. |
boardfarm_attached_device_boot
boardfarm_attached_device_boot(
config: BoardfarmConfig, cmdline_args: Namespace, device_manager: DeviceManager
) -> None
Boot boardfarm attached device.
This hook should be used to boot a device which is attached to a device in the environment. E.g. LAN.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
BoardfarmConfig
|
boardfarm config instance |
required |
|
Namespace
|
command line arguments |
required |
|
DeviceManager
|
device manager instance |
required |
Source code in boardfarm3/plugins/hookspecs/devices.py
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
boardfarm_attached_device_boot_async
async
boardfarm_attached_device_boot_async(
config: BoardfarmConfig, cmdline_args: Namespace, device_manager: DeviceManager
) -> None
Boot boardfarm attached device leveraging the asyncio library.
This hook should be used to boot a device which is attached to a device in the environment. E.g. LAN. To be used for the asynchronous implementation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
BoardfarmConfig
|
boardfarm config instance |
required |
|
Namespace
|
command line arguments |
required |
|
DeviceManager
|
device manager instance |
required |
Source code in boardfarm3/plugins/hookspecs/devices.py
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | |
boardfarm_attached_device_configure
boardfarm_attached_device_configure(
config: BoardfarmConfig, cmdline_args: Namespace, device_manager: DeviceManager
) -> None
Configure boardfarm attached device.
This hook should be used to configure a device, after having it booted, which is attached to a device in the environment. E.g. LAN.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
BoardfarmConfig
|
boardfarm config instance |
required |
|
Namespace
|
command line arguments |
required |
|
DeviceManager
|
device manager instance |
required |
Source code in boardfarm3/plugins/hookspecs/devices.py
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | |
boardfarm_attached_device_configure_async
async
boardfarm_attached_device_configure_async(
config: BoardfarmConfig, cmdline_args: Namespace, device_manager: DeviceManager
) -> None
Configure boardfarm attached device.
This hook should be used to configure a device, after having it booted, which is attached to a device in the environment. E.g. LAN.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
BoardfarmConfig
|
boardfarm config instance |
required |
|
Namespace
|
command line arguments |
required |
|
DeviceManager
|
device manager instance |
required |
Source code in boardfarm3/plugins/hookspecs/devices.py
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | |
boardfarm_device_boot
boardfarm_device_boot(
config: BoardfarmConfig, cmdline_args: Namespace, device_manager: DeviceManager
) -> None
Boot boardfarm device.
This hook should be used to boot a device which is dependent on one or more servers in the environment. E.g. CPE.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
BoardfarmConfig
|
boardfarm config instance |
required |
|
Namespace
|
command line arguments |
required |
|
DeviceManager
|
device manager instance |
required |
Source code in boardfarm3/plugins/hookspecs/devices.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | |
boardfarm_device_configure
boardfarm_device_configure(
config: BoardfarmConfig, cmdline_args: Namespace, device_manager: DeviceManager
) -> None
Configure boardfarm device.
This hook should be used to configure a device, after having it booted, which is dependent on one or more servers in the environment. E.g. CPE.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
BoardfarmConfig
|
boardfarm config instance |
required |
|
Namespace
|
command line arguments |
required |
|
DeviceManager
|
device manager instance |
required |
Source code in boardfarm3/plugins/hookspecs/devices.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
boardfarm_device_configure_async
async
boardfarm_device_configure_async(
config: BoardfarmConfig, cmdline_args: Namespace, device_manager: DeviceManager
) -> None
Configure boardfarm device.
This hook should be used to configure a device, after having it booted, which is dependent on one or more servers in the environment. E.g. CPE.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
BoardfarmConfig
|
boardfarm config instance |
required |
|
Namespace
|
command line arguments |
required |
|
DeviceManager
|
device manager instance |
required |
Source code in boardfarm3/plugins/hookspecs/devices.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | |
boardfarm_server_boot
boardfarm_server_boot(
config: BoardfarmConfig, cmdline_args: Namespace, device_manager: DeviceManager
) -> None
Boot boardfarm server device.
This hook should be used to boot a device which is not dependent on other devices in the environment. E.g. WAN and CMTS.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
BoardfarmConfig
|
boardfarm config instance |
required |
|
Namespace
|
command line arguments |
required |
|
DeviceManager
|
device manager instance |
required |
Source code in boardfarm3/plugins/hookspecs/devices.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
boardfarm_server_configure
boardfarm_server_configure(
config: BoardfarmConfig, cmdline_args: Namespace, device_manager: DeviceManager
) -> None
Configure boardfarm server device.
This hook should be used to configure a device, after having it booted, which is not dependent on other devices in the environment. E.g. WAN and CMTS
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
BoardfarmConfig
|
boardfarm config instance |
required |
|
Namespace
|
command line arguments |
required |
|
DeviceManager
|
device manager instance |
required |
Source code in boardfarm3/plugins/hookspecs/devices.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |
boardfarm_server_configure_async
boardfarm_server_configure_async(
config: BoardfarmConfig, cmdline_args: Namespace, device_manager: DeviceManager
) -> None
Configure boardfarm server device leveraging the asyncio library.
This hook should be used to configure a device, after having it booted, which is not dependent on other devices in the environment. E.g. WAN and CMTS To be used for the asynchronous implementation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
BoardfarmConfig
|
boardfarm config instance |
required |
|
Namespace
|
command line arguments |
required |
|
DeviceManager
|
device manager instance |
required |
Source code in boardfarm3/plugins/hookspecs/devices.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
boardfarm_skip_boot
boardfarm_skip_boot(
config: BoardfarmConfig, cmdline_args: Namespace, device_manager: DeviceManager
) -> None
Skips the booting for the device connected.
This hook skip the booting process on those devices that implement the boot_device hook
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
BoardfarmConfig
|
boardfarm config instance |
required |
|
Namespace
|
command line arguments |
required |
|
DeviceManager
|
device manager instance |
required |
Source code in boardfarm3/plugins/hookspecs/devices.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
boardfarm_skip_boot_async
async
boardfarm_skip_boot_async(
config: BoardfarmConfig, cmdline_args: Namespace, device_manager: DeviceManager
) -> None
Skips the booting for the device connected.
This hook skip the booting process on those devices that implement the boot_device hook
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
BoardfarmConfig
|
boardfarm config instance |
required |
|
Namespace
|
command line arguments |
required |
|
DeviceManager
|
device manager instance |
required |
Source code in boardfarm3/plugins/hookspecs/devices.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | |
contingency_check
contingency_check(env_req: dict[str, Any], device_manager: DeviceManager) -> None
Perform contingency check to make sure the device is working fine before use.
This hook could be used by any device. It is used by the pytest-boardfarm plugin to make sure the device is in good condition before running each test.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
dict[str, Any]
|
environment request dictionary |
required |
|
DeviceManager
|
device manager instance |
required |
Source code in boardfarm3/plugins/hookspecs/devices.py
286 287 288 289 290 291 292 293 294 295 296 297 298 | |
validate_device_requirements
validate_device_requirements(
config: BoardfarmConfig, cmdline_args: Namespace, device_manager: DeviceManager
) -> None
Validate device requirements.
This hook is responsible to validate the requirements of a device before deploying devices to the environment. This allows us to fail the deployment early.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
BoardfarmConfig
|
boardfarm config instance |
required |
|
Namespace
|
command line arguments |
required |
|
DeviceManager
|
device manager instance |
required |
Source code in boardfarm3/plugins/hookspecs/devices.py
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | |
validate_device_requirements_async
async
validate_device_requirements_async(
config: BoardfarmConfig, cmdline_args: Namespace, device_manager: DeviceManager
) -> None
Validate device requirements.
This hook is responsible to validate the requirements of a device before deploying devices to the environment. This allows us to fail the deployment early.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
BoardfarmConfig
|
boardfarm config instance |
required |
|
Namespace
|
command line arguments |
required |
|
DeviceManager
|
device manager instance |
required |
Source code in boardfarm3/plugins/hookspecs/devices.py
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 | |