Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 Open Networking Laboratory |
| 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 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.net.link; |
tom | 61359e9 | 2014-09-16 15:50:27 -0700 | [diff] [blame] | 17 | |
alshabib | b5522ff | 2014-09-29 19:20:00 -0700 | [diff] [blame] | 18 | import java.util.Set; |
| 19 | |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 20 | import org.onosproject.net.ConnectPoint; |
| 21 | import org.onosproject.net.DeviceId; |
| 22 | import org.onosproject.net.Link; |
| 23 | import org.onosproject.net.Link.State; |
Yuta HIGUCHI | f1f2ac0 | 2014-11-26 14:02:22 -0800 | [diff] [blame] | 24 | |
| 25 | import com.google.common.base.Predicate; |
| 26 | import com.google.common.collect.FluentIterable; |
tom | 61359e9 | 2014-09-16 15:50:27 -0700 | [diff] [blame] | 27 | |
tom | 61359e9 | 2014-09-16 15:50:27 -0700 | [diff] [blame] | 28 | /** |
| 29 | * Test adapter for link service. |
| 30 | */ |
| 31 | public class LinkServiceAdapter implements LinkService { |
| 32 | @Override |
| 33 | public int getLinkCount() { |
| 34 | return 0; |
| 35 | } |
| 36 | |
| 37 | @Override |
| 38 | public Iterable<Link> getLinks() { |
| 39 | return null; |
| 40 | } |
| 41 | |
| 42 | @Override |
Yuta HIGUCHI | f1f2ac0 | 2014-11-26 14:02:22 -0800 | [diff] [blame] | 43 | public Iterable<Link> getActiveLinks() { |
| 44 | return FluentIterable.from(getLinks()) |
| 45 | .filter(new Predicate<Link>() { |
| 46 | |
| 47 | @Override |
| 48 | public boolean apply(Link input) { |
| 49 | return input.state() == State.ACTIVE; |
| 50 | } |
| 51 | }); |
| 52 | } |
| 53 | |
| 54 | @Override |
tom | 61359e9 | 2014-09-16 15:50:27 -0700 | [diff] [blame] | 55 | public Set<Link> getDeviceLinks(DeviceId deviceId) { |
| 56 | return null; |
| 57 | } |
| 58 | |
| 59 | @Override |
| 60 | public Set<Link> getDeviceEgressLinks(DeviceId deviceId) { |
| 61 | return null; |
| 62 | } |
| 63 | |
| 64 | @Override |
| 65 | public Set<Link> getDeviceIngressLinks(DeviceId deviceId) { |
| 66 | return null; |
| 67 | } |
| 68 | |
| 69 | @Override |
| 70 | public Set<Link> getLinks(ConnectPoint connectPoint) { |
| 71 | return null; |
| 72 | } |
| 73 | |
| 74 | @Override |
| 75 | public Set<Link> getEgressLinks(ConnectPoint connectPoint) { |
| 76 | return null; |
| 77 | } |
| 78 | |
| 79 | @Override |
| 80 | public Set<Link> getIngressLinks(ConnectPoint connectPoint) { |
| 81 | return null; |
| 82 | } |
| 83 | |
| 84 | @Override |
| 85 | public Link getLink(ConnectPoint src, ConnectPoint dst) { |
| 86 | return null; |
| 87 | } |
| 88 | |
| 89 | @Override |
| 90 | public void addListener(LinkListener listener) { |
| 91 | } |
| 92 | |
| 93 | @Override |
| 94 | public void removeListener(LinkListener listener) { |
| 95 | } |
| 96 | |
tom | 61359e9 | 2014-09-16 15:50:27 -0700 | [diff] [blame] | 97 | } |