Tomáš Pecka | a18702d | 2021-01-25 18:07:23 +0100 | [diff] [blame] | 1 | /* |
Jan Kundrát | 7aa894e | 2022-03-30 19:32:40 +0200 | [diff] [blame] | 2 | * Copyright (C) 2016-2022 CESNET, https://photonics.cesnet.cz/ |
Tomáš Pecka | a18702d | 2021-01-25 18:07:23 +0100 | [diff] [blame] | 3 | * |
| 4 | * Written by Jan Kundrát <jan.kundrat@cesnet.cz> |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #pragma once |
| 9 | |
Jan Kundrát | 7aa894e | 2022-03-30 19:32:40 +0200 | [diff] [blame] | 10 | #include <sysrepo-cpp/Subscription.hpp> |
| 11 | #include "trompeloeil_doctest.h" |
Tomáš Pecka | a18702d | 2021-01-25 18:07:23 +0100 | [diff] [blame] | 12 | #include "test_log_setup.h" |
Tomáš Pecka | baafdd9 | 2024-01-24 13:53:34 +0100 | [diff] [blame] | 13 | #include "sysrepo-helpers/common.h" |
Tomáš Pecka | a18702d | 2021-01-25 18:07:23 +0100 | [diff] [blame] | 14 | |
Jan Kundrát | 7aa894e | 2022-03-30 19:32:40 +0200 | [diff] [blame] | 15 | /** @short Watch for a given YANG notification |
Tomáš Pecka | a18702d | 2021-01-25 18:07:23 +0100 | [diff] [blame] | 16 | |
Jan Kundrát | 7aa894e | 2022-03-30 19:32:40 +0200 | [diff] [blame] | 17 | When a real-time notification is recieved, the `notified()` method is invoked with stringified values |
| 18 | of all terminals that were passed to the original notification. |
| 19 | */ |
| 20 | struct NotificationWatcher { |
Jan Kundrát | 7aa894e | 2022-03-30 19:32:40 +0200 | [diff] [blame] | 21 | NotificationWatcher(sysrepo::Session& session, const std::string& xpath); |
Tomáš Pecka | baafdd9 | 2024-01-24 13:53:34 +0100 | [diff] [blame] | 22 | MAKE_MOCK1(notified, void(const Values&)); |
Tomáš Pecka | a18702d | 2021-01-25 18:07:23 +0100 | [diff] [blame] | 23 | private: |
Jan Kundrát | 7aa894e | 2022-03-30 19:32:40 +0200 | [diff] [blame] | 24 | sysrepo::Subscription m_sub; |
Tomáš Pecka | a18702d | 2021-01-25 18:07:23 +0100 | [diff] [blame] | 25 | }; |