use of org.onap.so.adapters.network.beans.ContrailSubnet in project so by onap.
the class ContrailSubnetMappersTest method createContrailSubnetHostRoutesMissingFieldTest.
@Test
public void createContrailSubnetHostRoutesMissingFieldTest() {
List<HostRoute> hostRoutes = new ArrayList<>();
HostRoute hostRoute1 = new HostRoute();
hostRoute1.setNextHop("next-hop1");
HostRoute hostRoute2 = new HostRoute();
hostRoute2.setNextHop("next-hop2");
hostRoute2.setPrefix("prefix2");
hostRoutes.add(hostRoute1);
hostRoutes.add(hostRoute2);
Subnet subnet = new Subnet();
subnet.setHostRoutes(hostRoutes);
ContrailSubnetMapper mapper = new ContrailSubnetMapper(subnet);
ContrailSubnet result = mapper.map();
ContrailSubnetHostRoutes routes = result.getHostRoutes();
assertEquals(2, routes.getHostRoutes().size());
assertEquals("next-hop1", routes.getHostRoutes().get(0).getNextHop());
assertEquals("prefix2", routes.getHostRoutes().get(1).getPrefix());
}
use of org.onap.so.adapters.network.beans.ContrailSubnet in project so by onap.
the class ContrailSubnetMappersTest method createSubnetTestValidCidr.
@Test
public void createSubnetTestValidCidr() {
Subnet subnet = new Subnet();
subnet.setCidr("test/value");
ContrailSubnetMapper mapper = new ContrailSubnetMapper(subnet);
ContrailSubnet result = mapper.map();
assertEquals("test", result.getSubnet().getIpPrefix());
assertEquals("value", result.getSubnet().getIpPrefixLen());
}
use of org.onap.so.adapters.network.beans.ContrailSubnet in project so by onap.
the class ContrailSubnetMappersTest method createSubnetTestNullCidr.
@Test
public void createSubnetTestNullCidr() {
Subnet subnet = new Subnet();
ContrailSubnetMapper mapper = new ContrailSubnetMapper(subnet);
ContrailSubnet result = mapper.map();
assertEquals(null, result.getSubnet().getIpPrefix());
assertEquals(null, result.getSubnet().getIpPrefixLen());
}
use of org.onap.so.adapters.network.beans.ContrailSubnet 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.adapters.network.beans.ContrailSubnet 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());
}
Aggregations