This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

NCM Config Template variable / parsing assistance

Hello All,

I've posted something similar to this a ways back, but I was never able to complete my testing, so I am starting over.

I am looking for some assitance in parsting out part of a cisco config (hostname) and taking that an putting it into a command for an access list.

Here's what I am targeting/ my example

I have a hostname lets say

Hostname is HOST1234     (the 1234 are actually the second and third octet of an IP address)

I simply want to create a script in NCM (that will not prompt for input) that will create a configuration similar to :

Below.. is an example of the hostname.. and xxx in in the ip address is a constant. the 12.34 comes from the hostname.

HOST1234

config t

access-list 1 permit  xxx.12.34.xxx  any eq nnnnnn

Does anyone have a similar template ?

  • You're not going to be able to chop up the hostname in the config template unfortunately, but you could put that information (the 1234 portion) in a custom property and then use *that* in the script. For example if you called it HostnameSuffix you could embed that in the code as @ContextNode.HostnameSuffix.

  • I would recommend splitting your 2nd and 3rd octets into 2 separate custom properties. They both likely signify something different (for me is is geographical area and site within that area). This would allow you to use it easily in many scripts as it is already digested and just needs to be put back together. If this is a way you want to consider doing it let me know and I can post a script I used to update all of my EIGRP configurations based on similar information.

  • You can use substring functions in config scripts