Infoblox’s global team of threat hunters uncovers a DNS operation with the ability to bypass traditional security measures and control the Great Firewall of China. Read about “Muddling Meerkat” and the many other threat actors discovered by Infoblox Threat Intel here.

Automation Scripts


Netmri interface description script

New Member
Posts: 1
1943     0


I'm looking to have a script in Netmri that will performs some actions on all the interfaces from my switches that contains a certain value "TEST" in the interface description:

If interface description contains "TEST" do : conf t; shutdown;

Do you have some examples? What's the best langage (CCS, Perl, Python) ?

Thank you for your replies.

Re: Netmri interface description script

New Member
Posts: 1
1943     0

The choice of scripting language almost doesn't matter -- use what's easiest for you.  For Perl or Python, you'll need to use the netmri_easy library to perform device association, login, etc.


The issue in most scripts is the pattern matching -- what will produce the output you want to capture to let you conditionally perform an operation.  For your case, I suggest sending this via CLI:

    show interface description | include up.*TEST

That will find interfaces with that description but will ignore ones that are already admin down.


If the output is empty, there's nothing to do.  Otherwise, loop on each matching statement (or implicitly in a CCS Trigger), and issue the shutdown command.

To prevent going in and out of config mode more than once, use a boolean ($config_changed) that you set the first time.  If it's false, then "config term"... and set it to true.

When there are no more matches, if $config_changed is true, then send a CLI "end" and optionally "write mem".


If you want to be extra careful in testing, use the DEBUG: attribute on CLI commands so that they don't actually change the config but you can check the logic flow.


The sample scripts that are available in each language show this technique.

Re: Netmri interface description script

[ Edited ]
New Member
Posts: 2
1943     0

Thanks for sharing this inforamtion.

Liteblue Login

Showing results for 
Search instead for 
Did you mean: 

Recommended for You