Search in sources :

Example 1 with Subnets

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);
}
Also used : L3Network(org.onap.aai.domain.yang.L3Network) Subnets(org.onap.aai.domain.yang.Subnets) Subnet(org.onap.aai.domain.yang.Subnet) L3Network(org.onap.aai.domain.yang.L3Network) BaseTaskTest(org.onap.so.bpmn.BaseTaskTest) Test(org.junit.Test)

Example 2 with Subnets

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;
}
Also used : Subnets(org.onap.aai.domain.yang.Subnets) IPAddressString(inet.ipaddr.IPAddressString) Subnet(org.openstack4j.model.network.Subnet)

Aggregations

Subnets (org.onap.aai.domain.yang.Subnets)2 IPAddressString (inet.ipaddr.IPAddressString)1 Test (org.junit.Test)1 L3Network (org.onap.aai.domain.yang.L3Network)1 Subnet (org.onap.aai.domain.yang.Subnet)1 BaseTaskTest (org.onap.so.bpmn.BaseTaskTest)1 Subnet (org.openstack4j.model.network.Subnet)1