blob: 328388644dc38cfba81e4e35f3d52abb1f5fed76 [file] [log] [blame]
Andrea Campanellacbbb7952019-11-25 06:38:41 +00001/*
2 * Copyright 2016-present Open Networking Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.opencord.olt.impl;
17
Saurav Dasf62cea82020-08-26 17:43:04 -070018import java.util.ArrayList;
19import java.util.Collection;
20import java.util.List;
21import java.util.Map;
22import java.util.Optional;
23import java.util.Set;
24import java.util.concurrent.CompletableFuture;
25
Andrea Campanellacbbb7952019-11-25 06:38:41 +000026import org.apache.commons.lang3.tuple.Pair;
27import org.junit.Before;
28import org.junit.Test;
29import org.onlab.packet.EthType;
30import org.onlab.packet.VlanId;
31import org.onosproject.cluster.NodeId;
32import org.onosproject.cluster.RoleInfo;
33import org.onosproject.mastership.MastershipInfo;
34import org.onosproject.mastership.MastershipListener;
35import org.onosproject.net.DeviceId;
36import org.onosproject.net.MastershipRole;
37import org.onosproject.net.PortNumber;
38import org.onosproject.net.flow.TrafficSelector;
39import org.onosproject.net.flow.TrafficTreatment;
40import org.onosproject.net.flow.criteria.Criterion;
41import org.onosproject.net.flow.criteria.EthTypeCriterion;
42import org.onosproject.net.flow.criteria.PortCriterion;
43import org.onosproject.net.flow.criteria.VlanIdCriterion;
44import org.onosproject.net.flow.instructions.Instruction;
45import org.onosproject.net.flow.instructions.Instructions;
46import org.onosproject.net.flow.instructions.L2ModificationInstruction;
47import org.onosproject.net.flowobjective.FilteringObjQueueKey;
48import org.onosproject.net.flowobjective.FilteringObjective;
49import org.onosproject.net.flowobjective.ForwardingObjQueueKey;
50import org.onosproject.net.flowobjective.ForwardingObjective;
51import org.onosproject.net.flowobjective.NextObjQueueKey;
52import org.onosproject.net.flowobjective.NextObjective;
53import org.onosproject.net.flowobjective.Objective;
54import org.onosproject.net.meter.MeterId;
55import org.onosproject.net.meter.MeterKey;
56import org.opencord.sadis.BandwidthProfileInformation;
57import org.opencord.sadis.UniTagInformation;
58
Saurav Dasf62cea82020-08-26 17:43:04 -070059import com.google.common.collect.ImmutableList;
60import com.google.common.collect.ImmutableMap;
61import com.google.common.collect.ImmutableSet;
62import com.google.common.collect.ListMultimap;
Andrea Campanellacbbb7952019-11-25 06:38:41 +000063
64public class OltFlowTest extends TestBase {
65 private OltFlowService oltFlowService;
Andrea Campanellacbbb7952019-11-25 06:38:41 +000066 PortNumber uniPortNumber = PortNumber.portNumber(1);
Andrea Campanella3a96ce82021-02-09 12:32:42 +010067 PortNumber uniPortNumber2 = PortNumber.portNumber(2);
Andrea Campanellacbbb7952019-11-25 06:38:41 +000068 PortNumber nniPortNumber = PortNumber.portNumber(65535);
69
70 UniTagInformation.Builder tagInfoBuilder = new UniTagInformation.Builder();
71 UniTagInformation uniTagInfo = tagInfoBuilder.setUniTagMatch(VlanId.vlanId((short) 35))
72 .setPonCTag(VlanId.vlanId((short) 33))
73 .setPonSTag(VlanId.vlanId((short) 7))
74 .setDsPonCTagPriority(0)
75 .setUsPonSTagPriority(0)
76 .setTechnologyProfileId(64)
77 .setDownstreamBandwidthProfile(dsBpId)
78 .setUpstreamBandwidthProfile(usBpId)
Saurav Dasf62cea82020-08-26 17:43:04 -070079 .setIsDhcpRequired(true)
80 .setIsIgmpRequired(true)
81 .build();
82
Andrea Campanella3a96ce82021-02-09 12:32:42 +010083 UniTagInformation.Builder tagInfoBuilderNoPcp = new UniTagInformation.Builder();
84 UniTagInformation uniTagInfoNoPcp = tagInfoBuilderNoPcp.setUniTagMatch(VlanId.vlanId((short) 35))
85 .setPonCTag(VlanId.vlanId((short) 34))
86 .setPonSTag(VlanId.vlanId((short) 7))
87 .setDsPonCTagPriority(-1)
88 .setUsPonSTagPriority(-1)
89 .setUsPonCTagPriority(-1)
90 .setDsPonSTagPriority(-1)
91 .setTechnologyProfileId(64)
92 .setDownstreamBandwidthProfile(dsBpId)
93 .setUpstreamBandwidthProfile(usBpId)
94 .setIsDhcpRequired(true)
95 .setIsIgmpRequired(true)
96 .build();
97
Saurav Dasf62cea82020-08-26 17:43:04 -070098 UniTagInformation.Builder tagInfoBuilder2 = new UniTagInformation.Builder();
99 UniTagInformation uniTagInfoNoDhcpNoIgmp = tagInfoBuilder2
100 .setUniTagMatch(VlanId.vlanId((short) 35))
101 .setPonCTag(VlanId.vlanId((short) 33))
102 .setPonSTag(VlanId.vlanId((short) 7))
103 .setDsPonCTagPriority(0)
104 .setUsPonSTagPriority(0)
105 .setTechnologyProfileId(64)
106 .setDownstreamBandwidthProfile(dsBpId)
107 .setUpstreamBandwidthProfile(usBpId)
Andrea Campanellacbbb7952019-11-25 06:38:41 +0000108 .build();
109
110 @Before
111 public void setUp() {
112 oltFlowService = new OltFlowService();
113 oltFlowService.oltMeterService = new MockOltMeterService();
114 oltFlowService.flowObjectiveService = new MockOltFlowObjectiveService();
115 oltFlowService.mastershipService = new MockMastershipService();
116 oltFlowService.sadisService = new MockSadisService();
117 oltFlowService.bpService = oltFlowService.sadisService.getBandwidthProfileService();
118 oltFlowService.appId = appId;
119 }
120
121 @Test
122 public void testDhcpFiltering() {
Saurav Dasf62cea82020-08-26 17:43:04 -0700123 oltFlowService.flowObjectiveService.clearQueue();
124 // ensure upstream dhcp traps can be added and removed
125 oltFlowService.processDhcpFilteringObjectives(DEVICE_ID_1, uniPortNumber,
126 usMeterId, uniTagInfo,
127 true, true);
128 assert oltFlowService.flowObjectiveService.getPendingFlowObjectives().size() == 1;
129 oltFlowService.processDhcpFilteringObjectives(DEVICE_ID_1, uniPortNumber,
130 usMeterId, uniTagInfo,
131 false, true);
132 assert oltFlowService.flowObjectiveService.getPendingFlowObjectives().size() == 2;
Andrea Campanella3a96ce82021-02-09 12:32:42 +0100133
134 // Ensure upstream flow has no pcp unless properly specified.
135 oltFlowService.processDhcpFilteringObjectives(DEVICE_ID_1, uniPortNumber2,
136 usMeterId, uniTagInfoNoPcp,
137 true, true);
138 assert oltFlowService.flowObjectiveService.getPendingFlowObjectives().size() == 3;
139
Saurav Dasf62cea82020-08-26 17:43:04 -0700140 // ensure upstream flows are not added if uniTagInfo is missing dhcp requirement
141 oltFlowService.processDhcpFilteringObjectives(DEVICE_ID_1, uniPortNumber,
142 usMeterId, uniTagInfoNoDhcpNoIgmp,
143 true, true);
Andrea Campanella3a96ce82021-02-09 12:32:42 +0100144 assert oltFlowService.flowObjectiveService.getPendingFlowObjectives().size() == 3;
Saurav Dasf62cea82020-08-26 17:43:04 -0700145
146 // ensure downstream traps don't succeed without global config for nni ports
147 oltFlowService.processDhcpFilteringObjectives(DEVICE_ID_1, nniPortNumber,
148 null, null,
149 true, false);
150 oltFlowService.processDhcpFilteringObjectives(DEVICE_ID_1, nniPortNumber,
151 null, null,
152 false, false);
Andrea Campanella3a96ce82021-02-09 12:32:42 +0100153 assert oltFlowService.flowObjectiveService.getPendingFlowObjectives().size() == 3;
Saurav Dasf62cea82020-08-26 17:43:04 -0700154 // do global config for nni ports and now it should succeed
155 oltFlowService.enableDhcpOnNni = true;
156 oltFlowService.processDhcpFilteringObjectives(DEVICE_ID_1, nniPortNumber,
157 null, null,
158 true, false);
159 oltFlowService.processDhcpFilteringObjectives(DEVICE_ID_1, nniPortNumber,
160 null, null,
161 false, false);
Andrea Campanella3a96ce82021-02-09 12:32:42 +0100162 assert oltFlowService.flowObjectiveService.getPendingFlowObjectives().size() == 5;
Saurav Dasf62cea82020-08-26 17:43:04 -0700163
164 // turn on DHCPv6 and we should get 2 flows
165 oltFlowService.enableDhcpV6 = true;
166 oltFlowService.processDhcpFilteringObjectives(DEVICE_ID_1, uniPortNumber,
167 usMeterId, uniTagInfo,
168 true, true);
Andrea Campanella3a96ce82021-02-09 12:32:42 +0100169 assert oltFlowService.flowObjectiveService.getPendingFlowObjectives().size() == 7;
Saurav Dasf62cea82020-08-26 17:43:04 -0700170
171 // turn off DHCPv4 and it's only v6
172 oltFlowService.enableDhcpV4 = false;
173 oltFlowService.processDhcpFilteringObjectives(DEVICE_ID_1, uniPortNumber,
174 usMeterId, uniTagInfo,
175 true, true);
Andrea Campanella3a96ce82021-02-09 12:32:42 +0100176 assert oltFlowService.flowObjectiveService.getPendingFlowObjectives().size() == 8;
Saurav Dasf62cea82020-08-26 17:43:04 -0700177
178 // cleanup
179 oltFlowService.flowObjectiveService.clearQueue();
180 oltFlowService.enableDhcpV4 = true;
181 oltFlowService.enableDhcpV6 = false;
Andrea Campanellacbbb7952019-11-25 06:38:41 +0000182 }
183
184 @Test
Gustavo Silva5c492dd2021-02-12 10:21:11 -0300185 public void testPppoedFiltering() {
186 oltFlowService.flowObjectiveService.clearQueue();
187
188 // ensure pppoed traps are not added if global config is off.
189 oltFlowService.enablePppoe = false;
190 oltFlowService.processPPPoEDFilteringObjectives(DEVICE_ID_1, uniPortNumber,
191 usMeterId, uniTagInfo,
192 true, true);
193 assert oltFlowService.flowObjectiveService.getPendingFlowObjectives().size() == 0;
194
195 // ensure upstream pppoed traps can be added and removed
196 oltFlowService.enablePppoe = true;
197 oltFlowService.processPPPoEDFilteringObjectives(DEVICE_ID_1, uniPortNumber,
198 usMeterId, uniTagInfo,
199 true, true);
200 assert oltFlowService.flowObjectiveService.getPendingFlowObjectives().size() == 1;
201 oltFlowService.processPPPoEDFilteringObjectives(DEVICE_ID_1, uniPortNumber,
202 usMeterId, uniTagInfo,
203 false, true);
204 assert oltFlowService.flowObjectiveService.getPendingFlowObjectives().size() == 2;
205
206 // ensure downstream pppoed traps can be added and removed
207 oltFlowService.processPPPoEDFilteringObjectives(DEVICE_ID_1, nniPortNumber,
208 null, null,
209 true, false);
210 assert oltFlowService.flowObjectiveService.getPendingFlowObjectives().size() == 3;
211 oltFlowService.processPPPoEDFilteringObjectives(DEVICE_ID_1, nniPortNumber,
212 null, null,
213 false, false);
214 assert oltFlowService.flowObjectiveService.getPendingFlowObjectives().size() == 4;
215
216 // cleanup
217 oltFlowService.flowObjectiveService.clearQueue();
218 }
219
220 @Test
Andrea Campanellacbbb7952019-11-25 06:38:41 +0000221 public void testIgmpFiltering() {
Saurav Dasf62cea82020-08-26 17:43:04 -0700222 oltFlowService.flowObjectiveService.clearQueue();
223
224 // ensure igmp flows can be added and removed
225 oltFlowService.processIgmpFilteringObjectives(DEVICE_ID_1, uniPortNumber,
226 usMeterId, uniTagInfo,
227 true, true);
228 assert oltFlowService.flowObjectiveService.getPendingFlowObjectives().size() == 1;
229 oltFlowService.processIgmpFilteringObjectives(DEVICE_ID_1, uniPortNumber, usMeterId,
230 uniTagInfo,
231 false, true);
232 assert oltFlowService.flowObjectiveService.getPendingFlowObjectives().size() == 2;
233
234 // ensure igmp flow is not added if uniTag has no igmp requirement
235 oltFlowService.processIgmpFilteringObjectives(DEVICE_ID_1, uniPortNumber,
236 usMeterId, uniTagInfoNoDhcpNoIgmp,
237 true, true);
238 assert oltFlowService.flowObjectiveService.getPendingFlowObjectives().size() == 2;
239
240 //ensure igmp flow on NNI fails without global setting
241 oltFlowService.processIgmpFilteringObjectives(DEVICE_ID_1, nniPortNumber,
242 null, null,
243 true, false);
244 assert oltFlowService.flowObjectiveService.getPendingFlowObjectives().size() == 2;
245
246 // igmp trap on NNI should succeed with global config
247 oltFlowService.enableIgmpOnNni = true;
248 oltFlowService.processIgmpFilteringObjectives(DEVICE_ID_1, nniPortNumber,
249 null, null,
250 true, false);
251 assert oltFlowService.flowObjectiveService.getPendingFlowObjectives().size() == 3;
252 // cleanup
253 oltFlowService.flowObjectiveService.clearQueue();
254
Andrea Campanellacbbb7952019-11-25 06:38:41 +0000255 }
256
257 @Test
258 public void testEapolFiltering() {
259 addBandwidthProfile(uniTagInfo.getUpstreamBandwidthProfile());
260 oltFlowService.enableEapol = true;
261
262 //will install
263 oltFlowService.processEapolFilteringObjectives(DEVICE_ID_1, uniPortNumber,
264 uniTagInfo.getUpstreamBandwidthProfile(), new CompletableFuture<>(),
265 uniTagInfo.getUniTagMatch(), true);
266
267 //bp profile doesn't exist
268 oltFlowService.processEapolFilteringObjectives(DEVICE_ID_1, uniPortNumber,
269 uniTagInfo.getDownstreamBandwidthProfile(), new CompletableFuture<>(),
270 uniTagInfo.getUniTagMatch(), true);
271 }
272
273 @Test
274 public void testLldpFiltering() {
275 oltFlowService.processLldpFilteringObjective(DEVICE_ID_1, nniPortNumber, true);
276 oltFlowService.processLldpFilteringObjective(DEVICE_ID_1, nniPortNumber, false);
277 }
278
279 @Test
280 public void testNniFiltering() {
Saurav Dasf62cea82020-08-26 17:43:04 -0700281 oltFlowService.flowObjectiveService.clearQueue();
282 oltFlowService.enableDhcpOnNni = true;
283 oltFlowService.enableIgmpOnNni = true;
Andrea Campanellacbbb7952019-11-25 06:38:41 +0000284 oltFlowService.processNniFilteringObjectives(DEVICE_ID_1, nniPortNumber, true);
Saurav Dasf62cea82020-08-26 17:43:04 -0700285 assert oltFlowService.flowObjectiveService.getPendingFlowObjectives()
286 .size() == 3;
Andrea Campanellacbbb7952019-11-25 06:38:41 +0000287 oltFlowService.processNniFilteringObjectives(DEVICE_ID_1, nniPortNumber, false);
Saurav Dasf62cea82020-08-26 17:43:04 -0700288 assert oltFlowService.flowObjectiveService.getPendingFlowObjectives()
289 .size() == 6;
290 oltFlowService.flowObjectiveService.clearQueue();
Andrea Campanellacbbb7952019-11-25 06:38:41 +0000291 }
292
293 @Test
294 public void testUpBuilder() {
295 ForwardingObjective objective =
296 oltFlowService.createUpBuilder(nniPortNumber, uniPortNumber, usMeterId, uniTagInfo).add();
297 checkObjective(objective, true);
298 }
299
300 @Test
301 public void testDownBuilder() {
302 ForwardingObjective objective =
303 oltFlowService.createDownBuilder(nniPortNumber, uniPortNumber, dsMeterId, uniTagInfo).remove();
304 checkObjective(objective, false);
305 }
306
307 private void checkObjective(ForwardingObjective fwd, boolean upstream) {
308 TrafficTreatment treatment = fwd.treatment();
309
310 //check instructions
311 Set<Instructions.MeterInstruction> meters = treatment.meters();
312 assert !meters.isEmpty();
313
314 Instructions.MetadataInstruction writeMetadata = treatment.writeMetadata();
315 assert writeMetadata != null;
316
317 List<Instruction> immediateInstructions = treatment.immediate();
318 Optional<Instruction> vlanInstruction = immediateInstructions.stream()
319 .filter(i -> i.type() == Instruction.Type.L2MODIFICATION)
320 .filter(i -> ((L2ModificationInstruction) i).subtype() ==
321 L2ModificationInstruction.L2SubType.VLAN_PUSH ||
322 ((L2ModificationInstruction) i).subtype() ==
323 L2ModificationInstruction.L2SubType.VLAN_POP)
324 .findAny();
325
326 assert vlanInstruction.isPresent();
327
328 //check match criteria
329 TrafficSelector selector = fwd.selector();
330 assert selector.getCriterion(Criterion.Type.IN_PORT) != null;
331 assert selector.getCriterion(Criterion.Type.VLAN_VID) != null;
332
333 if (!upstream) {
334 assert selector.getCriterion(Criterion.Type.METADATA) != null;
335 }
336 }
337
338 private class MockOltMeterService implements org.opencord.olt.internalapi.AccessDeviceMeterService {
339 @Override
340 public ImmutableMap<String, Collection<MeterKey>> getBpMeterMappings() {
341 return null;
342 }
343
344 @Override
Andrea Campanellacbbb7952019-11-25 06:38:41 +0000345 public MeterId getMeterIdFromBpMapping(DeviceId deviceId, String bandwidthProfile) {
346 return null;
347 }
348
349
350 @Override
351 public ImmutableSet<MeterKey> getProgMeters() {
352 return null;
353 }
354
355 @Override
356 public MeterId createMeter(DeviceId deviceId, BandwidthProfileInformation bpInfo,
357 CompletableFuture<Object> meterFuture) {
358 return usMeterId;
359 }
Jonathan Hart4f178fa2020-02-03 10:46:01 -0800360
361 @Override
Andrea Campanella600d2e22020-06-22 11:00:31 +0200362 public void removeFromPendingMeters(DeviceId deviceId, BandwidthProfileInformation bwpInfo) {
363
Andrea Campanella3ce4d282020-06-09 13:46:58 +0200364 }
365
366 @Override
Andrea Campanellad1e26642020-10-23 12:08:32 +0200367 public boolean checkAndAddPendingMeter(DeviceId deviceId, BandwidthProfileInformation bwpInfo) {
Andrea Campanella3ce4d282020-06-09 13:46:58 +0200368 return false;
369 }
370
Andrea Campanella600d2e22020-06-22 11:00:31 +0200371
Andrea Campanella3ce4d282020-06-09 13:46:58 +0200372 @Override
Jonathan Hart4f178fa2020-02-03 10:46:01 -0800373 public void clearMeters(DeviceId deviceId) {
374 }
Andrea Campanella600d2e22020-06-22 11:00:31 +0200375
376 @Override
377 public void clearDeviceState(DeviceId deviceId) {
378
379 }
Andrea Campanellacbbb7952019-11-25 06:38:41 +0000380 }
381
382 private class MockOltFlowObjectiveService implements org.onosproject.net.flowobjective.FlowObjectiveService {
Saurav Dasf62cea82020-08-26 17:43:04 -0700383 List<String> flowObjectives = new ArrayList<>();
384
Andrea Campanellacbbb7952019-11-25 06:38:41 +0000385 @Override
386 public void filter(DeviceId deviceId, FilteringObjective filteringObjective) {
Saurav Dasf62cea82020-08-26 17:43:04 -0700387 flowObjectives.add(filteringObjective.toString());
Andrea Campanellacbbb7952019-11-25 06:38:41 +0000388 EthTypeCriterion ethType = (EthTypeCriterion)
389 filterForCriterion(filteringObjective.conditions(), Criterion.Type.ETH_TYPE);
390
391 Instructions.MeterInstruction meter = filteringObjective.meta().metered();
392 Instruction writeMetadata = filteringObjective.meta().writeMetadata();
393 VlanIdCriterion vlanIdCriterion = (VlanIdCriterion)
394 filterForCriterion(filteringObjective.conditions(), Criterion.Type.VLAN_VID);
395 PortCriterion portCriterion = (PortCriterion) filteringObjective.key();
396
Andrea Campanella3a96ce82021-02-09 12:32:42 +0100397 filteringObjective.meta().allInstructions().forEach(instruction -> {
398 if (instruction.type().equals(Instruction.Type.L2MODIFICATION)) {
399 L2ModificationInstruction l2Instruction = (L2ModificationInstruction) instruction;
400 if (l2Instruction.subtype().equals(L2ModificationInstruction.L2SubType.VLAN_PCP)) {
401 //this, given the uniTagInfo we provide, should not be present
402 assert false;
403 }
404 }
405 });
406
Andrea Campanellacbbb7952019-11-25 06:38:41 +0000407
408 if (ethType.ethType().equals(EthType.EtherType.LLDP.ethType()) ||
409 portCriterion.port().equals(nniPortNumber)) {
410 assert meter == null;
411 assert writeMetadata == null;
412 assert vlanIdCriterion == null;
413 } else {
414 assert meter.meterId().equals(usMeterId) || meter.meterId().equals(dsMeterId);
415 assert writeMetadata != null;
Andrea Campanella3a96ce82021-02-09 12:32:42 +0100416 assert vlanIdCriterion == null || vlanIdCriterion.vlanId() == uniTagInfo.getUniTagMatch()
417 || vlanIdCriterion.vlanId() == uniTagInfoNoPcp.getUniTagMatch();
Andrea Campanellacbbb7952019-11-25 06:38:41 +0000418 }
419
420 }
421
422 @Override
423 public void forward(DeviceId deviceId, ForwardingObjective forwardingObjective) {
424
425 }
426
427 @Override
428 public void next(DeviceId deviceId, NextObjective nextObjective) {
429
430 }
431
432 @Override
433 public int allocateNextId() {
434 return 0;
435 }
436
437 @Override
438 public void initPolicy(String s) {
439
440 }
441
442 @Override
443 public void apply(DeviceId deviceId, Objective objective) {
444
445 }
446
447 @Override
448 public Map<Pair<Integer, DeviceId>, List<String>> getNextMappingsChain() {
449 return null;
450 }
451
452 @Override
453 public List<String> getNextMappings() {
454 return null;
455 }
456
457 @Override
458 public List<String> getPendingFlowObjectives() {
Saurav Dasf62cea82020-08-26 17:43:04 -0700459 return ImmutableList.copyOf(flowObjectives);
Andrea Campanellacbbb7952019-11-25 06:38:41 +0000460 }
461
462 @Override
463 public ListMultimap<FilteringObjQueueKey, Objective> getFilteringObjQueue() {
464 return null;
465 }
466
467 @Override
468 public ListMultimap<ForwardingObjQueueKey, Objective> getForwardingObjQueue() {
469 return null;
470 }
471
472 @Override
473 public ListMultimap<NextObjQueueKey, Objective> getNextObjQueue() {
474 return null;
475 }
476
477 @Override
478 public Map<FilteringObjQueueKey, Objective> getFilteringObjQueueHead() {
479 return null;
480 }
481
482 @Override
483 public Map<ForwardingObjQueueKey, Objective> getForwardingObjQueueHead() {
484 return null;
485 }
486
487 @Override
488 public Map<NextObjQueueKey, Objective> getNextObjQueueHead() {
489 return null;
490 }
491
492 @Override
493 public void clearQueue() {
Saurav Dasf62cea82020-08-26 17:43:04 -0700494 flowObjectives.clear();
Andrea Campanellacbbb7952019-11-25 06:38:41 +0000495 }
496
497 private Criterion filterForCriterion(Collection<Criterion> criteria, Criterion.Type type) {
498 return criteria.stream()
499 .filter(c -> c.type().equals(type))
500 .limit(1)
501 .findFirst().orElse(null);
502 }
503 }
504
505 private class MockMastershipService implements org.onosproject.mastership.MastershipService {
506 @Override
507 public MastershipRole getLocalRole(DeviceId deviceId) {
508 return null;
509 }
510
511 @Override
512 public boolean isLocalMaster(DeviceId deviceId) {
513 return true;
514 }
515
516 @Override
517 public CompletableFuture<MastershipRole> requestRoleFor(DeviceId deviceId) {
518 return null;
519 }
520
521 @Override
522 public CompletableFuture<Void> relinquishMastership(DeviceId deviceId) {
523 return null;
524 }
525
526 @Override
527 public NodeId getMasterFor(DeviceId deviceId) {
528 return null;
529 }
530
531 @Override
532 public RoleInfo getNodesFor(DeviceId deviceId) {
533 return null;
534 }
535
536 @Override
537 public MastershipInfo getMastershipFor(DeviceId deviceId) {
538 return null;
539 }
540
541 @Override
542 public Set<DeviceId> getDevicesOf(NodeId nodeId) {
543 return null;
544 }
545
546 @Override
547 public void addListener(MastershipListener mastershipListener) {
548
549 }
550
551 @Override
552 public void removeListener(MastershipListener mastershipListener) {
553
554 }
555 }
556}