Jian Li | ae3fcff | 2018-07-30 11:55:44 +0900 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2018-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 | package org.onosproject.openstacktelemetry.impl; |
| 17 | |
| 18 | import com.google.common.collect.ImmutableSet; |
| 19 | import com.google.common.collect.Sets; |
| 20 | import org.onosproject.openstacktelemetry.api.FlowInfo; |
| 21 | import org.onosproject.openstacktelemetry.api.OpenstackTelemetryService; |
| 22 | import org.onosproject.openstacktelemetry.api.TelemetryService; |
| 23 | |
| 24 | import java.util.Set; |
| 25 | |
| 26 | /** |
| 27 | * A mock up test class of openstack telemetry service. |
| 28 | */ |
| 29 | public class OpenstackTelemetryServiceAdapter implements OpenstackTelemetryService { |
| 30 | |
| 31 | Set<TelemetryService> services = Sets.newConcurrentHashSet(); |
| 32 | |
| 33 | @Override |
| 34 | public void addTelemetryService(TelemetryService telemetryService) { |
| 35 | services.add(telemetryService); |
| 36 | } |
| 37 | |
| 38 | @Override |
| 39 | public void removeTelemetryService(TelemetryService telemetryService) { |
| 40 | services.remove(telemetryService); |
| 41 | } |
| 42 | |
| 43 | @Override |
| 44 | public void publish(Set<FlowInfo> flowInfos) { |
| 45 | |
| 46 | } |
| 47 | |
| 48 | @Override |
| 49 | public Set<TelemetryService> telemetryServices() { |
| 50 | return ImmutableSet.copyOf(services); |
| 51 | } |
| 52 | } |