use of org.onap.aai.domain.yang.Subnets in project so by onap.
the class VrfValidationTest method testAaiSubnetValidation.
@Test
public void testAaiSubnetValidation() throws VrfBondingServiceException {
org.onap.aai.domain.yang.L3Network aaiLocalNetwork = new org.onap.aai.domain.yang.L3Network();
aaiLocalNetwork.setNetworkId("myNetworkID");
aaiLocalNetwork.setSubnets(new Subnets());
aaiLocalNetwork.getSubnets().getSubnet().add(new Subnet());
aaiLocalNetwork.getSubnets().getSubnet().get(0).setIpVersion("4");
ExpectedException.none();
vrfValidation.aaiSubnetValidation(aaiLocalNetwork);
aaiLocalNetwork.getSubnets().getSubnet().add(new Subnet());
aaiLocalNetwork.getSubnets().getSubnet().get(1).setIpVersion("6");
ExpectedException.none();
vrfValidation.aaiSubnetValidation(aaiLocalNetwork);
aaiLocalNetwork.setSubnets(null);
exceptionRule.expect(VrfBondingServiceException.class);
exceptionRule.expectMessage("LocalNetwork: myNetworkID has no subnets");
vrfValidation.aaiSubnetValidation(aaiLocalNetwork);
}
use of org.onap.aai.domain.yang.Subnets in project so by onap.
the class HeatBridgeImpl method buildSunets.
private Subnets buildSunets(Network network) {
Subnets aaiSubnets = new Subnets();
List<String> subnetIds = network.getSubnets();
subnetIds.forEach(subnetId -> {
Subnet subnet = osClient.getSubnetById(subnetId);
org.onap.aai.domain.yang.Subnet aaiSubnet = aaiHelper.buildSubnet(subnet);
if (aaiSubnet != null) {
aaiSubnets.getSubnet().add(aaiSubnet);
}
});
return aaiSubnets;
}
Aggregations