use of org.ovirt.engine.api.model.Network 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;
}
use of org.ovirt.engine.api.model.Network in project ovirt-engine by oVirt.
the class AbstractBackendNetworkAttachmentResourceTest method getModel.
protected org.ovirt.engine.api.model.NetworkAttachment getModel(int index) {
org.ovirt.engine.api.model.NetworkAttachment model = new org.ovirt.engine.api.model.NetworkAttachment();
model.setId(GUIDS[index].toString());
model.setNetwork(new Network());
model.getNetwork().setId(GUIDS[index].toString());
return model;
}
use of org.ovirt.engine.api.model.Network in project ovirt-engine by oVirt.
the class AbstractBackendNetworkAttachmentsResourceTest method getModel.
protected org.ovirt.engine.api.model.NetworkAttachment getModel(int index) {
org.ovirt.engine.api.model.NetworkAttachment model = new org.ovirt.engine.api.model.NetworkAttachment();
model.setId(GUIDS[index].toString());
model.setNetwork(new Network());
model.getNetwork().setId(NETWORK_ID.toString());
return model;
}
use of org.ovirt.engine.api.model.Network in project ovirt-engine by oVirt.
the class BackendClusterNetworksResourceTest method testAddNetwork.
@Test
public void testAddNetwork() throws Exception {
setUpClusterExpectations(CLUSTER_ID);
setUriInfo(setUpBasicUriExpectations());
setUpEntityQueryExpectations(1, null);
setUpGetNetworksByDataCenterExpectations(1, null);
setUpActionExpectations(ActionType.AttachNetworkToCluster, AttachNetworkToClusterParameter.class, new String[] { "ClusterId" }, new Object[] { CLUSTER_ID }, true, true);
Network model = getModel(0);
Response response = collection.add(model);
assertEquals(201, response.getStatus());
assertTrue(response.getEntity() instanceof Network);
verifyModel((Network) response.getEntity(), 0);
}
use of org.ovirt.engine.api.model.Network in project ovirt-engine by oVirt.
the class BackendClusterNetworksResourceTest method doTestBadAddNetwork.
private void doTestBadAddNetwork(boolean valid, boolean success, String detail) throws Exception {
setUpClusterExpectations(CLUSTER_ID);
setUriInfo(setUpBasicUriExpectations());
setUpGetNetworksByDataCenterExpectations(1, null);
setUpActionExpectations(ActionType.AttachNetworkToCluster, AttachNetworkToClusterParameter.class, new String[] { "ClusterId" }, new Object[] { CLUSTER_ID }, valid, success);
Network model = getModel(0);
try {
collection.add(model);
fail("expected WebApplicationException");
} catch (WebApplicationException wae) {
verifyFault(wae, detail);
}
}
Aggregations