blob: 4843877d8f97b40fc23fe04aba96655eccfa5c56 [file] [log] [blame]
/*
* Copyright 2014 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.net.intent;
import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableSet;
import org.onosproject.core.ApplicationId;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.Link;
import org.onosproject.net.Path;
import java.util.Collection;
import static com.google.common.base.Preconditions.checkNotNull;
public final class OpticalPathIntent extends Intent {
private final ConnectPoint src;
private final ConnectPoint dst;
private final Path path;
public OpticalPathIntent(ApplicationId appId,
ConnectPoint src,
ConnectPoint dst,
Path path) {
super(appId, null, ImmutableSet.copyOf(path.links()),
Intent.DEFAULT_INTENT_PRIORITY);
this.src = checkNotNull(src);
this.dst = checkNotNull(dst);
this.path = checkNotNull(path);
}
protected OpticalPathIntent() {
this.src = null;
this.dst = null;
this.path = null;
}
public ConnectPoint src() {
return src;
}
public ConnectPoint dst() {
return dst;
}
public Path path() {
return path;
}
@Override
public boolean isInstallable() {
return true;
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass())
.add("id", id())
.add("appId", appId())
.add("key", key())
.add("resources", resources())
.add("ingressPort", src)
.add("egressPort", dst)
.add("path", path)
.toString();
}
public Collection<Link> requiredLinks() {
return path.links();
}
}