blob: dec0f07ac76b80619b5d826b0fd7c48b60d2b39e [file] [log] [blame]
Tomáš Peckaa18702d2021-01-25 18:07:23 +01001/*
Jan Kundrát7aa894e2022-03-30 19:32:40 +02002 * Copyright (C) 2016-2022 CESNET, https://photonics.cesnet.cz/
Tomáš Peckaa18702d2021-01-25 18:07:23 +01003 *
4 * Written by Jan Kundrát <jan.kundrat@cesnet.cz>
5 *
6*/
7
8#pragma once
9
Jan Kundrát7aa894e2022-03-30 19:32:40 +020010#include <sysrepo-cpp/Subscription.hpp>
11#include "trompeloeil_doctest.h"
Tomáš Peckaa18702d2021-01-25 18:07:23 +010012#include "test_log_setup.h"
Tomáš Peckabaafdd92024-01-24 13:53:34 +010013#include "sysrepo-helpers/common.h"
Tomáš Peckaa18702d2021-01-25 18:07:23 +010014
Jan Kundrát7aa894e2022-03-30 19:32:40 +020015/** @short Watch for a given YANG notification
Tomáš Peckaa18702d2021-01-25 18:07:23 +010016
Jan Kundrát7aa894e2022-03-30 19:32:40 +020017When a real-time notification is recieved, the `notified()` method is invoked with stringified values
18of all terminals that were passed to the original notification.
19*/
20struct NotificationWatcher {
Jan Kundrát7aa894e2022-03-30 19:32:40 +020021 NotificationWatcher(sysrepo::Session& session, const std::string& xpath);
Tomáš Peckabaafdd92024-01-24 13:53:34 +010022 MAKE_MOCK1(notified, void(const Values&));
Tomáš Peckaa18702d2021-01-25 18:07:23 +010023private:
Jan Kundrát7aa894e2022-03-30 19:32:40 +020024 sysrepo::Subscription m_sub;
Tomáš Peckaa18702d2021-01-25 18:07:23 +010025};