Hi ,i have added this when statement but this statment is not making any sense could any one help here please??
to configure vrf services should be in shutdown
leaf vrf {
description
“Voice VRF”; when "/ios:native/voice/service[type=‘voip’]/shutdown"
tailf:cli-full-command;
tailf:cli-diff-create-after “/ios:native/ios:ip/ios:vrf”;
tailf:cli-diff-delete-before “/ios:native/ios:ip/ios:vrf”;
tailf:cli-diff-create-after “/ios:native/ios:vrf/ios:definition”;
tailf:cli-diff-delete-before “/ios:native/ios:vrf/ios:definition”;
must “/ios:native/ios:vrf/ios:definition[ios:name=current()] or /ios:native/ios:ip/ios:vrf[ios:name=current()]” {
error-message “VRF must be created 1st, deleted last”;
}
below are confd results the when condition is not getting invoke
voice service voip
no shutdown
no cpa
no supplementary-service sip handle-replaces
no supplementary-service sip moved-temporarily
no supplementary-service sip refer
sip
!
!
bgl-ads-3590# config t
Entering configuration mode terminal
bgl-ads-3590(config)# voice ?
Possible completions:
cause-code class error-passthru header-passing iec register service translation-profile translation-rule uc vrf
bgl-ads-3590(config)# voice vrf ?
Possible completions:
<string, min: 1 chars, max: 32 chars>[vrf12]
bgl-ads-3590(config)# voice vrf vrf10 bgl-ads-3590(config)# commit Commit complete.
You did not include the YANG for the shutdown leaf, so I am speculating that it looks something like this:
leaf shutdown {
tailf:cli-full-command;
tailf:cli-boolean-no;
type boolean;
default false;
}
Such a leaf will not be deleted as it has a default value. You need to check if the leaf is set to “true” with your when statement XPath expression. Example:
when "/ios:native/voice/service[type=‘voip’]/shutdown = 'true'"
i have used this statement but if we use this the vrf node wont be visible if we do no shutdown as shown below
bgl-ads-3590(config)# voice service voip
bgl-ads-3590(conf-voi-serv)# no shutdown**
bgl-ads-3590(conf-voi-serv)# show configuration diff
voice service voip
- shutdown
+ no shutdown
!
bgl-ads-3590(conf-voi-serv)# commit
Commit complete.
bgl-ads-3590(conf-voi-serv)# exit
bgl-ads-3590(config)# voice ?
Possible completions:
cause-code class error-passthru header-passing iec register service translation-profile translation-rule uc
bgl-ads-3590(config)# voice
but my requirment is node should be visible but when we try to commit it should show below error
"Cannot configure/unconfigure the CLI when VoIP services are running or when active VoIP calls are present"
Then perhaps you need a must statement, not a when statement.
must "/ios:native/voice/service[type=‘voip’]/shutdown = 'true'" {
error-message "Cannot configure/unconfigure the CLI when VoIP"
+ " services are running or when active VoIP calls are"
+ " present";
}
…although your error message text suggests that you are validating the state change, not the data. If so, must or when statements will not help. You will need a tailf:validate statement and callback application code for that.
Hi conny!
As you suggested to go through this tailf:validate
i have gone through can you please confirm is it correct to add tailf:validate as below??
leaf vrf {
description
“Voice VRF”;
when "/ios:native/voice/service[type='voip']/shutdown = 'true'"{
tailf:dependency "/ios:native/voice/service[type='voip']/shutdown";
}
tailf:cli-full-command;
tailf:cli-diff-create-after "/ios:native/ios:ip/ios:vrf";
tailf:cli-diff-delete-before "/ios:native/ios:ip/ios:vrf";
tailf:cli-diff-create-after "/ios:native/ios:vrf/ios:definition";
tailf:cli-diff-delete-before "/ios:native/ios:vrf/ios:definition";
must "/ios:native/ios:vrf/ios:definition[ios:name=current()] or /ios:native/ios:ip/ios:vrf[ios:name=current()]" {
error-message "VRF must be created 1st, deleted last";
}
type string {
length "1..32";
}
container voice {
description
"Global voice configuration";
tailf:cli-incomplete-no;
leaf vrf {
description
"Voice VRF";
tailf:cli-full-command;
tailf:cli-diff-create-after "/ios:native/ios:ip/ios:vrf";
tailf:cli-diff-delete-before "/ios:native/ios:ip/ios:vrf";
tailf:cli-diff-create-after "/ios:native/ios:vrf/ios:definition";
tailf:cli-diff-delete-before "/ios:native/ios:vrf/ios:definition";
must "/ios:native/ios:vrf/ios:definition[ios:name=current()] or /ios:native/ios:ip/ios:vrf[ios:name=current()]" {
error-message "VRF must be created 1st, deleted last";
}
> must "(/ios:native/voice/service[type='voip']/shutdown= 'true') and (/ios:native/voice/service[type='voip']/sip/call/service/stop)"{
> error-message "Cannot configure/unconfigure the CLI when VoIP services are running or when active VoIP calls are present";
> }
> tailf:cli-diff-dependency "/ios:native/voice/service[type='voip']/shutdown";
> tailf:cli-diff-dependency "/ios:native/voice/service[type='voip']/sip/call/service/stop";
type string {
length "1..32";
}
}
issue is when i try to do no call service stop after configuring voice vrf i am facing below error
rr4-utah_RP_0(config)# voice service voip
rr4-utah_RP_0(conf-voi-serv)#
rr4-utah_RP_0(conf-voi-serv)# no shutdown
rr4-utah_RP_0(conf-voi-serv)# show configuration diff
rr4-utah_RP_0(conf-voi-serv)# commit
Commit complete.
rr4-utah_RP_0(conf-voi-serv)# sip
rr4-utah_RP_0(conf-serv-sip)# no call service stop
> rr4-utah_RP_0(conf-serv-sip)# commit
> Aborted: 'voice vrf' (value "vrf1"): Cannot configure/unconfigure the CLI when VoIP services are running or when active VoIP calls are present
Yes conny,
this is the leafs i am referring to.
To create and delete voice vrf vrfname, shutdown should be true and call service stop should be present.
Ya for shutdown i am able to remove ,but for call service stop also it should allow me to delete but i am facing issue any other tailf do i need to use??
please help
Ok is must statement dont allow to delet both shutdown and call service stop??
my requirement it should allow to do no call service stop and no shutdown then in show configuration I should be able to see voice vrf configs ,please help me with this??