Search in sources :

Example 1 with VmGuestAgentInterface

use of org.ovirt.engine.core.common.businessentities.VmGuestAgentInterface in project ovirt-engine by oVirt.

the class VmInterfaceListModel method initSelectionGuestAgentData.

private void initSelectionGuestAgentData(VmNetworkInterface selectedItem) {
    if (selectedItem == null || getGuestAgentData() == null) {
        setSelectionGuestAgentData(null);
        return;
    }
    List<VmGuestAgentInterface> selectionInterfaces = new ArrayList<>();
    for (VmGuestAgentInterface guestInterface : getGuestAgentData()) {
        if (Objects.equals(guestInterface.getMacAddress(), selectedItem.getMacAddress())) {
            selectionInterfaces.add(guestInterface);
        }
    }
    setSelectionGuestAgentData(selectionInterfaces);
}
Also used : VmGuestAgentInterface(org.ovirt.engine.core.common.businessentities.VmGuestAgentInterface) ArrayList(java.util.ArrayList)

Example 2 with VmGuestAgentInterface

use of org.ovirt.engine.core.common.businessentities.VmGuestAgentInterface in project ovirt-engine by oVirt.

the class VdsBrokerObjectsBuilder method buildVmGuestAgentInterfacesData.

/**
 * Creates a list of {@link VmGuestAgentInterface} from the {@link VdsProperties.GuestNetworkInterfaces}
 *
 * @param vmId
 *            the Vm's ID which contains the interfaces
 *
 * @param struct
 *            the structure that describes the VM as reported by VDSM
 * @return a list of {@link VmGuestAgentInterface} or null if no guest vNics were reported
 */
public static List<VmGuestAgentInterface> buildVmGuestAgentInterfacesData(Guid vmId, Map<String, Object> struct) {
    if (!struct.containsKey(VdsProperties.VM_NETWORK_INTERFACES)) {
        return null;
    }
    List<VmGuestAgentInterface> interfaces = new ArrayList<>();
    for (Object ifaceStruct : (Object[]) struct.get(VdsProperties.VM_NETWORK_INTERFACES)) {
        VmGuestAgentInterface nic = new VmGuestAgentInterface();
        Map ifaceMap = (Map) ifaceStruct;
        nic.setInterfaceName(assignStringValue(ifaceMap, VdsProperties.VM_INTERFACE_NAME));
        nic.setMacAddress(getMacAddress(ifaceMap));
        nic.setIpv4Addresses(extractList(ifaceMap, VdsProperties.VM_IPV4_ADDRESSES, true));
        nic.setIpv6Addresses(extractList(ifaceMap, VdsProperties.VM_IPV6_ADDRESSES, true));
        nic.setVmId(vmId);
        interfaces.add(nic);
    }
    return interfaces;
}
Also used : VmGuestAgentInterface(org.ovirt.engine.core.common.businessentities.VmGuestAgentInterface) ArrayList(java.util.ArrayList) Map(java.util.Map) HashMap(java.util.HashMap)

Example 3 with VmGuestAgentInterface

use of org.ovirt.engine.core.common.businessentities.VmGuestAgentInterface in project ovirt-engine by oVirt.

the class BackendNicHelper method getDevices.

private static List<ReportedDevice> getDevices(BackendResource resource, Guid vmId, String mac) {
    List<ReportedDevice> devices = new ArrayList<>();
    for (VmGuestAgentInterface iface : getDevicesCollection(resource, vmId)) {
        if (StringUtils.equals(iface.getMacAddress(), mac)) {
            ReportedDevice device = LinkHelper.addLinks(ReportedDeviceMapper.map(iface, new ReportedDevice()));
            devices.add(device);
        }
    }
    return devices;
}
Also used : ReportedDevice(org.ovirt.engine.api.model.ReportedDevice) VmGuestAgentInterface(org.ovirt.engine.core.common.businessentities.VmGuestAgentInterface) ArrayList(java.util.ArrayList)

Example 4 with VmGuestAgentInterface

use of org.ovirt.engine.core.common.businessentities.VmGuestAgentInterface in project ovirt-engine by oVirt.

the class BackendVmNicResourceTest method getListOfVmGuestAgentInterfaces.

@SuppressWarnings("serial")
private Object getListOfVmGuestAgentInterfaces() {
    VmGuestAgentInterface iface = new VmGuestAgentInterface();
    iface.setMacAddress(ADDRESS);
    List<VmGuestAgentInterface> list = new ArrayList<>();
    list.add(iface);
    return list;
}
Also used : VmGuestAgentInterface(org.ovirt.engine.core.common.businessentities.VmGuestAgentInterface) ArrayList(java.util.ArrayList)

Example 5 with VmGuestAgentInterface

use of org.ovirt.engine.core.common.businessentities.VmGuestAgentInterface in project ovirt-engine by oVirt.

the class BackendVmNicsResourceTest method getListOfVmGuestAgentInterfaces.

@SuppressWarnings("serial")
private Object getListOfVmGuestAgentInterfaces() {
    VmGuestAgentInterface iface = new VmGuestAgentInterface();
    iface.setMacAddress(ADDRESSES[2]);
    List<VmGuestAgentInterface> list = new ArrayList<>();
    list.add(iface);
    return list;
}
Also used : VmGuestAgentInterface(org.ovirt.engine.core.common.businessentities.VmGuestAgentInterface) ArrayList(java.util.ArrayList)

Aggregations

VmGuestAgentInterface (org.ovirt.engine.core.common.businessentities.VmGuestAgentInterface)12 ArrayList (java.util.ArrayList)7 DListElement (com.google.gwt.dom.client.DListElement)2 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 StringJoiner (java.util.StringJoiner)1 Column (org.gwtbootstrap3.client.ui.Column)1 Row (org.gwtbootstrap3.client.ui.Row)1 Span (org.gwtbootstrap3.client.ui.html.Span)1 Test (org.junit.Test)1 Ip (org.ovirt.engine.api.model.Ip)1 IpVersion (org.ovirt.engine.api.model.IpVersion)1 ReportedDevice (org.ovirt.engine.api.model.ReportedDevice)1