use of com.emc.storageos.model.ports.StoragePortRestRep in project coprhd-controller by CoprHD.
the class ApiTest method updateStoragePortTZ.
/**
* Updates the storage port to set the transport zone.
*
* @param systemURI The storage system URI
* @param portURI The storage port URI
*/
private void updateStoragePortTZ(URI systemURI, RelatedResourceRep portURI) {
StoragePortRestRep portRep = rZAdmin.path(String.format("/vdc/storage-systems/%s/storage-ports/%s", systemURI, portURI.getId()).toString()).get(StoragePortRestRep.class);
StoragePortUpdate updateParam = new StoragePortUpdate();
if (portRep.getTransportType().equals(Block.FC.toString())) {
updateParam.setNetwork(_fctzone.getId());
} else if (portRep.getTransportType().equals("IP")) {
updateParam.setNetwork(_iptzone.getId());
}
ClientResponse resp = rZAdmin.path(String.format("/vdc/storage-ports/%s", portRep.getId()).toString()).put(ClientResponse.class, updateParam);
Assert.assertEquals(200, resp.getStatus());
}
use of com.emc.storageos.model.ports.StoragePortRestRep in project coprhd-controller by CoprHD.
the class SystemsMapper method map.
public static StoragePortRestRep map(StoragePort from) {
if (from == null) {
return null;
}
StoragePortRestRep to = new StoragePortRestRep();
mapDiscoveredDataObjectFields(from, to);
to.setPortName(from.getPortName());
to.setIpAddress(from.getIpAddress());
to.setTcpPortNumber(from.getTcpPortNumber());
to.setPortNetworkId(from.getPortNetworkId());
to.setPortEndPointId(from.getPortEndPointID());
to.setTransportType(from.getTransportType());
to.setNetwork(toRelatedResource(ResourceTypeEnum.NETWORK, from.getNetwork()));
to.setStorageDevice(toRelatedResource(ResourceTypeEnum.STORAGE_SYSTEM, from.getStorageDevice()));
to.setPortSpeed(from.getPortSpeed());
to.setPortType(from.getPortType());
to.setPortGroup(from.getPortGroup());
to.setAvgBandwidth(from.getAvgBandwidth());
to.setStaticLoad(from.getStaticLoad());
to.setRegistrationStatus(from.getRegistrationStatus());
to.setCompatibilityStatus(from.getCompatibilityStatus());
to.setOperationalStatus(from.getOperationalStatus());
to.setAssignedVirtualArrays(from.getAssignedVirtualArrays());
to.setConnectedVirtualArrays(from.getConnectedVirtualArrays());
to.setTaggedVirtualArrays(from.getTaggedVirtualArrays());
to.setDiscoveryStatus(from.getDiscoveryStatus());
// Port metrics.
Double percentBusy = MetricsKeys.getDoubleOrNull(MetricsKeys.avgPortPercentBusy, from.getMetrics());
if (percentBusy != null) {
to.setPortPercentBusy(percentBusy);
}
percentBusy = MetricsKeys.getDoubleOrNull(MetricsKeys.avgCpuPercentBusy, from.getMetrics());
if (percentBusy != null) {
to.setCpuPercentBusy(percentBusy);
}
to.setAllocationMetric(MetricsKeys.getDouble(MetricsKeys.portMetric, from.getMetrics()));
to.setVolumeLoad(MetricsKeys.getLong(MetricsKeys.volumeCount, from.getMetrics()));
to.setInitiatorLoad(MetricsKeys.getLong(MetricsKeys.initiatorCount, from.getMetrics()));
to.setAllocationDisqualified(MetricsKeys.getBoolean(MetricsKeys.allocationDisqualified, from.getMetrics()));
return to;
}
use of com.emc.storageos.model.ports.StoragePortRestRep in project coprhd-controller by CoprHD.
the class Networks method availableArrayEndpointsJson.
public static void availableArrayEndpointsJson(String id) {
// Get the ports NOT in the specified network matching the network type
NetworkRestRep network = NetworkUtils.getNetwork(id);
StoragePortUtils.TransportTypeFilter transportTypeFilter = new StoragePortUtils.TransportTypeFilter(network.getTransportType());
ResourceFilter<StoragePortRestRep> notInNetworkFilter = new StoragePortUtils.NetworkFilter(uri(id)).not();
listArrayEndpointsJson(network, StoragePortUtils.getStoragePorts(transportTypeFilter.and(notInNetworkFilter)));
}
use of com.emc.storageos.model.ports.StoragePortRestRep in project coprhd-controller by CoprHD.
the class Networks method listArrayEndpointsJson.
private static void listArrayEndpointsJson(NetworkRestRep network, List<StoragePortRestRep> ports) {
CachedResources<StorageSystemRestRep> storageSystems = StorageSystemUtils.createCache();
List<EndpointInfo> items = Lists.newArrayList();
for (StoragePortRestRep port : ports) {
items.add(new EndpointInfo(port, storageSystems));
}
setEndpointAttrs(network, items);
renderJSON(DataTablesSupport.createJSON(items, params));
}
use of com.emc.storageos.model.ports.StoragePortRestRep in project coprhd-controller by CoprHD.
the class Networks method getDisconnectedStorage.
public static void getDisconnectedStorage(@As(",") String[] ids) {
List<NetworkRestRep> networks = NetworkUtils.getNetworks();
Set<String> connectedstoragesystems = new HashSet<String>();
Set<String> disConnectedstoragesystems = new HashSet<String>();
for (NetworkRestRep network : networks) {
for (StoragePortRestRep port : StoragePortUtils.getStoragePortsByNetwork(network.getId())) {
connectedstoragesystems.add(port.getStorageDevice().getId().toString());
}
}
for (String id : ids) {
StorageSystemRestRep storageSystem = StorageSystemUtils.getStorageSystem(id);
if (storageSystem == null || storageSystem.getRegistrationStatus().equals("UNREGISTERED")) {
// ignore for now
continue;
}
if (!connectedstoragesystems.contains(id)) {
disConnectedstoragesystems.add(storageSystem.getName());
}
}
renderJSON(disConnectedstoragesystems);
}
Aggregations