Search in sources :

Example 1 with FCZoneReferences

use of com.emc.storageos.model.network.FCZoneReferences in project coprhd-controller by CoprHD.

the class NetworkSystemService method getReferences.

/**
 * This information is intended only for internal debugging.
 * The FCZoneReference structure represents a use of a SAN Zone by an ExportGroup/Volume
 * combination. This call allows one to check what ExportGroups/Volumes are using a given
 * SAN Zone.
 * Gets the FCZoneReference entries for a given wwnList (used to make the key).
 *
 * @param wwnList A comma separated list of wwn Zone members is used to make the search key.
 * @brief INTERNAL ONLY
 * @return FCZoneReferences a list of FCZoneReference structures
 */
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/san-references/{wwnList}")
@CheckPermission(roles = { Role.SYSTEM_ADMIN })
public FCZoneReferences getReferences(@PathParam("wwnList") String wwnList) {
    FCZoneReferences references = new FCZoneReferences();
    List<String> wwns = Arrays.asList(wwnList.split(","));
    for (int i = 0; i < wwns.size() - 1; i++) {
        for (int j = i + 1; j < wwns.size(); j++) {
            String key = FCZoneReference.makeEndpointsKey(Arrays.asList(new String[] { wwns.get(i).toUpperCase(), wwns.get(j).toUpperCase() }));
            List<URI> uris = _dbClient.queryByConstraint(AlternateIdConstraint.Factory.getFCZoneReferenceKeyConstraint(key));
            for (URI uri : uris) {
                FCZoneReference ref = _dbClient.queryObject(FCZoneReference.class, uri);
                if (ref != null) {
                    if (ref.getInactive() == false) {
                        Volume vol = _dbClient.queryObject(Volume.class, ref.getVolumeUri());
                        if (vol != null && vol.getInactive() == false) {
                            references.getReferences().add(map(ref));
                        }
                    }
                }
            }
        }
    }
    return references;
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) FCZoneReferences(com.emc.storageos.model.network.FCZoneReferences) URI(java.net.URI) AlternateIdConstraint(com.emc.storageos.db.client.constraint.AlternateIdConstraint) ContainmentConstraint(com.emc.storageos.db.client.constraint.ContainmentConstraint) FCEndpoint(com.emc.storageos.db.client.model.FCEndpoint) FCZoneReference(com.emc.storageos.db.client.model.FCZoneReference) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Aggregations

AlternateIdConstraint (com.emc.storageos.db.client.constraint.AlternateIdConstraint)1 ContainmentConstraint (com.emc.storageos.db.client.constraint.ContainmentConstraint)1 FCEndpoint (com.emc.storageos.db.client.model.FCEndpoint)1 FCZoneReference (com.emc.storageos.db.client.model.FCZoneReference)1 Volume (com.emc.storageos.db.client.model.Volume)1 FCZoneReferences (com.emc.storageos.model.network.FCZoneReferences)1 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)1 URI (java.net.URI)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1