Infoblox Exchange Cybersecurity Roadshow 2020 – Join us!
North America | Europe | Middle East/Africa | Asia-Pacific

Network Change & Configuration Management

Reply
Highlighted

Script-login

Techie
Posts: 16
2988     0

I'm have a perl script that is hard-coded to connect to the relevant devices to perform some actions. I don't want it to be run against a certain device from within the NetMRI execution engine. From the docs, it seems that "Script-Login: false" is a method to tell NetMRI to not login to the target device, but I can't seem to get it to work. The script executes correctly against the hard-coded devices, but a connection is still opened to the device I choose to run the script against. Is there any way to prevent this?

 

# BEGIN-SCRIPT-BLOCK
#
# Script-Filter:
#     true
#
# Script-Login: false
#
# Script-Variables:
#
#    $vlan_number            int            "Enter Vlan Number"
#    $vlan_name                string        "Enter Vlan Name"
#    $add_to_trunk            boolean        off
# END-SCRIPT-BLOCK
#
#
Highlighted

Script-Login Use in Perl Scripts

Adviser
Posts: 53
2988     0

Hi Sean,

Does the script call the log_message() method off of NetMRI::Easy? If so, that's the culprit. There is a known issue wherein calls to log_message() will cause a connection to the device to be opened despite Script-Login being set to false. The workaround is to call the _log_message_no_login() method off of NetMRI::Easy instead.

Thanks,

- Chris

 

Highlighted

Yes! That did the trick. It

Techie
Posts: 16
2989     0

Yes! That did the trick. It also indirectly solved the multi-line command output logging in my other thread. I suppose since the job is no longer opening a conection to a certain device, it is not triggering the bug.

Highlighted

Re: Yes! That did the trick

Adviser
Posts: 53
2989     0

Hi Sean,

Glad that both of the issues you were experiencing are resolved now. The multi-line command output is likely working because the _log_message_no_login() method takes a pretty different code path vs. the log_message() method.

Thanks,

- Chris

 

Highlighted

Re: Yes! That did the trick

Authority
Posts: 32
2989     0

I have a similar issue with CCS. Even with script-login set to false, the script fails if the device is not reachable or if the credentials aren't set in the device viewer. I am just trying to create a config file for a device using CCS. No connection is needed.

 

Script-Filter:
    $ipaddress like /192.168.20/

Script-Variables:
    $SITE_NUMBER string "SITE-#-REQUIRED_DO_NOT_USE_LEADING_ZEROS"
    $SITE_NAME string "FIXME-SITE-NAME"
    $SITE_ADDRESS string "FIXME-SITE-ADDRESS"
    $SITE_ROUTER_NAME string "FIXME-ROUTER-NAME"
    $SITE_SWITCH_NAME string "FIXME-SWITCH-NAME"
    $SITE_SWITCH_PORT string "FIXME-SWITCH-PORT"
    $SITE_CIR integer 100000

Script-Login:
    false

#-----------------------------------------------------------------------
Action:
    Set ASE-NoD specific values from NetMRI List "ASE NoD Site Parameters".

Action-Description:
    This action is executed once for every device that matches the
    Script-Filter defined above.

Action-Commands:
#Set variables for use by this script. Variables are gleaned from the NetMRI List "ASE NoD Site Parameters"
SET: $INNER_VLAN_1 = getListValue(ASE NoD Site Parameters,SITE_NUMBER,$SITE_NUMBER,INNER_VLAN_1,SITE_NUMBER_NOT_VALID)
SET: $INNER_VLAN_2 = getListValue(ASE NoD Site Parameters,SITE_NUMBER,$SITE_NUMBER,INNER_VLAN_2,SITE_NUMBER_NOT_VALID)
SET: $OUTER_VLAN = getListValue(ASE NoD Site Parameters,SITE_NUMBER,$SITE_NUMBER,OUTER_VLAN,SITE_NUMBER_NOT_VALID)
SET: $HOST_IP_1 = getListValue(ASE NoD Site Parameters,SITE_NUMBER,$SITE_NUMBER,HOST_IP_1,SITE_NUMBER_NOT_VALID)
SET: $REMOTE_IP_1 = getListValue(ASE NoD Site Parameters,SITE_NUMBER,$SITE_NUMBER,REMOTE_IP_1,SITE_NUMBER_NOT_VALID)
SET: $HOST_IP_2 = getListValue(ASE NoD Site Parameters,SITE_NUMBER,$SITE_NUMBER,HOST_IP_2,SITE_NUMBER_NOT_VALID)
SET: $REMOTE_IP_2 = getListValue(ASE NoD Site Parameters,SITE_NUMBER,$SITE_NUMBER,REMOTE_IP_2,SITE_NUMBER_NOT_VALID)
SET: $PREFERRED_NEIGHBOR = getListValue(ASE NoD Site Parameters,SITE_NUMBER,$SITE_NUMBER,PREFERRED_NEIGHBOR,SITE_NUMBER_NOT_VALID)
SET: $SITE_NUMBER_BNR = getListValue(ASE NoD Site Parameters,SITE_NUMBER,$SITE_NUMBER,SITE_NUMBER_BNR,SITE_NUMBER_NOT_VALID)

#Variable to calculate shape average
expr: $SHAPE_AVERAGE = $SITE_CIR * 1000

PRINT (ase-nod-config): version 15.4
PRINT (ase-nod-config): service timestamps debug datetime msec localtime show-timezone year
PRINT (ase-nod-config): service timestamps log datetime msec localtime show-timezone year

 

etc., etc.

Highlighted

Re: Yes! That did the trick

Adviser
Posts: 412
2989     0

This is a very old thread, you should have started a new one with a link to this one.

 

Why not use a Config Template, I see nothing glaring in your script, I would open a Case with Support

 

 

Follow me on LinkedIn: https://www.linkedin.com/in/sifbaksh
Twitter: https://twitter.com/sifbaksh
Showing results for 
Search instead for 
Do you mean 

Recommended for You