Search in sources :

Example 1 with Identity

use of org.opennms.core.wsman.Identity in project opennms by OpenNMS.

the class WsManDetector method isServiceDetected.

public DetectResults isServiceDetected(InetAddress address, WSManEndpoint endpoint) {
    // Issue the "Identify" request
    final WSManClient client = m_factory.getClient(endpoint);
    Identity identity = null;
    final Map<String, String> attributes = new HashMap<>();
    try {
        identity = client.identify();
        LOG.info("Identify succeeded for address {} with product vendor '{}' and product version '{}'.", address, identity.getProductVendor(), identity.getProductVersion());
        attributes.put(UPDATE_ASSETS, Boolean.toString(m_updateAssets));
        attributes.put(PRODUCT_VENDOR, identity.getProductVendor());
        attributes.put(PRODUCT_VERSION, identity.getProductVersion());
    } catch (WSManException e) {
        LOG.info("Identify failed for address {} with endpoint {}.", address, endpoint, e);
    }
    return new DetectResultsImpl(identity != null, attributes);
}
Also used : WSManException(org.opennms.core.wsman.exceptions.WSManException) HashMap(java.util.HashMap) WSManClient(org.opennms.core.wsman.WSManClient) Identity(org.opennms.core.wsman.Identity) DetectResultsImpl(org.opennms.netmgt.provision.support.DetectResultsImpl)

Aggregations

HashMap (java.util.HashMap)1 Identity (org.opennms.core.wsman.Identity)1 WSManClient (org.opennms.core.wsman.WSManClient)1 WSManException (org.opennms.core.wsman.exceptions.WSManException)1 DetectResultsImpl (org.opennms.netmgt.provision.support.DetectResultsImpl)1