class OspfConfigUtil {

    public static List<OspfProcess> processes(JsonNode jsonNodes) {
        List<OspfProcess> ospfProcesses = new ArrayList<>();
        if (jsonNodes == null) {
            return ospfProcesses;
        }
        //From each Process nodes, get area and related interface details.
        jsonNodes.forEach(jsonNode -> {
            List<OspfArea> areas = new ArrayList<>();
            //Get configured areas for the process.
            for (JsonNode areaNode : jsonNode.path(AREAS)) {
                List<OspfInterface> interfaceList = new ArrayList<>();
                for (JsonNode interfaceNode : areaNode.path(INTERFACE)) {
                    OspfInterface ospfInterface = interfaceDetails(interfaceNode);
                    if (ospfInterface != null) {
                        interfaceList.add(ospfInterface);
                    }
                }
                //Get the area details
                OspfArea area = areaDetails(areaNode);
                if (area != null) {
                    area.setOspfInterfaceList(interfaceList);
                    areas.add(area);
                }
            }
            OspfProcess process = new OspfProcessImpl();
            process.setProcessId(jsonNode.path(PROCESSID).asText());
            process.setAreas(areas);
            ospfProcesses.add(process);
        });

        return ospfProcesses;
    }

}

class OspfConfigUtilTest {

    private ObjectMapper mapper;
    private JsonNode jsonNode;
    private List<OspfProcess> ospfProcessList;
    private String jsonString;

    @Test
    public void testProcesses() throws Exception {

        jsonNode.path("areas");
        ospfProcessList = OspfConfigUtil.processes(jsonNode);
        assertThat(ospfProcessList, is(notNullValue()));
    }

}