use of org.onap.so.openstack.beans.Subnet in project so by onap.
the class ContrailSubnetMappersTest method createContrailSubnetPoolInvalidTest.
@Test
public void createContrailSubnetPoolInvalidTest() {
List<Pool> pools = new ArrayList<>();
Pool pool1 = new Pool();
pool1.setStart("start1");
pool1.setEnd("end1");
Pool pool2 = new Pool();
pool2.setStart("start2");
pools.add(pool1);
pools.add(pool2);
Subnet subnet = new Subnet();
subnet.setAllocationPools(pools);
ContrailSubnetMapper mapper = new ContrailSubnetMapper(subnet);
ContrailSubnet result = mapper.map();
List<ContrailSubnetPool> cspools = result.getAllocationPools();
assertEquals(1, cspools.size());
assertEquals("start1", cspools.get(0).getStart());
assertEquals("end1", cspools.get(0).getEnd());
}
use of org.onap.so.openstack.beans.Subnet in project so by onap.
the class ContrailSubnetMappersTest method createContrailSubnetPoolTest.
@Test
public void createContrailSubnetPoolTest() {
List<Pool> pools = new ArrayList<>();
Pool pool1 = new Pool();
pool1.setStart("start1");
pool1.setEnd("end1");
Pool pool2 = new Pool();
pool2.setStart("start2");
pool2.setEnd("end2");
pools.add(pool1);
pools.add(pool2);
Subnet subnet = new Subnet();
subnet.setAllocationPools(pools);
ContrailSubnetMapper mapper = new ContrailSubnetMapper(subnet);
ContrailSubnet result = mapper.map();
List<ContrailSubnetPool> cspools = result.getAllocationPools();
assertEquals(2, cspools.size());
assertEquals("start2", cspools.get(1).getStart());
assertEquals("end2", cspools.get(1).getEnd());
}
use of org.onap.so.openstack.beans.Subnet in project so by onap.
the class ContrailSubnetMappersTest method mapRemainingFields.
@Test
public void mapRemainingFields() {
Subnet subnet = new Subnet();
subnet.setEnableDHCP(true);
subnet.setGatewayIp("gateway-ip");
ContrailSubnetMapper mapper = new ContrailSubnetMapper(subnet);
ContrailSubnet result = mapper.map();
assertEquals(true, result.isEnableDhcp());
assertEquals("gateway-ip", result.getDefaultGateway());
}
use of org.onap.so.openstack.beans.Subnet in project so by onap.
the class ContrailSubnetMappersTest method createContrailSubnetHostRoutesEmptyTest.
@Test
public void createContrailSubnetHostRoutesEmptyTest() {
List<HostRoute> hostRoutes = new ArrayList<>();
Subnet subnet = new Subnet();
subnet.setHostRoutes(hostRoutes);
ContrailSubnetMapper mapper = new ContrailSubnetMapper(subnet);
ContrailSubnet result = mapper.map();
ContrailSubnetHostRoutes routes = result.getHostRoutes();
assertEquals(true, routes.getHostRoutes().isEmpty());
}
use of org.onap.so.openstack.beans.Subnet in project so by onap.
the class ContrailSubnetMappersTest method getSubnetNameTest.
@Test
public void getSubnetNameTest() {
Subnet subnet = new Subnet();
subnet.setSubnetName("name");
ContrailSubnetMapper mapper = new ContrailSubnetMapper(subnet);
assertEquals("if subnetName is populated map", "name", mapper.getSubnetName(subnet));
subnet = new Subnet();
subnet.setSubnetId("id");
mapper = new ContrailSubnetMapper(subnet);
assertEquals("choose id when name is null", "id", mapper.getSubnetName(subnet));
subnet = new Subnet();
mapper = new ContrailSubnetMapper(subnet);
assertEquals("expect null", null, mapper.getSubnetName(subnet));
}
Aggregations