Search in sources :

Example 6 with IpAddressAssignment

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

the class NetworkAttachmentMapperTest method testMapFromEntityIpv6Assignment.

@Test
public void testMapFromEntityIpv6Assignment() {
    final IpV6Address entity = new IpV6Address();
    entity.setBootProtocol(Ipv6BootProtocol.AUTOCONF);
    entity.setAddress(ADDRESS);
    entity.setGateway(GATEWAY);
    entity.setPrefix(PREFIX);
    final IpAddressAssignment actual = NetworkAttachmentMapper.mapIpv6AddressAssignment(entity);
    assertEquals(BootProtocol.AUTOCONF, actual.getAssignmentMethod());
    assertEquals(ADDRESS, actual.getIp().getAddress());
    assertEquals(GATEWAY, actual.getIp().getGateway());
    assertEquals(PREFIX_STR, actual.getIp().getNetmask());
}
Also used : IpV6Address(org.ovirt.engine.core.common.businessentities.network.IpV6Address) IpAddressAssignment(org.ovirt.engine.api.model.IpAddressAssignment) Test(org.junit.Test)

Example 7 with IpAddressAssignment

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

the class NetworkAttachmentMapperTest method verify.

@Override
protected void verify(org.ovirt.engine.api.model.NetworkAttachment model, org.ovirt.engine.api.model.NetworkAttachment transform) {
    assertNotNull(transform);
    assertEquals(model.getId(), transform.getId());
    assertNotNull(transform.getNetwork());
    assertEquals(model.getNetwork().getId(), transform.getNetwork().getId());
    assertNotNull(transform.getHostNic());
    assertEquals(model.getHostNic().getId(), transform.getHostNic().getId());
    assertNotNull(transform.getProperties());
    assertEquals(CustomPropertiesParser.toMap(model.getProperties()), CustomPropertiesParser.toMap(transform.getProperties()));
    assertNotNull(transform.getIpAddressAssignments());
    List<IpAddressAssignment> transformAddresses = transform.getIpAddressAssignments().getIpAddressAssignments();
    assertNotNull(transformAddresses);
    List<IpAddressAssignment> modelAddresses = model.getIpAddressAssignments().getIpAddressAssignments();
    assertEquals(modelAddresses.size(), transformAddresses.size());
    for (int i = 0; i < modelAddresses.size(); i++) {
        assertEquals(modelAddresses.get(i).getAssignmentMethod(), transformAddresses.get(i).getAssignmentMethod());
        Ip modelAddress = modelAddresses.get(i).getIp();
        Ip transformAddress = transformAddresses.get(i).getIp();
        assertEquals(modelAddress.getAddress(), transformAddress.getAddress());
        assertEquals(modelAddress.getNetmask(), transformAddress.getNetmask());
        assertEquals(modelAddress.getGateway(), transformAddress.getGateway());
    }
}
Also used : Ip(org.ovirt.engine.api.model.Ip) IpAddressAssignment(org.ovirt.engine.api.model.IpAddressAssignment)

Aggregations

IpAddressAssignment (org.ovirt.engine.api.model.IpAddressAssignment)7 Ip (org.ovirt.engine.api.model.Ip)4 Test (org.junit.Test)2 BootProtocol (org.ovirt.engine.api.model.BootProtocol)2 IpV6Address (org.ovirt.engine.core.common.businessentities.network.IpV6Address)2 Ipv4BootProtocol (org.ovirt.engine.core.common.businessentities.network.Ipv4BootProtocol)2 Ipv6BootProtocol (org.ovirt.engine.core.common.businessentities.network.Ipv6BootProtocol)2 Random (java.util.Random)1 HostNic (org.ovirt.engine.api.model.HostNic)1 IpAddressAssignments (org.ovirt.engine.api.model.IpAddressAssignments)1 Network (org.ovirt.engine.api.model.Network)1 AnonymousHostNetworkQos (org.ovirt.engine.core.common.businessentities.network.AnonymousHostNetworkQos)1 HostNetworkQos (org.ovirt.engine.core.common.businessentities.network.HostNetworkQos)1