app/models/manageiq/providers/lenovo/physical_infra_manager/parser/physical_switch_parser.rb
#
# Parses a switch into a Hash
#
# @param [XClarityClient::Switch] switch - object containing details for the switch
#
# @return [Hash] the switch data as required by the application
#
Parses a switch into a Hash
Parses a switch into a Hash
def parse_physical_switch(physical_switch)
        result = parse(physical_switch, parent::ParserDictionaryConstants::PHYSICAL_SWITCH)
        unless result[:power_state].nil?
          result[:power_state] = result[:power_state].downcase if %w(on off).include?(result[:power_state].downcase)
        end
        result[:type]         = parent::ParserDictionaryConstants::MIQ_TYPES["physical_switch"]
        result[:health_state] = parent::ParserDictionaryConstants::HEALTH_STATE_MAP[physical_switch.overallHealthState.nil? ? physical_switch.overallHealthState : physical_switch.overallHealthState.downcase]
        result[:hardware]     = get_hardwares(physical_switch)
        result[:physical_network_ports] = parent::PhysicalNetworkPortsParser.parse_physical_switch_ports(physical_switch)
        result
      end
def parse_physical_switch ( physical_switch ) result = parse ( physical_switch , parent :: ParserDictionaryConstants :: PHYSICAL_SWITCH ) unless result [ :power_state ] . nil? result [ :power_state ] = result [ :power_state ] . downcase if %w( on off ) . include? ( result [ :power_state ] . downcase ) end result [ :type ] = parent :: ParserDictionaryConstants :: MIQ_TYPES [ "physical_switch" ] result [ :health_state ] = parent :: ParserDictionaryConstants :: HEALTH_STATE_MAP [ physical_switch . overallHealthState . nil? ? physical_switch . overallHealthState : physical_switch . overallHealthState . downcase ] result [ :hardware ] = get_hardwares ( physical_switch ) result [ :physical_network_ports ] = parent :: PhysicalNetworkPortsParser . parse_physical_switch_ports ( physical_switch ) result end
Parses a switch into a Hash
Parses a switch into a Hash
the switch data as required by the application
the switch data as required by the application
Hash
physical_switch
object containing details for the switch
object containing details for the switch