Search in sources :

Example 76 with IsilonApi

use of com.emc.storageos.isilon.restapi.IsilonApi in project coprhd-controller by CoprHD.

the class IsilonFileStorageDeviceTest method testDiscoverIsilonStoragePools.

/**
 * Tests Isilon storage pool discovery
 *
 * @throws Exception
 */
@Test
public void testDiscoverIsilonStoragePools() {
    try {
        IsilonApi isilonApi = _isi.getIsilonDevice(_device);
        List<? extends IsilonPool> isilonStoragePools = isilonApi.getStoragePools();
        Assert.assertTrue("Isilon Storage Pool discovery failed " + isilonStoragePools.size(), false);
    } catch (IsilonException iex) {
        System.out.println("Isilon Storage pool discovery failed: " + iex.getCause());
    }
}
Also used : IsilonApi(com.emc.storageos.isilon.restapi.IsilonApi) IsilonException(com.emc.storageos.isilon.restapi.IsilonException) Test(org.junit.Test)

Example 77 with IsilonApi

use of com.emc.storageos.isilon.restapi.IsilonApi in project coprhd-controller by CoprHD.

the class IsilonFileStorageDeviceTest method testDiscoverIsilon.

/**
 * Tests Isilon discovery
 *
 * @throws Exception
 */
@Test
public void testDiscoverIsilon() {
    try {
        IsilonApi isilonApi = _isi.getIsilonDevice(_device);
        IsilonClusterConfig clusterConfig = isilonApi.getClusterConfig();
        Assert.assertTrue("Isilon discovery failed " + clusterConfig.getGuid(), false);
    } catch (IsilonException iex) {
        System.out.println("Isilon discovery failed: " + iex.getCause());
    }
}
Also used : IsilonClusterConfig(com.emc.storageos.isilon.restapi.IsilonClusterConfig) IsilonApi(com.emc.storageos.isilon.restapi.IsilonApi) IsilonException(com.emc.storageos.isilon.restapi.IsilonException) Test(org.junit.Test)

Example 78 with IsilonApi

use of com.emc.storageos.isilon.restapi.IsilonApi in project coprhd-controller by CoprHD.

the class IsilonFileStorageDeviceTest method testDiscoverIsilonStoragePorts.

/**
 * Tests Isilon storage port/Smart zone discovery
 *
 * @throws Exception
 */
@Test
public void testDiscoverIsilonStoragePorts() {
    try {
        IsilonApi isilonApi = _isi.getIsilonDevice(_device);
        List<IsilonStoragePort> isilonStoragePorts = isilonApi.getSmartConnectPorts();
        Assert.assertTrue("Isilon Storage Port discovery failed " + isilonStoragePorts.size(), false);
    } catch (IsilonException iex) {
        System.out.println("Isilon Storage port discovery failed: " + iex.getCause());
    }
}
Also used : IsilonApi(com.emc.storageos.isilon.restapi.IsilonApi) IsilonStoragePort(com.emc.storageos.isilon.restapi.IsilonStoragePort) IsilonException(com.emc.storageos.isilon.restapi.IsilonException) Test(org.junit.Test)

Example 79 with IsilonApi

use of com.emc.storageos.isilon.restapi.IsilonApi in project coprhd-controller by CoprHD.

the class IsilonFileStorageDeviceTest method testFileSystemDelete.

/**
 * Tests file system delete with existing smb shares and nfs exports.
 *
 * @throws Exception
 */
@Test
public void testFileSystemDelete() throws Exception {
    FileShare fs = new FileShare();
    fs.setId(URIUtil.createId(FileShare.class));
    fs.setLabel("test");
    fs.setCapacity(102400L);
    FileDeviceInputOutput args = new FileDeviceInputOutput();
    args.addStoragePool(_pool);
    args.addFSFileObject(fs);
    Assert.assertTrue("doCreateFS failed", _isi.doCreateFS(_device, args).getCommandStatus().equals(Operation.Status.ready.name()));
    // share file system with SMB
    SMBFileShare smbFileShare = new SMBFileShare("TestSMBShare", "Share created by unit test.", "allow", "change", -1);
    Assert.assertTrue("SMB share doShare() failed", _isi.doShare(_device, args, smbFileShare).getCommandStatus().equals(Operation.Status.ready.name()));
    Assert.assertTrue("SMB share doShare() failed, share not added to FS", fs.getSMBFileShares().keySet().contains(smbFileShare.getName()));
    Assert.assertTrue("SMB share doShare() failed, number of shares does not match", fs.getSMBFileShares().keySet().size() == 1);
    // add additional share
    SMBFileShare smbFileShare01 = new SMBFileShare("TestSMBShare01", "Share created by unit test.", "allow", "change", -1);
    Assert.assertTrue("SMB share doShare() failed", _isi.doShare(_device, args, smbFileShare01).getCommandStatus().equals(Operation.Status.ready.name()));
    Assert.assertTrue("SMB share doShare() failed, share not added to FS", fs.getSMBFileShares().keySet().contains(smbFileShare01.getName()));
    Assert.assertTrue("SMB share doShare() failed, number of shares does not match", fs.getSMBFileShares().keySet().size() == 2);
    // add additional share
    SMBFileShare smbFileShare02 = new SMBFileShare("TestSMBShare02", "Share created by unit test.", "allow", "change", -1);
    Assert.assertTrue("SMB share doShare() failed", _isi.doShare(_device, args, smbFileShare02).getCommandStatus().equals(Operation.Status.ready.name()));
    Assert.assertTrue("SMB share doShare() failed, share not added to FS", fs.getSMBFileShares().keySet().contains(smbFileShare02.getName()));
    Assert.assertTrue("SMB share doShare() failed, number of shares does not match", fs.getSMBFileShares().keySet().size() == 3);
    // delete one SMB share for FS
    Assert.assertTrue("SMB share doDeleteShare() failed", _isi.doDeleteShare(_device, args, smbFileShare).getCommandStatus().equals(Operation.Status.ready.name()));
    Assert.assertFalse("SMB share doDeleteShare() failed, share was not deleted from FS", fs.getSMBFileShares().keySet().contains(smbFileShare.getName()));
    Assert.assertTrue("SMB share doDeleteShare() failed, number of shares does not match", fs.getSMBFileShares().keySet().size() == 2);
    // export
    List<String> clients = new ArrayList<String>();
    clients.add(client1);
    FileExport export1 = new FileExport(clients, "port1", "sys", "root", "nobody", "nfs");
    Assert.assertTrue("doExport failed", _isi.doExport(_device, args, Arrays.asList(export1)).getCommandStatus().equals(Operation.Status.ready.name()));
    Assert.assertTrue("doExport failed, export not added to FS", fs.getFsExports().keySet().size() == 1);
    // add client
    clients.add(client2);
    FileExport export2 = new FileExport(clients, "port1", "sys", "root", "nobody", "nfs");
    Assert.assertTrue("doExport failed", _isi.doExport(_device, args, Arrays.asList(export2)).getCommandStatus().equals(Operation.Status.ready.name()));
    Assert.assertTrue("doExport failed, export not added to FS", fs.getFsExports().keySet().size() == 1);
    // create a new export
    clients = new ArrayList<String>();
    clients.add(client3);
    FileExport export3 = new FileExport(clients, "port1", "sys", "rw", "root", "nfs");
    Assert.assertTrue("doExport failed", _isi.doExport(_device, args, Arrays.asList(export3)).getCommandStatus().equals(Operation.Status.ready.name()));
    Assert.assertTrue("doExport failed, export not added to FS", fs.getFsExports().keySet().size() == 2);
    // delete
    Assert.assertTrue("doDeleteFs failed", _isi.doDeleteFS(_device, args).getCommandStatus().equals(Operation.Status.ready.name()));
    IsilonApi isilonApi = _isi.getIsilonDevice(_device);
    try {
        isilonApi.listDir(args.getFileObjMountPath(), null);
        Assert.assertTrue("File system delete failed: " + args.getFileObjMountPath(), false);
    } catch (IsilonException iex) {
        System.out.println("doDeleteFS --- delete FS success: " + iex.getCause());
    }
}
Also used : ArrayList(java.util.ArrayList) FileDeviceInputOutput(com.emc.storageos.volumecontroller.FileDeviceInputOutput) IsilonApi(com.emc.storageos.isilon.restapi.IsilonApi) IsilonException(com.emc.storageos.isilon.restapi.IsilonException) Test(org.junit.Test)

Example 80 with IsilonApi

use of com.emc.storageos.isilon.restapi.IsilonApi in project coprhd-controller by CoprHD.

the class IsilonFileStorageDeviceTest method testSnapshotDelete.

/**
 * Tests snapshot delete with existing SMB shares and NFS exports.
 *
 * @throws Exception
 */
@Test
public void testSnapshotDelete() throws Exception {
    // create FS to use
    FileShare fs = new FileShare();
    fs.setId(URIUtil.createId(FileShare.class));
    fs.setLabel("test");
    fs.setCapacity(102400L);
    FileDeviceInputOutput args = new FileDeviceInputOutput();
    args.addStoragePool(_pool);
    args.addFSFileObject(fs);
    Assert.assertTrue("doCreateFS failed", _isi.doCreateFS(_device, args).getCommandStatus().equals(Operation.Status.ready.name()));
    // create snap
    Snapshot snap = new Snapshot();
    snap.setId(URIUtil.createId(Snapshot.class));
    snap.setLabel("test_snap");
    args.addSnapshotFileObject(snap);
    Assert.assertTrue("doSnapshotFS failed", _isi.doSnapshotFS(_device, args).getCommandStatus().equals(Operation.Status.ready.name()));
    // share snap with SMB
    SMBFileShare smbFileShare = new SMBFileShare("TestSMBShare", "Share created by unit test.", "allow", "change", -1);
    Assert.assertTrue("SMB share doShare() failed", _isi.doShare(_device, args, smbFileShare).getCommandStatus().equals(Operation.Status.ready.name()));
    Assert.assertTrue("SMB share doShare() failed, share not added to snap", snap.getSMBFileShares().keySet().contains(smbFileShare.getName()));
    Assert.assertTrue("SMB share doShare() failed, number of shares does not match", snap.getSMBFileShares().keySet().size() == 1);
    // add additional share
    SMBFileShare smbFileShare01 = new SMBFileShare("TestSMBShare01", "Share created by unit test.", "allow", "change", -1);
    Assert.assertTrue("SMB share doShare() failed", _isi.doShare(_device, args, smbFileShare01).getCommandStatus().equals(Operation.Status.ready.name()));
    Assert.assertTrue("SMB share doShare() failed, share not added to snap", snap.getSMBFileShares().keySet().contains(smbFileShare01.getName()));
    Assert.assertTrue("SMB share doShare() failed, number of shares does not match", snap.getSMBFileShares().keySet().size() == 2);
    // add additional share
    SMBFileShare smbFileShare02 = new SMBFileShare("TestSMBShare02", "Share created by unit test.", "allow", "change", -1);
    Assert.assertTrue("SMB share doShare() failed", _isi.doShare(_device, args, smbFileShare02).getCommandStatus().equals(Operation.Status.ready.name()));
    Assert.assertTrue("SMB share doShare() failed, share not added to snap", snap.getSMBFileShares().keySet().contains(smbFileShare02.getName()));
    Assert.assertTrue("SMB share doShare() failed, number of shares does not match", snap.getSMBFileShares().keySet().size() == 3);
    // export snap
    List<String> clients = new ArrayList<String>();
    clients.add(client1);
    FileExport export1 = new FileExport(clients, "", "sys", "root", "nobody", "nfs");
    Assert.assertTrue("doExport failed", _isi.doExport(_device, args, Arrays.asList(export1)).getCommandStatus().equals(Operation.Status.ready.name()));
    Assert.assertTrue("doExport failed, export not added to snapshot", snap.getFsExports().keySet().size() == 1);
    // add client to the same export
    clients.add(client2);
    FileExport export2 = new FileExport(clients, "", "sys", "root", "nobody", "nfs");
    Assert.assertTrue("doExport failed", _isi.doExport(_device, args, Arrays.asList(export1)).getCommandStatus().equals(Operation.Status.ready.name()));
    Assert.assertTrue("doExport failed, export not added to snapshot", snap.getFsExports().keySet().size() == 1);
    // create a new export
    clients = new ArrayList<String>();
    clients.add(client3);
    clients.add(client4);
    FileExport export3 = new FileExport(clients, "", "sys", "rw", "nobody", "nfs");
    Assert.assertTrue("doExport failed", _isi.doExport(_device, args, Arrays.asList(export3)).getCommandStatus().equals(Operation.Status.ready.name()));
    Assert.assertTrue("doExport failed, export not added to snapshot", snap.getFsExports().keySet().size() == 2);
    // delete snap
    Assert.assertTrue("doDeleteSnapshot failed", _isi.doDeleteSnapshot(_device, args).getCommandStatus().equals(Operation.Status.ready.name()));
    IsilonApi isilonApi = _isi.getIsilonDevice(_device);
    try {
        isilonApi.listDir(args.getFileObjMountPath(), null);
        Assert.assertTrue("Snapshot delete failed: " + args.getFileObjMountPath(), false);
    } catch (IsilonException iex) {
        System.out.println("doDeleteSnapshot --- delete snapshot success: " + iex.getCause());
    }
    // delete file system
    Assert.assertTrue("doDeleteFS failed", _isi.doDeleteFS(_device, args).getCommandStatus().equals(Operation.Status.ready.name()));
    try {
        isilonApi.listDir(args.getFsMountPath(), null);
        Assert.assertTrue("FS delete failed: " + args.getFsMountPath(), false);
    } catch (IsilonException iex) {
        System.out.println("doDeleteFS --- delete FS success: " + iex.getCause());
    }
}
Also used : ArrayList(java.util.ArrayList) FileDeviceInputOutput(com.emc.storageos.volumecontroller.FileDeviceInputOutput) IsilonApi(com.emc.storageos.isilon.restapi.IsilonApi) IsilonException(com.emc.storageos.isilon.restapi.IsilonException) Test(org.junit.Test)

Aggregations

IsilonApi (com.emc.storageos.isilon.restapi.IsilonApi)81 IsilonException (com.emc.storageos.isilon.restapi.IsilonException)64 URISyntaxException (java.net.URISyntaxException)31 URI (java.net.URI)22 IsilonCollectionException (com.emc.storageos.plugins.metering.isilon.IsilonCollectionException)21 ArrayList (java.util.ArrayList)18 IsilonSyncPolicy (com.emc.storageos.isilon.restapi.IsilonSyncPolicy)14 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)13 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)12 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)12 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)12 IOException (java.io.IOException)12 JSONException (org.codehaus.jettison.json.JSONException)12 FileShare (com.emc.storageos.db.client.model.FileShare)11 BiosCommandResult (com.emc.storageos.volumecontroller.impl.BiosCommandResult)11 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)10 HashMap (java.util.HashMap)10 ControllerException (com.emc.storageos.volumecontroller.ControllerException)9 Test (org.junit.Test)8 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)7