Search in sources :

Example 16 with DualInetAddress

use of com.emc.storageos.coordinator.client.service.impl.DualInetAddress in project coprhd-controller by CoprHD.

the class HealthMonitorService method getNodeIP.

/**
 * Returns IP address of the node
 *
 * @param nodeId node id
 * @return IP address
 */
private String getNodeIP(String nodeId) {
    Map<String, DualInetAddress> ipLookupTable = _coordinatorClientExt.getCoordinatorClient().getInetAddessLookupMap().getControllerNodeIPLookupMap();
    DualInetAddress ip = ipLookupTable.get(nodeId);
    return ip.toString();
}
Also used : DualInetAddress(com.emc.storageos.coordinator.client.service.impl.DualInetAddress)

Example 17 with DualInetAddress

use of com.emc.storageos.coordinator.client.service.impl.DualInetAddress in project coprhd-controller by CoprHD.

the class TestCoordinatorService method createInetAddressLookup.

private CoordinatorClientInetAddressMap createInetAddressLookup() throws Exception {
    CoordinatorClientInetAddressMap lookup = new CoordinatorClientInetAddressMap();
    lookup.setNodeId("localhost");
    lookup.setDualInetAddress(DualInetAddress.fromAddress("127.0.0.1"));
    Map<String, DualInetAddress> addressMap = new HashMap<>();
    addressMap.put(lookup.getNodeId(), lookup.getDualInetAddress());
    lookup.setControllerNodeIPLookupMap(addressMap);
    return lookup;
}
Also used : HashMap(java.util.HashMap) CoordinatorClientInetAddressMap(com.emc.storageos.coordinator.client.service.impl.CoordinatorClientInetAddressMap) DualInetAddress(com.emc.storageos.coordinator.client.service.impl.DualInetAddress)

Example 18 with DualInetAddress

use of com.emc.storageos.coordinator.client.service.impl.DualInetAddress in project coprhd-controller by CoprHD.

the class StubCoordinatorClientImpl method createLocalAddressLookupMap.

/**
 * Creates a local address lookup map for use in local tests.
 *
 * @return the lookup map.
 */
public static CoordinatorClientInetAddressMap createLocalAddressLookupMap() {
    CoordinatorClientInetAddressMap addressMap = new CoordinatorClientInetAddressMap();
    addressMap.setNodeId("localhost");
    try {
        addressMap.setDualInetAddress(DualInetAddress.fromAddress("127.0.0.1"));
    } catch (UnknownHostException e) {
    // Should never happen, ignore
    }
    Map<String, DualInetAddress> ips = new HashMap<>();
    ips.put(addressMap.getNodeId(), addressMap.getDualInetAddress());
    addressMap.setControllerNodeIPLookupMap(ips);
    return addressMap;
}
Also used : UnknownHostException(java.net.UnknownHostException) CoordinatorClientInetAddressMap(com.emc.storageos.coordinator.client.service.impl.CoordinatorClientInetAddressMap) DualInetAddress(com.emc.storageos.coordinator.client.service.impl.DualInetAddress)

Example 19 with DualInetAddress

use of com.emc.storageos.coordinator.client.service.impl.DualInetAddress in project coprhd-controller by CoprHD.

the class DisasterRecoveryService method checkNATForAttachStandby.

private void checkNATForAttachStandby(ViPRCoreClient viprCoreClient) {
    DualInetAddress inetAddress = coordinator.getInetAddessLookupMap().getDualInetAddress();
    String ipv4 = inetAddress.getInet4();
    String ipv6 = inetAddress.getInet6();
    log.info("Got local node's IP addresses, IPv4 = {}, IPv6 = {}", ipv4, ipv6);
    DRNatCheckParam checkParam = new DRNatCheckParam();
    checkParam.setIPv4Address(ipv4);
    checkParam.setIPv6Address(ipv6);
    DRNatCheckResponse resp = viprCoreClient.site().checkIfBehindNat(checkParam);
    if (resp.isBehindNAT()) {
        throw APIException.internalServerErrors.addStandbyPrecheckFailed(String.format("The remote site sees this node's IP as %s, which is different from the local addresses: %s or %s, it may be behind a NAT.", resp.getSeenIp(), ipv4, ipv6));
    }
}
Also used : DRNatCheckResponse(com.emc.storageos.model.dr.DRNatCheckResponse) DRNatCheckParam(com.emc.storageos.model.dr.DRNatCheckParam) DualInetAddress(com.emc.storageos.coordinator.client.service.impl.DualInetAddress)

Example 20 with DualInetAddress

use of com.emc.storageos.coordinator.client.service.impl.DualInetAddress in project coprhd-controller by CoprHD.

the class CoordinatorTestBase method createLocalInetAddressLookupMap.

protected static CoordinatorClientInetAddressMap createLocalInetAddressLookupMap() throws UnknownHostException {
    CoordinatorClientInetAddressMap lookup = new CoordinatorClientInetAddressMap();
    lookup.setNodeId("localhost");
    lookup.setDualInetAddress(DualInetAddress.fromAddress("127.0.0.1"));
    Map<String, DualInetAddress> addressMap = new HashMap<>();
    addressMap.put(lookup.getNodeId(), lookup.getDualInetAddress());
    lookup.setControllerNodeIPLookupMap(addressMap);
    return lookup;
}
Also used : HashMap(java.util.HashMap) CoordinatorClientInetAddressMap(com.emc.storageos.coordinator.client.service.impl.CoordinatorClientInetAddressMap) DualInetAddress(com.emc.storageos.coordinator.client.service.impl.DualInetAddress)

Aggregations

DualInetAddress (com.emc.storageos.coordinator.client.service.impl.DualInetAddress)26 CoordinatorClientInetAddressMap (com.emc.storageos.coordinator.client.service.impl.CoordinatorClientInetAddressMap)13 HashMap (java.util.HashMap)9 ZkConnection (com.emc.storageos.coordinator.common.impl.ZkConnection)8 URI (java.net.URI)8 FileInputStream (java.io.FileInputStream)6 UnknownHostException (java.net.UnknownHostException)6 ArrayList (java.util.ArrayList)6 Properties (java.util.Properties)5 Before (org.junit.Before)5 CoordinatorClientImpl (com.emc.storageos.coordinator.client.service.impl.CoordinatorClientImpl)4 KeyCertificateAlgorithmValuesHolder (com.emc.storageos.security.keystore.impl.KeyCertificateAlgorithmValuesHolder)4 Test (org.junit.Test)4 DbVersionInfo (com.emc.storageos.coordinator.client.model.DbVersionInfo)3 KeyCertificatePairGenerator (com.emc.storageos.security.keystore.impl.KeyCertificatePairGenerator)3 DistributedLoadKeyStoreParam (com.emc.storageos.security.keystore.impl.DistributedLoadKeyStoreParam)2 Map (java.util.Map)2 TreeMap (java.util.TreeMap)2 Ignore (org.junit.Ignore)2 SoftwareVersion (com.emc.storageos.coordinator.client.model.SoftwareVersion)1