Search in sources :

Example 1 with EndpointInfo

use of models.datatable.NetworkEndpointDataTable.EndpointInfo in project coprhd-controller by CoprHD.

the class Networks method listArrayEndpointsJson.

private static void listArrayEndpointsJson(NetworkRestRep network, List<StoragePortRestRep> ports) {
    CachedResources<StorageSystemRestRep> storageSystems = StorageSystemUtils.createCache();
    List<EndpointInfo> items = Lists.newArrayList();
    for (StoragePortRestRep port : ports) {
        items.add(new EndpointInfo(port, storageSystems));
    }
    setEndpointAttrs(network, items);
    renderJSON(DataTablesSupport.createJSON(items, params));
}
Also used : EndpointInfo(models.datatable.NetworkEndpointDataTable.EndpointInfo) StorageSystemRestRep(com.emc.storageos.model.systems.StorageSystemRestRep) StoragePortRestRep(com.emc.storageos.model.ports.StoragePortRestRep)

Example 2 with EndpointInfo

use of models.datatable.NetworkEndpointDataTable.EndpointInfo in project coprhd-controller by CoprHD.

the class Networks method availableHostEndpointsJson.

public static void availableHostEndpointsJson(String id) {
    NetworkRestRep network = NetworkUtils.getNetwork(id);
    CachedResources<HostRestRep> hosts = HostUtils.createCache();
    List<EndpointInfo> items = Lists.newArrayList();
    if (TransportProtocols.isIp(network.getTransportType())) {
        // Host IP interfaces not in the network
        for (IpInterfaceRestRep ipInterface : NetworkUtils.getEligibleIpInterfaces(network.getId())) {
            items.add(new EndpointInfo(ipInterface, hosts));
        }
    }
    // Host initiators not in the network
    Set<String> protocols = NetworkUtils.getSupportedProtocols(network);
    for (InitiatorRestRep initiator : NetworkUtils.getEligibleInitiators(network.getId(), protocols)) {
        items.add(new EndpointInfo(initiator, hosts));
    }
    setEndpointAttrs(network, items);
    renderJSON(DataTablesSupport.createJSON(items, params));
}
Also used : EndpointInfo(models.datatable.NetworkEndpointDataTable.EndpointInfo) HostRestRep(com.emc.storageos.model.host.HostRestRep) IpInterfaceRestRep(com.emc.storageos.model.host.IpInterfaceRestRep) InitiatorRestRep(com.emc.storageos.model.host.InitiatorRestRep) NetworkRestRep(com.emc.storageos.model.varray.NetworkRestRep)

Example 3 with EndpointInfo

use of models.datatable.NetworkEndpointDataTable.EndpointInfo in project coprhd-controller by CoprHD.

the class Networks method setEndpointAttrs.

private static void setEndpointAttrs(NetworkRestRep network, List<EndpointInfo> endpoints) {
    Set<String> discovered = NetworkUtils.getDiscoveredEndpoints(network);
    Map<String, String> aliases = NetworkUtils.getAliases(network);
    for (EndpointInfo endpoint : endpoints) {
        endpoint.discovered = discovered.contains(endpoint.identifier);
        endpoint.alias = aliases.get(endpoint.identifier);
    }
}
Also used : EndpointInfo(models.datatable.NetworkEndpointDataTable.EndpointInfo)

Example 4 with EndpointInfo

use of models.datatable.NetworkEndpointDataTable.EndpointInfo in project coprhd-controller by CoprHD.

the class Networks method endpointsJson.

/**
 * Creates and renders JSON datatable source for endpoints for the given network.
 *
 * @param networkId
 *            the network ID.
 */
public static void endpointsJson(String networkId) {
    NetworkRestRep network = NetworkUtils.getNetwork(networkId);
    if (network == null) {
        error(MessagesUtils.get(UNKNOWN, networkId));
    }
    List<EndpointInfo> items = Lists.newArrayList();
    // All known endpoints, remove endpoints from storage systems and hosts to get manual endpoints
    Set<String> endpoints = Sets.newTreeSet(new Comparator<String>() {

        @Override
        public int compare(String s1, String s2) {
            return s1.compareToIgnoreCase(s2);
        }
    });
    endpoints.addAll(network.getEndpoints());
    // Add ports from storage systems
    CachedResources<StorageSystemRestRep> storageSystems = StorageSystemUtils.createCache();
    for (StoragePortRestRep storagePort : StoragePortUtils.getStoragePortsByNetwork(network.getId())) {
        items.add(new EndpointInfo(storagePort, storageSystems));
        for (String endpoint : NetworkUtils.getEndPoints(storagePort)) {
            endpoints.remove(endpoint);
        }
    }
    // Add ports from hosts
    CachedResources<HostRestRep> hosts = HostUtils.createCache();
    for (InitiatorRestRep initiator : NetworkUtils.getInitiators(network.getId())) {
        if (initiator.getHost() != null) {
            items.add(new EndpointInfo(initiator, hosts));
            endpoints.remove(NetworkUtils.getEndPoint(initiator));
        }
    }
    for (IpInterfaceRestRep ipInterface : NetworkUtils.getIpInterfaces(network.getId())) {
        if (ipInterface.getHost() != null) {
            items.add(new EndpointInfo(ipInterface, hosts));
            endpoints.remove(NetworkUtils.getEndPoint(ipInterface));
        }
    }
    // Add any remaining endpoints as 'manual'
    for (String endpoint : endpoints) {
        items.add(new EndpointInfo(endpoint));
    }
    setEndpointAttrs(network, items);
    renderJSON(DataTablesSupport.createJSON(items, params));
}
Also used : StorageSystemRestRep(com.emc.storageos.model.systems.StorageSystemRestRep) StoragePortRestRep(com.emc.storageos.model.ports.StoragePortRestRep) InitiatorRestRep(com.emc.storageos.model.host.InitiatorRestRep) IpInterfaceRestRep(com.emc.storageos.model.host.IpInterfaceRestRep) EndpointInfo(models.datatable.NetworkEndpointDataTable.EndpointInfo) HostRestRep(com.emc.storageos.model.host.HostRestRep) NetworkRestRep(com.emc.storageos.model.varray.NetworkRestRep)

Example 5 with EndpointInfo

use of models.datatable.NetworkEndpointDataTable.EndpointInfo in project coprhd-controller by CoprHD.

the class BlockExportGroups method availableInitiatorsJson.

public static void availableInitiatorsJson(String id) {
    CachedResources<HostRestRep> hosts = HostUtils.createCache();
    List<EndpointInfo> items = Lists.newArrayList();
    for (InitiatorRestRep initiator : getEligibleInitiators(uri(id))) {
        items.add(new EndpointInfo(initiator, hosts));
    }
    renderJSON(DataTablesSupport.createJSON(items, params));
}
Also used : EndpointInfo(models.datatable.NetworkEndpointDataTable.EndpointInfo) HostRestRep(com.emc.storageos.model.host.HostRestRep) InitiatorRestRep(com.emc.storageos.model.host.InitiatorRestRep)

Aggregations

EndpointInfo (models.datatable.NetworkEndpointDataTable.EndpointInfo)5 HostRestRep (com.emc.storageos.model.host.HostRestRep)3 InitiatorRestRep (com.emc.storageos.model.host.InitiatorRestRep)3 IpInterfaceRestRep (com.emc.storageos.model.host.IpInterfaceRestRep)2 StoragePortRestRep (com.emc.storageos.model.ports.StoragePortRestRep)2 StorageSystemRestRep (com.emc.storageos.model.systems.StorageSystemRestRep)2 NetworkRestRep (com.emc.storageos.model.varray.NetworkRestRep)2