API Guide
Firmware
Firmware versions reported by individual resource components are compared against a rmware repository to determine if
component rmware is up-to-date with the latest required versions.
Check Firmware compliance of all Resources
Here we check the rmware compliance state of all resources. Note this is done by the POST method and supplying a
ManagedDevice as the request body. The response is the same ManagedDevice with the addition of a compliance eld.
require 'ASMConfig'
# Get all managed devices
url = ASM::API::URI('/ManagedDevice')
response = ASM::API::sign {
RestClient.get url
}
doc = Nokogiri::XML(response)
doc.xpath('//ManagedDevice').each do |device|
url = ASM::API::URI('/FirmwareRepository/compliance')
begin
response = ASM::API::sign {
RestClient.post url, device.to_xml, :content_type => :xml
}
doc2 = Nokogiri::XML(response)
serviceTag = doc2.at_xpath('//serviceTag').content
compliance = doc2.at_xpath('//compliance').content
print "Device %s firmware is %s\n" % [serviceTag,compliance]
rescue RestClient::Exception => e
print "Got exception with status: %d\n" % e.response.code
print "%s\n" % e.response
end
end
22