Search in sources :

Example 21 with ResourceKey

use of com.integrien.alive.common.adapter3.ResourceKey in project Server_Management_Plugin_vRealize by Huawei.

the class ESightAdapter method setCpu.

private List<ResourceKey> setCpu(String host, List<ResourceKey> allResourceList, ServerDeviceBean deviceBean, ServerDeviceDetailBean device) {
    List<ResourceKey> deviceChildKeys = new ArrayList<>();
    List<CPUBean> cpuBeans = device.getCPU();
    if (!cpuBeans.isEmpty()) {
        List<ResourceKey> cpuResourceKey = new ArrayList<>();
        List<String> childHealthList = new ArrayList<>();
        for (CPUBean cpu : cpuBeans) {
            ResourceKey key = cpu.convert2Resource(host + deviceBean.getDn(), getAdapterKind(), metricsByResource);
            cpuResourceKey.add(key);
            allResourceList.add(key);
            childHealthList.add(ConvertUtils.convertHealthState(cpu.getHealthState()));
        }
        // CPU Group
        ResourceKey cpuGroup = device.createGroupKey(Constant.TREE_CPU_GROUP, Constant.KIND_CPU_GROUP, cpuResourceKey, relationshipsByResource, getAdapterKind());
        deviceChildKeys.add(cpuGroup);
        // add health state here
        setHealStatus4GroupObject(cpuGroup, Constant.ATTR_HEALTHSTATE, childHealthList);
    }
    return deviceChildKeys;
}
Also used : ArrayList(java.util.ArrayList) CPUBean(com.huawei.esight.service.bean.CPUBean) ResourceKey(com.integrien.alive.common.adapter3.ResourceKey)

Example 22 with ResourceKey

use of com.integrien.alive.common.adapter3.ResourceKey in project Server_Management_Plugin_vRealize by Huawei.

the class ESightAdapter method setConfig.

private void setConfig(String host, List<ResourceKey> allResourceList, List<ResourceKey> serverDeviceKeyList, List<String> serverTypeChildHealthList, ServerDeviceBean deviceBean) {
    ServerDeviceDetailBean device = service.getServerDetail(deviceBean.getDn());
    if (device == null) {
        logger.error("Failed to get detail of device with dn = " + deviceBean.getDn());
        return;
    }
    ResourceKey deviceResourceKey = device.convert2Resource(deviceBean.getDn(), getAdapterKind(), metricsByResource);
    // dn --> device key map
    deviceResourceKeyMap.put(deviceBean.getDn(), deviceResourceKey);
    deviceHealthMap.put(deviceBean.getDn(), ConvertUtils.convertHealthState(device.getStatus()));
    serverTypeChildHealthList.add(ConvertUtils.convertHealthState(device.getStatus()));
    allResourceList.add(deviceResourceKey);
    List<ResourceKey> deviceChildKeys = new ArrayList<>();
    List<ResourceKey> childBladeDeviceKeyList = new ArrayList<>();
    // child Blades
    List<ChildBladeBean> childBladeBeans = deviceBean.getChildBlades();
    for (ChildBladeBean bean : childBladeBeans) {
        childBladeDeviceKeyList.add(deviceResourceKeyMap.get(bean.getDn()));
    }
    // 处理childBlade显示重复的问题
    if (!deviceBean.isChildBlade()) {
        serverDeviceKeyList.add(deviceResourceKey);
    }
    // board
    deviceChildKeys.addAll(setBoard(host, allResourceList, deviceBean, device));
    // CPU
    deviceChildKeys.addAll(setCpu(host, allResourceList, deviceBean, device));
    // disk
    deviceChildKeys.addAll(setDisk(host, allResourceList, deviceBean, device));
    // fan
    deviceChildKeys.addAll(setFan(host, allResourceList, deviceBean, device, childBladeBeans));
    // memory
    deviceChildKeys.addAll(setMemory(host, allResourceList, deviceBean, device));
    // PSU
    deviceChildKeys.addAll(setPsu(host, allResourceList, deviceBean, device, childBladeBeans));
    // device Group
    deviceChildKeys.addAll(setDeviceGroup(device, childBladeDeviceKeyList, childBladeBeans));
    // PCIE
    deviceChildKeys.addAll(setPcie(host, allResourceList, deviceBean, device));
    // RAID
    deviceChildKeys.addAll(setRaid(host, allResourceList, deviceBean, device));
    // network card
    deviceChildKeys.addAll(setNetworkCard(host, allResourceList, deviceBean, device));
    // Mezz
    deviceChildKeys.addAll(setMezz(host, allResourceList, deviceBean, device));
    // 设置server device和group object(如cpuGroup, diskGroup, fanGroup等)的关联关系
    relationshipsByResource.put(deviceResourceKey, deviceChildKeys);
    allResourceList.addAll(deviceChildKeys);
}
Also used : ServerDeviceDetailBean(com.huawei.esight.service.bean.ServerDeviceDetailBean) ArrayList(java.util.ArrayList) ChildBladeBean(com.huawei.esight.service.bean.ChildBladeBean) ResourceKey(com.integrien.alive.common.adapter3.ResourceKey)

Example 23 with ResourceKey

use of com.integrien.alive.common.adapter3.ResourceKey in project Server_Management_Plugin_vRealize by Huawei.

the class ESightAdapter method setDisk.

private List<ResourceKey> setDisk(String host, List<ResourceKey> allResourceList, ServerDeviceBean deviceBean, ServerDeviceDetailBean device) {
    List<ResourceKey> deviceChildKeys = new ArrayList<>();
    List<DiskBean> diskBeans = device.getDisk();
    if (!diskBeans.isEmpty()) {
        List<ResourceKey> diskResourceKey = new ArrayList<>();
        List<String> childHealthList = new ArrayList<>();
        for (DiskBean disk : diskBeans) {
            ResourceKey key = disk.convert2Resource(host + deviceBean.getDn(), getAdapterKind(), metricsByResource);
            diskResourceKey.add(key);
            allResourceList.add(key);
            childHealthList.add(ConvertUtils.convertHealthState(disk.getHealthState()));
        }
        // disk Group
        ResourceKey diskGroup = device.createGroupKey(Constant.TREE_DISK_GROUP, Constant.KIND_DISK_GROUP, diskResourceKey, relationshipsByResource, getAdapterKind());
        deviceChildKeys.add(diskGroup);
        // add health state here
        setHealStatus4GroupObject(diskGroup, Constant.ATTR_HEALTHSTATE, childHealthList);
    }
    return deviceChildKeys;
}
Also used : DiskBean(com.huawei.esight.service.bean.DiskBean) ArrayList(java.util.ArrayList) ResourceKey(com.integrien.alive.common.adapter3.ResourceKey)

Example 24 with ResourceKey

use of com.integrien.alive.common.adapter3.ResourceKey in project Server_Management_Plugin_vRealize by Huawei.

the class ESightAdapter method setFan.

private List<ResourceKey> setFan(String host, List<ResourceKey> allResourceList, ServerDeviceBean deviceBean, ServerDeviceDetailBean device, List<ChildBladeBean> childBladeBeans) {
    List<ResourceKey> deviceChildKeys = new ArrayList<>();
    List<FanBean> fanBeans = device.getFan();
    if (!fanBeans.isEmpty()) {
        List<ResourceKey> fanResourceKey = new ArrayList<>();
        List<String> childHealthList = new ArrayList<>();
        for (FanBean fan : fanBeans) {
            ResourceKey key = fan.convert2Resource(host + deviceBean.getDn(), getAdapterKind(), metricsByResource);
            fanResourceKey.add(key);
            allResourceList.add(key);
            if (childBladeBeans.isEmpty()) {
                childHealthList.add(ConvertUtils.convertHealthState(fan.getHealthState()));
            }
        }
        // fan Group
        ResourceKey fanGroup = device.createGroupKey(Constant.TREE_FAN_GROUP, Constant.KIND_FAN_GROUP, fanResourceKey, relationshipsByResource, getAdapterKind());
        deviceChildKeys.add(fanGroup);
        // add health state here
        if (!childBladeBeans.isEmpty()) {
            String groupHealth = ConvertUtils.convertHealthState(device.getFanOverHealth());
            childHealthList.add(groupHealth);
        }
        setHealStatus4GroupObject(fanGroup, Constant.ATTR_HEALTHSTATE, childHealthList);
    }
    return deviceChildKeys;
}
Also used : FanBean(com.huawei.esight.service.bean.FanBean) ArrayList(java.util.ArrayList) ResourceKey(com.integrien.alive.common.adapter3.ResourceKey)

Example 25 with ResourceKey

use of com.integrien.alive.common.adapter3.ResourceKey in project Server_Management_Plugin_vRealize by Huawei.

the class ESightAdapter method setNetworkCard.

private List<ResourceKey> setNetworkCard(String host, List<ResourceKey> allResourceList, ServerDeviceBean deviceBean, ServerDeviceDetailBean device) {
    List<ResourceKey> deviceChildKeys = new ArrayList<>();
    List<NetworkCardBean> networkcardBeans = device.getNetworkCard();
    if (!networkcardBeans.isEmpty()) {
        List<ResourceKey> netWorkCardResourceKey = new ArrayList<>();
        List<String> childHealthList = new ArrayList<>();
        for (NetworkCardBean bean : networkcardBeans) {
            ResourceKey key = bean.convert2Resource(host + deviceBean.getDn(), getAdapterKind(), metricsByResource);
            netWorkCardResourceKey.add(key);
            allResourceList.add(key);
            childHealthList.add(ConvertUtils.convertHealthState(bean.getHealthState()));
        }
        // network card Group
        ResourceKey networkCardGroup = device.createGroupKey(Constant.TREE_NETWORK_CARD_GROUP, Constant.KIND_NETWORK_CARD_GROUP, netWorkCardResourceKey, relationshipsByResource, getAdapterKind());
        deviceChildKeys.add(networkCardGroup);
        setHealStatus4GroupObject(networkCardGroup, Constant.ATTR_HEALTHSTATE, childHealthList);
    }
    return deviceChildKeys;
}
Also used : NetworkCardBean(com.huawei.esight.service.bean.NetworkCardBean) ArrayList(java.util.ArrayList) ResourceKey(com.integrien.alive.common.adapter3.ResourceKey)

Aggregations

ResourceKey (com.integrien.alive.common.adapter3.ResourceKey)27 ArrayList (java.util.ArrayList)26 MetricData (com.integrien.alive.common.adapter3.MetricData)14 MetricKey (com.integrien.alive.common.adapter3.MetricKey)14 ResourceIdentifierConfig (com.integrien.alive.common.adapter3.config.ResourceIdentifierConfig)13 ChildBladeBean (com.huawei.esight.service.bean.ChildBladeBean)2 DiscoveryResult (com.integrien.alive.common.adapter3.DiscoveryResult)2 Relationships (com.integrien.alive.common.adapter3.Relationships)2 ResourceConfig (com.integrien.alive.common.adapter3.config.ResourceConfig)2 EsightException (com.huawei.esight.exception.EsightException)1 BoardBean (com.huawei.esight.service.bean.BoardBean)1 CPUBean (com.huawei.esight.service.bean.CPUBean)1 DiskBean (com.huawei.esight.service.bean.DiskBean)1 FanBean (com.huawei.esight.service.bean.FanBean)1 MemoryBean (com.huawei.esight.service.bean.MemoryBean)1 MezzBean (com.huawei.esight.service.bean.MezzBean)1 NetworkCardBean (com.huawei.esight.service.bean.NetworkCardBean)1 PCIEBean (com.huawei.esight.service.bean.PCIEBean)1 PSUBean (com.huawei.esight.service.bean.PSUBean)1 RAIDBean (com.huawei.esight.service.bean.RAIDBean)1