use of com.emc.storageos.model.varray.NetworkRestRep in project coprhd-controller by CoprHD.
the class Networks method getNetwork.
/**
* Gets a network by ID, or flashes an error and goes back to the referring page or the list page if no referrer.
*
* @param id
* the network ID.
* @return the network.
*/
@Util
public static NetworkRestRep getNetwork(String id) {
NetworkRestRep network = NetworkUtils.getNetwork(id);
if (network == null) {
flash.error(MessagesUtils.get(UNKNOWN, id));
backToReferrer();
list();
}
return network;
}
use of com.emc.storageos.model.varray.NetworkRestRep in project coprhd-controller by CoprHD.
the class Networks method availableHostEndpointsJson.
public static void availableHostEndpointsJson(String id) {
NetworkRestRep network = NetworkUtils.getNetwork(id);
CachedResources<HostRestRep> hosts = HostUtils.createCache();
List<EndpointInfo> items = Lists.newArrayList();
if (TransportProtocols.isIp(network.getTransportType())) {
// Host IP interfaces not in the network
for (IpInterfaceRestRep ipInterface : NetworkUtils.getEligibleIpInterfaces(network.getId())) {
items.add(new EndpointInfo(ipInterface, hosts));
}
}
// Host initiators not in the network
Set<String> protocols = NetworkUtils.getSupportedProtocols(network);
for (InitiatorRestRep initiator : NetworkUtils.getEligibleInitiators(network.getId(), protocols)) {
items.add(new EndpointInfo(initiator, hosts));
}
setEndpointAttrs(network, items);
renderJSON(DataTablesSupport.createJSON(items, params));
}
use of com.emc.storageos.model.varray.NetworkRestRep in project coprhd-controller by CoprHD.
the class Networks method getConnectedStorage.
public static void getConnectedStorage() {
List<NetworkRestRep> networks = NetworkUtils.getNetworks();
Set<String> connectedstoragesystems = new HashSet<String>();
for (NetworkRestRep network : networks) {
for (StoragePortRestRep port : StoragePortUtils.getStoragePortsByNetwork(network.getId())) {
connectedstoragesystems.add(port.getStorageDevice().getId().toString());
}
}
renderJSON(connectedstoragesystems);
}
use of com.emc.storageos.model.varray.NetworkRestRep in project coprhd-controller by CoprHD.
the class VirtualArrays method updateNetworks.
/**
* Updates the given networks with the virtual array assignment changes.
*
* @param ids
* the network IDs.
* @param changes
* the virtual array changes.
*/
private static void updateNetworks(List<URI> ids, VirtualArrayAssignmentChanges changes) {
if (ids.isEmpty()) {
return;
}
List<NetworkRestRep> networks = NetworkUtils.getNetworks(ids);
for (NetworkRestRep network : networks) {
NetworkUpdate update = new NetworkUpdate();
update.setVarrayChanges(changes);
NetworkUtils.update(network.getId(), update);
}
}
use of com.emc.storageos.model.varray.NetworkRestRep in project coprhd-controller by CoprHD.
the class InternalApiTest method testNetworkUsingInternalClient.
@Test
public void testNetworkUsingInternalClient() {
// first add a new endpoint
String newEndpoint = "www.networktest-" + System.currentTimeMillis() + ".com";
NetworkEndpointParam endpointParam = new NetworkEndpointParam();
endpointParam.setEndpoints(Arrays.asList(newEndpoint));
endpointParam.setOp(NetworkEndpointParam.EndpointOp.add.name());
NetworkRestRep network = _internalNetworkClient.updateNetworkEndpoints(_networkId, endpointParam);
Assert.assertNotNull("update should not return a null response", network);
Assert.assertTrue("response should contain the new endpoint " + newEndpoint, network.getEndpoints().contains(newEndpoint));
// then remove it again
endpointParam.setOp(NetworkEndpointParam.EndpointOp.remove.name());
network = _internalNetworkClient.updateNetworkEndpoints(_networkId, endpointParam);
Assert.assertNotNull("update should not return a null response", network);
Assert.assertFalse("response should not contain the new endpoint " + newEndpoint, network.getEndpoints().contains(newEndpoint));
}
Aggregations