05-03-2019 12:24 PM
Hi,
I have a device template which I am using to configure my device's password. Here the is the results:
admin@ncs(config)# devices device nexus apply-template template-name test variable { name pass value 'cisco' }
apply-template-result {
device nexus
result ok
}
admin@ncs(config)# commit dry-run outformat native
native {
device {
name nexus
data username admin password 0 cisco role network-admin
}
}
admin@ncs(config)# commit
Commit complete.
I confirm it works by ssh'ing to the real device with the new password.
Now when adding a special character, here is the result:
admin@ncs(config)# devices device nexus apply-template template-name test variable { name pass value 'cisco!123' }
-----------------------------------------------------------------------------------------------------------^
syntax error: expecting '}'
I know what is being sent is XPath logic per:
admin@ncs(config)# devices device nexus apply-template template-name test variable { name pass value ?
Possible completions:
<node set> - an XPath expression resulting in a node set
<number> - some integer or float number. This is an XPath number.
<quoted> - some text enclosed in single quotes. This is an XPath string.
Does anyone here know what value I need to insert between the single quotes that include a special character to make it work? Or is it not supported?
thank you
Solved! Go to Solution.
05-03-2019 02:52 PM
'!' is a comment marker in the C-style CLI, so, of course you should escape that character in the C-style CLI in general, and especially in templates. So, use 'cisco\!23' as the value in the command.
If you try the same in the J-style CLI, it will work even without the escaping. But you can see the same problem in the J-style CLI, with the '#' character, since '#' denotes a comment in the J-style CLI. So, in J-style CLI, to configure a value with '#' character, you should escape it, like 'cisco\#123'
/Ram
05-03-2019 02:52 PM
'!' is a comment marker in the C-style CLI, so, of course you should escape that character in the C-style CLI in general, and especially in templates. So, use 'cisco\!23' as the value in the command.
If you try the same in the J-style CLI, it will work even without the escaping. But you can see the same problem in the J-style CLI, with the '#' character, since '#' denotes a comment in the J-style CLI. So, in J-style CLI, to configure a value with '#' character, you should escape it, like 'cisco\#123'
/Ram
05-03-2019 02:59 PM
03-05-2020 08:18 PM
I meet the same question but the another char "?", the question mask.
the device is F5 and I want to create a monitor, there is a parameter called "send", and its value is an url. In the following example, I simple the value "get ?"
Of cause, I use the escape character but the nso give the following error info:
<ERROR> 05-Mar-2020::23:06:14.602 NedComGenericBase Ned-Worker-Thread-0: - BigIP Error in prepare com.tailf.ned.NedException: AddToTransaction: Device Response: create /ltm monitor http "sj-test" { adaptive "disabled" defaults-from "http" destination "*:*" interval "5" ip-dscp "0" recv "none" recv-disable "none" send "get \?" time-until-up "0" timeout "16" } -> Command: create /ltm monitor http "sj-test" { adaptive "disabled" defaults-from "http" destination "*:*" interval "5" ip-dscp "0" recv "none" recv-disable "none" send "get \?" time-until-up "0" timeout "16" } at com.tailf.packages.ned.bigip.BigIpNedGeneric.addToTransaction(BigIpNedGeneric.java:4816) at com.tailf.packages.ned.bigip.BigIpNedGeneric.addToTransaction(BigIpNedGeneric.java:4728) at com.tailf.packages.ned.bigip.BigIpNedGeneric.edit(BigIpNedGeneric.java:3537) at com.tailf.packages.ned.bigip.BigIpNedGeneric.prepare(BigIpNedGeneric.java:3100) at com.tailf.ned.NedWorker.dorun(NedWorker.java:1589) at com.tailf.ned.NedWorker.run(NedWorker.java:294) <ERROR> 05-Mar-2020::23:06:14.603 NedComGenericBase Ned-Worker-Thread-0: - BigIP AddToTransaction: Device Response: create /ltm monitor http "sj-test" { adaptive "disabled" defaults-from "http" destination "*:*" interval "5" ip-dscp "0" recv "none" recv-disable "none" send "get \?" time-until-up "0" timeout "16" } -> Command: create /ltm monitor http "sj-test" { adaptive "disabled" defaults-from "http" destination "*:*" interval "5" ip-dscp "0" recv "none" recv-disable "none" send "get \?" time-until-up "0" timeout "16" } <WARN> 05-Mar-2020::23:06:14.603 NedWorker Ned-Worker-Thread-0: - reporting error with illegal errorcode : 'AddToTransaction: Device Response: create /ltm monitor http "sj-test" { adaptive "disabled" defaults-from "http" destination "*:*" interval "5" ip-dscp "0" recv "none" recv-disable "none" send "get \?" time-until-up "0" timeout "16" } -> Command: create /ltm monitor http "sj-test" { adaptive "disabled" defaults-from "http" destination "*:*" interval "5" ip-dscp "0" recv "none" recv-disable "none" send "get \?" time-until-up "0" timeout "16" } ', fallback to NED_EXTERNAL_ERROR
03-06-2020 03:23 AM - edited 03-06-2020 03:24 AM
I define the "send" element in my Yang , use the:
module monitor {
...
import ietf-inet-types {
prefix inet;
}
...
leaf send {
type inet:uri;
}
}
it seems can accept the vaule "Get \?" , but it still cannot accept the value "GET /HELLO/WORLD/cisco\?success\r\n"
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the NSO Developer community: