YAML and JSON Output Modules
yaml and json output modules display transformed lab topology in YAML or JSON format. You can invoke them by specifying -o yaml
or -o json
parameter in netlab create command.
Both output modules can take an optional destination file name (default: stdout).
Multiple formatting modifiers (separated with colons) can be used to reduce the amount of information displayed from the transformed lab topology:
nodefault – Remove default settings (defaults key).
noaddr – Remove address pools (addressing key).
Any other formatting modifier is evaluated as a Python expression within the transformed lab topology context.
Examples:
To display this information… |
…use this command |
---|---|
whole transformed topology |
|
whole topology without the defaults |
|
whole topology without the defaults or addressing pools |
|
node data |
|
address pools |
|
Formatting modifier can select any subset of the lab topology, for example:
To display this information… |
…use this command |
---|---|
data for node |
|
interface data for node |
|
device data for device |
|
settings for D2 output module |
|
valid attributes for the BGP module |
|
Finally, the formatting modifier is evaluated as a Python expression, so you can display anything that can be expressed as a one-line expression (you will probably have to quote the whole yaml:expression
string):
To display this information… |
…use this command |
---|---|
second interface on node |
|
node names |
|
netlab create command stores the results into an output file when you specify format=output
or format:expr=output
value for the --output
parameter. For example:
To write this information into a file … |
… use this command |
---|---|
whole topology into |
|
node data into |
|
link data into |
|