cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
839
Views
0
Helpful
11
Replies

How to apply a device template to a device when a character contains a special character like '?'(the question mask)?

shiqian
Cisco Employee
Cisco Employee

First I apologize if my action bother you because I already put my question below this discuss but the old question seems has solved and anybody may not see my question, so I rise it in a new one. The old link is shown below if you want to have a look:

 

https://community.cisco.com/t5/nso-developer-hub-discussions/how-to-apply-a-device-template-to-a-device-when-a-character/m-p/3850073#M3747 

 

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

then 

I change the definition "send" element in my Yang (I used type string before), 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";

Do you have some advice to help me? Thank you

 

 

 

11 Replies 11

yfherzog
Cisco Employee
Cisco Employee

I don't think I fully understand the scenario, but when you say that you use the escape character, which escape character did you use?

I don't know the device or the NED, it might be that the URI characters needs to be escaped with HTML escape characters. e.g. '/' replaced with '%2F', '?' replaced with '%3F', etc.

 

https://www.w3schools.com/tags/ref_urlencode.ASP

Thank you for your reply.
My original value is

"GET /HELLO/WORLD/cisco?success\r\n"

and I create a parameter called send, this parameter type I set in Yang model is string. When the nso ned translate this parameter, it meets the character '?' in this parameter, it is a special char in most device, it is a 'help' character, so I try to escape it, and I change my value into this form 

"GET /HELLO/WORLD/cisco\?success\r\n"

you can see I use this escape character '\' , 

And I follow your advertise, I change my value into this style:

"GET /HELLO/WORLD/cisco%5C%3Fsuccess\r\n"

But the NSO still change the value into:

"GET /HELLO/WORLD/cisco\?success\r\n"

when it sends the template to the F5 device and still report the fault log.

Thanks again for your interest in this discussion.

 

 

 

What actually needs to be sent to the device?

If you remove all escaping, what is actually sent to the device?

the actually value is

"GET /HELLO/WORLD/cisco?success\r\n"

and if I send it directly through NSO ned method, it can't be send to the device, and the fault log will occur on NSO log.

If I send this value below to device through the NSO method:

"GET /HELLO/WORLD/cisco\?success\r\n"

or

"GET /HELLO/WORLD/cisco%5C%3Fsuccess\r\n"

it will be send to the f5 device correctly but the fault log will occur on NSO log.

 

What does it mean that "it can't be send to the device, and the fault log will occur on NSO log."?

 

What error message do you get from NSO?

What do you get on the NED trace?

First I fix one mistake that I told above, the fiirst case still can be send to the F5 device, for example:

if I sent the value is:

GET /HELLO/WORLD/cisco?success\r\n

the NSO platform will show:截屏2020-03-08下午9.47.56.png

and the NSO log shows:

<ERROR> 08-Mar-2020::09:42:43.422 NedComGenericBase Ned-Worker-Thread-2: - BigIP Error in prepare
com.tailf.ned.NedException: AddToTransaction:
Device Response:
create /ltm monitor http "test_05" {  adaptive "disabled" defaults-from "http" destination "*:*" interval "5" ip-dscp "0" recv "none" recv-disable "none" send "GET /HELLO/WORLD/cisco?
Values:
  [enter value]
->
Command:
create /ltm monitor http "test_05" {  adaptive "disabled" defaults-from "http" destination "*:*" interval "5" ip-dscp "0" recv "none" recv-disable "none" send "GET /HELLO/WORLD/cisco?success\r\n" 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> 08-Mar-2020::09:42:43.422 NedComGenericBase Ned-Worker-Thread-2: - BigIP AddToTransaction:

But the monitor 'test_05' is still created on F5 device:截屏2020-03-08下午9.57.11.png

 

 and you can see the value is set to "GET /HELLO/WORLD/ciscosuccess\r\n" without question mask.

 

Can you share the error message and the trace from when you try to configure "GET /HELLO/WORLD/cisco\?success\r\n"?

Sorry to reply to you now,and I cannot reproduce this error message now in the case "GET /HELLO/WORLD/cisco\?success\r\n". It becomes normal and can be push to the F5 device!

But you can refer my error message about "GET /HELLO/WORLD/cisco?success\r\n", they are very similar.

So, you're now able to do what you were aiming for. Issue solved?

This issue occurs randomly, sometimes the '\?' can and sometimes it break error log. I hope to find a stable method.

LanDownUnda
Beginner
Beginner

Fancy seeing an F5 Support question on a Cisco Forum!

Nether the less - special characters like question marks can be a pain. I've never needed to use the CLI to configure monitors as I've used the GUI as recommended by a F5 Support Engineer for reasons like this.

 

If you are looking at automation the creation of monitors then I recommend using the F5 API or learning pyATS which will be supporting F5 BIGIP In their next monthly release.

 

I hope this helps!

*** Rate All Helpful Responses ***
Getting Started

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:

Recognize Your Peers