README-ned-settings
NED settings details
This NED is equipped with a number of runtime configuration options "NED settings" allowing for customization by the end user. All options are configurable using the NSO API for NED settings. Most NED settings can be configured globally, per device profile or per device instance in the following locations:
global /ncs:devices/global-settings/ned-settings/cisco-ios/ profile /ncs:devices/ncs:profiles/profile:/ned-settings/cisco-ios/ device /ncs:/device/devices/device:/ned-settings/cisco-ios/
Profiles setting overrides global-settings and device settings override profile settings, hence the narrowest scope of the setting is used by the device.
If user changes a ned-setting, then user must reconnect to the device, i.e. disconnect and connect in order for the new setting to take effect.
From the NSO CLI the device instance NED settings for this NED are available under:
# config
# devices device dev-1 ned-settings cisco-ios
Press TAB to see all the NED settings.
Table of contents
1. ned-settings cisco-ios
2. logger
3. connection
4. proxy
5. read
5.1. replace-config
5.2. inject-config
5.3. inject-interface-config
5.4. snmp-server-user-defaults
6. write
6.1. config-warning
6.2. config-dependency
6.3. inject-command
6.4. replace-commit
6.5. inject-answer
6.6. config-archive
7. auto
8. api
9. live-status
9.1. auto-prompts
10. developer
10.1. simulate-show1. ned-settings cisco-ios
The following top level ned-settings can be modified.
2. ned-settings cisco-ios logger
Settings for controlling logs generated.
3. ned-settings cisco-ios connection
This section lists the connection ned-settings used when connecting to the device:
4. ned-settings cisco-ios proxy
See sections 9, 10 and 11 in README.md for information on proxy ned-settings used to connect via a jump host, terminal server or "exec" proxy, i.e. executing a command/script to connect to device.
Note: The NED also supports a second jump host by configuring 'ned-settings cisco-ios proxy2' ned-settings.
5. ned-settings cisco-ios read
Settings used when reading from device.
5.1. ned-settings cisco-ios read replace-config
The read replace-config list ned-setting can be used to replace or filter out config line(s) upon reading from device, i.e. both in a sync-from and a config-hash transaction id.
Apart from the list id, the setting takes one mandatory leaf (regex) and two optional (replacement and when):
5.2. ned-settings cisco-ios read inject-config
read inject-config
read inject-interface-config
The inject-config and inject-interface-config ned-settings can also be used to inject config lines when reading from device, e.g. parsing show running-config. The injected config is injected first or last, or as specified by a DOTALL regexp expression. It can also be configured to be inserted after/before each match.
The inject config settings were implemented to solve cases where IOS behaves inconsistently, e.g. hidden defaults which vary from device to device, even vary between interfaces types.
An example:
interface / logging event link-status is usually shown as "no logging event link-status" when not set and hidden when set. But on a cat4500 it is the reverse: it is shown when set and hidden when not set. To solve this one can configure as below:
To inject 'logging event link-status' on all interfaces (works for most device types, hence put globally):
devices global-settings ned-settings cisco-ios read inject-interface-config 1 interface ".*" config "logging event link-status"
To inject 'no logging event link-status' on device cat4500 only (after the global setting, hence overriding it):
devices device cat4500 ned-settings cisco-ios read inject-interface-config 1 interface ".*" config "no logging event link-status"
The two config entries above will solve compare diff problems with logging event link-status.
Another example of config injection use is switchport, which may be need to be injected on some devices types. See section 7.
Here is an example of injecting global config, which will be injected at the top level of show running-config:
devices global-settings ned-settings cisco-ios read inject-config glob config "hostname DEFAULT-HOST-NAME"
Global inject config also take an optional 'regexp' string which can be used to inject config line(s). The inject can be specified with 'where' leaf, eight values are supported:
before-each inject command before each matching before-first inject command before first matching after-each inject command after each matching after-last inject command after last matching before-topmode inject command before regex topmode after-topmode inject command after regex topmode first inject command first if regex matches or is unset last inject command last if regex matches or is unset
Here is an example how to inject default-metric after each found router eigrp on a cat4500:
devices device cat4500-1 ned-settings cisco-ios read inject-config eigrp regexp "router eigrp (\d+)" config " default-metric $1 100 255 1 1500"
Up to 9 groups (expr) are supported in the regexp, e.g. $1 - $9.
Note that in order for the new inject setting to take effect, you must disconnect and disconnect. A sync-from is also needed to populate NCS/NSO CDB with newly configured injection config.
5.3. ned-settings cisco-ios read inject-interface-config
See 'read inject-config' above for information on how to use this ned-setting.
5.4. ned-settings cisco-ios read snmp-server-user-defaults
Use this ned-setting to change the default snmp-server user passwords to avoid static configration of unknown passwords.
6. ned-settings cisco-ios write
Settings used when writing to device.
6.1. ned-settings cisco-ios write config-warning
This setting is used to filter, i.e. ignore device output (warnings/errors)
write config-warning
After having sent a config command to the device the NED will treat any text reply as an error and abort the transaction. The config command that caused the failed transaction will be shown together with the error message returned by the device. Sometimes the text message is not an actual error. It could be a warning that should be ignored. The NED has a static list of known warnings, an example:
// general "warning: \S+.*", "%.?note:", "info:", "aaa: warning", ".*success", "enter text message", "hqm_tablemap_inform: class_remove error",
If you stumble upon a warning not already in the NED, which is quite likely due to the large number of warnings, you can configure the NED to ignore them using this ned-setting.
The list key is a regular expression with a warning that should be ignored.
For example, to add a new warning exception:
admin@ncs(config)# devices global-settings ned-settings cisco-ios write config-warning "Address .* may not be up" admin@ncs(config)# commit Commit complete. admin@ncs(config)# devices device dev-1 disconnect admin@ncs(config)# devices device dev-1 connect result true info (admin) Connected to dev-1
Note that in order for the warning exception to take effect, you must disconnect and connect again, to re-read ned-settings.
6.2. ned-settings cisco-ios write config-dependency
write config-dependency
This ned-setting can be used to add dynamic dependency rules to the NED before being permanently fixed in the NED. This can be useful if a dependency bug is found and you do not want to upgrade the NED or are in a hurry for the fix.
Apart from the list id, each ned-setting list entry is configured with:
mode Regex specifying config mode where the rule is checked, don't set for top-mode.
move Regex specifying line(s) to move.
action Where to move the line(s). Can be set to before|after|last|first.
stay Regex specifying where 'move' lines will be moved with before|after action.
6.3. ned-settings cisco-ios write inject-command
write inject-command
The cisco-ios write inject-command ned-setting can be used to inject command line(s) in a transaction. This can be needed, for example, when deleting crypto config which requires a clear command to be run before delete.
The ned-settings is configured with:
id User defined name for this ned-setting used to identify the list entry
config-line The config line(s) where command should be injected (DOTALL regexp)
command The command (or config) to inject after|before config-line. Prefix with 'do ' if you want to run exec command in config mode. Prefix with 'exec ' if you want to run exec command in exec mode.
'where', eight values are supported: before-each inject command before each matching before-first inject command before first matching after-each inject command after each matching after-last inject command after last matching before-topmode inject command before regex topmode after-topmode inject command after regex topmode first inject command first if regex matches or is unset last inject command last if regex matches or is unset
An example (of a previously hard coded inject case):
devices global-settings ned-settings cisco-ios write inject-command C1 config-line "no crypto ikev2 keyring \S+" command "do clear crypto session" before-first devices global-settings ned-settings cisco-ios write inject-command C2 config-line "no crypto ikev2 keyring \S+" command "do clear crypto ikev2 sa fast" before-first
The above inject command configs will cause a delete of ikev2 keyring to look like this:
do clear crypto session do clear crypto ikev2 sa fast no crypto ikev2 keyring XXX
$i (where i is value from 1 to 9) can also be used to inject matches values from the config line. For example:
devices global-settings ned-settings cisco-ios write inject-command C2 config-line "no interface Tunnel(\d+)" command "do clear dmvpn session interface Tunnel $1 static" before-first
with a deletion of interface Tunnel100 results in:
!do clear dmvpn session interface Tunnel 100 static no interface Tunnel100
Hence, $1 is replaced with the first group value from the config line, which is (\d+).
6.4. ned-settings cisco-ios write replace-commit
write replace-commit
The write replace-commit list ned-setting can be used to replace or filter out config line(s) upon writing to device.
Apart from the list id, the setting takes one mandatory leaf and one optional: regexp The regular expression (DOTALL) to which the config is to be matched. replacement The string which would replace all found matches. May use groups from regexp. Leave unset for filtering.
The setting works much like String.replaceAll, i.e. it replaces all matches, can use regexp catch groups etc.
6.5. ned-settings cisco-ios write inject-answer
write inject-answer
Some config commands may prompt the CLI for a password, or answer to a question. The NED will automatically answer Y(ES) to all such standard questions, assuming the config should take effect.
Some questions though, like password prompts, the NED will not know the answer to. In such cases, the NED must be configured with the correct answer(s) to a question using the write inject-answer ned-setting list.
The ned-settings is configured with:
question Last line of the device question, regular expression
answer Answer(s) to device question. Separate multiple answers and end with \n.
ml-question Multi-line question, DOTALL regular expression [optional]
For example, when enabling a pki server config with "no shutdown", the user must submit a password (twice) the first time. The question from the device will look like this:
%Some server settings cannot be changed after CA certificate generation. % Please enter a passphrase to protect the private key % or type Return to exit Password:
The password must be submitted twice, hence a second question from the device will show once the password is entered the first time:
Re-enter password:
Both questions, prompting for the password, may be answers with a single inject-answer entry (note the double \n below):
devices device ned-settings cisco-ios write inject-answer A1 question "\APassword:" answer "cisco123\ncisco123\n"
If there are identical password prompts which require different passwords, use the ml-question to specify which entry should be used for which, e.g.:
devices device ned-settings cisco-ios write inject-answer A1 question "\APassword:" answer "cisco123\ncisco123\n" ml-question "changed after CA certificate generation"
6.6. ned-settings cisco-ios write config-archive
When config-archive is configured IOS NED will save running-configuration into file(s) on device.
The running-configuration is copied after NED performs 'write memory'.
The errors during copy, if any, should be ignored (with log entry), hence if a copy operation fails the transaction proceeds to success, and any subsequent copy operations are attempted. The transaction succeeds even when all copy operations fail. Each list entry, unless disabled, will result in a copy operation.
The copy operation is performed as 'copy /noverify running-config url'
The url for destination is formed in the following manner:
Substitution is performed on filename: %h is replaced with device name, which is NSO /devices/device/name %d is replaced with NSO system date in YYYY-MM-DD format %t is replaced with NSO system time in hh:mm:ss format %i is replaced with NSO Maapi transaction id Each of substituional sequences is optional. The sequences can appear in any order.
For example following filenames are valid: config_backup.txt config_backup_%h.txt config_backup_%h_%i.txt config_backup_%h_%dT%t_%i.txt %i_%d_%h.txt
If type = 'remote' and remote-user or remote-user and remote-password specified, substitution is performed on directory by splicing in user/password, e.g. directory scp://server.examle.com/ remote-user archiveuser remote-user archivepassword result scp://user:[email protected]/
Result of directory and filename substitution joined together to form target url
The NED does not verify resulting url for validity.
Maximum files:
After the copy operation completes, NED will:
Perform directory listing on the device dir directory
If the directory contains more then max-files files, NED will remove oldest files, so that only max-files are left in the directory delete /force directoryAndOldFileName
If max-files is configured, it is critical that the directory is dedicated to keeping the archive, otherwise non-archive files may be removed. This is especially dangerous if the directory is committed all together or points to the root of local system, which will lead to removal of ios image and startup configuraiton files.
7. ned-settings cisco-ios auto
Configure auto (dynamic behaviour) when reading or writing from|to device.
8. ned-settings cisco-ios api
Configure API (new API features/changes).
9. ned-settings cisco-ios live-status
Configure NED settings related to live-status.
9.1. ned-settings cisco-ios live-status auto-prompts
See section 5. Built in live-status actions in README.md for information on how to use this ned-setting.
10. ned-settings cisco-ios developer
Contains settings used by the NED developers.
10.1. ned-settings cisco-ios developer simulate-show
Used with live-status to inject simualted output for a show command.
Last updated
Was this helpful?

