Search in sources :

Example 1 with VdcIpsecPropertiesResponse

use of com.emc.storageos.geomodel.VdcIpsecPropertiesResponse in project coprhd-controller by CoprHD.

the class IPSecMonitor method getIpsecPropsThroughHTTPS.

private Map<String, String> getIpsecPropsThroughHTTPS(String node) {
    Map<String, String> props = new HashMap<String, String>();
    try {
        GeoClientCacheManager geoClientMgr = getGeoClientManager();
        if (geoClientMgr != null) {
            GeoServiceClient geoClient = geoClientMgr.getGeoClient(getVdcShortIdByIp(node));
            String version = geoClient.getViPRVersion();
            if (version.compareTo("vipr-2.5") < 0) {
                log.info("remote vdc version is less than 2.5, skip getting ipsec properties");
                return props;
            }
            VdcIpsecPropertiesResponse ipsecProperties = geoClient.getIpsecProperties();
            if (ipsecProperties != null) {
                props.put(IPSEC_KEY, ipsecProperties.getIpsecKey());
                props.put(VDC_CONFIG_VERSION, ipsecProperties.getVdcConfigVersion());
                props.put(IPSEC_STATUS, ipsecProperties.getIpsecStatus());
            }
        } else {
            log.warn("GeoClientCacheManager is null, skip getting ipsec properties from " + node);
        }
    } catch (Exception e) {
        log.warn("can't get ipsec properties from remote vdc: " + node, e);
    }
    return props;
}
Also used : HashMap(java.util.HashMap) VdcIpsecPropertiesResponse(com.emc.storageos.geomodel.VdcIpsecPropertiesResponse) GeoClientCacheManager(com.emc.storageos.security.geo.GeoClientCacheManager) GeoServiceClient(com.emc.storageos.security.geo.GeoServiceClient)

Example 2 with VdcIpsecPropertiesResponse

use of com.emc.storageos.geomodel.VdcIpsecPropertiesResponse in project coprhd-controller by CoprHD.

the class IpsecService method getIpsecProperties.

@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/properties")
public VdcIpsecPropertiesResponse getIpsecProperties() {
    log.info("in getIpsecProperties()");
    VdcIpsecPropertiesResponse response = new VdcIpsecPropertiesResponse();
    try {
        String localIP = IpUtils.getLocalIPAddress();
        Map<String, String> localIpsecProp = LocalRepository.getInstance().getIpsecProperties(localIP);
        response.setIpsecKey(localIpsecProp.get(IPSEC_KEY));
        response.setIpsecStatus(localIpsecProp.get(IPSEC_STATUS));
        response.setVdcConfigVersion(localIpsecProp.get(VDC_CONFIG_VERSION));
    } catch (Exception e) {
        log.error("retrieve local ipsec properties error: " + e.getMessage());
    }
    return response;
}
Also used : VdcIpsecPropertiesResponse(com.emc.storageos.geomodel.VdcIpsecPropertiesResponse) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Aggregations

VdcIpsecPropertiesResponse (com.emc.storageos.geomodel.VdcIpsecPropertiesResponse)2 GeoClientCacheManager (com.emc.storageos.security.geo.GeoClientCacheManager)1 GeoServiceClient (com.emc.storageos.security.geo.GeoServiceClient)1 HashMap (java.util.HashMap)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1