@Override
    public String getOnuStatistics(String target) {
        DriverHandler handler = handler();
        NetconfController controller = handler.get(NetconfController.class);
        MastershipService mastershipService = handler.get(MastershipService.class);
        DeviceId ncDeviceId = handler.data().deviceId();
        checkNotNull(controller, "Netconf controller is null");
        String reply = null;
        String[] onuId = null;

        if (!mastershipService.isLocalMaster(ncDeviceId)) {
            log.warn("Not master for {} Use {} to execute command",
                     ncDeviceId,
                     mastershipService.getMasterFor(ncDeviceId));
            return null;
        }

        if (target != null) {
            onuId = checkIdString(target);
            if (onuId == null) {
                log.error("Failed to check ID: {}", target);
                return null;
            }
        }

        try {
            StringBuilder request = new StringBuilder();
            request.append(VOLT_NE_OPEN + VOLT_NE_NAMESPACE);
            request.append(ANGLE_RIGHT + NEW_LINE);
            request.append(buildStartTag(VOLT_STATISTICS));
            if (onuId != null) {
                request.append(buildStartTag(ONU_STATISTICS))
                    .append(buildStartTag(ONU_GEM_STATS))
                    .append(buildStartTag(GEM_STATS))
                    .append(buildStartTag(PONLINK_ID, false))
                    .append(onuId[FIRST_PART])
                    .append(buildEndTag(PONLINK_ID));
                if (onuId.length > ONE) {
                    request.append(buildStartTag(ONU_ID, false))
                        .append(onuId[SECOND_PART])
                        .append(buildEndTag(ONU_ID));
                }
                request.append(buildEndTag(GEM_STATS))
                    .append(buildEndTag(ONU_GEM_STATS));

                request.append(buildStartTag(ONU_ETH_STATS))
                    .append(buildStartTag(ETH_STATS))
                    .append(buildStartTag(PONLINK_ID, false))
                    .append(onuId[FIRST_PART])
                    .append(buildEndTag(PONLINK_ID));
                if (onuId.length > ONE) {
                    request.append(buildStartTag(ONU_ID, false))
                        .append(onuId[SECOND_PART])
                        .append(buildEndTag(ONU_ID));
                }
                request.append(buildEndTag(ETH_STATS))
                    .append(buildEndTag(ONU_ETH_STATS))
                    .append(buildEndTag(ONU_STATISTICS));
            } else  {
                request.append(buildEmptyTag(ONU_STATISTICS));
            }
            request.append(buildEndTag(VOLT_STATISTICS))
                .append(VOLT_NE_CLOSE);

            reply = controller
                        .getDevicesMap()
                        .get(ncDeviceId)
                        .getSession()
                        .get(request.toString(), REPORT_ALL);
        } catch (NetconfException e) {
            log.error("Cannot communicate to device {} exception {}", ncDeviceId, e);
        }
        return reply;
    }
@Test
    public void testInvalidGetOnuStatsInput() throws Exception {
        String reply;
        String target;

        for (int i = ZERO; i < INVALID_GET_STATS_TCS.length; i++) {
            target = INVALID_GET_STATS_TCS[i];
            reply = voltConfig.getOnuStatistics(target);
            assertNull("Incorrect response for INVALID_GET_STATS_TCS", reply);
        }
    }