def start_element(name, attrs = [])
super
case name
when 'accessmethod'
@access_method = { 'type' => attr_value('type', attrs) }
when 'accessmethods'
@device['access_methods'] = []
when 'device'
@device = {
'id' => attr_value('id', attrs),
'label' => attr_value('label', attrs),
'status' => attr_value('status', attrs)
}
when 'err'
@response['err'] = {
'code' => attr_value('code', attrs),
'msg' => attr_value('msg', attrs)
}
when 'cage', 'facility', 'rack', 'row', 'zone'
@device['location'][name] = { 'id' => attr_value('id', attrs) }
if code = attr_value('code', attrs)
@device['location'][name]['code'] = code
end
when 'drive'
@drive = { 'position' => attr_value('position', attrs) }
when 'ipassignment'
type = attr_value('type', attrs)
@device['ipassignments'] = []
@device['ipassignments'] << {
'id' => attr_value('id', attrs),
'type' => attr_value('type', attrs),
'description' => attr_value('description', attrs),
}
when 'ipassignments'
@device['ipassignments'] = {}
when 'location'
@device['location'] = {}
when 'memory'
@device['memory'] = { 'size' => attr_value('size', attrs).to_i }
when 'model', 'type'
@device[name] = { 'id' => attr_value('id', attrs) }
when 'operating_system'
@device['operating_system'] = {}
when 'power_consumption'
@device[name] = attr_value('unit', attrs)
when 'processor'
@device['processor'] = {}
when 'rsp'
@response['stat'] = attr_value('stat', attrs)
when 'storage'
@device['drives'] = []
end
end