REFERENCE

v6.11.0

Policy Engine

Policy-as-code: evaluate an organisation's OWN compliance rules (YAML) against a config snapshot — offline, read-only, CI-able, with Markdown/JSON/SARIF output.

Tools

list_policies

List Loaded Policy Rules · Risk: read

Lists every loaded policy rule file and the rules inside it — id, severity, what it asserts and which section it applies to. Rules come from policy.paths (or MIKROTIK_POLICY_PATHS) plus the bundled starter pack. A file that failed validation is listed WITH its errors rather than dropped, so a policy set that silently shrank is visible. Contacts no device.

ParameterRequiredDefinition
tagNoOnly rules carrying this tag {"type":"string"}
severityNoOnly rules of this severity {"type":"string","enum":["critical","high","medium","low","info"]}

validate_policy_file

Validate a Policy Rule File · Risk: read

Schema-checks a policy rule file — as inline text or a path — and reports each problem with the path into the document (policies.2.assert.field), so a rule file can be authored iteratively without running it against anything. Catches what silently breaks a rule set: duplicate ids, two predicates in one leaf, an unknown key, an over-long or invalid regex. Contacts no device and reads no config.

ParameterRequiredDefinition
contentNoRule file text (YAML or JSON) {"type":"string"}
pathNoPath to a rule file to read instead {"type":"string"}

check_policy_snapshot

Check Policies Against a Snapshot · Risk: read

Evaluates the loaded policy rules against a STORED configuration snapshot — no device is contacted at all, which is what makes this runnable in CI. Pass snapshot_id (from list_config_snapshots), or config_text to check an export you already have. Reports a compliance score, the failing rules by severity, and the offending config line for each. A rule matching nothing is reported as NOT APPLICABLE, never as a pass.

ParameterRequiredDefinition
snapshot_idNoSnapshot id to evaluate {"type":"string"}
config_textNoRaw /export text to evaluate instead {"type":"string"}
deviceNoLabel the report with this device name {"type":"string"}

run_policy_check

Run a Policy Check on a Device · Risk: read

Captures the device's current configuration (/export terse, a read-only print — it writes nothing and leaves no file on the router) and evaluates every loaded policy rule against it. This is the live version of check_policy_snapshot: same rules, same report, freshest config. Nothing is ever written to the device — remediation belongs to the hardening and change-plan tools, and keeping this read-only is what makes it safe to run against production.

ParameterRequiredDefinition
tagNoOnly evaluate rules carrying this tag {"type":"string"}

explain_policy_finding

Explain a Policy Finding · Risk: read

Explains one finding from the most recent policy check in depth: the rule, the offending configuration line, why it failed (expected versus actual) and the remediation. Use it after run_policy_check or check_policy_snapshot when a finding needs to become an action. Reads the cached report — no device is contacted.

ParameterRequiredDefinition
rule_idYesRule id from the report {"type":"string"}
deviceNoWhich device's report, when several were checked {"type":"string"}

export_policy_report

Export the Policy Report · Risk: read

Renders the most recent policy check as Markdown, JSON or SARIF 2.1.0. SARIF is the format GitHub code-scanning ingests, so a router's configuration can be linted in a pull request exactly like source code — each finding lands on the line of the export that caused it. Reads the cached report; no device is contacted.

ParameterRequiredDefinition
formatYes{"default":"markdown","type":"string","enum":["markdown","json","sarif"]}
deviceNoWhich device's report, when several were checked {"type":"string"}
artifactNoSARIF artifact path the findings point at (default <device>.rsc) {"type":"string"}

On this page