use of org.onap.so.adapters.network.beans.ContrailSubnetHostRoute in project so by onap.
the class ContrailSubnetHostRouteMapper method map.
public ContrailSubnetHostRoute map() {
final ContrailSubnetHostRoute contrailSubnetHostRoute = new ContrailSubnetHostRoute();
if (hostRoute != null) {
contrailSubnetHostRoute.setNextHop(hostRoute.getNextHop());
contrailSubnetHostRoute.setPrefix(hostRoute.getPrefix());
}
return contrailSubnetHostRoute;
}
use of org.onap.so.adapters.network.beans.ContrailSubnetHostRoute in project so by onap.
the class ContrailSubnetMappersTest method contrailSubnetHostRouteMapperTest.
@Test
public void contrailSubnetHostRouteMapperTest() {
HostRoute hostRoute = new HostRoute();
hostRoute.setNextHop("hop");
hostRoute.setPrefix("prefix");
ContrailSubnetHostRouteMapper mapper = new ContrailSubnetHostRouteMapper(hostRoute);
ContrailSubnetHostRoute cshr = mapper.map();
assertEquals("hop", cshr.getNextHop());
assertEquals("prefix", cshr.getPrefix());
}
use of org.onap.so.adapters.network.beans.ContrailSubnetHostRoute in project so by onap.
the class ContrailSubnetMapper method createContrailSubnetHostRoutes.
protected Optional<ContrailSubnetHostRoutes> createContrailSubnetHostRoutes(final Subnet subnet) {
Optional<ContrailSubnetHostRoutes> result = Optional.empty();
if (subnet.getHostRoutes() != null) {
ContrailSubnetHostRoutes hostRoutesObj = new ContrailSubnetHostRoutes();
List<ContrailSubnetHostRoute> hrList = new ArrayList<>();
for (HostRoute hr : subnet.getHostRoutes()) {
if (!isNullOrEmpty(hr.getPrefix()) || !isNullOrEmpty(hr.getNextHop())) {
hrList.add(new ContrailSubnetHostRouteMapper(hr).map());
}
}
if (!hrList.isEmpty()) {
hostRoutesObj.setHostRoutes(hrList);
result = Optional.of(hostRoutesObj);
}
}
return result;
}
Aggregations