Search in sources :

Example 6 with StoragePortList

use of com.emc.storageos.model.ports.StoragePortList in project coprhd-controller by CoprHD.

the class NetworkService method getStoragePorts.

/**
 * This call returns a list of all Storage Ports associated
 * with the Network end points.
 * <p>
 *
 * @param id the URN of a ViPR network
 * @brief List storage ports
 * @return StoragePortList
 */
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
@Path("/{id}/storage-ports")
public StoragePortList getStoragePorts(@PathParam("id") URI id) {
    ArgValidator.checkUri(id);
    Network tzone = _dbClient.queryObject(Network.class, id);
    ArgValidator.checkEntityNotNull(tzone, id, isIdEmbeddedInURL(id));
    StoragePortList registeredStoragePorts = new StoragePortList();
    URIQueryResultList storagePortURIs = new URIQueryResultList();
    _dbClient.queryByConstraint(AlternateIdConstraint.Factory.getNetworkStoragePortConstraint(id.toString()), storagePortURIs);
    Iterator<URI> storagePortURIsIter = storagePortURIs.iterator();
    while (storagePortURIsIter.hasNext()) {
        URI storagePortURI = storagePortURIsIter.next();
        StoragePort storagePort = _dbClient.queryObject(StoragePort.class, storagePortURI);
        if (storagePort != null && !storagePort.getInactive()) {
            registeredStoragePorts.getPorts().add(toNamedRelatedResource(storagePort, storagePort.getNativeGuid()));
        }
    }
    return registeredStoragePorts;
}
Also used : Network(com.emc.storageos.db.client.model.Network) MapNetwork(com.emc.storageos.api.mapper.functions.MapNetwork) StoragePort(com.emc.storageos.db.client.model.StoragePort) StoragePortList(com.emc.storageos.model.ports.StoragePortList) URI(java.net.URI) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 7 with StoragePortList

use of com.emc.storageos.model.ports.StoragePortList in project coprhd-controller by CoprHD.

the class ApiTest method updateAllVnxAndVmaxPorts.

/**
 * Update the discovered VNX/VMAX storage ports to set the transport zone.
 *
 * @param provider : Provider.
 */
private void updateAllVnxAndVmaxPorts(SMISProviderRestRep provider) {
    StorageSystemList systemList = rZAdmin.path("/vdc/storage-systems").get(StorageSystemList.class);
    for (RelatedResourceRep resRep : systemList.getStorageSystems()) {
        StorageSystemRestRep system = rZAdmin.path(String.format("/vdc/storage-systems/%s", resRep.getId()).toString()).get(StorageSystemRestRep.class);
        if (system.getSystemType().equals(Type.vnxblock.toString()) || system.getSystemType().equals(Type.vmax.toString())) {
            // Register all the discovered storage ports .
            StoragePortList vnxBlockPortList = rZAdmin.path(String.format("/vdc/storage-systems/%s/storage-ports", system.getId()).toString()).get(StoragePortList.class);
            List<NamedRelatedResourceRep> vnxBlockPortURIList = vnxBlockPortList.getPorts();
            for (RelatedResourceRep portURI : vnxBlockPortURIList) {
                updateStoragePortTZ(resRep.getId(), portURI);
            }
        }
    }
}
Also used : StorageSystemList(com.emc.storageos.model.systems.StorageSystemList) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) RelatedResourceRep(com.emc.storageos.model.RelatedResourceRep) StorageSystemRestRep(com.emc.storageos.model.systems.StorageSystemRestRep) StoragePortList(com.emc.storageos.model.ports.StoragePortList) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep)

Aggregations

StoragePortList (com.emc.storageos.model.ports.StoragePortList)7 URI (java.net.URI)5 StoragePort (com.emc.storageos.db.client.model.StoragePort)4 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)4 GET (javax.ws.rs.GET)4 Produces (javax.ws.rs.Produces)4 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)3 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)3 Path (javax.ws.rs.Path)3 MapStoragePort (com.emc.storageos.api.mapper.functions.MapStoragePort)2 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)2 StorageSystemList (com.emc.storageos.model.systems.StorageSystemList)2 ArrayList (java.util.ArrayList)2 Asset (com.emc.sa.asset.annotation.Asset)1 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)1 MapNetwork (com.emc.storageos.api.mapper.functions.MapNetwork)1 MapVirtualArray (com.emc.storageos.api.mapper.functions.MapVirtualArray)1 BulkList (com.emc.storageos.api.service.impl.response.BulkList)1 Network (com.emc.storageos.db.client.model.Network)1 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)1