The networking_cisco.plugins.ml2.drivers.cisco.nexus.nexus_restapi_client
Module¶
Implements REST API Client For Nexus
-
class
networking_cisco.plugins.ml2.drivers.cisco.nexus.nexus_restapi_client.
CiscoNexusRestapiClient
(credentials, accepted_codes=[200, 201, 204], scheme=’http’, timeout=30, max_retries=2, request_cookie=True)¶ Bases:
object
-
rest_delete
(action, ipaddr=None, body=None, headers=None)¶
-
rest_get
(action, ipaddr, body=None, headers=None)¶
-
rest_post
(action, ipaddr=None, body=None, headers=None)¶
-
send_request
(method, action, body=None, headers=None, ipaddr=None)¶ Perform the HTTP request.
The response is in either JSON format or plain text. A GET method will invoke a JSON response while a PUT/POST/DELETE returns message from the the server in plain text format. Exception is raised when server replies with an INTERNAL SERVER ERROR status code (500) i.e. an error has occurred on the server or SERVICE UNAVAILABLE (404) i.e. server is not reachable.
Parameters: - method – type of the HTTP request. POST, GET, PUT or DELETE
- action – path to which the client makes request
- body – dict of arguments which are sent as part of the request
- headers – header for the HTTP request
- server_ip – server_ip for the HTTP request.
Returns: JSON or plain text in HTTP response
-