blob: 20c7839732fa670a55760981db30f921091ba843 [file] [log] [blame]
Daniele Moro8d630f12021-06-15 20:53:22 +02001/*
2 * Copyright 2021-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.pipelines.fabric.impl.behaviour.upf;
18
19import org.onosproject.net.DeviceId;
20import org.onosproject.net.pi.model.PiCounterModel;
21import org.onosproject.net.pi.model.PiPipeconf;
22import org.onosproject.net.pi.model.PiPipeconfId;
23import org.onosproject.net.pi.model.PiTableModel;
24import org.onosproject.net.pi.service.PiPipeconfListener;
25import org.onosproject.net.pi.service.PiPipeconfService;
26
27import java.util.Collection;
28import java.util.Optional;
29
30import static org.easymock.EasyMock.createMock;
31import static org.easymock.EasyMock.expect;
32import static org.easymock.EasyMock.replay;
33
34public class MockPiPipeconfService implements PiPipeconfService {
35
36 private final PiPipeconf mockPiPipeconf;
37
38 public MockPiPipeconfService(Collection<PiTableModel> tables,
39 Collection<PiCounterModel> counters) {
40 mockPiPipeconf = createMock(PiPipeconf.class);
41 expect(mockPiPipeconf.pipelineModel())
42 .andReturn(new MockPiPipelineModel(tables, counters))
43 .anyTimes();
44 replay(mockPiPipeconf);
45 }
46
47 @Override
48 public Optional<PiPipeconf> getPipeconf(PiPipeconfId id) {
49 return Optional.of(mockPiPipeconf);
50 }
51
52 @Override
53 public Optional<PiPipeconf> getPipeconf(DeviceId deviceId) {
54 return Optional.of(mockPiPipeconf);
55 }
56
57 @Override
58 public void register(PiPipeconf pipeconf) throws IllegalStateException {
59
60 }
61
62 @Override
63 public void unregister(PiPipeconfId pipeconfId) throws IllegalStateException {
64
65 }
66
67 @Override
68 public Iterable<PiPipeconf> getPipeconfs() {
69 return null;
70 }
71
72 @Override
73 public void bindToDevice(PiPipeconfId pipeconfId, DeviceId deviceId) {
74
75 }
76
77 @Override
78 public String getMergedDriver(DeviceId deviceId, PiPipeconfId pipeconfId) {
79 return null;
80 }
81
82 @Override
83 public Optional<PiPipeconfId> ofDevice(DeviceId deviceId) {
84 return Optional.empty();
85 }
86
87 @Override
88 public void addListener(PiPipeconfListener listener) {
89
90 }
91
92 @Override
93 public void removeListener(PiPipeconfListener listener) {
94
95 }
96}