class NetworkAdapterObjectMapper {

    protected List<Subnet> buildOpenstackSubnetList(L3Network l3Network) {

        List<org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet> subnets = l3Network.getSubnets();
        List<org.onap.so.openstack.beans.Subnet> subnetList = new ArrayList<>();
        // create mapper from onap Subnet to openstack bean Subnet
        if (modelMapper.getTypeMap(org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet.class,
                org.onap.so.openstack.beans.Subnet.class) == null) {
            PropertyMap<org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet, org.onap.so.openstack.beans.Subnet> personMap =
                    new PropertyMap<org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet, org.onap.so.openstack.beans.Subnet>() {
                        @Override
                        protected void configure() {
                            map().setSubnetName(source.getSubnetName());
                            map(source.getSubnetId(), destination.getSubnetId());
                            map(source.getNeutronSubnetId(), destination.getNeutronId());
                            map(source.getGatewayAddress(), destination.getGatewayIp());
                            map(source.getIpVersion(), destination.getIpVersion());
                            map(source.isDhcpEnabled(), destination.getEnableDHCP());
                            map(source.getSubnetSequence(), destination.getSubnetSequence());
                        }
                    };
            modelMapper.addMappings(personMap);
        }

        for (org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet subnet : subnets) {
            org.onap.so.openstack.beans.Subnet openstackSubnet =
                    modelMapper.map(subnet, org.onap.so.openstack.beans.Subnet.class);
            if (StringUtils.isEmpty(openstackSubnet.getGatewayIp())) {
                openstackSubnet.setGatewayIp("NULL");
            }
            // update cidr value
            if (subnet.getNetworkStartAddress() != null && subnet.getCidrMask() != null)
                openstackSubnet
                        .setCidr(subnet.getNetworkStartAddress().concat(FORWARD_SLASH).concat(subnet.getCidrMask()));
            List<org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute> hostRouteList = subnet.getHostRoutes();
            List<org.onap.so.openstack.beans.HostRoute> openstackHostRouteList = new ArrayList<>();
            org.onap.so.openstack.beans.HostRoute openstackHostRoute;
            // TODO only 2 fields available on openstack object. Confirm it is sufficient or add as needed
            for (org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute hostRoute : hostRouteList) {
                openstackHostRoute = new org.onap.so.openstack.beans.HostRoute();
                openstackHostRoute.setNextHop(hostRoute.getNextHop());
                openstackHostRoute.setPrefix(hostRoute.getRoutePrefix());
                // add host route to the list
                openstackHostRouteList.add(openstackHostRoute);
            }
            if (subnet.getDhcpStart() != null && !subnet.getDhcpStart().equals("")) {
                org.onap.so.openstack.beans.Pool openstackAllocationPool = new org.onap.so.openstack.beans.Pool();
                openstackAllocationPool.setStart(subnet.getDhcpStart());
                openstackAllocationPool.setEnd(subnet.getDhcpEnd());
                List<org.onap.so.openstack.beans.Pool> allocationPools = new ArrayList<>();
                allocationPools.add(openstackAllocationPool);
                openstackSubnet.setAllocationPools(allocationPools);
            }
            openstackSubnet.setHostRoutes(openstackHostRouteList);
            // add subnet to the list
            subnetList.add(openstackSubnet);
        }
        return subnetList;
    }

}