Important
This project is under development. All source code and features on the main branch are for the purpose of testing or evaluation and not production ready.
Module for controlling entries in OSD.
-
check if host exists
does_host_exist(mac: str)
mac
: MAC address- return
bool
value indicating whether host exists or not
-
get host details
get_host_details(mac: str)
mac
: MAC address- return
dict
with host information
-
add host
add_host(mac: str, os: str, active_boot_type: ActiveBootType, refresh: RefreshMode, description: str)
mac
: MAC addressos
: OS keyactive_boot_type
: active boot typerefresh
: refresh modedescription
: optional description for host
-
alter host
alter_host(mac: str, diskless_os: str, imageloader_os: str, iso_os: str, active_boot_type: ActiveBootType, refresh: RefreshMode, description: str)
mac
: MAC addressdiskless_os
: Diskless OS keyimageloader_os
: ImageLoader OS keyiso_os
: ISO OS keyactive_boot_type
: active boot typerefresh
: refresh modedescription
: optional description for host
-
delete host
delete_host(mac: str)
mac
: MAC address
-
get available OSes
get_available_oses(mac: str, os_type: OsType)
mac
: MAC addressos_type
: OS type- return
list
of available OSes
-
get host IP
get_host_ip(mac: str)
mac
: MAC address- return
IPv4Address
object with retrieved IP address
import logging
from mfd_osd_control import OsdController, RefreshMode, OsType, ActiveBootType
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
osd = OsdController(base_url="osd.example.com")
list_of_oses = osd.get_available_oses(mac="00:11:22:AA:BB:CC", os_type=OsType.DISKLESS)
logger.log(level=logging.DEBUG, msg=list_of_oses)
if not osd.does_host_exist(mac="00:11:22:AA:BB:CC"):
osd.add_host(mac="00:11:22:AA:BB:CC", os=list_of_oses[0], active_boot_type=ActiveBootType.DISKLESS, refresh=RefreshMode.ONCE)
host_details = osd.get_host_details(mac="00:11:22:AA:BB:CC")
logger.log(level=logging.DEBUG, msg=host_details)
osd.alter_host(mac="00:11:22:AA:BB:CC", diskless_os=list_of_oses[1])
ip_addr = osd.get_host_ip(mac="00:11:22:AA:BB:CC")
logger.log(level=logging.DEBUG, msg=ip_addr)
osd.delete_host(mac="00:11:22:AA:BB:CC")
- Linux
- Windows
- ESXi
- FreeBSD
If you encounter any bugs or have suggestions for improvements, you're welcome to contribute directly or open an issue here.