YANG-modeled operations
The SR Linux CLI supports YANG-modeled operational commands in the application data model.
SR Linux defines these commands as YANG action statements as defined in RFC7950. An action executes an operation on the device, such as clearing statistics or resetting protocol information. Actions typically return structured output, although some actions may display unstructured text when executed from the CLI. The model defines each action in the application context where it applies. An action that clears BGP malformed-update information, for example, belongs to the BGP context of a network instance.
You can execute an action using the tools command. The
tools command is global and can be entered from any context. The
tools command must be used to explicitly enable the action's
execution. This prevents actions from being running accidentally when navigating through
the CLI tree.
YANG model of an action
An action is defined using the action statement specified in RFC 7950.
The action is attached to the operational hierarchy of the feature it operates on,
allowing the action to be associated with the relevant object or resource. For example,
the restart action in the application management hierarchy is attached
to a specific application instance. The invocation path identifies the target
application through the list key (name), so the application name does
not need to be repeated in the action input.
The input and output statements are optional. The
input statement defines parameters provided when invoking the
action, while the output statement defines the data returned by the action. Input
parameters are typically modeled as leaves or leaf-lists. If the operation does not
require additional parameters, the input statement can be omitted.
Similarly, the output statement can be omitted when indicating success
or failure is sufficient.
The following example shows a restart action attached to an operational
application list entry.
module: srl_nokia-app-mgmt
augment /srl-sys:system:
+--ro app-management
+--ro application* [name]
+--ro name string
+---x restart {tools-as-modeled-actions-different-io-app-mgr}?
+---w input
| +--w (type-of-restart)?
| +--:(warm-case)
| | +---w warm empty
| +--:(cold-case)
| +---w cold empty
+--ro output
+--ro sent-signal uint32
+--ro sent-signal-name string
+--ro delayed boolean
The preceding example illustrates an action with both input and
output parameters. The input allows the caller to
request either a warm or cold restart of the specified application. The
output reports information about the signal sent to the application
and whether the restart operation was delayed. The target application is identified by
the application list key in the invocation path, so the application name is not included
in the action input.
Unstructured output
Some YANG modeled actions in SR Linux may optionally provide unstructured data as an alternative to the prefered structured data.
SR Linux YANG model that
provide this unstructured-data is modeled using an SR Linux reserved
key-less YANG list named srl-unstructured-output. This field
includes formatted, human readable, unstructured data only and it is therefore not
the prefered approach when automating any activity on SR Linux.
Data provided in the srl-unstructured-output YANG list is returned
on the CLI only, and only when either:
- The operator explicitly requests this output format. In this situation, only the
contents of the
srl-unstructured-outputlist is displayed and none of the structured data modelled in that actions output section is returned. - There is no structured output and the operator has configured the
tools-unstructured-fallbackoption.
Executing an action
Execute an action from the context where it is defined, or from anywhere else by entering the full path as shown in the following example.
Execute an action
--{ + candidate shared default }--[ ]--
# tools network-instance default protocols bgp clear-malformed-updates
--{ + candidate shared default }--[ ]--
# tools network-instance default protocols bgp neighbor 10.2.2.1 clear-malformed-updates
--{ + candidate shared default }--[ network-instance default protocols bgp ]--
# tools clear-malformed-updates
--{ + candidate shared default }--[ system grpc-server mgmt ]--
# tools /network-instance default protocols bgp clear-malformed-updates
Finding an action
Enter the ? command to list the commands and actions in the current
context. The CLI lists configuration commands under local commands and lists actions
under local actions. To list only the actions, enter tools and press
Tab.
Local commands and local actions
--{ running }--[ network-instance default protocols bgp neighbor fd00:fde8::2:13 ]--
# ?
Local commands:
admin-state* Administratively enable or disable the peer
afi-safi List of address families supported by the BGP neighbor
as-path-options Options for handling the AS_PATH in received BGP routes
authentication Container with authentication options that apply to this specific peer
description* A user provided description string for the peer
export-policy* Apply an export policy to advertised BGP routes
failure-detection
Options related to methods of detecting BGP session failure
graceful-restart Options related to router behavior as a graceful restart helper
import-policy* Apply an import policy to received BGP routes
local-as Options related to the local autonomous-system number advertised by this router to the peer
local-preference*
The value of the local-preference attribute that is added to received routes from the peer, if it is EBGP
multihop Configuration parameters specifying the multihop behaviour for an EBGP peer. This is not applicable to an IBGP peer.
next-hop-self* When set to true, the next-hop in all IPv4-unicast, IPv6-unicast and EVPN BGP routes advertised to the peer, if IBGP, is set equal to the local-address used on this session (or to the router ID if the NLRI is IPv6 and there
is no IPv6 local address to use). This is independent of the route origin (EBGP, IBGP-client, IBGP-non-client or redistributed direct/static/aggregate route).
peer-as* The autonomous system number expected from the peer
peer-group* A reference to the peer-group template to use for this BGP session
route-flap-damping*
Enable/disable route flap damping procedures for routes received from this peer if it is an EBGP peer
route-reflector Container with route reflection configuration options.
send-default-route
Options for controlling the generation of default routes towards the peer
timers
trace-options Debug traceoptions for BGP
transport
Local actions:
soft-clear Perform a soft reset of the BGP neighbor
reset-peer Perform a hard reset of the BGP neighbor
*** Not all commands are listed, press '?' again to see all options ***
Press tab after tools to list the local actions only
--{ + running }--[ network-instance default protocols bgp neighbor 10.2.2.2 ]--
# tools
.. reset-peer
/ route-flap-damping
clear-malformed-updates soft-clear
tree from tools command
Use the tree from tools command to display the actions in the
current context. Add a path to display the actions under that path. Add
detail or extensive to show the input and
output of each action. Add flat to display each node on one line.
You can combine flat with detail or
extensive.
?indicates an optional node.^Iindicates input to the action.^Oindicates output from the action.xindicates the action itself.tree from tools extensiveshows this flag.
--{ + running }--[ ]--
# tree from tools / network-instance protocols bgp neighbor
neighbor
+-- reset-peer
+-- soft-clear
| +-- route-refresh
+-- route-flap-damping
| +-- clear-history
+-- clear-malformed-updates
tree from tools detail command
--{ + running }--[ ]--
# tree from tools detail / network-instance protocols bgp neighbor
neighbor* [peer-address] bgp_mgr
+-- reset-peer? bgp_mgr
+-- soft-clear! bgp_mgr
| +-- route-refresh? bgp_mgr
+-- route-flap-damping! bgp_mgr
| +-- clear-history? bgp_mgr
+-- clear-malformed-updates
tree from tools extensive command
--{ + running }--[ ]--
# tree from tools extensive / network-instance protocols bgp neighbor
rw neighbor* [peer-address] bgp_mgr
+--rw peer-address srl_nokia-common:ip-address-with-zone bgp_mgr
+--rw reset-peer? empty bgp_mgr
+--rw soft-clear! bgp_mgr
| +--rw route-refresh? identityref bgp_mgr
+--rw route-flap-damping! bgp_mgr
| +--rw clear-history? empty bgp_mgr
+--x clear-malformed-updates
tree from tools flat command
--{ + running }--[ ]--
# tree from tools flat / network-instance protocols bgp neighbor
network-instance protocols bgp neighbor reset-peer
network-instance protocols bgp neighbor soft-clear route-refresh
network-instance protocols bgp neighbor route-flap-damping clear-history
network-instance protocols bgp neighbor clear-malformed-updates
tree from tools flat detail command
--{ + running }--[ ]--
# tree from tools flat detail / network-instance protocols bgp neighbor
network-instance* [name] protocols bgp!+ neighbor* [peer-address] reset-peer? bgp_mgr
network-instance* [name] protocols bgp!+ neighbor* [peer-address] soft-clear! route-refresh? bgp_mgr
network-instance* [name] protocols bgp!+ neighbor* [peer-address] route-flap-damping! clear-history? bgp_mgr
network-instance* [name] protocols bgp!+ neighbor* [peer-address] clear-malformed-updates
network-instance* [name] protocols bgp!+ neighbor* [peer-address] clear-malformed-updates
tree from tools flat extensive command
--{ + running }--[ ]--
# tree from tools flat extensive / network-instance protocols bgp neighbor
rw network-instance* [name] protocols bgp!+ neighbor* [peer-address] peer-address srl_nokia-common:ip-address-with-zone bgp_mgr
rw network-instance* [name] protocols bgp!+ neighbor* [peer-address] reset-peer? empty bgp_mgr
rw network-instance* [name] protocols bgp!+ neighbor* [peer-address] soft-clear! route-refresh? identityref bgp_mgr
rw network-instance* [name] protocols bgp!+ neighbor* [peer-address] route-flap-damping! clear-history? empty bgp_mgr
x network-instance* [name] protocols bgp!+ neighbor* [peer-address] clear-malformed-updates
ro network-instance* [name] protocols bgp!+ neighbor* [peer-address] clear-malformed-updates
Displaying action results
The CLI displays action output as the action produces it. The command completes when the action completes. If the action fails, the CLI displays a message, even if it has already displayed some output. The device also records any failures in the system log. When an action succeeds and returns no data, the CLI displays no output.
Formatting action output
Use the as output modifier to choose the format of one action command.
The modifier overrides the default format for that command as described in the following
sections.
Display as text
The as text command displays the structured output in CLI text. This
is the default option.
--{ + running }--[ ]--
# tools system ipfix flow-cache dump-flows ipv4 | as text
flow-dump "type: 1
The top 20 IPv4 unicast flows seen by cflowd are:
Current Time: 10/14/2026 12:57:33
Last Cleared Time: 10/14/2026 12:49:01
ifIndexContext: global
Intf/Ingr SrcIP Intf/Egr DstIP Pro ToS
I-vRtrID S-Port Msk AS E-vRtrID D-Port Msk AS Flgs Pkts
NextHop Pkt-Size Time
--------------------------------------------------------------------------------
98304 130.210.240.1 0 130.195.80.2 1 0x00
10242 0 /32 0 0 0 /24 0 0x00 338
0.0.0.0 84 68
98304 130.210.240.1 0 130.195.80.2 1 0x00
10242 0 /32 0 0 0 /24 0 0x00 335
0.0.0.0 84 68
98304 130.210.240.1 0 130.195.80.2 1 0x00
10242 0 /32 0 0 0 /24 0 0x00 335
0.0.0.0 84 68
98304 130.210.240.1 0 130.195.80.2 1 0x00
10242 0 /32 0 0 0 /24 0 0x00 330
0.0.0.0 84 67
98304 130.210.240.1 0 130.210.240.2 1 0x00
10242 0 /32 0 0 0 /32 0 0x00 3
0.0.0.0 84 2
--------------------------------------------------------------------------------
"
Unstructured output
The as unstructured-output command displays the unstructured data
output, if defined in the special srl-unstructured-output YANG list of the action.
If the action has structured output, it is not displayed. If the action has no
unstructured output, the CLI displays nothing. See Unstructured output for more information.
The environment tools-unstructured-fallback configuration can be set
to true to allow the CLI to display unstructured output if the
action does not define any structured output. Fallback is enabled by default.
--{ + running }--[ ]--
# environment tools-unstructured-fallback true
Use the environment tools-output-format command to set the default
display format for tools commands that do not include an
as modifier. Valid values are text,
json, yaml, xml, and
unstructured-output. The default is text.
With text, json, yaml, or
xml, the CLI renders the action's structured output in that
format and omits unstructured output. With unstructured-output, the
CLI displays only the unstructured lines defined for the action.
The environment tools-output-format command sets the default encoding for YANG-modeled tools actions; The environment output-format command sets the default for info, show, and other non-tools CLI output. The two settings are independent and appear separately in environment show and srlinux.rc.
--{ + candidate shared default }--[ ]--
# system cli environment tools-output-format?
usage: tools-output-format <json|text|unstructured-output|xml|yaml>
The CLI output display format applied to 'tools' commands. Set to 'text' by default
Selecting 'text', 'json', 'yaml' or 'xml' causes the action's
structured 'output' updates to be rendered using the standard data
formatter. Selecting 'unstructured-output' instead displays only the
action's free-form 'standard_output' channel.
Positional arguments:
value [json|text|unstructured-output|xml|yaml, default text]
The tools output format is stored in the global srlinux.rc file.
[tools-output-format]
# The default CLI output display format applied to 'tools' (YANG-modeled
# action) commands. It is used when the user does not specify the output
# modifier (e.g. '| as json') in the tools command itself.
# Selecting 'text' (the default), 'json', 'yaml' or 'xml' renders the action's
# structured 'output' updates through the standard data formatter and
# suppresses the unstructured channel; selecting 'unstructured-output' displays
# only the action's free-form 'standard_output' channel.
# Note: 'table' is intentionally not available for 'tools' commands because
# action outputs are not tabular. Use [output-display-format] for non-action
# commands.
# Supported values are: "text", "json", "yaml", "xml", "unstructured-output"
#
# Default value:
# value = "text"
usage: environment
The environment command lists the tools settings with the other
environment commands.
--{ running }--[ ]--
# environment
usage: environment
Control the look-and-feel of the CLI
Local commands:
alias Create or overwrite an alias
basic-prompt Change the prompt for 'basic' cli-engine type displayed before every input line
bottom-toolbar Change the text displayed in the bottom toolbar.
cli-engine CLI engine settings
commit-options Commit options settings
complete-on-enter
Trigger auto-completion when you press Enter
complete-on-space
Trigger auto-completion whenever you press Spacebar
complete-on-tab Trigger auto-completion whenever you press Tab
delete Reset/remove environment settings
discard-options Discard options settings
key-completer-limit
The limit on number of keys shown in auto-completion
load Load the environment settings from a file
network-instance The default network-instance to be used if not specified
output-format The CLI output display format. Set to 'text' by default.
output-modifier-alias
Create or overwrite an output modifier alias
pagination Pagination override of the CLI output, either "on" or "off"
prompt Change the prompt for 'advanced' cli-engine type displayed before every input line
save Store the environment settings to a file
session-idle-timeout
The idle timeout override for the CLI session in seconds
show Show the currently active environment settings
tools-output-format
The CLI output display format applied to 'tools' commands. Set to 'text' by default.
tools-unstructured-fallback
Fall back to a 'tools' action's free-form standard_output when the
yang-models The default yang-models to be used when starting the CLI, either "srl" or "oc"
*** Not all commands are listed, press '?' again to see all options ***