class VrfValidation {

    protected void aaiSubnetValidation(org.onap.aai.domain.yang.L3Network aaiLocalNetwork)
            throws VrfBondingServiceException {
        if (aaiLocalNetwork.getSubnets() == null || aaiLocalNetwork.getSubnets().getSubnet() == null) {
            throw new VrfBondingServiceException("LocalNetwork: " + aaiLocalNetwork.getNetworkId() + " has no subnets");
        } else if (aaiLocalNetwork.getSubnets().getSubnet().size() == 1
                && !aaiLocalNetwork.getSubnets().getSubnet().get(0).getIpVersion().equalsIgnoreCase("4")) {
            throw new VrfBondingServiceException("LocalNetwork: " + aaiLocalNetwork.getNetworkId()
                    + " has 1 subnet but the Ip version of subnet is : "
                    + aaiLocalNetwork.getSubnets().getSubnet().get(0).getIpVersion() + " and is not 4");
        } else if (aaiLocalNetwork.getSubnets().getSubnet().size() == 2
                && !ipVersionValidation(aaiLocalNetwork.getSubnets().getSubnet().get(0).getIpVersion(),
                        aaiLocalNetwork.getSubnets().getSubnet().get(1).getIpVersion())) {
            throw new VrfBondingServiceException("LocalNetwork: " + aaiLocalNetwork.getNetworkId()
                    + " has 2 subnets but the combination of the Ip versions for the subnets did not match the ip version of one of them to be 4 and one to be 6");
        } else if (aaiLocalNetwork.getSubnets().getSubnet().isEmpty()
                || aaiLocalNetwork.getSubnets().getSubnet().size() > 2) {
            throw new VrfBondingServiceException("LocalNetwork: " + aaiLocalNetwork.getNetworkId()
                    + " either has no subnets or more than 2 subnets");
        }
    }

}