Reference Guide

response = ASM::API::sign {
RestClient.post url, cred.to_xml, :content_type => :xml
}
payload = ASM::Payload.from_xml(response)
credId = payload.get('id')
# Save it for future use as a payload
payload.save_xml("credential_%s.xml" % credId)
DiscoveryRequest
A DiscoveryRequest is a set of credential references and a set of IP ranges. A sweep of the given IP ranges
will attempt to determine if Resources of the given types, specified by the credential types referenced in
the request, exist at those IP addresses.
Discover Chassis and contained Blade Servers
Using the predefined chassis and server credentials, initiate a discovery request against an IP address that
is known to belong to a Chassis.
require 'ASMConfig'
url = ASM::API::URI('/DiscoveryRequest')
# Get credential ids
creds = ASM::Payload::load_xml('credentials.xml')
server_cred = creds.doc.xpath('//serverCredential').select{|c|
c.at_xpath('label').text == 'Dell PowerEdge Default'}.first.xpath('id').text
chassis_cred = creds.doc.xpath('//chassisCredential').select{|c|
c.at_xpath('label').text == 'Dell chassis default'}.first.xpath('id').text
disc = ASM::Payload::load_xml('discovery_skeleton.xml')
disc.set('deviceStartIp', '172.17.4.17')
disc.set('deviceEndIp', '172.17.4.17')
disc.set('unmanaged', 'false')
disc.appendChildren('DiscoverIPRangeDeviceRequest',
'deviceChassisCredRef' => chassis_cred,
'deviceServerCredRef' => server_cred,
'bDiscoverDevicesInChassis' => 'true')
begin
response = ASM::API::sign {
RestClient.post url, disc.to_xml, :content_type => :xml
}
payload = ASM::Payload.from_xml(response)
# Get the job status
jobStatus = payload.get('DiscoveryRequest/status')
print "<status>%s</status>\n" % jobStatus
rescue RestClient::Exception => e
print "Got exception with status: %d\n" % e.response.code
print "%s\n" % e.response
end
17