blob: 7d6555a9cbfe611931cc345d5a2e5d289c8febdf [file] [log] [blame]
Claudine Chiu45920dd2016-07-28 19:19:46 +00001/*
Brian O'Connord03d7dd2016-08-02 23:33:25 -07002 * Copyright 2016-present Open Networking Laboratory
Claudine Chiu45920dd2016-07-28 19:19:46 +00003 *
Brian O'Connord03d7dd2016-08-02 23:33:25 -07004 * 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 Chiu45920dd2016-07-28 19:19:46 +00007 *
Brian O'Connord03d7dd2016-08-02 23:33:25 -07008 * 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 Chiu45920dd2016-07-28 19:19:46 +000015 */
Claudine Chiu45920dd2016-07-28 19:19:46 +000016package org.onosproject.incubator.net.virtual.impl;
17
yoonseonc6a69272017-01-12 18:22:20 -080018import org.onosproject.incubator.net.virtual.NetworkId;
Claudine Chiu45920dd2016-07-28 19:19:46 +000019import org.onosproject.incubator.net.virtual.VirtualNetworkService;
yoonseon214963b2016-11-21 15:41:07 -080020import org.onosproject.incubator.net.virtual.VnetService;
Claudine Chiu45920dd2016-07-28 19:19:46 +000021import org.onosproject.net.DisjointPath;
22import org.onosproject.net.ElementId;
23import org.onosproject.net.Link;
24import org.onosproject.net.Path;
25import org.onosproject.net.host.HostService;
26import org.onosproject.net.topology.LinkWeight;
27import org.onosproject.net.topology.PathService;
28import org.onosproject.net.topology.AbstractPathService;
29import org.onosproject.net.topology.TopologyService;
30
31import java.util.Map;
32import java.util.Set;
33
Claudine Chiu45920dd2016-07-28 19:19:46 +000034/**
35 * Path service implementation built on the virtual network service.
36 */
yoonseon214963b2016-11-21 15:41:07 -080037public class VirtualNetworkPathManager
38 extends AbstractPathService
Claudine Chiu45920dd2016-07-28 19:19:46 +000039 implements PathService, VnetService {
40
yoonseonc6a69272017-01-12 18:22:20 -080041 private final NetworkId networkId;
Claudine Chiu45920dd2016-07-28 19:19:46 +000042
43 /**
44 * Creates a new virtual network path service object.
45 *
46 * @param virtualNetworkManager virtual network manager service
yoonseonc6a69272017-01-12 18:22:20 -080047 * @param networkId a virtual network identifier
Claudine Chiu45920dd2016-07-28 19:19:46 +000048 */
49
yoonseon214963b2016-11-21 15:41:07 -080050 public VirtualNetworkPathManager(VirtualNetworkService virtualNetworkManager,
yoonseonc6a69272017-01-12 18:22:20 -080051 NetworkId networkId) {
52 this.networkId = networkId;
53
54 topologyService = virtualNetworkManager.get(networkId(), TopologyService.class);
55 hostService = virtualNetworkManager.get(networkId(), HostService.class);
Claudine Chiu45920dd2016-07-28 19:19:46 +000056 }
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
yoonseon214963b2016-11-21 15:41:07 -080069 public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst,
70 Map<Link, Object> riskProfile) {
Claudine Chiu45920dd2016-07-28 19:19:46 +000071 return getDisjointPaths(src, dst, null, riskProfile);
72 }
73
74 @Override
yoonseonc6a69272017-01-12 18:22:20 -080075 public NetworkId networkId() {
76 return this.networkId;
Claudine Chiu45920dd2016-07-28 19:19:46 +000077 }
78}