use of com.emc.storageos.model.varray.NetworkList in project coprhd-controller by CoprHD.
the class NetworkService method getAllNetworks.
/**
* This call returns a list of all the networks, regardless of whether or not
* they are associated with a virtual array.
* <p>
* If network systems are discovered, fiber channel networks that are discovered are not initially associated with virtual array. The
* discovered networks must be updated to associate then with virtual arrays.
*
* @brief List networks
* @return a list of all networks
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
public NetworkList getAllNetworks(@QueryParam("wwn") String wwn) {
NetworkList tzlist = new NetworkList();
if (wwn != null) {
// Validate the argument for wwn structure...
ArgValidator.checkFieldValidWwn(wwn);
// Normalize wwn for colon-separated and all-caps
wwn = WwnUtils.convertWWN(wwn.toUpperCase(), FORMAT.COLON);
Network network = NetworkUtil.getEndpointNetwork(wwn, _dbClient);
if (network != null) {
tzlist.getNetworks().add(toNamedRelatedResource(ResourceTypeEnum.NETWORK, network.getId(), network.getLabel()));
}
} else {
List<URI> networks = _dbClient.queryByType(Network.class, true);
List<Network> transportZones = _dbClient.queryObject(Network.class, networks);
for (Network network : transportZones) {
if (network == null || network.getInactive() == true) {
continue;
}
tzlist.getNetworks().add(toNamedRelatedResource(ResourceTypeEnum.NETWORK, network.getId(), network.getLabel()));
}
}
return tzlist;
}
use of com.emc.storageos.model.varray.NetworkList in project coprhd-controller by CoprHD.
the class VirtualArrayService method getNetworkList.
/**
* List transport zones in VirtualArray
*
* @param id the URN of a ViPR VirtualArray
* @brief List VirtualArray Networks
* @return List of Networks
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/networks")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR }, acls = { ACL.USE })
public NetworkList getNetworkList(@PathParam("id") URI id) {
NetworkList networkList = new NetworkList();
// Verify the passed virtual array id.
ArgValidator.checkFieldUriType(id, VirtualArray.class, "id");
VirtualArray varray = _dbClient.queryObject(VirtualArray.class, id);
ArgValidator.checkEntity(varray, id, isIdEmbeddedInURL(id));
// Get the networks assigned to the virtual array.
List<Network> networks = CustomQueryUtility.queryActiveResourcesByRelation(_dbClient, id, Network.class, "connectedVirtualArrays");
for (Network network : networks) {
if (network == null || network.getInactive() == true) {
continue;
}
networkList.getNetworks().add(toNamedRelatedResource(ResourceTypeEnum.NETWORK, network.getId(), network.getLabel()));
}
return networkList;
}
Aggregations