class NetconfResponse

Class defining response to most requests made in rubybvc.

Attributes

body[RW]

<variable>: the response from the request or more information about failure

status[RW]

integer: success or failure status of request

Public Instance Methods

message() click to toggle source

Return a string for the status.

Return Value

  • string : A string describing the status of the response (success or reason for failure).

# File lib/utils/netconf_response.rb, line 50
def message
  case(@status)
  when NetconfResponseStatus::OK
    "Success"
  when NetconfResponseStatus::NODE_CONNECTED
    "Node is connected"
  when NetconfResponseStatus::NODE_DISCONNECTED
    "Node is disconnected"
  when NetconfResponseStatus::NODE_NOT_FOUND
    "Node not found"
  when NetconfResponseStatus::NODE_CONFIGURED
    "Node is configured"
  when NetconfResponseStatus::CONN_ERROR
    "Server connection error"
  when NetconfResponseStatus::CTRL_INTERNAL_ERROR
    "Internal server error"
  when NetconfResponseStatus::HTTP_ERROR
    msg = "HTTP error"
    msg += " #{@body.code}" if @body && @body.code
    msg += " - #{@body.message}" if @body && @body.message
    msg
  when NetconfResponseStatus::DATA_NOT_FOUND
    "Requested data not found"
  end
end