use of com.emc.storageos.db.client.model.NetworkSystem in project coprhd-controller by CoprHD.
the class NetworkDeviceController method updateAliases.
@Override
public void updateAliases(URI uri, String fabricId, String fabricWwn, List<ZoneWwnAliasUpdate> updateAliases, String taskId) throws ControllerException {
NetworkSystem device = getNetworkSystemObject(uri);
// Lock to prevent concurrent operations on the same VSAN / FABRIC.
InterProcessLock fabricLock = NetworkFabricLocker.lockFabric(fabricId, _coordinator);
try {
// Get the file device reference for the type of file device managed
// by the controller.
NetworkSystemDevice networkDevice = getDevice(device.getSystemType());
if (networkDevice == null) {
throw NetworkDeviceControllerException.exceptions.updateAliasesFailedNull(device.getSystemType());
}
BiosCommandResult result = networkDevice.updateAliases(device, updateAliases, fabricId, fabricWwn);
setStatus(NetworkSystem.class, device.getId(), taskId, result.isCommandSuccess(), result.getServiceCoded());
_auditMgr.recordAuditLog(null, null, EVENT_SERVICE_TYPE, OperationTypeEnum.UPDATE_ALIAS, System.currentTimeMillis(), AuditLogManager.AUDITLOG_SUCCESS, AuditLogManager.AUDITOP_END, device.getId().toString(), device.getLabel(), device.getPortNumber(), device.getUsername(), device.getSmisProviderIP(), device.getSmisPortNumber(), device.getSmisUserName(), device.getSmisUseSSL());
} catch (Exception ex) {
ServiceError serviceError = NetworkDeviceControllerException.errors.updateAliasesFailedExc(device.getSystemType(), ex);
_dbClient.error(NetworkSystem.class, device.getId(), taskId, serviceError);
} finally {
NetworkFabricLocker.unlockFabric(fabricId, fabricLock);
}
}
use of com.emc.storageos.db.client.model.NetworkSystem in project coprhd-controller by CoprHD.
the class NetworkDeviceController method addAliases.
@Override
public void addAliases(URI uri, String fabricId, String fabricWwn, List<ZoneWwnAlias> aliases, String taskId) throws ControllerException {
NetworkSystem device = getNetworkSystemObject(uri);
// Lock to prevent concurrent operations on the same VSAN / FABRIC.
InterProcessLock fabricLock = NetworkFabricLocker.lockFabric(fabricId, _coordinator);
try {
// Get the file device reference for the type of file device managed
// by the controller.
NetworkSystemDevice networkDevice = getDevice(device.getSystemType());
if (networkDevice == null) {
throw NetworkDeviceControllerException.exceptions.addAliasesFailedNull(device.getSystemType());
}
BiosCommandResult result = networkDevice.addAliases(device, aliases, fabricId, fabricWwn);
setStatus(NetworkSystem.class, device.getId(), taskId, result.isCommandSuccess(), result.getServiceCoded());
_auditMgr.recordAuditLog(null, null, EVENT_SERVICE_TYPE, OperationTypeEnum.ADD_ALIAS, System.currentTimeMillis(), AuditLogManager.AUDITLOG_SUCCESS, AuditLogManager.AUDITOP_END, device.getId().toString(), device.getLabel(), device.getPortNumber(), device.getUsername(), device.getSmisProviderIP(), device.getSmisPortNumber(), device.getSmisUserName(), device.getSmisUseSSL());
} catch (Exception ex) {
ServiceError serviceError = NetworkDeviceControllerException.errors.addAliasesFailedExc(device.getSystemType(), ex);
_dbClient.error(NetworkSystem.class, device.getId(), taskId, serviceError);
} finally {
NetworkFabricLocker.unlockFabric(fabricId, fabricLock);
}
}
use of com.emc.storageos.db.client.model.NetworkSystem in project coprhd-controller by CoprHD.
the class NetworkDeviceController method removeAliases.
@Override
public void removeAliases(URI uri, String fabricId, String fabricWwn, List<ZoneWwnAlias> aliases, String taskId) throws ControllerException {
NetworkSystem device = getNetworkSystemObject(uri);
// Lock to prevent concurrent operations on the same VSAN / FABRIC.
InterProcessLock fabricLock = NetworkFabricLocker.lockFabric(fabricId, _coordinator);
try {
// Get the file device reference for the type of file device managed
// by the controller.
NetworkSystemDevice networkDevice = getDevice(device.getSystemType());
if (networkDevice == null) {
throw NetworkDeviceControllerException.exceptions.removeAliasesFailedNull(device.getSystemType());
}
BiosCommandResult result = networkDevice.removeAliases(device, aliases, fabricId, fabricWwn);
setStatus(NetworkSystem.class, device.getId(), taskId, result.isCommandSuccess(), result.getServiceCoded());
_auditMgr.recordAuditLog(null, null, EVENT_SERVICE_TYPE, OperationTypeEnum.REMOVE_ALIAS, System.currentTimeMillis(), AuditLogManager.AUDITLOG_SUCCESS, AuditLogManager.AUDITOP_END, device.getId().toString(), device.getLabel(), device.getPortNumber(), device.getUsername(), device.getSmisProviderIP(), device.getSmisPortNumber(), device.getSmisUserName(), device.getSmisUseSSL());
} catch (Exception ex) {
ServiceError serviceError = NetworkDeviceControllerException.errors.removeAliasesFailedExc(device.getSystemType(), ex);
_dbClient.error(NetworkSystem.class, device.getId(), taskId, serviceError);
} finally {
NetworkFabricLocker.unlockFabric(fabricId, fabricLock);
}
}
use of com.emc.storageos.db.client.model.NetworkSystem in project coprhd-controller by CoprHD.
the class NetworkDiscoveryWorker method verifyVersion.
/**
* Verify the firmware version for the NetworkSystem
*
* @param uri - Device URI
* @throws ControllerException thrown if firmware version is not supported
*/
public void verifyVersion(URI uri) throws ControllerException {
// Retrieve the storage device info from the database.
NetworkSystem networkDev = getDeviceObject(uri);
NetworkSystemDevice networkDevice = getDevice();
if (networkDevice == null) {
throw NetworkDeviceControllerException.exceptions.verifyVersionFailedNull(uri.toString());
}
String version = null;
try {
version = networkDevice.getVersion(networkDev);
networkDev.setVersion(version);
String minimumSupportedVersion = VersionChecker.getMinimumSupportedVersion(Type.valueOf(networkDev.getSystemType()));
_log.info("Verifying version details : Minimum Supported Version {} - Discovered Firmware Version {}", minimumSupportedVersion, version);
if (VersionChecker.verifyVersionDetails(minimumSupportedVersion, version) < 0) {
networkDev.setCompatibilityStatus(DiscoveredDataObject.CompatibilityStatus.INCOMPATIBLE.name());
throw NetworkDeviceControllerException.exceptions.versionNotSupported(version, minimumSupportedVersion);
} else {
networkDev.setCompatibilityStatus(DiscoveredDataObject.CompatibilityStatus.COMPATIBLE.name());
}
} catch (Exception ex) {
Date date = new Date();
networkDev.setLastDiscoveryStatusMessage(ex.getMessage());
throw NetworkDeviceControllerException.exceptions.verifyVersionFailed(uri.toString(), date.toString(), ex);
} finally {
if (networkDev != null) {
try {
dbClient.updateObject(networkDev);
} catch (DatabaseException ex) {
_log.error("Error while persisting object to DB", ex);
}
}
}
}
use of com.emc.storageos.db.client.model.NetworkSystem in project coprhd-controller by CoprHD.
the class NetworkDiscoveryWorker method updateRoutedNetworks.
/**
* Looks in the topology view for endpoints that accessible by routing
*
* @param networkSystem the network system being refreshed
* @param updatedNetworks the networks that require updating
* @param routedEndpoints the routed endpoints map of Fabric-WWN-to-endpoints-WWN
* @throws Exception
*/
private void updateRoutedNetworks(NetworkSystem networkSystem, List<Network> updatedNetworks, Map<String, Set<String>> routedEndpoints) throws Exception {
if (!this.getDevice().isCapableOfRouting(networkSystem)) {
_log.info("NetworkSystem {} does not support routing across VSANs, skipping routed networks update/discovery", networkSystem.getLabel());
// Clear out the routedNetworks entries, if filled, for non-IVR Cisco switches. This can happen in upgrade scenarios.
URIQueryResultList networkSystemNetworkUriList = new URIQueryResultList();
dbClient.queryByConstraint(ContainmentConstraint.Factory.getNetworkSystemNetworkConstraint(networkSystem.getId()), networkSystemNetworkUriList);
for (URI networkSystemNetworkUri : networkSystemNetworkUriList) {
Network networkSystemNetwork = dbClient.queryObject(Network.class, networkSystemNetworkUri);
boolean isNetworkConnectedToRoutableSwitch = false;
for (String ns : networkSystemNetwork.getNetworkSystems()) {
NetworkSystem connectedNetworkSystem = dbClient.queryObject(NetworkSystem.class, URI.create(ns));
if (this.getDevice().isCapableOfRouting(connectedNetworkSystem)) {
isNetworkConnectedToRoutableSwitch = true;
;
}
}
// to another switch that supports routing.
if (!isNetworkConnectedToRoutableSwitch) {
_log.info("Updating routedNetwork to null for {}", networkSystemNetwork.getLabel());
networkSystemNetwork.setRoutedNetworks(null);
dbClient.updateObject(networkSystemNetwork);
}
}
// Update the connected varray assignments
_log.info("Updating connected network and varray assignments");
for (Network network : DataObjectUtils.toMap(NetworkUtil.getDiscoveredNetworks(dbClient)).values()) {
NetworkAssociationHelper.setNetworkConnectedVirtualArrays(network, false, dbClient);
}
return;
}
Map<URI, Network> allNetworks = DataObjectUtils.toMap(NetworkUtil.getDiscoveredNetworks(dbClient));
// Determine routed networks. We get here only for switches that have IVR feature enabled.
getDevice().determineRoutedNetworks(networkSystem);
for (Network network : allNetworks.values()) {
NetworkAssociationHelper.setNetworkConnectedVirtualArrays(network, false, dbClient);
}
}
Aggregations