use of com.emc.storageos.networkcontroller.NetworkController in project coprhd-controller by CoprHD.
the class NetworkSystemService method doDiscoverNetworkSystem.
/**
* Common code for submitting a request for discovery. The request may not be performed
* by the discovery framework if a discovery was recently performed or is ongoing for
* the network system.
*
* @param device the network system to be discovered to re-discovered.
* provided, a new taskId is generated.
* @return the task used to track the discovery job
*/
private TaskResourceRep doDiscoverNetworkSystem(NetworkSystem device) {
NetworkController controller = getNetworkController(device.getSystemType());
DiscoveredObjectTaskScheduler scheduler = new DiscoveredObjectTaskScheduler(_dbClient, new NetworkJobExec(controller));
String taskId = UUID.randomUUID().toString();
ArrayList<AsyncTask> tasks = new ArrayList<AsyncTask>(1);
tasks.add(new AsyncTask(NetworkSystem.class, device.getId(), taskId));
TaskList taskList = scheduler.scheduleAsyncTasks(tasks);
return taskList.getTaskList().iterator().next();
}
use of com.emc.storageos.networkcontroller.NetworkController in project coprhd-controller by CoprHD.
the class NetworkSystemService method removeAliases.
/**
* Removes one or more aliases from the specified network system. For Brocade the fabric from where
* the aliases will be removed must be specified. For MDS, this input is ignored if provided.
*
* @param aliases A parameter structure listing the aliases to be removed. The alias member is an
* optional parameter and when provided, the alias membership is checked prior to removing it.
* @param id the URN of a ViPR network system.
* @prereq none
* @brief Remove aliases to network system to VSAN or fabric
* @return A task description structure.
* @throws InternalException
*/
@POST
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/san-aliases/remove")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.RESTRICTED_SYSTEM_ADMIN })
public TaskResourceRep removeAliases(WwnAliasesDeleteParam aliases, @PathParam("id") URI id) throws InternalException {
String task = UUID.randomUUID().toString();
ArgValidator.checkFieldUriType(id, NetworkSystem.class, "id");
ArgValidator.checkFieldNotEmpty(aliases.getAliases(), "aliases");
NetworkSystem device = queryResource(id);
String fabricId = aliases.getFabricId();
if (Type.brocade.toString().equals(device.getSystemType())) {
ArgValidator.checkFieldNotEmpty(fabricId, "fabric-id");
}
String fabricWwn = null;
if (WWNUtility.isValidWWN(fabricId)) {
fabricWwn = fabricId;
fabricId = fabricId.replaceAll(":", "");
}
Operation op = _dbClient.createTaskOpStatus(NetworkSystem.class, device.getId(), task, ResourceOperationTypeEnum.REMOVE_ALIAS);
List<ZoneWwnAlias> zoneAliases = new ArrayList<ZoneWwnAlias>();
for (WwnAliasParam alias : aliases.getAliases()) {
validateAlias(alias, false);
zoneAliases.add(new ZoneWwnAlias(alias.getName(), alias.getAddress()));
auditOp(OperationTypeEnum.REMOVE_ALIAS, true, AuditLogManager.AUDITOP_BEGIN, alias.getName(), device.getId().toString(), device.getLabel(), device.getPortNumber(), device.getUsername(), device.getSmisProviderIP(), device.getSmisPortNumber(), device.getSmisUserName(), device.getSmisUseSSL(), device.getVersion(), device.getUptime());
}
NetworkController controller = getNetworkController(device.getSystemType());
controller.removeAliases(device.getId(), fabricId, fabricWwn, zoneAliases, task);
return toTask(device, task, op);
}
Aggregations