Network Management

NCM script to push a banner change takes a while to execute

Some mechanics of a Banner Command and NCM logic that conflicts and caused a lot of overhead creating slow performance or hangs the application or even the server. In order to alleviate this pressure, add a couple of macros to the script to temporarily bypass some NCM logic and increase efficiency

First published date

10/9/2018 4:05 PM

Last published date

6/21/2023 7:00 PM

Overview

In short, there are some mechanics of a Banner Command and NCM logic that conflicts and caused a lot of overhead, creating slow performance or hanging of the application or server. To alleviate this pressure, add a couple of macros to the script to temporarily bypass some NCM logic and increase efficiency

Product section

Network Configuration Manager

Cause

When NCM issues a command, it needs to examine each blob that is returned to determine whether the prompt has been returned and to guide the next course of action. The entire banner is processed with a few characters at a time. This creates a delay, as NCM has to process the logic that would usually take three seconds or more.

Resolution

  1. In the execute command script, on the line after the conf t command is issued add the macro:
${DisablePromptDetection}
  1. After the last deliminator in the banner is written, drop down a line and add the macro:
${EnablePromptDetection}

Example:

conf t

${DisablePromptDetection}

banner motd ^C

PLEASE DO NOT CHANGE THE HOSTNAME OF THIS DEVICE
OR CHANGE USERNAMES AND PASSWORDS!

^C 

${EnablePromptDetection}

end

It is crucial after the ${DisablePromptDetection}macro is issued one does not neglect to have the ${EnablePromptDetection} back to turn it back on.

To use this option in the config change template the template needs to have the following commands added:

string @disablePromptDetection = '${DisablePromptDetection}'
string @enablePromptDetection = '${EnablePromptDetection}'

Then @disablePromptDetection is used in the command where one would need to disable the prompt detection.

Example:

script ChangeMOTDBannerCiscoIOS (
                                           NCM.Nodes @ContextNode, 
                                           string @MOTDBanner   )
{
string @disablePromptDetection = '${DisablePromptDetection}'
string @enablePromptDetection = '${EnablePromptDetection}' 
  CLI
  {
configure terminal
@disablePromptDetection
no banner motd
banner login C@MOTDBanner C
@enablePromptDetection
end
  }


}