Skip to content

Commit aa15c5a

Browse files
Razvan Becheriutmarkwalder
authored andcommitted
[#3245] addressed review
1 parent 88bbd44 commit aa15c5a

File tree

6 files changed

+85
-85
lines changed

6 files changed

+85
-85
lines changed

src/hooks/dhcp/perfmon/alarm.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,21 @@ class Alarm : public DurationKey {
3030
///
3131
/// @param family protocol family AF_INET or AF_INET6
3232
/// @param query_type message type of the query packet
33-
/// @param response_type_ message type of the response packet
33+
/// @param response_type message type of the response packet
3434
/// @param start_event_label label of the start event
3535
/// @param end_event_label label of the end event
3636
/// @param SubnetID subnet_id id of the selected subnet
3737
/// @param low_water threshold below which the average duration must fall to clear the alarm
3838
/// @brief high_water threshold above which the average duration must rise to trigger the alarm.
3939
/// @brief enabled true sets state to CLEAR, otherwise DISABLED, defaults to true.
40-
Alarm(uint16_t family, uint8_t query_type_, uint8_t response_type_,
40+
Alarm(uint16_t family, uint8_t query_type, uint8_t response_type,
4141
const std::string& start_event_label, const std::string& end_event_label,
42-
dhcp::SubnetID subnet_id_,
42+
dhcp::SubnetID subnet_id,
4343
const Duration& low_water, const Duration& high_water, bool enabled = true);
4444

4545
/// @brief Constructor
4646
///
47-
/// param key composite key that identifies the alarm
47+
/// @param key composite key that identifies the alarm
4848
/// @param low_water threshold below which the average duration must fall to clear the alarm
4949
/// @brief high_water threshold above which the average duration must rise to trigger the alarm.
5050
/// @brief enabled true sets state to CLEAR, otherwise DISABLED, defaults to true.

src/hooks/dhcp/perfmon/monitored_duration.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ namespace perfmon {
2121
// DurationDataInterval methods
2222

2323
DurationDataInterval::DurationDataInterval(const Timestamp& start_time /* = PktEvent::now()*/)
24-
: start_time_(start_time), occurrences_(0),
25-
min_duration_(pos_infin), max_duration_(neg_infin),
26-
total_duration_(microseconds(0)) {
24+
: start_time_(start_time), occurrences_(0),
25+
min_duration_(pos_infin), max_duration_(neg_infin),
26+
total_duration_(microseconds(0)) {
2727
}
2828

2929
void

src/hooks/dhcp/perfmon/monitored_duration.h

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class DurationDataInterval {
6363
/// @brief Get the number of occurrences that have contributed to the
6464
/// interval.
6565
///
66-
/// @return uint64_t containing the number of occurrences.
66+
/// @return the number of occurrences.
6767
uint64_t getOccurrences() const {
6868
return (occurrences_);
6969
};
@@ -119,20 +119,20 @@ typedef boost::shared_ptr<DurationDataInterval> DurationDataIntervalPtr;
119119
/// -# Response Packet Type
120120
/// -# Start Event
121121
/// -# End Event
122-
/// -# Subnet ID can be GLOBAL_SUBNET_ID for aggregate durations
122+
/// -# Subnet ID can be GLOBAL_SUBNET_ID for aggregate durations
123123
class DurationKey {
124124
public:
125125
/// @brief Constructor
126126
///
127127
/// @param family protocol family AF_INET or AF_INET6
128128
/// @param query_type message type of the query packet
129-
/// @param response_type_ message type of the response packet
129+
/// @param response_type message type of the response packet
130130
/// @param start_event_label label of the start event
131131
/// @param end_event_label label of the end event
132-
/// @param SubnetID subnet_id id of the selected subnet
133-
DurationKey(uint16_t family, uint8_t query_type_, uint8_t response_type_,
132+
/// @param subnet_id id of the selected subnet
133+
DurationKey(uint16_t family, uint8_t query_type, uint8_t response_type,
134134
const std::string& start_event_label, const std::string& end_event_label,
135-
dhcp::SubnetID subnet_id_);
135+
dhcp::SubnetID subnet_id);
136136

137137
/// @brief Destructor
138138
virtual ~DurationKey() = default;
@@ -141,33 +141,33 @@ class DurationKey {
141141
///
142142
/// @return uint16_t containing the family (AF_INET or AF_INET6)
143143
uint16_t getFamily() {
144-
return(family_);
144+
return (family_);
145145
}
146146

147147
/// @brief Get the query packet type.
148148
///
149-
/// @return uint8_t containing the query packet type.
149+
/// @return the query packet type.
150150
uint8_t getQueryType() const {
151151
return (query_type_);
152152
}
153153

154154
/// @brief Get the response packet type.
155155
///
156-
/// @return uint8_t containing the response packet type.
156+
/// @return the response packet type.
157157
uint8_t getResponseType() const {
158158
return (response_type_);
159159
};
160160

161161
/// @brief Get the start event label.
162162
///
163-
/// @return String containing the start event label.
163+
/// @return the start event label.
164164
std::string getStartEventLabel() const {
165165
return (start_event_label_);
166166
}
167167

168168
/// @brief Get the end event label.
169169
///
170-
/// @return String containing the end event label.
170+
/// @return the end event label.
171171
std::string getEndEventLabel() const {
172172
return (end_event_label_);
173173
}
@@ -197,27 +197,27 @@ class DurationKey {
197197
///
198198
/// @endcode
199199
///
200-
/// @return String containing the composite label.
200+
/// @return the composite label.
201201
std::string getLabel() const;
202202

203203
/// @brief Validates that a query and response message type pair is sane.
204204
///
205205
/// @param family Protocol family of the key (AF_INET or AF_INET6)
206206
/// The format of the string:
207207
/// @param query_type message type of the query packet
208-
/// @param response_type_ message type of the response packet
208+
/// @param response_type message type of the response packet
209209
///
210210
/// @throw BadValue is the pairing does not make sense.
211211
static void validateMessagePair(uint16_t family, uint8_t query_type, uint8_t response_type);
212212

213213
protected:
214-
/// @brief Protocol family AF_INET or AF_INET6
214+
/// @brief Protocol family AF_INET or AF_INET6.
215215
uint16_t family_;
216216

217-
/// @brief Query message type (e.g. DHCPDISCOVER, DHCP6_SOLICIT)
217+
/// @brief Query message type (e.g. DHCPDISCOVER, DHCP6_SOLICIT).
218218
uint8_t query_type_;
219219

220-
/// @brief Response message type. (e.g. DHCPOFFER, DHCP6_ADVERTISE)
220+
/// @brief Response message type (e.g. DHCPOFFER, DHCP6_ADVERTISE).
221221
uint8_t response_type_;
222222

223223
/// @brief Label of the start event which begins the duration.
@@ -239,39 +239,39 @@ class MonitoredDuration : public DurationKey {
239239
///
240240
/// @param family protocol family AF_INET or AF_INET6
241241
/// @param query_type message type of the query packet
242-
/// @param response_type_ message type of the response packet
242+
/// @param response_type message type of the response packet
243243
/// @param start_event_label label of the start event
244244
/// @param end_event_label label of the end event
245-
/// @param SubnetID subnet_id id of the selected subnet
246-
/// @param Duration interval_duration_;
247-
MonitoredDuration(uint16_t family, uint8_t query_type_, uint8_t response_type_,
245+
/// @param subnet_id id of the selected subnet
246+
/// @param interval_duration the interval duration
247+
MonitoredDuration(uint16_t family, uint8_t query_type, uint8_t response_type,
248248
const std::string& start_event_label, const std::string& end_event_label,
249-
dhcp::SubnetID subnet_id_, const Duration& interval_duration_);
249+
dhcp::SubnetID subnet_id, const Duration& interval_duration);
250250

251251
/// @brief Constructor
252252
///
253-
/// param key composite key that identifies the alarm
254-
/// @param Duration interval_duration_;
255-
MonitoredDuration(const DurationKey& key, const Duration& interval_duration_);
253+
/// @param key composite key that identifies the alarm
254+
/// @param interval_duration the interval duration
255+
MonitoredDuration(const DurationKey& key, const Duration& interval_duration);
256256

257257
/// @brief Destructor
258258
virtual ~MonitoredDuration() = default;
259259

260-
/// @brief Get the interval duration
260+
/// @brief Get the interval duration.
261261
///
262262
/// @return Duration containing the interval duration.
263263
Duration getIntervalDuration() const {
264-
return(interval_duration_);
264+
return (interval_duration_);
265265
}
266266

267-
/// @brief Get the previous interval
267+
/// @brief Get the previous interval.
268268
///
269269
/// @return Pointer to the previous interval if it exists or an empty pointer.
270270
DurationDataIntervalPtr getPreviousInterval() const {
271271
return (previous_interval_);
272272
}
273273

274-
/// @brief Get the current interval
274+
/// @brief Get the current interval.
275275
///
276276
/// @return Pointer to the current interval if it exists or an empty pointer.
277277
DurationDataIntervalPtr getCurrentInterval() const {

src/hooks/dhcp/perfmon/tests/alarm_unittests.cc

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ TEST(Alarm, validConstructors) {
3030
Duration low_water(milliseconds(50));
3131
Duration high_water(milliseconds(250));
3232
ASSERT_NO_THROW_LOG(alarm.reset(new Alarm(AF_INET, DHCPDISCOVER, DHCPOFFER,
33-
"process_started", "process_completed",
34-
SUBNET_ID_GLOBAL,
35-
low_water, high_water)));
33+
"process_started", "process_completed",
34+
SUBNET_ID_GLOBAL,
35+
low_water, high_water)));
3636
ASSERT_TRUE(alarm);
3737
EXPECT_EQ(alarm->getFamily(), AF_INET);
3838
EXPECT_EQ(alarm->getQueryType(), DHCPDISCOVER);
@@ -52,7 +52,7 @@ TEST(Alarm, validConstructors) {
5252
// Create valid v6 key and use that to create an alarm. Verify contents and label.
5353
DurationKeyPtr key;
5454
ASSERT_NO_THROW_LOG(key.reset(new DurationKey(AF_INET6, DHCPV6_SOLICIT, DHCPV6_ADVERTISE,
55-
"mt_queued", "process_started", 77)));
55+
"mt_queued", "process_started", 77)));
5656

5757
ASSERT_NO_THROW_LOG(alarm.reset(new Alarm(*key, low_water, high_water, false)));
5858
ASSERT_TRUE(alarm);
@@ -77,23 +77,23 @@ TEST(Alarm, invalidConstructors) {
7777
Duration low_water(milliseconds(50));
7878
Duration high_water(milliseconds(250));
7979
ASSERT_THROW_MSG(alarm.reset(new Alarm(AF_INET, DHCPDISCOVER, DHCPDISCOVER,
80-
"process_started", "process_completed",
81-
SUBNET_ID_GLOBAL, low_water, high_water)),
80+
"process_started", "process_completed",
81+
SUBNET_ID_GLOBAL, low_water, high_water)),
8282
BadValue,
8383
"Response type: DHCPDISCOVER not valid for query type: DHCPDISCOVER");
8484

8585
// Low water too high, should throw.
8686
ASSERT_THROW_MSG(alarm.reset(new Alarm(AF_INET, DHCPDISCOVER, DHCPOFFER,
87-
"process_started", "process_completed",
88-
SUBNET_ID_GLOBAL, high_water, low_water)),
87+
"process_started", "process_completed",
88+
SUBNET_ID_GLOBAL, high_water, low_water)),
8989
BadValue,
9090
"low water: 00:00:00.250000, must be less than high water:"
9191
" 00:00:00.050000");
9292

9393
// Create valid v6 key.
9494
DurationKeyPtr key;
9595
ASSERT_NO_THROW_LOG(key.reset(new DurationKey(AF_INET6, DHCPV6_SOLICIT, DHCPV6_ADVERTISE,
96-
"mt_queued", "process_started", 77)));
96+
"mt_queued", "process_started", 77)));
9797

9898
// Low water too high, should throw.
9999
ASSERT_THROW_MSG(alarm.reset(new Alarm(*key, high_water, low_water)),
@@ -108,9 +108,9 @@ TEST(Alarm, lowWaterHighWaterSetters) {
108108
Duration high_water(milliseconds(250));
109109
AlarmPtr alarm;
110110
ASSERT_NO_THROW_LOG(alarm.reset(new Alarm(AF_INET, DHCPDISCOVER, DHCPOFFER,
111-
"process_started", "process_completed",
112-
SUBNET_ID_GLOBAL,
113-
low_water, high_water)));
111+
"process_started", "process_completed",
112+
SUBNET_ID_GLOBAL,
113+
low_water, high_water)));
114114

115115
// Should be able to set thresholds to new, valid values.
116116
low_water += milliseconds(50);
@@ -135,8 +135,8 @@ TEST(Alarm, clearAndDisable) {
135135
auto start_time = PktEvent::now();
136136
AlarmPtr alarm;
137137
ASSERT_NO_THROW_LOG(alarm.reset(new Alarm(AF_INET, DHCPDISCOVER, DHCPOFFER,
138-
"process_started", "process_completed",
139-
SUBNET_ID_GLOBAL, milliseconds(100), milliseconds(200))));
138+
"process_started", "process_completed",
139+
SUBNET_ID_GLOBAL, milliseconds(100), milliseconds(200))));
140140

141141
// Initial state should be CLEAR, stos_time_ should be close to now, no report time.
142142
EXPECT_EQ(alarm->getState(), Alarm::CLEAR);
@@ -175,7 +175,7 @@ TEST(Alarm, clearAndDisable) {
175175
// ```
176176
// INPUT | OUTPUT
177177
// Test sample relationship Input Report Int.|
178-
// to the thresholds State Elapsed | Report State Stos Last Report
178+
// to the thresholds State Elapsed | Report State Stos Last Report
179179
// -------------------------------------------------|----------------------------------
180180
// sample < low_water C false | false C - -
181181
// sample < low_water C true | false C - -

0 commit comments

Comments
 (0)