Search in sources :

Example 6 with IpInterface

use of com.emc.storageos.db.client.model.IpInterface in project coprhd-controller by CoprHD.

the class IpInterfaceCompleter method complete.

@Override
protected void complete(DbClient dbClient, Status status, ServiceCoded coded) throws DeviceControllerException {
    super.complete(dbClient, status, coded);
    switch(status) {
        case error:
            dbClient.error(IpInterface.class, this.getId(), getOpId(), coded);
            break;
        default:
            dbClient.ready(IpInterface.class, this.getId(), getOpId());
    }
    if (deactivateOnComplete && status.equals(Status.ready)) {
        IpInterface ipinterface = dbClient.queryObject(IpInterface.class, this.getId());
        dbClient.markForDeletion(ipinterface);
        _logger.info("IpInterface marked for deletion: " + this.getId());
    }
}
Also used : IpInterface(com.emc.storageos.db.client.model.IpInterface)

Example 7 with IpInterface

use of com.emc.storageos.db.client.model.IpInterface in project coprhd-controller by CoprHD.

the class AixHostDiscoveryAdapter method discoverIpInterfaces.

@Override
protected void discoverIpInterfaces(Host host, List<IpInterface> oldIpInterfaces) {
    AixSystem aix = getCli(host);
    for (IPInterface nic : aix.listIPInterfaces()) {
        if (StringUtils.isNotBlank(nic.getIpAddress())) {
            IpInterface ipInterface = getOrCreateIpInterface(oldIpInterfaces, nic.getIpAddress());
            discoverIp4Interface(host, ipInterface, nic);
        }
    }
}
Also used : IpInterface(com.emc.storageos.db.client.model.IpInterface) IPInterface(com.iwave.ext.linux.model.IPInterface) AixSystem(com.emc.aix.AixSystem)

Example 8 with IpInterface

use of com.emc.storageos.db.client.model.IpInterface in project coprhd-controller by CoprHD.

the class EsxHostDiscoveryAdapter method discoverConnectedHostInitiators.

/**
 * Discovers connected Host's Initiators and Ipinterfaces
 *
 * @param hostSystem
 *            - {@link HostSystem} VI SDK managedObject instance
 * @param targetHost
 *            - {@link Host} being discovered.
 * @param oldInitiators
 *            - old initiator list
 * @param addedInitiators
 *            - new/added initiator list
 */
protected void discoverConnectedHostInitiators(HostSystem hostSystem, Host targetHost, List<Initiator> oldInitiators, List<Initiator> addedInitiators) {
    // discover ipInterfaces
    info(String.format("Discovering IP interfaces for %s", targetHost.forDisplay()));
    List<IpInterface> oldIpInterfaces = new ArrayList<IpInterface>();
    Iterables.addAll(oldIpInterfaces, getIpInterfaces(targetHost));
    for (HostVirtualNic nic : getNics(hostSystem)) {
        if (isIp6Interface(nic)) {
            IpInterface ipInterface = getOrCreateIpInterface(oldIpInterfaces, nic.spec.getIp().ipAddress);
            discoverIp6Interface(targetHost, ipInterface, nic);
        }
        if (isIp4Interface(nic)) {
            IpInterface ipInterface = getOrCreateIpInterface(oldIpInterfaces, nic.spec.getIp().ipAddress);
            discoverIp4Interface(targetHost, ipInterface, nic);
        }
    }
    removeDiscoveredInterfaces(oldIpInterfaces);
    info(String.format("Discovering initiators for %s", targetHost.forDisplay()));
    Iterables.addAll(oldInitiators, getInitiators(targetHost));
    for (HostHostBusAdapter hba : getHostBusAdapters(hostSystem)) {
        if (hba instanceof HostFibreChannelHba) {
            String port = SanUtils.normalizeWWN(((HostFibreChannelHba) hba).getPortWorldWideName());
            Initiator initiator;
            if (findInitiatorByPort(oldInitiators, port) == null) {
                initiator = getOrCreateInitiator(targetHost.getId(), oldInitiators, port);
                addedInitiators.add(initiator);
            } else {
                initiator = getOrCreateInitiator(targetHost.getId(), oldInitiators, port);
            }
            discoverInitiator(targetHost, initiator, (HostFibreChannelHba) hba);
        } else if (hba instanceof HostInternetScsiHba) {
            String iqn = ((HostInternetScsiHba) hba).getIScsiName();
            Initiator initiator;
            if (findInitiatorByPort(oldInitiators, iqn) == null) {
                initiator = getOrCreateInitiator(targetHost.getId(), oldInitiators, iqn);
                addedInitiators.add(initiator);
            } else {
                initiator = getOrCreateInitiator(targetHost.getId(), oldInitiators, iqn);
            }
            discoverInitiator(targetHost, initiator, (HostInternetScsiHba) hba);
        }
    }
    if (!oldInitiators.isEmpty()) {
        clearScaleIOInitiators(oldInitiators);
    }
}
Also used : HostVirtualNic(com.vmware.vim25.HostVirtualNic) IpInterface(com.emc.storageos.db.client.model.IpInterface) Initiator(com.emc.storageos.db.client.model.Initiator) HostInternetScsiHba(com.vmware.vim25.HostInternetScsiHba) ArrayList(java.util.ArrayList) HostFibreChannelHba(com.vmware.vim25.HostFibreChannelHba) HostHostBusAdapter(com.vmware.vim25.HostHostBusAdapter)

Example 9 with IpInterface

use of com.emc.storageos.db.client.model.IpInterface in project coprhd-controller by CoprHD.

the class HpuxHostDiscoveryAdapter method discoverIpInterfaces.

@Override
protected void discoverIpInterfaces(Host host, List<IpInterface> oldIpInterfaces) {
    HpuxSystem hpux = getCli(host);
    for (IPInterface nic : hpux.listIPInterfaces()) {
        if (StringUtils.isNotBlank(nic.getIpAddress())) {
            IpInterface ipInterface = getOrCreateIpInterface(oldIpInterfaces, nic.getIpAddress());
            discoverIp4Interface(host, ipInterface, nic);
        }
    }
}
Also used : IpInterface(com.emc.storageos.db.client.model.IpInterface) IPInterface(com.iwave.ext.linux.model.IPInterface) HpuxSystem(com.emc.hpux.HpuxSystem)

Example 10 with IpInterface

use of com.emc.storageos.db.client.model.IpInterface in project coprhd-controller by CoprHD.

the class LinuxHostDiscoveryAdapter method discoverIpInterfaces.

@Override
protected void discoverIpInterfaces(Host host, List<IpInterface> oldIpInterfaces) {
    LinuxSystemCLI linux = createLinuxCLI(host);
    for (IPInterface nic : linux.listIPInterfaces()) {
        if (StringUtils.isNotBlank(nic.getIpAddress())) {
            IpInterface ipInterface = getOrCreateIpInterface(oldIpInterfaces, nic.getIpAddress());
            discoverIp4Interface(host, ipInterface, nic);
        }
        if (StringUtils.isNotBlank(nic.getIP6Address())) {
            IpInterface ipInterface = getOrCreateIpInterface(oldIpInterfaces, StringUtils.substringBefore(nic.getIP6Address(), "/"));
            discoverIp6Interface(host, ipInterface, nic);
        }
    }
}
Also used : LinuxSystemCLI(com.iwave.ext.linux.LinuxSystemCLI) IpInterface(com.emc.storageos.db.client.model.IpInterface) IPInterface(com.iwave.ext.linux.model.IPInterface)

Aggregations

IpInterface (com.emc.storageos.db.client.model.IpInterface)27 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)7 URI (java.net.URI)7 Path (javax.ws.rs.Path)7 Produces (javax.ws.rs.Produces)7 MapIpInterface (com.emc.storageos.api.mapper.functions.MapIpInterface)6 Host (com.emc.storageos.db.client.model.Host)6 POST (javax.ws.rs.POST)4 Initiator (com.emc.storageos.db.client.model.Initiator)3 IPInterface (com.iwave.ext.linux.model.IPInterface)3 ArrayList (java.util.ArrayList)3 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)2 FileExport (com.emc.storageos.db.client.model.FileExport)2 Consumes (javax.ws.rs.Consumes)2 GET (javax.ws.rs.GET)2 AixSystem (com.emc.aix.AixSystem)1 HpuxSystem (com.emc.hpux.HpuxSystem)1 MapNetwork (com.emc.storageos.api.mapper.functions.MapNetwork)1 ComputeSystemController (com.emc.storageos.computesystemcontroller.ComputeSystemController)1 DbClient (com.emc.storageos.db.client.DbClient)1