use of com.emc.storageos.db.client.model.NetworkSystem in project coprhd-controller by CoprHD.
the class NetworkSystemService method getFabrics.
/**
* Returns a list of the VSAN or fabric names configured on this network system.
* 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.
* @prereq none
* @brief List network system VSANs and fabrics
* @return A list of fabric names configured on the Network System.
* @throws InternalException
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/san-fabrics")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
public Fabrics getFabrics(@PathParam("id") URI id) throws InternalException {
Fabrics fabrics = new Fabrics();
ArgValidator.checkFieldUriType(id, NetworkSystem.class, "id");
NetworkSystem device = queryResource(id);
NetworkController controller = getNetworkController(device.getSystemType());
List<String> fabricIds = controller.getFabricIds(device.getId());
fabrics.setFabricIds(fabricIds);
return fabrics;
}
use of com.emc.storageos.db.client.model.NetworkSystem in project coprhd-controller by CoprHD.
the class NetworkSystemService method getAliases.
/**
* Returns a list of aliases for the specified network system. For Brocade, aliases
* can be retrieved per fabric only and fabric-id is a required parameter. For MDS,
* the full list of device aliases for the network system is returned and fabric-id is
* ignored if provided.
*
* 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 fabric as returned by
* /vdc/network-systems/{id}/san-fabrics or the WWN of the fabric
* @prereq none
* @brief List aliases in a network system or a fabric
* @return A list of aliases.
* @throws InternalException
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/san-aliases")
@CheckPermission(roles = { Role.SYSTEM_ADMIN })
public WwnAliasesParam getAliases(@PathParam("id") URI id, @QueryParam("fabric-id") String fabricId) throws InternalException {
ArgValidator.checkFieldUriType(id, NetworkSystem.class, "id");
NetworkSystem device = queryResource(id);
if (Type.brocade.toString().equals(device.getSystemType())) {
ArgValidator.checkFieldNotEmpty(fabricId, "fabric-id");
}
String fabricWwn = null;
if (WWNUtility.isValidWWN(fabricId)) {
fabricWwn = fabricId;
fabricId = fabricId.replaceAll(":", "");
}
NetworkController controller = getNetworkController(device.getSystemType());
List<WwnAliasParam> aliases = new ArrayList<WwnAliasParam>(controller.getAliases(device.getId(), fabricId, fabricWwn));
return new WwnAliasesParam(aliases);
}
use of com.emc.storageos.db.client.model.NetworkSystem in project coprhd-controller by CoprHD.
the class NetworkSystemService method updateNetworkSystem.
/**
* Updates an already present network system by matching the URI. This can be used to
* change the IP address or port, change the credentials, or update the name of a
* network sytem. A refresh (discovery) is asynchronously initiated as a result of this call.
*
* @param id - the URN of a ViPR NetworkSystem
* @param param structure contains all the parameters that can be updated.
* @prereq none
* @brief Update network system
* @return The rest representation for the updated NetworkSystem
* @throws InternalException
*/
@PUT
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.RESTRICTED_SYSTEM_ADMIN })
public TaskResourceRep updateNetworkSystem(@PathParam("id") URI id, NetworkSystemUpdate param) throws InternalException {
ArgValidator.checkFieldUriType(id, NetworkSystem.class, "id");
NetworkSystem device = _dbClient.queryObject(NetworkSystem.class, id);
ArgValidator.checkEntityNotNull(device, id, isIdEmbeddedInURL(id));
// Check for existing device.
checkForDuplicateDevice(device.getId(), param.getIpAddress(), param.getPortNumber(), param.getSmisProviderIp(), param.getSmisPortNumber(), param.getName());
if (param.getName() != null) {
device.setLabel(param.getName());
}
if (param.getIpAddress() != null) {
device.setIpAddress(param.getIpAddress());
}
if (param.getPortNumber() != null) {
device.setPortNumber(param.getPortNumber());
}
if (param.getUserName() != null) {
device.setUsername(param.getUserName());
}
if (param.getPassword() != null) {
device.setPassword(param.getPassword());
}
if (param.getSmisProviderIp() != null) {
device.setSmisProviderIP(param.getSmisProviderIp());
}
if (param.getSmisPortNumber() != null) {
device.setSmisPortNumber(param.getSmisPortNumber());
}
if (param.getSmisUserName() != null) {
device.setSmisUserName(param.getSmisUserName());
}
if (param.getSmisPassword() != null) {
device.setSmisPassword(param.getSmisPassword());
}
if (param.getSmisUseSsl() != null) {
device.setSmisUseSSL(param.getSmisUseSsl());
}
device.setNativeGuid(NativeGUIDGenerator.generateNativeGuid(device));
_dbClient.updateObject(device);
startNetworkSystem(device);
auditOp(OperationTypeEnum.UPDATE_NETWORK_SYSTEM, true, null, device.getId().toString(), device.getLabel(), device.getPortNumber(), device.getUsername(), device.getSmisProviderIP(), device.getSmisPortNumber(), device.getSmisUserName(), device.getSmisUseSSL(), device.getVersion(), device.getUptime());
return doDiscoverNetworkSystem(device);
}
use of com.emc.storageos.db.client.model.NetworkSystem in project coprhd-controller by CoprHD.
the class NetworkSystemService method removeSanZones.
/**
* Deletes one or more zone(s) from the active zoneset of the VSAN or fabric specified in
* the network system. This is an asynchronous call.
*
* @param sanZones A list of Zones and their zone members that should be deleted from
* the active zoneset. Note: the zone members must be included (deletion of a zone is based
* on matching both the name and the zone 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 none
* @brief Delete zones from network system 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-fabrics/{fabricId}/san-zones/remove")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.RESTRICTED_SYSTEM_ADMIN })
public TaskResourceRep removeSanZones(SanZonesDeleteParam sanZones, @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);
Operation op = _dbClient.createTaskOpStatus(NetworkSystem.class, device.getId(), task, ResourceOperationTypeEnum.REMOVE_SAN_ZONE);
List<Zone> zones = new ArrayList<Zone>();
for (SanZone sz : sanZones.getZones()) {
Zone zone = new Zone(sz.getName());
zones.add(zone);
for (String szm : sz.getMembers()) {
ZoneMember member = createZoneMember(szm);
zone.getMembers().add(member);
}
auditOp(OperationTypeEnum.REMOVE_SAN_ZONE, true, AuditLogManager.AUDITOP_BEGIN, zone.getName(), device.getId().toString(), device.getLabel(), device.getPortNumber(), device.getUsername(), device.getSmisProviderIP(), device.getSmisPortNumber(), device.getSmisUserName(), device.getSmisUseSSL(), device.getVersion(), device.getUptime());
}
ArgValidator.checkFieldNotEmpty(zones, "zones");
NetworkController controller = getNetworkController(device.getSystemType());
controller.removeSanZones(device.getId(), fabricId, fabricWwn, zones, false, task);
return toTask(device, task, op);
}
use of com.emc.storageos.db.client.model.NetworkSystem in project coprhd-controller by CoprHD.
the class NetworkSystemService method queryResource.
@Override
protected NetworkSystem queryResource(URI id) {
ArgValidator.checkUri(id);
NetworkSystem device = _dbClient.queryObject(NetworkSystem.class, id);
ArgValidator.checkEntityNotNull(device, id, isIdEmbeddedInURL(id));
return device;
}
Aggregations