cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
999
Views
5
Helpful
2
Replies

Can't add a multiline banner using RESTCONF?

EhsanVessal
Level 1
Level 1

Hey all

 

  I'm having issues adding a multiline banner to a switch using RESTCONF. This is the banner I want to type in:

banner exec ^
This is a private system operated for and by Company Inc.
   Authorization from Company Inc. management is required to use this system.
                    Use by unauthorized persons is prohibited.
^


When I type it in on the command line and do a REST call via this URL: http://{host}/restconf/data/native/banner I get this output:

{
    "Cisco-IOS-XE-native:banner": {
        "exec": {
            "banner": "^"
        },
        "login": {
            "banner": "^"
        }
    }
}

It only returns to me the first line, and none of the subsequent banner even though I have verified that the banner is there and working.

 

When I try to make a REST call using PUT or PATCH methods, it can take in the banner as long as I make it a single line. But when I want to break it up into a multiline string using line breaks "\n" it doesn't understand the character and gives me a HTTP 400 error. I can use a carriage return "\r", however that will input the banner up until the "\r" and nothing after it.

Is there a way to get a Multiline banner working in RESTCONF?

 

--Ehsan

2 Replies 2

I am not 100% on this - but _think_ you cannot send multi-line using this model, only single line as you see. I _think_ for multi-line you need to send this as part of the running-config instead.

 

Hope this helps.

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

I was afraid of that. I found a topic posted here where it was able to be done with en EEM script using the guestshell, so I guess I'll try to do it via ZTP. It had the same issues funnily, it doesn't recognize "\n" as a line break. "\r" was recognized as a carriage return in both cases, but with RESTCONF it wouldn't print anything else after the "\r" was invoked. At least with the EEM script in guestshell it prints everything after the "\r".