Search in sources :

Example 1 with VdcNatCheckParam

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

the class ConnectVdcTaskOp method checkNetworkTopology.

private String checkNetworkTopology(VdcPreCheckResponse vdcBeingAdded) {
    SoftwareVersion remoteVer = new SoftwareVersion(vdcBeingAdded.getSoftwareVersion());
    if (remoteVer.compareTo(netcheckMinVer) >= 0) {
        String nodeId = this.dbClient.getCoordinatorClient().getPropertyInfo().getProperty("node_id");
        log.info("Retrieving IP addresses of local node: {}, and let remote VDC {} check if we're behind a NAT", nodeId, vdcBeingAdded.getShortId());
        DualInetAddress inetAddress = this.dbClient.getCoordinatorClient().getInetAddessLookupMap().getDualInetAddress();
        String ipv4 = inetAddress.getInet4();
        String ipv6 = inetAddress.getInet6();
        log.info("Got local node's IP addresses, IPv4 = {}, IPv6 = {}", ipv4, ipv6);
        VdcNatCheckParam checkParam = new VdcNatCheckParam();
        checkParam.setIPv4Address(ipv4);
        checkParam.setIPv6Address(ipv6);
        VdcNatCheckResponse resp = geoClientCache.getGeoClient(vdcInfo).vdcNatCheck(checkParam);
        if (resp.isBehindNAT()) {
            return String.format("The remote VDC %s seen this node's IP is %s, which is different from what we think: %s or %s, we may behind a NAT", vdcBeingAdded.getShortId(), resp.getSeenIp(), ipv4, ipv6);
        }
    } else {
        log.info("Remote VDC is of version {}, lower than {}, NAT check skipped.", remoteVer, netcheckMinVer);
    }
    return null;
}
Also used : SoftwareVersion(com.emc.storageos.coordinator.client.model.SoftwareVersion) VdcNatCheckParam(com.emc.storageos.geomodel.VdcNatCheckParam) VdcNatCheckResponse(com.emc.storageos.geomodel.VdcNatCheckResponse) DualInetAddress(com.emc.storageos.coordinator.client.service.impl.DualInetAddress)

Aggregations

SoftwareVersion (com.emc.storageos.coordinator.client.model.SoftwareVersion)1 DualInetAddress (com.emc.storageos.coordinator.client.service.impl.DualInetAddress)1 VdcNatCheckParam (com.emc.storageos.geomodel.VdcNatCheckParam)1 VdcNatCheckResponse (com.emc.storageos.geomodel.VdcNatCheckResponse)1