class Hpe3parSdk::PortManager

Port Manager Rest API methods

Public Class Methods

new(http) click to toggle source
# File lib/Hpe3parSdk/port_manager.rb, line 19
def initialize(http)
  @http = http
  @ports_uri = '/ports'
end

Public Instance Methods

get_fc_ports(state) click to toggle source
# File lib/Hpe3parSdk/port_manager.rb, line 33
def get_fc_ports(state)
  get_protocol_ports(PortProtocol::FC, state)
end
get_ip_ports(state) click to toggle source
# File lib/Hpe3parSdk/port_manager.rb, line 41
def get_ip_ports(state)
  get_protocol_ports(PortProtocol::IP, state)
end
get_iscsi_ports(state) click to toggle source
# File lib/Hpe3parSdk/port_manager.rb, line 37
def get_iscsi_ports(state)
  get_protocol_ports(PortProtocol::ISCSI, state)
end
get_ports() click to toggle source
# File lib/Hpe3parSdk/port_manager.rb, line 24
def get_ports
  ports_list = []
  response = @http.get(@ports_uri)
  response[1]['members'].each do |port|
      ports_list.push(Port.new(port))
  end
  ports_list
end
get_protocol_ports(protocol, state = nil) click to toggle source
# File lib/Hpe3parSdk/port_manager.rb, line 45
def get_protocol_ports(protocol, state = nil)
  return_ports = []
  ports = get_ports
  if ports
    ports.each do |port|
      if port.protocol == protocol
        if state.nil?
          return_ports.push(port)
        elsif port.linkState == state
          return_ports.push(port)
        end
      end
    end
  end
  return_ports
end