Network Change & Configuration Management

Reply
Highlighted

How do you run a script through router reload ?

Authority
Posts: 40
5725     0

Hi Frank, Sif, John,
I am trying to accomplish a simple task..
Make some changes on the box...
Reload the box..
Ping to see if the box came up...
Connect to the box and execute some show commands.

 

I failed despite multiple attempts. Would appreciate if you could help.
I tried the following.

1. send_command ("reload \r"); -> Fails because the connection is terminated immediately.

2. send_comand("reload in 1 \r");
Close_connection();
sleep 180;
open_connection();
send_command ();   --> Seems to fail here..

'NetMRI cli-connections/cli-error Failed to associate device 5787 with session http://netmri/api/2.10/cli_connections/open.json at /mnt/host/lib/NetMRI_Easy.pm line 692

Can you let me know what is the best way to accomplish this?

The other options I tried were:

1. my $easy = new NetMRI_Easy;

   $easy -> send_command() ;

perform reload..

my $easy2 = new NetMRI_Easy;

$easy2-> send_command();  -- Fails here...

 

Script is as follows;

use strict;
use warnings;
#use NetMRI_Easy;
require "Infoblox_Job.pm";
use Data:Smiley Very Happyumper qw(Dumper);
use Term::ANSIColor qw(:constants);

send_command("show ip int br | i up");
send_command("reload in 1 \r");
close_connection();    -- I also tried to close_session() before calling open_session()

my $tries = 180;
my $down = 1;
while ($down && $tries > 0) {
$down = system("ping -n -c 1 10.5.112.1");
$tries -= 1;
sleep 1;
print "$tries seconds more...\n";
}

if (!$down) {
open_connection();
send_command("show ip int br | i up");
} else {
print "Device not up yet";
}

Thanks,
Rahul Shenoy

Rahul,

MGriffin
Techie
Posts: 37
5726     0

Rahul,

Perhaps this will help...

 

The process:

Script gets device interaction service ("dis") session
Script uses "dis" session to open "cli connection" to a device (or several devices)
Script uses "cli connections"
Script closes "cli connections"
Script closes "dis session"

Only *one* CLI connection is allowed to be opened by the DIS to a specific device. That is, the DIS will not open multiple connections to the same device. This prevents us from overwhelming the device, etc.

If you don't close the CLI connection, it will have to time out. Until it does, no other DIS session will be able to open a connection to the device.

There is also a limit on the number of open DIS sessions. I believe the default is somewhere on the order of 25.

Closing the DIS session will automatically close all the open CLI connections for that DIS session. You should explicitly close the CLI connection when you are done with it to be sure, as well as the DIS session.

 

E.G.


#!/usr/bin/perl

use strict;
use warnings;
use autodie;

use NetMRI::API;
use Data::Dumper;

$| = 1;

# this will read the user's .netmri.yml file for credentials
#
my $netmri = new NetMRI::API({ api_version => 2.6 }) ;

# grab the first device we find
my $d = $netmri->broker->device->search({InfraDeviceInd => 1, DeviceVendor => "Cisco"})->{devices}->[0];
print Dumper($d),"\n";

my $dis = $netmri->broker->dis_session->open({DeviceID => $d->DeviceID, job_id => 0})->{dis_session};
print Dumper($dis), "\n";

my $cli = $netmri->broker->dis_session->open_connection({DeviceID => $d->DeviceID, id => $dis->SessionID});
print Dumper($cli), "\n";

foreach my $cmd ("show ver", "show ip route") {
 print "Running $cmd...\n";
 my $r = $netmri->broker->cli_connection->send_command({id => $dis->SessionID, DeviceID => $d->DeviceID, command => $cmd});
 print Dumper($r),"\n";
}

Hi Mike,

Authority
Posts: 40
5726     0

Hi Mike,

Thanks a ton for your reply. Since I am not able to run the script externally, I used your logic to run using netmri_easy.  I could successfully close

and reopen session. But please help me resolve a timeout issue that puts my script into error state. The actual reload of the box can take around 3 minutes but I expect depending on the config it might take upto a good 10 minutes. My script errors out while waiting for ping to be successful. There is no error status or any details in the process logs. My script is as below.

#!/usr/bin/perl -w
# BEGIN-SCRIPT-BLOCK
# Script-Filter: $Vendor == "Cisco" and $type in ["Router","Switch-Router","Switch"] and $sysdescr like /IOS/
#
#
# Script-Login:
# true
#
# Script-Variables:
# $save_config string "no"
#
# END-SCRIPT-BLOCK
use strict;
use warnings;
use NetMRI_Easy;
#require "Infoblox_Job.pm";
use Data:Smiley Very Happyumper qw(Dumper);
use Term::ANSIColor qw(:constants);
use NetMRI::API;

my $netmri = new NetMRI_Easy;

#print Dumper($netmri),"\n";

# grab the first device we find
my $d = $netmri->device;
print Dumper($d),"\n";

my $dis = $netmri->broker->dis_session->open({DeviceID => $d->DeviceID, job_id => 0})->{dis_session};
print Dumper($dis), "\n";

my $cli = $netmri->broker->dis_session->open_connection({DeviceID => $d->DeviceID, id => $dis->SessionID});
print Dumper($cli), "\n";

#print Dumper($netmri),"\n";


foreach my $cmd ("show ver", "show ip route" , "reload in 1 \r") {
    print "Running $cmd...\n";
    my $r = $netmri->broker->cli_connection->send_command({id => $dis->SessionID, DeviceID => $d->DeviceID, command => $cmd});
    print Dumper($r),"\n";
}

print "closing first connection\n";
my $result = $netmri->broker->dis_session->close({id => $dis->SessionID});
print Dumper($result), "\n";

print "Sleeping for 60 seconds for reload command to take effect\n";
sleep(60);

my $tries = 360;
my $down = 1;
while ($down && $tries > 0) {
        $down = system("ping -n -c 1 10.5.112.1");
        $tries -= 1;
        sleep 1;
        print "$tries seconds more...\n";
}

if (!$down) {  

print "Device not up yet";
}

print "Opening second connection \n";

my $dis2 = $netmri->broker->dis_session->open({DeviceID => $d->DeviceID, job_id => 0})->{dis_session};
print Dumper($dis2), "\n";

my $cli2 = $netmri->broker->dis_session->open_connection({DeviceID => $d->DeviceID, id => $dis2->SessionID});
print Dumper($cli2), "\n";

foreach my $cmd ("show ver", "show ip route") {
    print "Running $cmd...\n";
    my $r2 = $netmri->broker->cli_connection->send_command({id => $dis2->SessionID, DeviceID => $d->DeviceID, command => $cmd});
    print Dumper($r2),"\n";
}

print "closing second connection\n";
$result = $netmri->broker->dis_session->close({id => $dis2->SessionID});
print Dumper($result), "\n";

print "End of Script\n";

 

Rahul,

MGriffin
Techie
Posts: 37
5726     0

Rahul,

Set the 'Script-Timeout' value in the "Script-Block" header section.

I.E.


#!/usr/bin/perl -w
# BEGIN-SCRIPT-BLOCK
# Script-Filter: $Vendor == "Cisco" and $type in ["Router","Switch-Router","Switch"] and $sysdescr like /IOS/
#
# Script-Timeout: 1500
#
# Script-Login:
# true
#
# Script-Variables:
# $save_config string "no"
#
# END-SCRIPT-BLOCK

The script timeout can be extended up to 4 hours.

Thanks Mike.. I should have

Authority
Posts: 40
5726     0

Thanks Mike.. I should have known about this variable. 

One last question,

Closing the session clears the session logs. Is there anyway such that we can see each of the session logs individually or together?

 

Thanks,

Rahul Shenoy

Rahul,

MGriffin
Techie
Posts: 37
5726     0

Rahul,

Would sending everything of interest to the "log_message()" function satisfy this request? 

Set it up something like this:


###################################################################
#
# log_message
#
# Local log_message function that doesn't require a
# cli connection to a target device.
#
###################################################################
sub log_message
{
 my $sev = shift;
 my $msg = shift;
 
 $netmri->broker->job->log_message({ id => $netmri->batch_id, severity => $sev, message  => $msg });
}

Hi Mike,

Authority
Posts: 40
5726     0

Hi Mike,

I am using the log_message currently and we can see the output under custom_logs.

But it would be nice to see the session logs as you can see exactly what happened on the router.

 

Thanks,

Rahul Shenoy

Rahul,

MGriffin
Techie
Posts: 37
5726     0

Rahul,

I will need to test this to see exactly how it reacts.

If you leave the dis open, but close the cli_session, does the same occur?  This should still work, as another cli connection session should be able to be opened after closing the first, within the same dis.

I'm not sure, until I test, if the session log is tied to cli session or the dis itself.

Hi Mike,

Authority
Posts: 40
5726     0

Hi Mike,

Yes. I tried executing only the open_cli and close_cli but I wasn't able to succeed.  I got the message "Unable to connect to device:5787 " message. Perhaps my program was written incorrectly. I have to get back to this task and will ping you again soon.

 

Thanks,

Rahul Shenoy

Hi Mike,

Authority
Posts: 40
5726     0

Hi Mike,

Finally I got some bandwidth to work on this again... While the previous method worked fine, the problem was when you close the session, the session_logs are unavailable. This is important to me because I want to see what exactly was configured on the router. Since a session is separate from a CLI connection as you suggested, I am trying to close and reopen a cli connection. I could succesfully close a CLI connection, but unable to reopen it again. I think I have to rewrite some variables manually or passing the arguments wrong. Please help.

My logic is as follows.

$netmri->send_command()  // seems to open a cli connection if there is none for the first time. later it checks the variabel cli_connection to prevent multiple connections to the box.

I close the connection using $netmri->client->broker-dissession->close()

And the next $netmri->send_command() should automatically open a new connection since there is no active connection.

 

The error I am getting is this.

*** Error / NetMRI general/record-not-found Could not find DIS Session ID 14335472972306-33428 http://netmri/api/2.10/cli_connections/send_command.json at /mnt/host/lib/NetMRI_Easy.pm line 475 
  
 Script exited with code: 255 
  ***

 
 
My code looks like this:

my $output = $netmri->send_command("sh version");
print Dumper $netmri;
my $d = $netmri->device;
print "\n Output of netmri->device";
print Dumper $d,"\n";

my $b = $netmri->broker;
print "Broker object";
print Dumper $b;

my $client = $netmri->client;
print "Client object\n";
print Dumper $client;

my $dis = $netmri->{per_device}->{dis_session_id};
print "\n Output of netmri->dis_session_id";
print Dumper $dis;

my $broker = $client->broker->dis_session;
my $result = $broker->close({ id => $dis});
print "\n Output of close";
print Dumper $result;


print "Check if cli_connection is closed \n";
print Dumper $netmri;
$netmri->{per_device}->{cli_connection} =0;

print "Check if cli_connection is now set to 0";
print Dumper $netmri;

print "\n Opening second connection";
$netmri->send_command("show version");

I first tried without resetting the {cli_connection} to 0 but same error occurred. I expected this variable to set to zero when I close an active connection.

 

 

 

The output is as follows... I have removed some output which spits out the ip address of the device etc.

Output of netmri->dis_session_id$VAR1 = '14335472972306-33428';

 Output of close$VAR1 = {
          'command_response' => '""'
        };
Check if cli_connection is closed
$VAR1 = bless( {
                 'job_id' => '57872',
                 'broker_cache' => bless( {
                                            'client' => bless( {
                                                                 'croak_if_error' => 1,
                                                                 '_instance_id' => 0,
                                                                 '_class_format' => 'NetMRI::API::Broker::V2_10_0::%s',
                                                                 'persistent' => 0,
                                                                 'password' => 'e0e89b57a4adb3ac74bc5bc39f4ed5c38f229c7a015ada0f296b69a8e59743aa1642',
                                                                 '_base_uri' => 'http://netmri/api/2.10',
                                                                 'url' => 'http://netmri',
                                                                 '_user' => {},
                                                                 'encoding' => 'json',
                                                                 'broker_autoload' => $VAR1->{'broker_cache'},
                                                                 '_legacy' => 0,
                                                                 'follow_accepted' => 1,
                                                                 'user_agent' => bless( {
                                                                                          'max_redirect' => 7,
                                                                                          'ssl_opts' => {
                                                                                                          'verify_hostname' => 0
                                                                                                        },
                                                                                          'protocols_forbidden' => undef,
                                                                                          'show_progress' => undef,
                                                                                          'handlers' => {
                                                                                                          'request_prepare' => bless( [
                                                                                                                                        {
                                                                                                                                          'owner' => 'LWP::UserAgent::cookie_jar',
                                                                                                                                          'callback' => sub { "DUMMY" },
                                                                                                                                          'line' => '/usr/share/perl5/LWP/UserAgent.pm:680'
                                                                                                                                        }
                                                                                                                                      ], 'HTTP::Config' ),
                                                                                                          'response_header' => bless( [
                                                                                                                                        {
                                                                                                                                          'owner' => 'LWP::UserAgent:Smiley Tonguearse_head',
                                                                                                                                          'callback' => sub { "DUMMY" },
                                                                                                                                          'm_media_type' => 'html',
                                                                                                                                          'line' => '/usr/share/perl5/LWP/UserAgent.pm:659'
                                                                                                                                        }
                                                                                                                                      ], 'HTTP::Config' ),
                                                                                                          'response_done' => bless( [
                                                                                                                                      {
                                                                                                                                        'owner' => 'LWP::UserAgent::cookie_jar',
                                                                                                                                        'callback' => sub { "DUMMY" },
                                                                                                                                        'line' => '/usr/share/perl5/LWP/UserAgent.pm:683'
                                                                                                                                      }
                                                                                                                                    ], 'HTTP::Config' )
                                                                                                        },
                                                                                          'no_proxy' => [],
                                                                                          'protocols_allowed' => undef,
                                                                                          'local_address' => undef,
                                                                                          'use_eval' => 1,
                                                                                          'requests_redirectable' => [
                                                                                                                       'GET',
                                                                                                                       'HEAD'
                                                                                                                     ],
                                                                                          'timeout' => 180,
                                                                                          'cookie_jar' => bless( {
                                                                                                                   'COOKIES' => {
                                                                                                                                  'netmri.local' => {
                                                                                                                                                      '/' => {
                                                                                                                                                               '_netmri' => [
                                                                                                                                                                              0,
                                                                                                                                                                              'BAh7CzoPc2Vzc2lvbl9pZCIlZjVjZTc0MzZlZTkyMThkYTFiY2U4Zjc0YjNhMTA3NmU6DmF1dGhfdHlwZUkiCnRva2VuBjoGRUY6DnVzZXJfbmFtZSIpc3lzdGVtX19TY2hlZFJ1bi5wbF8zMzM0MV8xNDMzNTQ3Mjk1Og1wYXNzd29yZCIBgGUwZTg5N2FiNGEzYTFiMTNlNmE5ZWRjZWMyMTY5MTdhYTAxMDJhYzczYTY5N2ViNjY0MzBlZDlmNGEwODNlYWNmYjU3YTRhZGIzYWM3NGJjNWJjMzlmNGVkNWMzOGYyMjljN2EwMTVhZGEwZjI5NmI2OWE4ZTU5NzQzYWExNjQyOhRkYXRldGltZV9mb3JtYXRJIhYlWS0lbS0lZCAlSDolTTolUwY7B0Y6EGV4cGlyeV90aW1lSXU6CVRpbWUNwNQcgA5PJIwJOg1uYW5vX251bWllOg1uYW5vX2RlbmkGOg1zdWJtaWNybyIHCWA6C29mZnNldGn%2BwMc%3D--cc21ca21e039da061e33bc7239bfa2aabb32aa6f',
                                                                                                                                                                              undef,
                                                                                                                                                                              1,
                                                                                                                                                                              undef,
                                                                                                                                                                              undef,
                                                                                                                                                                              1,
                                                                                                                                                                              {
                                                                                                                                                                                'HttpOnly' => undef
                                                                                                                                                                              }
                                                                                                                                                                            ]
                                                                                                                                                             }
                                                                                                                                                    }
                                                                                                                                }
                                                                                                                 }, 'HTTP::Cookies' ),
                                                                                          'def_headers' => bless( {
                                                                                                                    'user-agent' => 'NetMRI::API'
                                                                                                                  }, 'HTTP::Headers' ),
                                                                                          'proxy' => {},
                                                                                          'max_size' => undef
                                                                                        }, 'LWP::UserAgent' ),
                                                                 'response_parser' => bless( {
                                                                                               'api_version' => bless( [
                                                                                                                         '2',
                                                                                                                         '10',
                                                                                                                         0
                                                                                                                       ], 'NetMRI::API::APIVersion' ),
                                                                                               'client' => $VAR1->{'broker_cache'}{'client'},
                                                                                               '_loaded' => {
                                                                                                              'DisSession' => 1,
                                                                                                              'Device' => 1,
                                                                                                              'CliConnection' => 1
                                                                                                            },
                                                                                               '_legacy' => 0,
                                                                                               '_json' => bless( do{\(my $o = '')}, 'JSON' ),
                                                                                               '_true' => 1,
                                                                                               '_false' => 0
                                                                                             }, 'NetMRI::API::Response:Smiley Tonguearser::JSON' ),
                                                                 'username' => 'system__SchedRun.pl_33341_1433547295',
                                                                 'api_version' => $VAR1->{'broker_cache'}{'client'}{'response_parser'}{'api_version'},
                                                                 'broker' => {
                                                                               'DisSession' => bless( {
                                                                                                        'client' => 0,
                                                                                                        '_legacy' => 0
                                                                                                      }, 'NetMRI::API::Broker::V2_10_0:Smiley Very HappyisSession' ),
                                                                               'Device' => bless( {
                                                                                                    'client' => 0,
                                                                                                    '_legacy' => 0
                                                                                                  }, 'NetMRI::API::Broker::V2_10_0:Smiley Very Happyevice' ),
                                                                               'CliConnection' => bless( {
                                                                                                           'client' => 0,
                                                                                                           '_legacy' => 0
                                                                                                         }, 'NetMRI::API::Broker::V2_10_0::CliConnection' ),
                                                                               'Job' => bless( {
                                                                                                 'client' => 0,
                                                                                                 '_legacy' => 0
                                                                                               }, 'NetMRI::API::Broker::V2_10_0::Job' )
                                                                             }
                                                               }, 'NetMRI::API' )
                                          }, 'NetMRI::API::BrokerAutoload' ),
                 'batch_id' => '19136',
                 'device' => bless( {
                                      //output removed
                                    }, 'NetMRI::API::Remote::V2_10_0:Smiley Very Happyevice' ),
                 'device_id' => '4184504',
                 'per_device' => {
                                   'dis_session_id' => '14335472972306-33428',
                                   'cli_connection' => 1
                                 },
                 'api_version' => undef,
                 'client' => $VAR1->{'broker_cache'}{'client'},
                 'remote_log_message' => sub { "DUMMY" },
                 'legacy' => 0,
                 'debug' => 0,
                 'well_known' => {
                                   //output removed
                                 }
               }, 'NetMRI_Easy' );
Check if cli_connection is now set to 0
$VAR1 = bless( {
                 'job_id' => '57872',
                 'broker_cache' => bless( {
                                            'client' => bless( {
                                                                 'croak_if_error' => 1,
                                                                 '_instance_id' => 0,
                                                                 '_class_format' => 'NetMRI::API::Broker::V2_10_0::%s',
                                                                 'persistent' => 0,
                                                                 'password' => 'e016917aa0102ac73a697eb66430ed9f4a083eacfb57a4adb3ac74bc5bc39f4ed5c38f229c7a015ada0f296b69a8e59743aa1642',
                                                                 '_base_uri' => 'http://netmri/api/2.10',
                                                                 'url' => 'http://netmri',
                                                                 '_user' => {},
                                                                 'encoding' => 'json',
                                                                 'broker_autoload' => $VAR1->{'broker_cache'},
                                                                 '_legacy' => 0,
                                                                 'follow_accepted' => 1,
                                                                 'user_agent' => bless( {
                                                                                          'max_redirect' => 7,
                                                                                          'ssl_opts' => {
                                                                                                          'verify_hostname' => 0
                                                                                                        },
                                                                                          'protocols_forbidden' => undef,
                                                                                          'show_progress' => undef,
                                                                                          'handlers' => {
                                                                                                          'request_prepare' => bless( [
                                                                                                                                        {
                                                                                                                                          'owner' => 'LWP::UserAgent::cookie_jar',
                                                                                                                                          'callback' => sub { "DUMMY" },
                                                                                                                                          'line' => '/usr/share/perl5/LWP/UserAgent.pm:680'
                                                                                                                                        }
                                                                                                                                      ], 'HTTP::Config' ),
                                                                                                          'response_header' => bless( [
                                                                                                                                        {
                                                                                                                                          'owner' => 'LWP::UserAgent:Smiley Tonguearse_head',
                                                                                                                                          'callback' => sub { "DUMMY" },
                                                                                                                                          'm_media_type' => 'html',
                                                                                                                                          'line' => '/usr/share/perl5/LWP/UserAgent.pm:659'
                                                                                                                                        }
                                                                                                                                      ], 'HTTP::Config' ),
                                                                                                          'response_done' => bless( [
                                                                                                                                      {
                                                                                                                                        'owner' => 'LWP::UserAgent::cookie_jar',
                                                                                                                                        'callback' => sub { "DUMMY" },
                                                                                                                                        'line' => '/usr/share/perl5/LWP/UserAgent.pm:683'
                                                                                                                                      }
                                                                                                                                    ], 'HTTP::Config' )
                                                                                                        },
                                                                                          'no_proxy' => [],
                                                                                          'protocols_allowed' => undef,
                                                                                          'local_address' => undef,
                                                                                          'use_eval' => 1,
                                                                                          'requests_redirectable' => [
                                                                                                                       'GET',
                                                                                                                       'HEAD'
                                                                                                                     ],
                                                                                          'timeout' => 180,
                                                                                          'cookie_jar' => bless( {
                                                                                                                   'COOKIES' => {
                                                                                                                                  'netmri.local' => {
                                                                                                                                                      '/' => {
                                                                                                                                                               '_netmri' => [
                                                                                                                                                                              0,
                                                                                                                                                                              'BAh7CzoPc2Vzc2lvbl9pZCIlZjVjZTc0MzZlZTkyMThkYTFiY2U4Zjc0YjNhMTA3NmU6DmF1dGhfdHlwZUkiCnRva2VuBjoGRUY6DnVzZXJfbmFtZSIpc3lzdGVtX19TY2hlZFJ1bi5wbF8zMzM0MV8xNDMzNTQ3Mjk1Og1wYXNzd29yZCIBgGUwZTg5N2FiNGEzYTFiMTNlNmE5ZWRjZWMyMTY5MTdhYTAxMDJhYzczYTY5N2ViNjY0MzBlZDlmNGEwODNlYWNmYjU3YTRhZGIzYWM3NGJjNWJjMzlmNGVkNWMzOGYyMjljN2EwMTVhZGEwZjI5NmI2OWE4ZTU5NzQzYWExNjQyOhRkYXRldGltZV9mb3JtYXRJIhYlWS0lbS0lZCAlSDolTTolUwY7B0Y6EGV4cGlyeV90aW1lSXU6CVRpbWUNwNQcgA5PJIwJOg1uYW5vX251bWllOg1uYW5vX2RlbmkGOg1zdWJtaWNybyIHCWA6C29mZnNldGn%2BwMc%3D--cc21ca21e039da061e33bc7239bfa2aabb32aa6f',
                                                                                                                                                                              undef,
                                                                                                                                                                              1,
                                                                                                                                                                              undef,
                                                                                                                                                                              undef,
                                                                                                                                                                              1,
                                                                                                                                                                              {
                                                                                                                                                                                'HttpOnly' => undef
                                                                                                                                                                              }
                                                                                                                                                                            ]
                                                                                                                                                             }
                                                                                                                                                    }
                                                                                                                                }
                                                                                                                 }, 'HTTP::Cookies' ),
                                                                                          'def_headers' => bless( {
                                                                                                                    'user-agent' => 'NetMRI::API'
                                                                                                                  }, 'HTTP::Headers' ),
                                                                                          'proxy' => {},
                                                                                          'max_size' => undef
                                                                                        }, 'LWP::UserAgent' ),
                                                                 'response_parser' => bless( {
                                                                                               'api_version' => bless( [
                                                                                                                         '2',
                                                                                                                         '10',
                                                                                                                         0
                                                                                                                       ], 'NetMRI::API::APIVersion' ),
                                                                                               'client' => $VAR1->{'broker_cache'}{'client'},
                                                                                               '_loaded' => {
                                                                                                              'DisSession' => 1,
                                                                                                              'Device' => 1,
                                                                                                              'CliConnection' => 1
                                                                                                            },
                                                                                               '_legacy' => 0,
                                                                                               '_json' => bless( do{\(my $o = '')}, 'JSON' ),
                                                                                               '_true' => 1,
                                                                                               '_false' => 0
                                                                                             }, 'NetMRI::API::Response:Smiley Tonguearser::JSON' ),
                                                                 'username' => 'system__SchedRun.pl_33341_1433547295',
                                                                 'api_version' => $VAR1->{'broker_cache'}{'client'}{'response_parser'}{'api_version'},
                                                                 'broker' => {
                                                                               'DisSession' => bless( {
                                                                                                        'client' => 0,
                                                                                                        '_legacy' => 0
                                                                                                      }, 'NetMRI::API::Broker::V2_10_0:Smiley Very HappyisSession' ),
                                                                               'Device' => bless( {
                                                                                                    'client' => 0,
                                                                                                    '_legacy' => 0
                                                                                                  }, 'NetMRI::API::Broker::V2_10_0:Smiley Very Happyevice' ),
                                                                               'CliConnection' => bless( {
                                                                                                           'client' => 0,
                                                                                                           '_legacy' => 0
                                                                                                         }, 'NetMRI::API::Broker::V2_10_0::CliConnection' ),
                                                                               'Job' => bless( {
                                                                                                 'client' => 0,
                                                                                                 '_legacy' => 0
                                                                                               }, 'NetMRI::API::Broker::V2_10_0::Job' )
                                                                             }
                                                               }, 'NetMRI::API' )
                                          }, 'NetMRI::API::BrokerAutoload' ),
                 'batch_id' => '19136',
                 'device' => bless( {
                                      //output removed
                                      'DeviceFirstOccurrenceTime' => '2015-03-19 17:00:28'
                                    }, 'NetMRI::API::Remote::V2_10_0:Smiley Very Happyevice' ),
                 'device_id' => '4184504',
                 'per_device' => {
                                   'dis_session_id' => '14335472972306-33428',
                                   'cli_connection' => 0
                                 },
                 'api_version' => undef,
                 'client' => $VAR1->{'broker_cache'}{'client'},
                 'remote_log_message' => sub { "DUMMY" },
                 'legacy' => 0,
                 'debug' => 0,
                 'well_known' => {
                                   //output removed
                                 }
               }, 'NetMRI_Easy' );

NetMRI general/record-not-found Could not find DIS Session ID 14335472972306-33428 http://netmri/api/2.10/dis_sessions/close.json at /mnt/host/lib/NetMRI_Easy.pm line 422
END failed--call queue aborted at - line 37.

*** ERROR: Error 'NetMRI general/record-not-found Could not find DIS Session ID 14335472972306-33428 http://netmri/api/2.10/cli_connections/send_command.json at /mnt/host/lib/NetMRI_Easy.pm line 475

Script exited with code: 255

 

 

 

 

 

 

 

 

 

Rahul,

MGriffin
Techie
Posts: 37
5726     0

Rahul,

There is not a way to reconnect to the same session, in order to keep the session log the same throughout the script.

Please open a Support Case for this, as it will need to become an RFE to be implemented within the product.

Closing the DIS, and opening a new DIS/connection, is the correct way to proceed; and you confirmed that this method worked for you previously, I believe.

Hi Mike,

Authority
Posts: 40
5726     0

Hi Mike,

Thanks for your reply.

Hmmm.. That's not good to know. But atleast I have one way of getting around.

If you look at the log output carefully, I still see "NetMRI::API::Broker::V2_10_0:" even though I had called out for "use NetMRI_Easy({ api_version => 2.6 })".  Why is this happening? I want to be able to force run the script using the same API version since my prod and test netmri are on different versions. Let me know.

 

Thanks,

Rahul Shenoy

 

 

You can try api_version =>

Adviser
Posts: 390
5726     0

You can try api_version => auto

Sif

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