Search in sources :

Example 26 with DualInetAddress

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

the class ZkSimulator method connectClient.

/**
 * Connects to Zookeeper server
 *
 * @return The instance of CoordinatorClient
 * @throws IOException
 */
private CoordinatorClient connectClient() throws IOException {
    CoordinatorClientImpl client = new CoordinatorClientImpl();
    ZkConnection conn = new ZkConnection();
    URI zkUri = URI.create(String.format("coordinator://localhost:%s", config.getClientPortAddress().getPort()));
    conn.setServer(Arrays.asList(zkUri));
    conn.setTimeoutMs(10 * 1000);
    conn.setSiteIdFile("build/data/zk/siteIdFile");
    log.info("Connecting with coordinator service...");
    conn.build();
    log.info("Connecting with coordinator service.");
    client.setZkConnection(conn);
    CoordinatorClientInetAddressMap inetAddressMap = new CoordinatorClientInetAddressMap();
    inetAddressMap.setNodeId("standalone");
    inetAddressMap.setDualInetAddress(DualInetAddress.fromAddress("127.0.0.1"));
    inetAddressMap.setCoordinatorClient(client);
    inetAddressMap.setControllerNodeIPLookupMap(new HashMap<String, DualInetAddress>());
    client.setInetAddessLookupMap(inetAddressMap);
    client.setSysSvcName("syssvc");
    client.setSysSvcVersion("1");
    client.setVdcShortId("vdc1");
    Properties properties = new Properties();
    properties.setProperty(BackupConstants.BACKUP_MAX_MANUAL_COPIES, "5");
    client.setDefaultProperties(properties);
    FileInputStream is = new FileInputStream(ovfPropsLocation);
    Properties ovfProps = new Properties();
    ovfProps.load(is);
    is.close();
    client.setOvfProperties(ovfProps);
    client.start();
    return client;
}
Also used : CoordinatorClientImpl(com.emc.storageos.coordinator.client.service.impl.CoordinatorClientImpl) CoordinatorClientInetAddressMap(com.emc.storageos.coordinator.client.service.impl.CoordinatorClientInetAddressMap) Properties(java.util.Properties) URI(java.net.URI) ZkConnection(com.emc.storageos.coordinator.common.impl.ZkConnection) DualInetAddress(com.emc.storageos.coordinator.client.service.impl.DualInetAddress) FileInputStream(java.io.FileInputStream)

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