Reply

XML script to iterate through rules

Techie
Posts: 9
7719     0

Hi,

 

I am new to XML scripts. I wanted to create a xml rule in NetMRI. The requirement is to define 10 command lines in the rule. NetMRI should iterate through each line and test each line in the current device configuration. In the end it gives me the lines Found and Not Found as output.

 

Any help would be greatly appreciated.

Thank You.

Re: XML script to iterate through rules

Superuser
Posts: 115
7719     0

Can you post the lines that you want to check?

 

Also, you can accomplish this without XML as well

Follow me on LinkedIn: https://www.linkedin.com/in/sifbaksh
Twitter: https://twitter.com/sifbaksh

https://sifbaksh.com

Re: XML script to iterate through rules

Techie
Posts: 9
7720     0
snmp-server enable traps snmp authentication linkdown linkup coldstart warmstart
snmp-server enable traps transceiver all
snmp-server enable traps tty
snmp-server enable traps auth-framework sec-violation
snmp-server enable traps config-copy
snmp-server enable traps config
snmp-server enable traps config-ctid
snmp-server enable traps energywise
aaa accounting commands 1 default start-stop group .*
aaa accounting commands 15 default start-stop group .*
aaa accounting connection default start-stop group .*
aaa accounting exec default start-stop group .*
aaa accounting network default start-stop group .*
aaa accounting system default start-stop group .*
aaa accounting update newinfo
aaa authentication login default group .* local
aaa authorization commands 1 default group .* none
aaa authorization commands 15 default group .* none
aaa authorization config-commands
aaa new-model
aaa session-id common




Siddharth Sharma
Sr. Network Engineer
.........................................................
US Direct Dial (O) : +1-612.671.9464 M: +91-7039630779

[cid:image001.jpg@01D5DC0F.4D937FF0]Ameriprise Financial
Ameriprise India Private Limited
Plot # A - 112, Sector 65, Noida
Uttar Pradesh, India 201301

We shape financial solutions for a lifetime(r)

Re: XML script to iterate through rules

Superuser
Posts: 115
7720     0

For this, I would create two rules.  One for SNMP and one for AAA

 

I will post them here shortly

Follow me on LinkedIn: https://www.linkedin.com/in/sifbaksh
Twitter: https://twitter.com/sifbaksh

https://sifbaksh.com

Re: XML script to iterate through rules

Techie
Posts: 9
7720     0
Thanks Baksh !



Siddharth Sharma
Sr. Network Engineer
.........................................................
US Direct Dial (O) : +1-612.671.9464 M: +91-7039630779

[cid:image001.jpg@01D5DC11.C1B1AFE0]Ameriprise Financial
Ameriprise India Private Limited
Plot # A - 112, Sector 65, Noida
Uttar Pradesh, India 201301

We shape financial solutions for a lifetime(r)

Re: XML script to iterate through rules

[ Edited ]
Superuser
Posts: 115
7720     0

Please see attached

 

You will also need to add a Device Filter or it will run that against all the devices 

 

Also, join us on Slack and here is a list of Scripts and Rules, I'm going to upload these to that list

 

https://github.com/infobloxopen/netmri-toolkit

 

 

Here you will find some additional rules

https://github.com/infobloxopen/netmri-toolkit/tree/master/policy/rule_logic_builder

 

Follow me on LinkedIn: https://www.linkedin.com/in/sifbaksh
Twitter: https://twitter.com/sifbaksh

https://sifbaksh.com

Re: XML script to iterate through rules

Expert
Posts: 70
7720     0

Are you determined to create it in XML?  Instead you could use the Logic Rule Builder to specify that all of those statements must be present in any order, and that no others of those types may exist.  Like Sif suggested, one rule for AAA and another for SNMP seems preferable.  If you combine those into a policy, the resulting analysis will flag any violations.

 

Once those rules work as you wish, you could Export the rules or policy in XML format and then examine it.

Re: XML script to iterate through rules

Techie
Posts: 9
7720     0
My intent to write an XML script is that If i have 6 "AAA" coomands defined in a rule and the first command fails; Netmri will report violation for the first AAA failed command but we won't get to know what second command is missing.

I wanted to write a XML script which tells me out of 6 commands defined in the rule what all commands failed while iterating the rule from top to bottom.

Thanks !
Showing results for 
Search instead for 
Did you mean: 

Recommended for You