Search in sources :

Example 11 with Network

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;
}
Also used : Network(org.ovirt.engine.api.model.Network) Nic(org.ovirt.engine.api.model.Nic) Mac(org.ovirt.engine.api.model.Mac)

Example 12 with Network

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;
}
Also used : Network(org.ovirt.engine.api.model.Network) NetworkAttachment(org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)

Example 13 with Network

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;
}
Also used : Network(org.ovirt.engine.api.model.Network) NetworkAttachment(org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)

Example 14 with Network

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);
}
Also used : Response(javax.ws.rs.core.Response) Network(org.ovirt.engine.api.model.Network) Test(org.junit.Test)

Example 15 with Network

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);
    }
}
Also used : WebApplicationException(javax.ws.rs.WebApplicationException) Network(org.ovirt.engine.api.model.Network)

Aggregations

Network (org.ovirt.engine.api.model.Network)45 Test (org.junit.Test)16 WebApplicationException (javax.ws.rs.WebApplicationException)9 Response (javax.ws.rs.core.Response)6 DataCenter (org.ovirt.engine.api.model.DataCenter)6 VnicProfile (org.ovirt.engine.api.model.VnicProfile)5 V3Network (org.ovirt.engine.api.v3.types.V3Network)4 Guid (org.ovirt.engine.core.compat.Guid)4 Networks (org.ovirt.engine.api.model.Networks)3 V3Networks (org.ovirt.engine.api.v3.types.V3Networks)3 V3PortMirroring (org.ovirt.engine.api.v3.types.V3PortMirroring)3 NetworkAttachment (org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)3 HostNic (org.ovirt.engine.api.model.HostNic)2 NetworkLabels (org.ovirt.engine.api.model.NetworkLabels)2 Nic (org.ovirt.engine.api.model.Nic)2 ClusterNetworksResource (org.ovirt.engine.api.resource.ClusterNetworksResource)2 NetworkResource (org.ovirt.engine.api.resource.NetworkResource)2 NetworksResource (org.ovirt.engine.api.resource.NetworksResource)2 SystemResource (org.ovirt.engine.api.resource.SystemResource)2 VnicProfileResource (org.ovirt.engine.api.resource.VnicProfileResource)2