@ -332,7 +332,7 @@ output, use the ``parse_cli`` filter::
The ``parse_cli`` filter will load the spec file and pass the command output
The ``parse_cli`` filter will load the spec file and pass the command output
through, it returning JSON output. The spec file is a YAML yaml that defines
through, it returning JSON output. The spec file is a YAML yaml that defines
how to parse the CLI output.
how to parse the CLI output.
The spec file should be valid formatted YAML. It defines how to parse the CLI
The spec file should be valid formatted YAML. It defines how to parse the CLI
output and return JSON data. Below is an example of a valid spec file that
output and return JSON data. Below is an example of a valid spec file that
@ -357,8 +357,8 @@ will parse the output from the ``show vlan`` command.::
The spec file above will return a JSON data structure that is a list of hashes
The spec file above will return a JSON data structure that is a list of hashes
with the parsed VLAN information.
with the parsed VLAN information.
The same command could be parsed into a hash by using the key and values
The same command could be parsed into a hash by using the key and values
directives. Here is an example of how to parse the output into a hash
directives. Here is an example of how to parse the output into a hash
value using the same ``show vlan`` command.::
value using the same ``show vlan`` command.::
---
---
@ -379,7 +379,7 @@ value using the same ``show vlan`` command.::
state_static:
state_static:
value: present
value: present
Another common use case for parsing CLI commands is to break a large command
Another common use case for parsing CLI commands is to break a large command
into blocks that can parsed. This can be done using the ``start_block`` and
into blocks that can parsed. This can be done using the ``start_block`` and
``end_block`` directives to break the command into blocks that can be parsed.::
``end_block`` directives to break the command into blocks that can be parsed.::
@ -594,6 +594,56 @@ which will produce this output:
.._other_useful_filters:
.._other_useful_filters:
URL Split Filter
`````````````````
..versionadded:: 2.4
The ``urlsplit`` filter extracts the fragment, hostname, netloc, password, path, port, query, scheme, and username from an URL. With no arguments, returns a dictionary of all the fields::