@Override
    public boolean subscribe(String mode) {
        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");

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

        if (mode != null) {
            if (!DISABLE.equals(mode)) {
                log.error("Invalid mode: {}", mode);
                return false;
            }
        }

        try {
            if (mode != null) {
                controller.getDevicesMap().get(ncDeviceId).getSession().
                        endSubscription();
            } else {
                StringBuilder request = new StringBuilder();
                request.append(ANGLE_LEFT + NOTIFY_ALERT + SPACE);
                request.append(VOLT_NE_NAMESPACE + SLASH + ANGLE_RIGHT);

                controller.getDevicesMap().get(ncDeviceId).getSession().
                        startSubscription(request.toString());
            }
        } catch (NetconfException e) {
            log.error("Cannot communicate to device {} exception {}", ncDeviceId, e);
            return false;
        }
        return true;
    }
@Test
    public void testSubscribe() throws Exception {
        assertTrue("Incorrect response", voltConfig.subscribe(null));
        assertFalse("Incorrect response", voltConfig.subscribe("false"));
        assertTrue("Incorrect response", voltConfig.subscribe("disable"));
    }