cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
438
Views
1
Helpful
1
Replies

live-status error

suvdeshm
Cisco Employee
Cisco Employee
Hello Experts,
I am trying to set type 6 password on IOSXR device which apparently can be done only from live-status command. But I am getting an error.
This command works from cli -------
admin@ncs# devices device device_name live-status exec any auto-prompts { question ".*Enter new key.*" answer mykey12345 } auto-prompts { question ".*Enter confirm key.*" answer mykey12345 } "key config-key password-encryption"
result
Thu Jun 1 16:26:04.525 EDT
New password Requirements: Min-length 6, Max-length 64
Enter new key : (auto-prompt mykey12345) ->
Enter confirm key : (auto-prompt mykey12345) ->
Master key operation is started in background
RP/0/RSP0/CPU0:DNJ-DCN#
 
I am trying this from action in python package:-------
device = root.devices.device[device_name]
live_status_action_input = device.live_status.exec.any.get_input()
live_status_cmd = "auto-prompts { question \".*Enter new key.*\" answer mykey12345 } auto-prompts { question \".*Enter confirm key.*\" answer mykey12345 } \"key config-key password-encryption\""
 
output_result = device.live_status.cisco_ios_xr_stats__exec[live_status_cmd](live_status_action_input)
 
 But I get an error :-------

 output_result = device.live_status.cisco_ios_xr_stats__exec[live_status_cmd](live_status_action_input)

 File "/nso-6.0/src/ncs/pyapi/ncs/maagic.py", line 535, in __getitem__

    child = self._children.get_by_yang(self._backend, self, name)

  File "/nso-6.0/src/ncs/pyapi/ncs/childlist.py", line 184, in get_by_yang

    name = self.full_name_from_short_name(name)

  File "/nso-6.0/src/ncs/pyapi/ncs/childlist.py", line 210, in full_name_from_short_name

    return self.short_name_to_full_name[short_name]

KeyError: 'auto-prompts { question ".*Enter new key.*" answer mykey12345 } auto-prompts { question ".*Enter confirm key.*" answer mykey12345 } "key config-key password-encryption"'

 
1 Reply 1

jvikman
Cisco Employee
Cisco Employee

Emil Holmström answered this in another place:

-----8><-----

the action looks like this:

    tailf:action any {
      tailf:info "Execute any command on device";
      tailf:actionpoint ncsinternal {
        tailf:internal;
      }

      input {
        leaf admin-mode {
          tailf:info "Set to run the action in admin mode";
          type empty;
        }

        list auto-prompts {
          tailf:info "One-shot auto-prompts list, used to ignore/reply on questions";
          tailf:cli-suppress-mode;
          key question;
          leaf question {
            tailf:info "Device question, regular expression";
            type string {
              tailf:info "WORD;;Question, regex format";
            }
          }

          leaf answer {
            tailf:info "Answer to device question";
            type string {
              tailf:info "WORD;;Answer to device question | <exit|prompt|timeout|ignore|enter>";
            }
          }
        }

so shouldn't the input be entered something like this:

auto_prompts.create('.Enter new key.')

auto_prompts['.Enter new key.'].answer = 'mykey12345'

-----8><-----