03-19-2018 07:32 AM - edited 03-01-2019 04:07 AM
Wanted to know `ssh.fetch_host_keys().result.string` all possible resulting strings i.e. updated, unchanged, failed, e.t.c
if any document can you please point me where i can find.
Solved! Go to Solution.
03-20-2018 09:24 AM
Have a look in <NSO installation>/src/ncs/yang/tailf-ncs-ssh.yang
10-19-2020 05:33 AM - edited 10-19-2020 05:43 AM
@Jan Lindblad Thanks, Now I am able to see all the possibly in the yang, pasting here.
grouping ssh-host-keys-result {
leaf result {
type enumeration {
enum failed {
description
"The key retrieval failed, e.g. due to failure to connect
to the device or cluster node.";
tailf:code-name hostkey_failed;
}
enum unchanged {
description
"The key retrieval succeeded, and the keys were the same
as those already known.";
}
enum updated {
description
"The key retrieval succeeded, and the keys were not the same
as those already known - i.e. there was at least one new or
changed key. The updated keys were committed";
}
enum updated-uncommitted {
description
"The key retrieval succeeded, and the keys were not the same
as those already known - i.e. there was at least one new or
changed key. The updated keys were not committed, only stored
in the current transaction, since the device or cluster node
entry the keys pertain to was not committed (i.e. it only
exists in the current transaction). The keys will be
committed when the user commits the transaction.";
}
enum not-available {
description
"Key retrieval was not attempted due to not being applicable for
the device type or additional live-tree protocol (e.g. CLI
access via telnet rather than SSH).";
}
}
}
}
I found a better way in recent days to fetch the fingerprint value, here is the solution
dev = root.devices.device['ios-dev0'] list(dev.ssh.host_key)[0].show_fingerprint().value
Thanks,
Kiran Kumar
03-19-2018 09:00 PM
Hi,
You can get result as following.
---
for dev in root.ncs__devices.device:
output = dev.ssh.fetch_host_keys()
print('[{}]fetch result: {}'.format(dev.name, output.result))
---
$ python ssh_fetch.py
[csr1kv]fetch result: unchanged
The result of tailf:action is same as the output structure.
03-19-2018 10:56 PM
This will give one result out of ? (updated, unchanged, failed, e.t.c) -> I want to know there i can find that list of results or the code which is sending them.
03-20-2018 09:24 AM
Have a look in <NSO installation>/src/ncs/yang/tailf-ncs-ssh.yang
10-19-2020 05:33 AM - edited 10-19-2020 05:43 AM
@Jan Lindblad Thanks, Now I am able to see all the possibly in the yang, pasting here.
grouping ssh-host-keys-result {
leaf result {
type enumeration {
enum failed {
description
"The key retrieval failed, e.g. due to failure to connect
to the device or cluster node.";
tailf:code-name hostkey_failed;
}
enum unchanged {
description
"The key retrieval succeeded, and the keys were the same
as those already known.";
}
enum updated {
description
"The key retrieval succeeded, and the keys were not the same
as those already known - i.e. there was at least one new or
changed key. The updated keys were committed";
}
enum updated-uncommitted {
description
"The key retrieval succeeded, and the keys were not the same
as those already known - i.e. there was at least one new or
changed key. The updated keys were not committed, only stored
in the current transaction, since the device or cluster node
entry the keys pertain to was not committed (i.e. it only
exists in the current transaction). The keys will be
committed when the user commits the transaction.";
}
enum not-available {
description
"Key retrieval was not attempted due to not being applicable for
the device type or additional live-tree protocol (e.g. CLI
access via telnet rather than SSH).";
}
}
}
}
I found a better way in recent days to fetch the fingerprint value, here is the solution
dev = root.devices.device['ios-dev0'] list(dev.ssh.host_key)[0].show_fingerprint().value
Thanks,
Kiran Kumar
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide