use of org.ovirt.engine.api.model.HostNic in project ovirt-engine by oVirt.
the class BackendHostNicNetworkAttachmentsResourceTest method getModel.
@Override
protected org.ovirt.engine.api.model.NetworkAttachment getModel(int index) {
org.ovirt.engine.api.model.NetworkAttachment model = super.getModel(index);
model.setHostNic(new HostNic());
model.getHostNic().setId(HOST_NIC_ID.toString());
return model;
}
use of org.ovirt.engine.api.model.HostNic in project ovirt-engine by oVirt.
the class CompletenessAssertorTest method testCompleteListSubFields.
@Test
public void testCompleteListSubFields() throws Exception {
HostNic bond = new HostNic();
bond.setName("joe");
bond.setNetwork(new Network());
bond.getNetwork().setId("0");
bond.setBonding(new Bonding());
bond.getBonding().setSlaves(new HostNics());
HostNic slave = new HostNic();
slave.setId("0");
bond.getBonding().getSlaves().getHostNics().add(slave);
slave = new HostNic();
slave.setId("0");
bond.getBonding().getSlaves().getHostNics().add(slave);
CompletenessAssertor.validateParameters(bond, "name", "network.id|name", "bonding.slaves.id|name");
}
use of org.ovirt.engine.api.model.HostNic in project ovirt-engine by oVirt.
the class CompletenessAssertorTest method testMissingListSubFields.
@Test
public void testMissingListSubFields() throws Exception {
HostNic bond = new HostNic();
try {
CompletenessAssertor.validateParameters(bond, "name", "network.id|name", "bonding.slaves.id|name");
fail("expected WebApplicationException on incomplete model");
} catch (WebApplicationException wae) {
verifyIncompleteException(wae, "HostNic", "name, network.id|name, bonding.slaves.id|name");
}
}
use of org.ovirt.engine.api.model.HostNic in project ovirt-engine by oVirt.
the class BackendHostNicsResource method addParents.
@Override
public HostNic addParents(HostNic hostNic) {
final HostNic nic = super.addParents(hostNic);
final Host host = new Host();
host.setId(hostId);
nic.setHost(host);
if (nic.getPhysicalFunction() != null) {
nic.getPhysicalFunction().setHost(host);
}
return nic;
}
use of org.ovirt.engine.api.model.HostNic in project ovirt-engine by oVirt.
the class BackendHostNicsResource method list.
@Override
public HostNics list() {
HostNics ret = new HostNics();
List<VdsNetworkInterface> ifaces = getCollection();
Map<String, Guid> networkNameToNetworkIdMap = mapNetworkNamesToNetworkIds();
Map<Guid, NetworkAttachment> attachmentsByNetworkId = getAttachmentsByNetworkId();
for (VdsNetworkInterface iface : ifaces) {
HostNic hostNic = populate(map(iface, ifaces), iface);
setCustomProperties(attachmentsByNetworkId, networkNameToNetworkIdMap, hostNic);
String networkName = iface.getNetworkName();
if (networkNameToNetworkIdMap.containsKey(networkName)) {
Guid networkId = networkNameToNetworkIdMap.get(networkName);
hostNic.getNetwork().setId(networkId.toString());
hostNic.getNetwork().setName(null);
}
ret.getHostNics().add(addLinks(hostNic));
}
return addActions(ret);
}
Aggregations