12-17-2019 07:32 AM
Hi All,
I am writing a template for data kicker, I have used a trigger expression like this:
<trigger-expr>/devices/device[name='{$device}']/config/ios:interface/{$interface-type}[name='{$interface-id}']/shutdown='false'</trigger-expr>
But it seems this is always evaluating to False, even when shutdown is true on the interface for eg, when I change the shutdown on CLI I get this message in debug kicker output:
device-IOS3-Ethernet-id-0/81-IOS6 at /ncs:devices/ncs:device[ncs:name='IOS3']/ncs:config/ios:interface/ios:Ethernet[ios:name='0/81']/ios:shutdown changed; not invoking 'add-ce-re-deploy-action' trigger-expr false -> false
Can someone please suggest what is wrong with the expression I am using?
Thanks,
Neetika
Solved! Go to Solution.
12-18-2019 01:18 PM
Hello, I took a few minutes to look into this...
One key for understanding the config of the kickers was to check out the commentary in the kicker yang modeling in file <nso-inst>/src/ncs/yang/tailf-kicker.yang
The below kicker will fire (and call the action) only when the interface goes from shutdown (shutdown leaf exits) to 'no-shutdown' (shutdown field does not exist) - note: the config trigger-type = enter (not default enter-and-leave which would trigger change both ways t->f and f->t):
admin@ncs% show kickers
data-kicker test-kicker {
monitor /ncs:devices/ncs:device[ncs:name='ios-0']/ncs:config/ios:interface/ios:FastEthernet[ios:name='1/0'];
trigger-expr not(./shutdown);
trigger-type enter;
kick-node hostname:action;
action-name change-hostname;
}
[ok][2019-12-18 16:03:02]
[edit]
admin@ncs% show devices device ios-0 config ios:interface FastEthernet 1/0
ip {
no-address {
address false;
}
}
[ok][2019-12-18 16:03:05]
[edit]
admin@ncs% set devices device ios-0 config ios:interface FastEthernet 1/0 shutdown
[ok][2019-12-18 16:03:13]
[edit]
admin@ncs% commit | debug kicker
2019-12-18T16:03:19.611 kicker: test-kicker at /ncs:devices/ncs:device[ncs:name='ios-0']/ncs:config/ios:interface/ios:FastEthernet[ios:name='1/0'] changed; not invoking 'change-hostname' trigger-expr true -> false
Commit complete.
[ok][2019-12-18 16:03:19]
[edit]
admin@ncs% show devices device ios-0 config ios:interface FastEthernet 1/0
ip {
no-address {
address false;
}
}
shutdown;
[ok][2019-12-18 16:03:40]
[edit]
admin@ncs% delete devices device ios-0 config ios:interface FastEthernet 1/0 shutdown
[ok][2019-12-18 16:03:50]
[edit]
admin@ncs% commit | debug kicker
2019-12-18T16:03:55.375 kicker: test-kicker at /ncs:devices/ncs:device[ncs:name='ios-0']/ncs:config/ios:interface/ios:FastEthernet[ios:name='1/0'] changed; invoking 'change-hostname' trigger-expr false -> true
Commit complete.
12-17-2019 10:45 AM
In the ios NED the interface shutdown leaf is not a boolean, it is specified as type empty:
// interface * / shutdown
leaf shutdown {
// Note: default to "no shutdown" in order to be able to bring if up.
tailf:info "Shutdown the selected interface";
tailf:cli-show-no;
tailf:cli-full-command;
type empty;
}
You'll need to check for existence of the the shutdown leaf - value comparison with a leaf that doesn’t exist (i.e. “an empty node-set”) evaluates to false.
So instead of checking for the shutdown leaf = false you need to check the path expression = false.
Haven't tested the syntax, but perhaps something like this:
<trigger-expr>"/devices/device[name='{$device}']/config/ios:interface/{$interface-type}[name='{$interface-id}']/shutdown"='false'</trigger-expr>
12-18-2019 08:08 AM
Hi,
Thank you for the inputs, I agree since shutdown is type empty, I need to check the path expression.
I tried this kicker now:
admin@ncs# show running-config kickers
kickers data-kicker device-IOS3-Ethernet-id-2/2-IOS6
monitor /devices/device[name='IOS3']/config/ios:interface/Ethernet[name='2/2']/shutdown
trigger-expr "\"/devices/device[name='IOS3']/config/ios:interface/Ethernet[name='2/2']/shutdown\"='false'"
trigger-type enter
kick-node /services/cfs-services:cfs-services[name='fia3']/add-ce-re-deploy
action-name add-ce-re-deploy-action
!
However, it is still giving me the same results when I add or remove shutdown on the interface:
admin@ncs(config-if)# commit dry-run | debug kicker
2019-12-18T09:56:17.961 kicker: device-IOS3-Ethernet-id-2/2-IOS6 at /ncs:devices/ncs:device[ncs:name='IOS3']/ncs:config/ios:interface/ios:Ethernet[ios:name='2/2']/ios:shutdown changed; not invoking 'add-ce-re-deploy-action' trigger-expr false -> false
cli {
local-node {
data devices {
device IOS3 {
config {
ios:interface {
Ethernet 2/2 {
- shutdown;
}
}
}
}
}
}
}
Any clue what might be wrong now?
Thank you
12-18-2019 01:18 PM
Hello, I took a few minutes to look into this...
One key for understanding the config of the kickers was to check out the commentary in the kicker yang modeling in file <nso-inst>/src/ncs/yang/tailf-kicker.yang
The below kicker will fire (and call the action) only when the interface goes from shutdown (shutdown leaf exits) to 'no-shutdown' (shutdown field does not exist) - note: the config trigger-type = enter (not default enter-and-leave which would trigger change both ways t->f and f->t):
admin@ncs% show kickers
data-kicker test-kicker {
monitor /ncs:devices/ncs:device[ncs:name='ios-0']/ncs:config/ios:interface/ios:FastEthernet[ios:name='1/0'];
trigger-expr not(./shutdown);
trigger-type enter;
kick-node hostname:action;
action-name change-hostname;
}
[ok][2019-12-18 16:03:02]
[edit]
admin@ncs% show devices device ios-0 config ios:interface FastEthernet 1/0
ip {
no-address {
address false;
}
}
[ok][2019-12-18 16:03:05]
[edit]
admin@ncs% set devices device ios-0 config ios:interface FastEthernet 1/0 shutdown
[ok][2019-12-18 16:03:13]
[edit]
admin@ncs% commit | debug kicker
2019-12-18T16:03:19.611 kicker: test-kicker at /ncs:devices/ncs:device[ncs:name='ios-0']/ncs:config/ios:interface/ios:FastEthernet[ios:name='1/0'] changed; not invoking 'change-hostname' trigger-expr true -> false
Commit complete.
[ok][2019-12-18 16:03:19]
[edit]
admin@ncs% show devices device ios-0 config ios:interface FastEthernet 1/0
ip {
no-address {
address false;
}
}
shutdown;
[ok][2019-12-18 16:03:40]
[edit]
admin@ncs% delete devices device ios-0 config ios:interface FastEthernet 1/0 shutdown
[ok][2019-12-18 16:03:50]
[edit]
admin@ncs% commit | debug kicker
2019-12-18T16:03:55.375 kicker: test-kicker at /ncs:devices/ncs:device[ncs:name='ios-0']/ncs:config/ios:interface/ios:FastEthernet[ios:name='1/0'] changed; invoking 'change-hostname' trigger-expr false -> true
Commit complete.
12-19-2019 07:50 AM
Thank you so much, the solution worked perfectly.
12-19-2019 07:57 AM
One more query regarding kickers, I am trying to send few input params to the action method like I have the following template for kicker,
<config xmlns="http://tail-f.com/ns/config/1.0">
<kickers xmlns="http://tail-f.com/ns/kicker">
<data-kicker>
<id>device-{$device}-{$interface-type}-id-{$interface-id}-{$ce-device}</id>
<trigger-expr>not(./shutdown)</trigger-expr>
<trigger-type>enter</trigger-type>
<monitor>/devices/device[name='{$device}']/config/ios:interface/{$interface-type}[name='{$interface-id}']</monitor>
<kick-node>/services/cfs-services[name='{$name}']/add-ce-re-deploy</kick-node>
<action-name>add-ce-re-deploy-action</action-name>
</data-kicker>
</kickers>
</config>
I am able to get the "name" of cfs-services (in python code by using kp) but other than that if I have to set few other params, what is the easy way to do it? I am guessing there should be a way to set few params which kicker action can read later when it is invoked.
Any inputs appreciated.
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