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;
}
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);
}
}
}
}
Aggregations