SOLA
Loading...
Searching...
No Matches
scenario_steps.h
1// Copyright 2023 The SOLA authors
2//
3// This file is part of DAISI.
4//
5// DAISI is free software: you can redistribute it and/or modify it under the terms of the GNU
6// General Public License as published by the Free Software Foundation; version 2.
7//
8// DAISI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
9// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
10// Public License for more details.
11//
12// You should have received a copy of the GNU General Public License along with DAISI. If not, see
13// <https://www.gnu.org/licenses/>.
14//
15// SPDX-License-Identifier: GPL-2.0-only
16
17#ifndef DAISI_MINHTON_NS3_MINHTON_SCENARIO_STEPS_H_
18#define DAISI_MINHTON_NS3_MINHTON_SCENARIO_STEPS_H_
19
20#include <cstdint>
21#include <optional>
22#include <string>
23
24#include "manager/scenariofile_component.h"
25#include "ns3/core-module.h"
26
27namespace daisi::minhton_ns3 {
28
29struct JoinOne {
30 static std::string typeName() { return "join-one"; }
31
32 std::optional<ns3::Time> delay;
33 std::optional<uint32_t> level;
34 std::optional<uint32_t> number;
35 std::optional<uint32_t> index;
36
37 void parse(const YAML::Node &node) {
38 SERIALIZE_NS3_TIME_OPTIONAL(delay);
39 SERIALIZE_VAR(level);
40 SERIALIZE_VAR(number);
41 SERIALIZE_VAR(index);
42 }
43};
44
45struct JoinMany {
46 static std::string typeName() { return "join-many"; }
47
48 std::optional<ns3::Time> delay;
49 uint32_t number;
50 std::string mode;
51
52 void parse(const YAML::Node &node) {
53 SERIALIZE_NS3_TIME_OPTIONAL(delay);
54 SERIALIZE_VAR(number);
55 SERIALIZE_VAR(mode);
56 }
57};
58
59struct LeaveOne {
60 static std::string typeName() { return "leave-one"; }
61
62 std::optional<ns3::Time> delay;
63 std::optional<uint32_t> level;
64 std::optional<uint32_t> number;
65 std::optional<uint32_t> index;
66
67 void parse(const YAML::Node &node) {
68 SERIALIZE_NS3_TIME_OPTIONAL(delay);
69 SERIALIZE_VAR(level);
70 SERIALIZE_VAR(number);
71 SERIALIZE_VAR(index);
72 }
73};
74
75struct LeaveMany {
76 static std::string typeName() { return "leave-many"; }
77
78 std::optional<ns3::Time> delay;
79 uint32_t number;
80 std::string mode;
81
82 void parse(const YAML::Node &node) {
83 SERIALIZE_NS3_TIME_OPTIONAL(delay);
84 SERIALIZE_VAR(number);
85 SERIALIZE_VAR(mode);
86 }
87};
88
89struct SearchMany {
90 static std::string typeName() { return "search-many"; }
91
92 std::optional<ns3::Time> delay;
93 uint32_t number;
94
95 void parse(const YAML::Node &node) {
96 SERIALIZE_NS3_TIME_OPTIONAL(delay);
97 SERIALIZE_VAR(number);
98 }
99};
100
101struct SearchAll {
102 static std::string typeName() { return "search-all"; }
103
104 std::optional<ns3::Time> delay;
105
106 void parse(const YAML::Node &node) { SERIALIZE_NS3_TIME_OPTIONAL(delay); }
107};
108
109struct FailOne {
110 static std::string typeName() { return "fail-one"; }
111
112 std::optional<ns3::Time> delay;
113 std::optional<uint32_t> level;
114 std::optional<uint32_t> number;
115 std::optional<uint32_t> index;
116
117 void parse(const YAML::Node &node) {
118 SERIALIZE_NS3_TIME_OPTIONAL(delay);
119 SERIALIZE_VAR(level);
120 SERIALIZE_VAR(number);
121 SERIALIZE_VAR(index);
122 }
123};
124
125struct FailMany {
126 static std::string typeName() { return "fail-many"; }
127
128 std::optional<ns3::Time> delay;
129 uint32_t number;
130
131 void parse(const YAML::Node &node) {
132 SERIALIZE_NS3_TIME_OPTIONAL(delay);
133 SERIALIZE_VAR(number);
134 }
135};
136
138 static std::string typeName() { return "mixed-execution"; }
139
140 std::optional<ns3::Time> delay;
141 uint32_t join_number;
142 uint32_t leave_number;
143 uint32_t search_number;
144
145 void parse(const YAML::Node &node) {
146 SERIALIZE_NS3_TIME_OPTIONAL(delay);
147 SERIALIZE_VAR(join_number);
148 SERIALIZE_VAR(leave_number);
149 SERIALIZE_VAR(search_number);
150 }
151};
152
154 static std::string typeName() { return "validate-leave"; }
155
156 std::optional<ns3::Time> delay;
157
158 void parse(const YAML::Node &node) { SERIALIZE_NS3_TIME_OPTIONAL(delay); }
159};
160
161struct FindQuery {
162 static std::string typeName() { return "find-query"; }
163
164 uint32_t level;
165 uint32_t number;
166 std::string scope;
167 std::string query;
168 uint32_t validity_threshold;
169
170 void parse(const YAML::Node &node) {
171 SERIALIZE_VAR(level);
172 SERIALIZE_VAR(number);
173 SERIALIZE_VAR(scope);
174 SERIALIZE_VAR(query);
175 SERIALIZE_VAR(validity_threshold);
176 }
177};
178
179struct Time {
180 static std::string typeName() { return "time"; }
181
182 ns3::Time time;
183
184 void parse(const YAML::Node &node) { SERIALIZE_NS3_TIME(time); }
185};
186
188 static std::string typeName() { return "static-build"; }
189
190 uint32_t number;
191
192 void parse(const YAML::Node &node) { SERIALIZE_VAR(number); }
193};
194
196 static std::string typeName() { return "request-countdown"; }
197
198 uint32_t number;
199
200 void parse(const YAML::Node &node) { SERIALIZE_VAR(number); }
201};
202
203} // namespace daisi::minhton_ns3
204
205#endif
Definition scenario_steps.h:125
Definition scenario_steps.h:109
Definition scenario_steps.h:161
Definition scenario_steps.h:45
Definition scenario_steps.h:29
Definition scenario_steps.h:75
Definition scenario_steps.h:59
Definition scenario_steps.h:137
Definition scenario_steps.h:195
Definition scenario_steps.h:101
Definition scenario_steps.h:89
Definition scenario_steps.h:187
Definition scenario_steps.h:179
Definition scenario_steps.h:153