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());
}
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());
}
}
Aggregations