blob: cc214e394bb9b80aa8b0606b1f6ee2731a3d2bcb [file] [log] [blame]
Simon Hunt2ff17592017-11-08 15:34:07 -08001/*
2 * Copyright 2017-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 */
16
17package org.onosproject.segmentrouting;
18
19import org.onosproject.net.ConnectPoint;
20import org.onosproject.net.DeviceId;
21import org.onosproject.net.PortNumber;
22
23import java.util.ArrayList;
24import java.util.List;
25
26/**
27 * An augmented implementation of {@link PortAuthTracker}, so that we can
28 * instrument its behavior for unit test assertions.
29 */
30class AugmentedPortAuthTracker extends PortAuthTracker {
31
32 // instrument blocking flow activity, so we can see when we get hits
33 final List<ConnectPoint> installed = new ArrayList<>();
34 final List<ConnectPoint> cleared = new ArrayList<>();
35
36
37 void resetMetrics() {
38 installed.clear();
39 cleared.clear();
40 }
41
42 @Override
43 void installBlockingFlow(DeviceId d, PortNumber p) {
44 super.installBlockingFlow(d, p);
45 installed.add(new ConnectPoint(d, p));
46 }
47
48 @Override
49 void clearBlockingFlow(DeviceId d, PortNumber p) {
50 super.clearBlockingFlow(d, p);
51 cleared.add(new ConnectPoint(d, p));
52 }
53}