Search in sources :

Example 1 with IPInterface

use of com.iwave.ext.linux.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 2 with IPInterface

use of com.iwave.ext.linux.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 3 with IPInterface

use of com.iwave.ext.linux.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)

Example 4 with IPInterface

use of com.iwave.ext.linux.model.IPInterface in project coprhd-controller by CoprHD.

the class ListIPInterfacesCommand method parseOutput.

@Override
public void parseOutput() {
    results = Lists.newArrayList();
    if (getOutput() != null && getOutput().getStdout() != null) {
        String stdout = getOutput().getStdout();
        TextParser parser = new TextParser();
        parser.setRepeatPattern(BLOCK_PATTERN);
        for (String textBlock : parser.parseTextBlocks(StringUtils.trim(stdout))) {
            IPInterface ipInfo = new IPInterface();
            String interfaceName = parser.findMatch(INTERFACE_NAME, textBlock);
            ipInfo.setInterfaceName(StringUtils.trim(interfaceName));
            String ipAddress = parser.findMatch(ADDRESS_PATTERN, textBlock);
            ipInfo.setIpAddress(StringUtils.trim(ipAddress));
            String netMask = parser.findMatch(MASK_PATTERN, textBlock);
            ipInfo.setNetMask(StringUtils.trim(netMask));
            String ip6Address = parser.findMatch(IP6_ADDRESS, textBlock);
            ipInfo.setIP6Address(StringUtils.trim(ip6Address));
            String broadcastAddress = parser.findMatch(BROADCAST_ADDRESS_PATTERN, textBlock);
            ipInfo.setBroadcastAddress(StringUtils.trim(broadcastAddress));
            if (ipInfo.getIpAddress() != null) {
                results.add(ipInfo);
            }
        }
    }
}
Also used : IPInterface(com.iwave.ext.linux.model.IPInterface) TextParser(com.iwave.ext.text.TextParser)

Example 5 with IPInterface

use of com.iwave.ext.linux.model.IPInterface in project coprhd-controller by CoprHD.

the class ListIPInterfacesCommand method parseOutput.

@Override
public void parseOutput() {
    results = Lists.newArrayList();
    if (getOutput() != null && getOutput().getStdout() != null) {
        String stdout = getOutput().getStdout();
        TextParser parser = new TextParser();
        parser.setRepeatPattern(BLOCK_PATTERN);
        for (String textBlock : parser.parseTextBlocks(StringUtils.trim(stdout))) {
            IPInterface ipInfo = new IPInterface();
            String interfaceName = parser.findMatch(INTERFACE_NAME, textBlock);
            ipInfo.setInterfaceName(StringUtils.trim(interfaceName));
            String ipAddress = parser.findMatch(ADDRESS_PATTERN, textBlock);
            ipInfo.setIpAddress(StringUtils.trim(ipAddress));
            String netMask = parser.findMatch(MASK_PATTERN, textBlock);
            ipInfo.setNetMask(StringUtils.trim(netMask));
            String ip6Address = parser.findMatch(IP6_ADDRESS, textBlock);
            ipInfo.setIP6Address(StringUtils.trim(ip6Address));
            String broadcastAddress = parser.findMatch(BROADCAST_ADDRESS_PATTERN, textBlock);
            ipInfo.setBroadcastAddress(StringUtils.trim(broadcastAddress));
            if (ipInfo.getIpAddress() != null) {
                results.add(ipInfo);
            }
        }
    }
}
Also used : IPInterface(com.iwave.ext.linux.model.IPInterface) TextParser(com.iwave.ext.text.TextParser)

Aggregations

IPInterface (com.iwave.ext.linux.model.IPInterface)7 IpInterface (com.emc.storageos.db.client.model.IpInterface)3 TextParser (com.iwave.ext.text.TextParser)3 LinuxSystemCLI (com.iwave.ext.linux.LinuxSystemCLI)2 AixSystem (com.emc.aix.AixSystem)1 HpuxSystem (com.emc.hpux.HpuxSystem)1