Claudine Chiu | 45920dd | 2016-07-28 19:19:46 +0000 | [diff] [blame] | 1 | /* |
Brian O'Connor | d03d7dd | 2016-08-02 23:33:25 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Laboratory |
Claudine Chiu | 45920dd | 2016-07-28 19:19:46 +0000 | [diff] [blame] | 3 | * |
Brian O'Connor | d03d7dd | 2016-08-02 23:33:25 -0700 | [diff] [blame] | 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 |
Claudine Chiu | 45920dd | 2016-07-28 19:19:46 +0000 | [diff] [blame] | 7 | * |
Brian O'Connor | d03d7dd | 2016-08-02 23:33:25 -0700 | [diff] [blame] | 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. |
Claudine Chiu | 45920dd | 2016-07-28 19:19:46 +0000 | [diff] [blame] | 15 | */ |
Claudine Chiu | 45920dd | 2016-07-28 19:19:46 +0000 | [diff] [blame] | 16 | package org.onosproject.incubator.net.virtual.impl; |
| 17 | |
yoonseon | c6a6927 | 2017-01-12 18:22:20 -0800 | [diff] [blame^] | 18 | import org.onosproject.incubator.net.virtual.NetworkId; |
Claudine Chiu | 45920dd | 2016-07-28 19:19:46 +0000 | [diff] [blame] | 19 | import org.onosproject.incubator.net.virtual.VirtualNetworkService; |
yoonseon | 214963b | 2016-11-21 15:41:07 -0800 | [diff] [blame] | 20 | import org.onosproject.incubator.net.virtual.VnetService; |
Claudine Chiu | 45920dd | 2016-07-28 19:19:46 +0000 | [diff] [blame] | 21 | import org.onosproject.net.DisjointPath; |
| 22 | import org.onosproject.net.ElementId; |
| 23 | import org.onosproject.net.Link; |
| 24 | import org.onosproject.net.Path; |
| 25 | import org.onosproject.net.host.HostService; |
| 26 | import org.onosproject.net.topology.LinkWeight; |
| 27 | import org.onosproject.net.topology.PathService; |
| 28 | import org.onosproject.net.topology.AbstractPathService; |
| 29 | import org.onosproject.net.topology.TopologyService; |
| 30 | |
| 31 | import java.util.Map; |
| 32 | import java.util.Set; |
| 33 | |
Claudine Chiu | 45920dd | 2016-07-28 19:19:46 +0000 | [diff] [blame] | 34 | /** |
| 35 | * Path service implementation built on the virtual network service. |
| 36 | */ |
yoonseon | 214963b | 2016-11-21 15:41:07 -0800 | [diff] [blame] | 37 | public class VirtualNetworkPathManager |
| 38 | extends AbstractPathService |
Claudine Chiu | 45920dd | 2016-07-28 19:19:46 +0000 | [diff] [blame] | 39 | implements PathService, VnetService { |
| 40 | |
yoonseon | c6a6927 | 2017-01-12 18:22:20 -0800 | [diff] [blame^] | 41 | private final NetworkId networkId; |
Claudine Chiu | 45920dd | 2016-07-28 19:19:46 +0000 | [diff] [blame] | 42 | |
| 43 | /** |
| 44 | * Creates a new virtual network path service object. |
| 45 | * |
| 46 | * @param virtualNetworkManager virtual network manager service |
yoonseon | c6a6927 | 2017-01-12 18:22:20 -0800 | [diff] [blame^] | 47 | * @param networkId a virtual network identifier |
Claudine Chiu | 45920dd | 2016-07-28 19:19:46 +0000 | [diff] [blame] | 48 | */ |
| 49 | |
yoonseon | 214963b | 2016-11-21 15:41:07 -0800 | [diff] [blame] | 50 | public VirtualNetworkPathManager(VirtualNetworkService virtualNetworkManager, |
yoonseon | c6a6927 | 2017-01-12 18:22:20 -0800 | [diff] [blame^] | 51 | NetworkId networkId) { |
| 52 | this.networkId = networkId; |
| 53 | |
| 54 | topologyService = virtualNetworkManager.get(networkId(), TopologyService.class); |
| 55 | hostService = virtualNetworkManager.get(networkId(), HostService.class); |
Claudine Chiu | 45920dd | 2016-07-28 19:19:46 +0000 | [diff] [blame] | 56 | } |
| 57 | |
| 58 | @Override |
| 59 | public Set<Path> getPaths(ElementId src, ElementId dst) { |
| 60 | return getPaths(src, dst, null); |
| 61 | } |
| 62 | |
| 63 | @Override |
| 64 | public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst) { |
| 65 | return getDisjointPaths(src, dst, (LinkWeight) null); |
| 66 | } |
| 67 | |
| 68 | @Override |
yoonseon | 214963b | 2016-11-21 15:41:07 -0800 | [diff] [blame] | 69 | public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst, |
| 70 | Map<Link, Object> riskProfile) { |
Claudine Chiu | 45920dd | 2016-07-28 19:19:46 +0000 | [diff] [blame] | 71 | return getDisjointPaths(src, dst, null, riskProfile); |
| 72 | } |
| 73 | |
| 74 | @Override |
yoonseon | c6a6927 | 2017-01-12 18:22:20 -0800 | [diff] [blame^] | 75 | public NetworkId networkId() { |
| 76 | return this.networkId; |
Claudine Chiu | 45920dd | 2016-07-28 19:19:46 +0000 | [diff] [blame] | 77 | } |
| 78 | } |