check_device_policy_sync
Compare a device's firewall policies with its assigned FortiManager policy package and report per-policy differences to identify policy drift and uninstalled changes.
Instructions
Compare a device's firewall policies with its assigned policy package.
Reports, policy by policy, what differs between the package FortiManager has assigned to the device and what the device has. Read-only.
Two views of "what the device has", chosen with source:
revision: the latest device DB revision -- the configuration last retrieved from or installed to the device, i.e. what it runs.device_db: FortiManager's current device DB, which also holds changes staged in FortiManager but not installed yet.both(default): both comparisons, plus device DB vs revision -- a difference there is staged in FortiManager and not installed.
Only policies the package installs on this device count: install-on targets (devices and nested device groups) are resolved, and policy blocks are expanded in place. Policies only on the device side can be global header/footer policies or edits made on the device.
Args: adom: ADOM name device: Managed device name vdom: VDOM (default "root") package: Package to compare with (default: the one assigned to the device/VDOM) source: "revision", "device_db" or "both" (default) revision: Device DB revision to use (default -1, the latest; see list_device_revisions). Ignored for source="device_db".
Returns: dict: status, in_sync (all comparisons run), package, install_status, revision (number, time, comment), interface_mapping (normalized interfaces this device names differently), comparisons: {"package_vs_revision", "package_vs_device_db", "device_db_vs_revision"} as requested -- each with in_sync, summary, only_in_ lists, modified (field -> value per side) and order_matches -- and not_targeted (package policies scoped to other devices).
Example: >>> result = await check_device_policy_sync("demo", "branch1") >>> for p in result["comparisons"]["package_vs_revision"]["modified"]: ... print(p["policyid"], p["differences"])
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"adom": "<adom>",
"device": "<device>"
},
"name": "check_device_policy_sync"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| adom | Yes | ||
| vdom | No | root | |
| device | Yes | ||
| source | No | both | |
| package | No | ||
| revision | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||