Skip to main content

Device Models

Overview

The Device models provide a structured way to manage device resources in Palo Alto Networks' Strata Cloud Manager. These models represent firewall devices, their configuration, licensing, and status information. The models handle validation of inputs and outputs when interacting with the SCM API.

Models

The module provides the following Pydantic models:

  • DeviceBaseModel: Base model with fields common to all device operations
  • DeviceCreateModel: Model for creating new devices
  • DeviceUpdateModel: Model for updating existing devices
  • DeviceResponseModel: Response model for device operations (includes many additional status fields)
  • DeviceLicenseModel: Model for license entries
  • DeviceListResponseModel: Model for paginated device list responses

Most models use extra="forbid" configuration, which rejects any fields not explicitly defined in the model. The DeviceResponseModel uses extra="allow" to accommodate new API fields.

Model Attributes

DeviceBaseModel

AttributeTypeRequiredDefaultDescription
namestrNoNoneDevice name
display_namestrNoNoneDisplay name for the device
serial_numberstrNoNoneDevice serial number
familystrNoNoneDevice family (e.g., 'vm')
modelstrNoNoneDevice model (e.g., 'PA-VM')
folderstrNoNoneFolder name containing the device
hostnamestrNoNoneDevice hostname
typestrNoNoneDevice type (e.g., 'on-prem')
device_onlyboolNoNoneTrue if device-only entry
is_connectedboolNoNoneConnection status
descriptionstrNoNoneDevice description
labelsList[str]NoNoneLabels assigned to the device
snippetsList[str]NoNoneSnippets associated with the device

DeviceCreateModel

Inherits all fields from DeviceBaseModel without additional fields.

DeviceUpdateModel

Request body for PUT /config/setup/v1/devices/{id}. This is a standalone model — it does not inherit from DeviceBaseModel. The upstream devices-put schema only accepts the five writable fields listed below; serial_number, hostname, is_connected, family, model, name, and type are read-only and rejected by the update model.

AttributeTypeRequiredDefaultDescription
idstrYesUnique device identifier (carried in URL, not payload)
display_namestrNoNoneDisplay name for the device
folderstrNoNoneFolder containing the device
descriptionstrNoNoneDevice description
labelsList[str]NoNoneLabels to assign to the device
snippetsList[str]NoNoneSnippets to associate with the device

DeviceResponseModel

Extends DeviceBaseModel by adding many response-specific fields:

AttributeTypeRequiredDefaultDescription
idstrYesNoneUnique device identifier
connected_sincestrNoNoneISO timestamp when connected
last_disconnect_timestrNoNoneISO timestamp when disconnected
last_device_update_timestrNoNoneISO timestamp of last update
last_das_update_timestrNoNoneISO timestamp of last DAS update
deactivate_wait_hrsintNoNoneDeactivation wait hours
deactivated_bystrNoNoneWho deactivated the device
to_be_deactivated_atstrNoNoneScheduled deactivation time
dev_cert_detailstrNoNoneDevice certificate detail
dev_cert_expiry_datestrNoNoneDevice certificate expiry
app_versionstrNoNoneApp version
app_release_datestrNoNoneApp release date
av_release_datestrNoNoneAntivirus release date
anti_virus_versionstrNoNoneAntivirus version
threat_versionstrNoNoneThreat version
threat_release_datestrNoNoneThreat release date
wf_verstrNoNoneWildFire version
wf_release_datestrNoNoneWildFire release date
iot_versionstrNoNoneIoT version
iot_release_datestrNoNoneIoT release date
gp_client_verionstrNoNoneGlobalProtect client version
gp_data_versionstrNoNoneGlobalProtect data version
log_db_versionstrNoNoneLog DB version
software_versionstrNoNoneSoftware version
uptimestrNoNoneDevice uptime
mac_addressstrNoNoneMAC address
ip_addressstrNoNoneIPv4 address
ipV6_addressstrNoNoneIPv6 address
url_db_verstrNoNoneURL DB version
url_db_typestrNoNoneURL DB type
license_matchboolNoNoneLicense match status
available_licensesList[DeviceLicenseModel]NoNoneList of available licenses
installed_licensesList[DeviceLicenseModel]NoNoneList of installed licenses
ha_statestrNoNoneHA state
ha_peer_statestrNoNoneHA peer state
ha_peer_serialstrNoNoneHA peer serial number
vm_statestrNoNoneVM state

Supporting Models

DeviceLicenseModel

AttributeTypeRequiredDefaultDescription
featurestrYesNoneFeature name for the license
expiresstrYesNoneExpiration date (YYYY-MM-DD)
issuedstrYesNoneIssued date (YYYY-MM-DD)
expiredstrNoNoneWhether the license is expired (yes/no)
authcodestrNoNoneAuthorization code for the license

DeviceListResponseModel

AttributeTypeRequiredDefaultDescription
dataList[DeviceResponseModel]YesNoneList of device objects
limitintYesNoneMax number of devices returned
offsetintYesNoneOffset for pagination
totalintYesNoneTotal number of devices available

Exceptions

The Device models can raise the following exceptions during validation:

  • ValueError: Raised when field validation fails
  • ValidationError: Raised by Pydantic when model validation fails

Usage Examples

Listing Devices

from scm.client import Scm

# Initialize client
client = Scm(
client_id="your_client_id",
client_secret="your_client_secret",
tsg_id="your_tsg_id"
)

# List all devices
devices = client.device.list()

for device in devices:
print(f"Device: {device.name}")
print(f"Model: {device.model}")
print(f"Serial: {device.serial_number}")
print(f"Software Version: {device.software_version}")

Getting a Device by ID

from scm.client import Scm

# Initialize client
client = Scm(
client_id="your_client_id",
client_secret="your_client_secret",
tsg_id="your_tsg_id"
)

# Get device by ID
device = client.device.get("001122334455")
print(f"Device: {device.name}")
print(f"IP Address: {device.ip_address}")
print(f"HA State: {device.ha_state}")

Fetching a Device by Name

from scm.client import Scm

# Initialize client
client = Scm(
client_id="your_client_id",
client_secret="your_client_secret",
tsg_id="your_tsg_id"
)

# Fetch device by name
device = client.device.fetch(name="PA-VM-1")
if device:
print(f"Found device: {device.name}")
print(f"Connected: {device.is_connected}")

# Access license information
if device.installed_licenses:
for lic in device.installed_licenses:
print(f"License: {lic.feature}")
print(f"Expires: {lic.expires}")
print(f"Issued: {lic.issued}")
else:
print("Device not found")

Filtering Devices

from scm.client import Scm

# Initialize client
client = Scm(
client_id="your_client_id",
client_secret="your_client_secret",
tsg_id="your_tsg_id"
)

# Filter by type (server-side)
vm_devices = client.device.list(type="vm")

# Filter by model (server-side)
pa_vm_devices = client.device.list(model="PA-VM")

# Filter device-only entries (client-side)
device_only = client.device.list(device_only=True)

for device in vm_devices:
print(f"VM Device: {device.name} - {device.model}")