Search in sources :

Example 1 with StoragePortRestRep

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());
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) StoragePortRestRep(com.emc.storageos.model.ports.StoragePortRestRep) StoragePortUpdate(com.emc.storageos.model.ports.StoragePortUpdate)

Example 2 with StoragePortRestRep

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;
}
Also used : StoragePortRestRep(com.emc.storageos.model.ports.StoragePortRestRep)

Example 3 with StoragePortRestRep

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)));
}
Also used : StoragePortRestRep(com.emc.storageos.model.ports.StoragePortRestRep) StoragePortUtils(util.StoragePortUtils) NetworkRestRep(com.emc.storageos.model.varray.NetworkRestRep)

Example 4 with StoragePortRestRep

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));
}
Also used : EndpointInfo(models.datatable.NetworkEndpointDataTable.EndpointInfo) StorageSystemRestRep(com.emc.storageos.model.systems.StorageSystemRestRep) StoragePortRestRep(com.emc.storageos.model.ports.StoragePortRestRep)

Example 5 with StoragePortRestRep

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);
}
Also used : StorageSystemRestRep(com.emc.storageos.model.systems.StorageSystemRestRep) StoragePortRestRep(com.emc.storageos.model.ports.StoragePortRestRep) NetworkRestRep(com.emc.storageos.model.varray.NetworkRestRep) HashSet(java.util.HashSet)

Aggregations

StoragePortRestRep (com.emc.storageos.model.ports.StoragePortRestRep)22 URI (java.net.URI)8 StorageSystemRestRep (com.emc.storageos.model.systems.StorageSystemRestRep)7 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)5 NetworkRestRep (com.emc.storageos.model.varray.NetworkRestRep)4 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)4 StoragePortInfo (models.datatable.StoragePortDataTable.StoragePortInfo)3 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)2 InitiatorRestRep (com.emc.storageos.model.host.InitiatorRestRep)2 StoragePortGroupRestRepList (com.emc.storageos.model.portgroup.StoragePortGroupRestRepList)2 StoragePortList (com.emc.storageos.model.ports.StoragePortList)2 StoragePortUpdate (com.emc.storageos.model.ports.StoragePortUpdate)2 AssetOption (com.emc.vipr.model.catalog.AssetOption)2 FlashException (controllers.util.FlashException)2 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 EndpointInfo (models.datatable.NetworkEndpointDataTable.EndpointInfo)2 Asset (com.emc.sa.asset.annotation.Asset)1 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)1 SnapshotList (com.emc.storageos.model.SnapshotList)1