blob: 70a02383ad0a23f837b642437ea589e37223977e [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
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'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.net.intent;
weibitf32383b2014-10-22 10:17:31 -070017
18import java.util.Collection;
weibitf32383b2014-10-22 10:17:31 -070019
Brian O'Connorabafb502014-12-02 22:26:20 -080020import org.onosproject.core.ApplicationId;
21import org.onosproject.net.ConnectPoint;
22import org.onosproject.net.Link;
Brian O'Connorabafb502014-12-02 22:26:20 -080023import org.onosproject.net.Path;
weibitf32383b2014-10-22 10:17:31 -070024
25import com.google.common.base.MoreObjects;
Brian O'Connor4908d602014-10-23 15:58:20 -070026import com.google.common.collect.ImmutableSet;
weibitf32383b2014-10-22 10:17:31 -070027
Brian O'Connor4908d602014-10-23 15:58:20 -070028public class OpticalPathIntent extends Intent {
Brian O'Connor086724e2014-10-23 15:47:32 -070029
30 private final ConnectPoint src;
31 private final ConnectPoint dst;
weibitf32383b2014-10-22 10:17:31 -070032 private final Path path;
Brian O'Connor086724e2014-10-23 15:47:32 -070033
weibitf32383b2014-10-22 10:17:31 -070034
weibit7e583462014-10-23 10:14:05 -070035 public OpticalPathIntent(ApplicationId appId,
36 ConnectPoint src,
37 ConnectPoint dst,
weibit7e583462014-10-23 10:14:05 -070038 Path path) {
Sho SHIMIZU2c255db2014-12-09 15:49:15 -080039 super(appId, ImmutableSet.copyOf(path.links()));
Brian O'Connor086724e2014-10-23 15:47:32 -070040 this.src = src;
41 this.dst = dst;
weibitf32383b2014-10-22 10:17:31 -070042 this.path = path;
43 }
44
weibit9e622ac2014-10-23 13:45:44 -070045 protected OpticalPathIntent() {
Brian O'Connor086724e2014-10-23 15:47:32 -070046 this.src = null;
47 this.dst = null;
weibitf32383b2014-10-22 10:17:31 -070048 this.path = null;
49 }
50
Brian O'Connor086724e2014-10-23 15:47:32 -070051 public ConnectPoint src() {
52 return src;
53 }
54
55 public ConnectPoint dst() {
56 return dst;
57 }
58
weibitf32383b2014-10-22 10:17:31 -070059 public Path path() {
60 return path;
61 }
weibitf32383b2014-10-22 10:17:31 -070062
weibitf32383b2014-10-22 10:17:31 -070063 @Override
weibit7e583462014-10-23 10:14:05 -070064 public boolean isInstallable() {
weibitf32383b2014-10-22 10:17:31 -070065 return true;
66 }
67
68 @Override
weibitf32383b2014-10-22 10:17:31 -070069 public String toString() {
70 return MoreObjects.toStringHelper(getClass())
71 .add("id", id())
Brian O'Connor086724e2014-10-23 15:47:32 -070072 .add("ingressPort", src)
73 .add("egressPort", dst)
weibitf32383b2014-10-22 10:17:31 -070074 .add("path", path)
75 .toString();
76 }
77
Praseed Balakrishnan00dd1f92014-11-19 17:12:36 -080078
weibitf32383b2014-10-22 10:17:31 -070079 public Collection<Link> requiredLinks() {
80 return path.links();
81 }
82}