Search in sources :

Example 1 with Network

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

the class BackendAssignedVnicProfilesResource method addParents.

@Override
public VnicProfile addParents(VnicProfile vnicProfile) {
    vnicProfile.setNetwork(new Network());
    vnicProfile.getNetwork().setId(networkId);
    return vnicProfile;
}
Also used : Network(org.ovirt.engine.api.model.Network)

Example 2 with Network

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

the class BackendIscsiBondNetworksResourceTest method testAdd.

@Test
public void testAdd() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    Network network = getModel(0);
    network.setId(NETWORK_ID.toString());
    setUpGetEntityExpectations(QueryType.GetIscsiBondById, IdQueryParameters.class, new String[] { "Id" }, new Object[] { ISCSI_BOND_ID }, getIscsiBondWithNoNetworks());
    setUpActionExpectations(ActionType.EditIscsiBond, EditIscsiBondParameters.class, new String[] { "IscsiBond" }, new Object[] { getIscsiBondContainingNetwork() }, true, true, null);
    Response response = collection.add(network);
    assertEquals(200, response.getStatus());
}
Also used : Response(javax.ws.rs.core.Response) Network(org.ovirt.engine.api.model.Network) Test(org.junit.Test)

Example 3 with Network

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

the class BackendNetworkResourceTest method testConflictedUpdate.

@Test
public void testConflictedUpdate() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    setUpEntityQueryExpectations(1);
    Network model = getModel(1);
    model.setId(GUIDS[1].toString());
    try {
        resource.update(model);
        fail("expected WebApplicationException");
    } catch (WebApplicationException wae) {
        verifyImmutabilityConstraint(wae);
    }
}
Also used : WebApplicationException(javax.ws.rs.WebApplicationException) Network(org.ovirt.engine.api.model.Network) Test(org.junit.Test)

Example 4 with Network

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

the class BackendNetworksResourceTest method testAddNetwork.

@Test
public void testAddNetwork() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    setUpCreationExpectations(ActionType.AddNetwork, AddNetworkStoragePoolParameters.class, new String[] { "StoragePoolId" }, new Object[] { DATA_CENTER_ID }, true, true, // GUIDS[0],
    null, QueryType.GetAllNetworks, IdQueryParameters.class, new String[] { "Id" }, new Object[] { Guid.Empty }, asList(getEntity(0)));
    Network model = getModel(0);
    model.setDataCenter(new DataCenter());
    model.getDataCenter().setId(DATA_CENTER_ID.toString());
    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) DataCenter(org.ovirt.engine.api.model.DataCenter) Network(org.ovirt.engine.api.model.Network) Test(org.junit.Test)

Example 5 with Network

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

the class BackendNetworksResourceTest method testAddNetworkWithNamedDataCenter.

@Test
public void testAddNetworkWithNamedDataCenter() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    setUpEntityQueryExpectations(QueryType.GetStoragePoolByDatacenterName, NameQueryParameters.class, new String[] { "Name" }, new Object[] { NAMES[1] }, setUpStoragePool(DATA_CENTER_ID));
    setUpCreationExpectations(ActionType.AddNetwork, AddNetworkStoragePoolParameters.class, new String[] { "StoragePoolId" }, new Object[] { DATA_CENTER_ID }, true, true, // GUIDS[0],
    null, QueryType.GetAllNetworks, IdQueryParameters.class, new String[] { "Id" }, new Object[] { Guid.Empty }, asList(getEntity(0)));
    Network model = getModel(0);
    model.setDataCenter(new DataCenter());
    model.getDataCenter().setName(NAMES[1]);
    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) DataCenter(org.ovirt.engine.api.model.DataCenter) Network(org.ovirt.engine.api.model.Network) Test(org.junit.Test)

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