use of com.emc.storageos.model.network.SanZoneUpdateParam in project coprhd-controller by CoprHD.
the class NetworkSystemService method updateSanZones.
/**
* For given network system's fabric, update zones via add and/or remove their pwwns or aliases.
* This is an asynchronous call.
*
* @param updateSanZones A parameter structure listing the zone(s) to be added and their members.
* @param id the URN of a ViPR network system.
* @param fabricId The name of the VSAN or fabric as returned by /vdc/network-systems/{id}/san-fabrics
* or the VSAN or fabric WWN
* @prereq Updating zones must be exist in network system with given <code>id</code>
* @brief Update SAN zones details for network system VSAN or fabric
* @return A task description structure.
* @throws InternalException
*/
@PUT
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/san-fabrics/{fabricId}/san-zones")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.RESTRICTED_SYSTEM_ADMIN })
public TaskResourceRep updateSanZones(SanZoneUpdateParams updateSanZones, @PathParam("id") URI id, @PathParam("fabricId") String fabricId) throws InternalException {
String task = UUID.randomUUID().toString();
String fabricWwn = null;
if (WWNUtility.isValidWWN(fabricId)) {
fabricWwn = fabricId;
fabricId = fabricId.replaceAll(":", "");
}
ArgValidator.checkFieldUriType(id, NetworkSystem.class, "id");
NetworkSystem device = queryResource(id);
List<ZoneUpdate> updateZones = new ArrayList<ZoneUpdate>();
for (SanZoneUpdateParam sz : updateSanZones.getUpdateZones()) {
ZoneUpdate updateZone = new ZoneUpdate(sz.getName());
validateZoneName(sz.getName(), device.getSystemType());
for (String szm : sz.getAddMembers()) {
if (StringUtils.isEmpty(szm)) {
continue;
}
ZoneMember member = createZoneMember(szm);
updateZone.getAddZones().add(member);
}
for (String szm : sz.getRemoveMembers()) {
if (StringUtils.isEmpty(szm)) {
continue;
}
ZoneMember member = createZoneMember(szm);
updateZone.getRemoveZones().add(member);
}
updateZones.add(updateZone);
auditOp(OperationTypeEnum.UPDATE_SAN_ZONE, true, AuditLogManager.AUDITOP_BEGIN, updateZone.getName(), device.getId().toString(), device.getLabel(), device.getPortNumber(), device.getUsername(), device.getSmisProviderIP(), device.getSmisPortNumber(), device.getSmisUserName(), device.getSmisUseSSL(), device.getVersion(), device.getUptime());
}
ArgValidator.checkFieldNotEmpty(updateZones, "zones");
Operation op = _dbClient.createTaskOpStatus(NetworkSystem.class, device.getId(), task, ResourceOperationTypeEnum.UPDATE_SAN_ZONE);
NetworkController controller = getNetworkController(device.getSystemType());
controller.updateSanZones(device.getId(), fabricId, fabricWwn, updateZones, false, task);
return toTask(device, task, op);
}
Aggregations