use of com.emc.storageos.model.network.SanZoneRestRep in project coprhd-controller by CoprHD.
the class NetworkSystemService method getSanZones.
/**
* Returns a list of the active zones (and their zone members) for the specified
* fabric or VSAN in a network system. E.g., ../san-fabrics/{fabric-id}/san-zones?zone-name="abc-zone"&exclude-members=true
* Note: This is a synchronous call to the device and may take a while to receive a response.
*
* @param id the URN of a ViPR network system.
* @param fabricId The name of the VSAN or fabric as returned by
* @param zoneName - only returns zone with zone name matched the given name. Return all zones, if not specified.
* @param excludeMembers - true, do not include members with zone. Include members, if not specified.
* @param excludeAliases - true, do not include aliases with zone. Include aliases, if not specified.
* @prereq none
* @brief List active zones in a network system fabric or VSAN
* @return A list of the active zones and their members. If zone name is specified, and there is a match, then only one zone is
* returned.
* If excludeMembers is true, then only zone name is present.
* @throws InternalException
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/san-fabrics/{fabricId}/san-zones")
@CheckPermission(roles = { Role.SYSTEM_ADMIN })
public SanZonesRestRep getSanZones(@PathParam("id") URI id, @PathParam("fabricId") String fabricId, @QueryParam("zone-name") String zoneName, @QueryParam("exclude-members") boolean excludeMembers, @QueryParam("exclude-aliases") boolean excludeAliases) throws InternalException {
SanZonesRestRep szones = new SanZonesRestRep();
ArgValidator.checkFieldUriType(id, NetworkSystem.class, "id");
NetworkSystem device = queryResource(id);
String fabricWwn = null;
if (WWNUtility.isValidWWN(fabricId)) {
fabricWwn = fabricId;
fabricId = fabricId.replaceAll(":", "");
}
NetworkController controller = getNetworkController(device.getSystemType());
List<Zoneset> zonesets = controller.getZonesets(device.getId(), fabricId, fabricWwn, zoneName, excludeMembers, excludeAliases);
for (Zoneset zoneset : zonesets) {
for (Zone zone : zoneset.getZones()) {
SanZoneRestRep sz = new SanZoneRestRep();
sz.setName(zone.getName());
for (ZoneMember member : zone.getMembers()) {
// convert zone member to xml aware. Only fill in alias if member is an alias type
sz.getMembers().add(new SanZoneMemberRestRep(member.getAddress(), member.isAliasType() ? member.getAlias() : null));
}
szones.getZones().add(sz);
}
}
return szones;
}
Aggregations