Showing results for 
Search instead for 
Did you mean: 
Create Post
Level 9

Script variables not parsing?

I figured this should work as a test but it doesn't

I simply created a script, then run this script against a node

:log warning "Script Test Start"

:log warning "Node IP is ${N=SwisEntity;M=IP_Address}"

:log warning "Node IP also is ${IP}"

:log warning "Script Test End"

since i'm only getting 2 log entries, it looks like it's literally pasting those characters in (which is an invalid command and gets rejected)

I also tried this in a compliance rule by simply entering

/ip address find where address=${N=SwisEntity;M=IP_Address}

Expecting when I hit test and point to a config file it would show i.e.

/ip address find where address=

But again it shows the literal text, not an IP address

Am I doing something wrong here?

I need to be able to run compliance reports and find some particular lines that use the primary/loopback address of nodes. And if those lines don't exist, NCM will create them. So scripting is necessary here as it'll be run against hundreds of routers

0 Kudos
2 Replies

The variable you are looking for is ${AgentIP}

:log warning "Script Test Start"

:log warning "Node IP is ${AgentIP}"

:log warning "Script Test End"

I don't remember if I've found the published SW docs on that, but this thread has some old stuff in it.

Looking for list of NCM variables

0 Kudos

I believe variables like that only resolve in NCM when they are used as part of a config change template.   All other areas of ncm are just straight text entries

- Marc Netterfield, Github
0 Kudos