SRL Variables and Context

How to address the current object, device-global configuration, VDOMs, appliance metadata, and dynamic paths.

Scope roots

RootValueExample
thisCurrent rule section or current per-edit entry.this.status
configNormalized configuration for the current execution scope.config.firewall.policy
global.configExplicit device-global configuration.global.config.system.global
vdoms.<name>.configExplicit configuration for a named VDOM.vdoms.root.config.system.interface
applianceDetected platform and runtime context.appliance.vendor

Appliance fields

PathOutput
appliance.vendorNormalized vendor slug, for example fortinet.
appliance.typePlatform family, for example fortigate.
appliance.hardwareDetected model/platform text.
appliance.osDetected full OS version.
appliance.os_major_minorMajor/minor OS version such as 7.2.
appliance.scopeglobal, vdom, or all.
appliance.current_vdomCurrent VDOM name or global.
appliance.vdomsSelected VDOM-name list.
appliance.multi_vdomBoolean indicating multiple selected VDOMs.
appliance.interfaces.<name>.network_typeClassification for a physical/logical interface or FortiGate zone: internet, external, dmz, internal, restricted, undefined, or any. A zone with differently classified members returns a list containing every distinct member classification.
appliance.interfaces.any.network_typeAlways returns any. This is the synthetic metadata entry for policies that use the FortiGate any interface.

Variables and dynamic paths

$vdomName = appliance.current_vdom;
$fieldName = "status";
$interfaceName = this.srcintf;

$status = this.$fieldName;
$policy = vdoms.$vdomName.config.firewall.policy.10;
$networkType = appliance.interfaces.$interfaceName.network_type;

Variables begin with $. A variable used as a path segment is resolved at runtime, allowing one rule to inspect multiple VDOMs, sections, fields, or object names.

Use any(appliance.interfaces.$interfaceName.network_type, "internet", "external") for network classification checks. any() accepts both the scalar value returned for an interface or uniform zone and the list returned for a mixed zone.

If a path cannot be resolved, SRL carries an internal unresolved value. Presence functions and operators treat it as missing; text conversion produces an empty string and numeric conversion produces zero.

Annotation metadata

Configuration arrays are internally annotated so functions can recover their source identity without exposing private metadata to loops, counts, keys, or output.

$objectName = name(this);
$objectPath = path(this);
$section = parent(this);

addInfoFinding(
    "Object " + $objectName + " is under " + path($section),
    "Review the object in its source section."
);

array_values(), array_slice(), array_reverse(), and array_group_by() retain annotations on returned configuration objects.