Search in sources :

Example 1 with Mac

use of org.ovirt.engine.api.model.Mac in project ovirt-engine by oVirt.

the class BackendVmNicResourceTest method getNic.

protected Nic getNic(boolean withNetwork) {
    Nic nic = new Nic();
    nic.setMac(new Mac());
    nic.getMac().setAddress("00:1a:4a:16:85:18");
    if (withNetwork) {
        Network network = new Network();
        network.setId(GUIDS[0].toString());
    }
    Network network = new Network();
    network.setId(GUIDS[0].toString());
    return nic;
}
Also used : Network(org.ovirt.engine.api.model.Network) Nic(org.ovirt.engine.api.model.Nic) Mac(org.ovirt.engine.api.model.Mac)

Example 2 with Mac

use of org.ovirt.engine.api.model.Mac in project ovirt-engine by oVirt.

the class NicMapper method map.

@Mapping(from = VmNetworkInterface.class, to = Nic.class)
public static Nic map(VmNetworkInterface entity, Nic template) {
    Nic model = template != null ? template : new Nic();
    if (entity.getVmId() != null) {
        model.setVm(new Vm());
        model.getVm().setId(entity.getVmId().toString());
    }
    if (entity.getId() != null) {
        model.setId(entity.getId().toString());
    }
    if (entity.getName() != null) {
        model.setName(entity.getName());
    }
    if (entity.getMacAddress() != null) {
        model.setMac(new Mac());
        model.getMac().setAddress(entity.getMacAddress());
    }
    model.setLinked(entity.isLinked());
    model.setInterface(map(entity.getType()));
    model.setPlugged(entity.isPlugged());
    if (entity.getVnicProfileId() != null) {
        model.setVnicProfile(new VnicProfile());
        model.getVnicProfile().setId(entity.getVnicProfileId().toString());
    }
    return model;
}
Also used : Vm(org.ovirt.engine.api.model.Vm) VnicProfile(org.ovirt.engine.api.model.VnicProfile) Nic(org.ovirt.engine.api.model.Nic) Mac(org.ovirt.engine.api.model.Mac)

Aggregations

Mac (org.ovirt.engine.api.model.Mac)2 Nic (org.ovirt.engine.api.model.Nic)2 Network (org.ovirt.engine.api.model.Network)1 Vm (org.ovirt.engine.api.model.Vm)1 VnicProfile (org.ovirt.engine.api.model.VnicProfile)1