Skip to content

dvmcmd

Device Manager Command

FLAGS module-attribute #

FLAGS = Literal['none', 'create_task', 'nonblocking', 'log_dev']

DeviceCommand #

Bases: Device

Device extended with data suitable for task handling

Attributes:

Name Type Description
name str

object name

adm_usr str

admin user

adm_pass list[str]

admin password

app_ver str

App DB version

av_ver str

Anti-Virus DB version

checksum str

Configuration checksum

conf_status CONF_STATUS

Configuration status

desc str

Device description

device_action DEVICE_ACTION

Device add or remove action

device_blueprint str

Device blueprint name

ha_group_id int

HA group ID

ha_group_name str

HA group Name

hostname str

hostname

ip str

Device IP address

meta_fields dict

Meta fields data

mgmt_if str

management interface name

mgmt_mode MGMT_MODE

Management mode of the device

mgmt_uuid str
mgt_vdom str

management VDOM

mr int

OS minor version

os_type OS_TYPE

OS type of the device

os_ver OS_VER

OS major version

patch int

OS patch version

psk str

pre-shared secret

sn str

Serial number of the device

version int
platform_str str

platform name (device model)

vdom list[VDOM]

VDOM list

ha_slave list[VDOM]

Optional[List[HASlave]]

DeviceTask #

Bases: FMGExecObject

Add/Del device request

Attributes:

Name Type Description
action Literal['add', 'del']

Add or Del device

adom str

ADOM to use

device Union[str, DeviceAction, ModelDevice]

Device to add/del

flags List[FLAGS]

Job flags

groups List[Scope]

device groups

validate_devicejob #

validate_devicejob() -> DeviceTask

Validate device job

Source code in pyfortinet/fmg_api/dvmcmd.py
@model_validator(mode="after")
def validate_devicejob(self) -> "DeviceTask":
    """Validate device job"""
    self._url = self._url.replace("{action}", self.action)
    if self.action == "del":
        if not isinstance(self.device, str):
            self.device = self.device.name  # deleting a device requires device id or name
    elif isinstance(self.device, str):
        raise ValueError("Adding a device requires a Device or DeviceCommand instance")
    return self