Reply

python script - connection issue for 90% of hp devices

skozankiewicz
Techie
Posts: 1
61     0

Hello,

 

I tried use script to change same configuration on my switches, but I received error like that:

-------

*** Error / Traceback (most recent call last): 
   File "", line 161, in  
   File "/usr/lib/python3.4/site-packages/infoblox_netmri/easy/netmri_easy.py", line 36, in __init__ 
     self.cli_connection = self._open_cli_connection() 
   File "/usr/lib/python3.4/site-packages/infoblox_netmri/easy/netmri_easy.py", line 79, in _open_cli_connection 
     DeviceID=self.device_id 
   File "/usr/lib/python3.4/site-packages/infoblox_netmri/api/broker/v3_3_0/cli_connection_broker.py", line 78, in open 
     return self.api_request(self._get_method_fullname("open"), kwargs) 
   File "/usr/lib/python3.4/site-packages/infoblox_netmri/api/broker/broker.py", line 24, in api_request 
     params 
   File "/usr/lib/python3.4/site-packages/infoblox_netmri/client.py", line 227, in api_request 
     return self._make_request(url=url, method="post", data=data) 
   File "/usr/lib/python3.4/site-packages/infoblox_netmri/client.py", line 103, in _make_request 
     return self._send_request(url, method, data, extra_headers) 
   File "/usr/lib/python3.4/site-packages/infoblox_netmri/client.py", line 129, in _send_request 
     raise HTTPError(res.json(), response=res) 
 requests.exceptions.HTTPError: {'message': 'Device handler init for device 173 failed: api_open_session failure, buf: 

*** ERROR: No authentication information found for device ***', 'error': 'general/cli-error'} 
  ***

 Session log does not exist since there was an unknown error. 

-----------------

 

 

Username and password are ok, I can connect from my computer without problem.  

 

 

# BEGIN-SCRIPT-BLOCK
#
# Script-Filter:
# $Vendor eq "HP"
#
# END-SCRIPT-BLOCK

import requests, json, re
from infoblox_netmri.easy import NetMRIEasy


# This values will be provided by NetMRI before execution
defaults = {
"api_url": api_url,
"http_username": http_username,
"http_password": http_password,
"job_id": job_id,
"device_id": device_id,
"batch_id": batch_id
}


# Create NetMRI context manager. It will close session after execution

with NetMRIEasy(**defaults) as easy:
  easy.send_command('show version')

Showing results for 
Search instead for 
Do you mean 

Recommended for You