Search in sources :

Example 6 with NetworkRestRep

use of com.emc.storageos.model.varray.NetworkRestRep in project coprhd-controller by CoprHD.

the class Networks method getNetwork.

/**
 * Gets a network by ID, or flashes an error and goes back to the referring page or the list page if no referrer.
 *
 * @param id
 *            the network ID.
 * @return the network.
 */
@Util
public static NetworkRestRep getNetwork(String id) {
    NetworkRestRep network = NetworkUtils.getNetwork(id);
    if (network == null) {
        flash.error(MessagesUtils.get(UNKNOWN, id));
        backToReferrer();
        list();
    }
    return network;
}
Also used : NetworkRestRep(com.emc.storageos.model.varray.NetworkRestRep) Util(play.mvc.Util)

Example 7 with NetworkRestRep

use of com.emc.storageos.model.varray.NetworkRestRep 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 8 with NetworkRestRep

use of com.emc.storageos.model.varray.NetworkRestRep in project coprhd-controller by CoprHD.

the class Networks method getConnectedStorage.

public static void getConnectedStorage() {
    List<NetworkRestRep> networks = NetworkUtils.getNetworks();
    Set<String> connectedstoragesystems = new HashSet<String>();
    for (NetworkRestRep network : networks) {
        for (StoragePortRestRep port : StoragePortUtils.getStoragePortsByNetwork(network.getId())) {
            connectedstoragesystems.add(port.getStorageDevice().getId().toString());
        }
    }
    renderJSON(connectedstoragesystems);
}
Also used : StoragePortRestRep(com.emc.storageos.model.ports.StoragePortRestRep) NetworkRestRep(com.emc.storageos.model.varray.NetworkRestRep) HashSet(java.util.HashSet)

Example 9 with NetworkRestRep

use of com.emc.storageos.model.varray.NetworkRestRep in project coprhd-controller by CoprHD.

the class VirtualArrays method updateNetworks.

/**
 * Updates the given networks with the virtual array assignment changes.
 *
 * @param ids
 *            the network IDs.
 * @param changes
 *            the virtual array changes.
 */
private static void updateNetworks(List<URI> ids, VirtualArrayAssignmentChanges changes) {
    if (ids.isEmpty()) {
        return;
    }
    List<NetworkRestRep> networks = NetworkUtils.getNetworks(ids);
    for (NetworkRestRep network : networks) {
        NetworkUpdate update = new NetworkUpdate();
        update.setVarrayChanges(changes);
        NetworkUtils.update(network.getId(), update);
    }
}
Also used : NetworkRestRep(com.emc.storageos.model.varray.NetworkRestRep) NetworkUpdate(com.emc.storageos.model.varray.NetworkUpdate)

Example 10 with NetworkRestRep

use of com.emc.storageos.model.varray.NetworkRestRep in project coprhd-controller by CoprHD.

the class InternalApiTest method testNetworkUsingInternalClient.

@Test
public void testNetworkUsingInternalClient() {
    // first add a new endpoint
    String newEndpoint = "www.networktest-" + System.currentTimeMillis() + ".com";
    NetworkEndpointParam endpointParam = new NetworkEndpointParam();
    endpointParam.setEndpoints(Arrays.asList(newEndpoint));
    endpointParam.setOp(NetworkEndpointParam.EndpointOp.add.name());
    NetworkRestRep network = _internalNetworkClient.updateNetworkEndpoints(_networkId, endpointParam);
    Assert.assertNotNull("update should not return a null response", network);
    Assert.assertTrue("response should contain the new endpoint " + newEndpoint, network.getEndpoints().contains(newEndpoint));
    // then remove it again
    endpointParam.setOp(NetworkEndpointParam.EndpointOp.remove.name());
    network = _internalNetworkClient.updateNetworkEndpoints(_networkId, endpointParam);
    Assert.assertNotNull("update should not return a null response", network);
    Assert.assertFalse("response should not contain the new endpoint " + newEndpoint, network.getEndpoints().contains(newEndpoint));
}
Also used : NetworkEndpointParam(com.emc.storageos.model.varray.NetworkEndpointParam) NetworkRestRep(com.emc.storageos.model.varray.NetworkRestRep) Test(org.junit.Test)

Aggregations

NetworkRestRep (com.emc.storageos.model.varray.NetworkRestRep)16 StoragePortRestRep (com.emc.storageos.model.ports.StoragePortRestRep)4 HashSet (java.util.HashSet)3 EndpointAliasRestRep (com.emc.storageos.model.EndpointAliasRestRep)2 HostRestRep (com.emc.storageos.model.host.HostRestRep)2 InitiatorRestRep (com.emc.storageos.model.host.InitiatorRestRep)2 IpInterfaceRestRep (com.emc.storageos.model.host.IpInterfaceRestRep)2 StorageSystemRestRep (com.emc.storageos.model.systems.StorageSystemRestRep)2 EndpointInfo (models.datatable.NetworkEndpointDataTable.EndpointInfo)2 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)1 FCEndpoint (com.emc.storageos.db.client.model.FCEndpoint)1 StringSet (com.emc.storageos.db.client.model.StringSet)1 StringHashMapEntry (com.emc.storageos.model.StringHashMapEntry)1 StringMapAdapter (com.emc.storageos.model.adapters.StringMapAdapter)1 NetworkCreate (com.emc.storageos.model.varray.NetworkCreate)1 NetworkEndpointParam (com.emc.storageos.model.varray.NetworkEndpointParam)1 NetworkUpdate (com.emc.storageos.model.varray.NetworkUpdate)1 WebResource (com.sun.jersey.api.client.WebResource)1 FlashException (controllers.util.FlashException)1 URI (java.net.URI)1