blob: 65d8d6d7438a7a2a4ae8001d3e9da4c7b7a0dae0 [file] [log] [blame]
tom4c6606f2014-09-07 11:11:21 -07001package org.onlab.onos.net.link;
2
tomf5d85d42014-10-02 05:27:56 -07003import org.onlab.onos.net.AbstractDescription;
tom4c6606f2014-09-07 11:11:21 -07004import org.onlab.onos.net.ConnectPoint;
tomeadbb462014-09-07 16:10:19 -07005import org.onlab.onos.net.Link;
tomf5d85d42014-10-02 05:27:56 -07006import org.onlab.onos.net.SparseAnnotations;
tom4c6606f2014-09-07 11:11:21 -07007
8/**
9 * Default implementation of immutable link description entity.
10 */
tomf5d85d42014-10-02 05:27:56 -070011public class DefaultLinkDescription extends AbstractDescription
12 implements LinkDescription {
tom4c6606f2014-09-07 11:11:21 -070013
tomeadbb462014-09-07 16:10:19 -070014 private final ConnectPoint src;
15 private final ConnectPoint dst;
16 private final Link.Type type;
tom4c6606f2014-09-07 11:11:21 -070017
18 /**
19 * Creates a link description using the supplied information.
20 *
tomeadbb462014-09-07 16:10:19 -070021 * @param src link source
22 * @param dst link destination
23 * @param type link type
tomf5d85d42014-10-02 05:27:56 -070024 * @param annotations optional key/value annotations
tom4c6606f2014-09-07 11:11:21 -070025 */
tomf5d85d42014-10-02 05:27:56 -070026 public DefaultLinkDescription(ConnectPoint src, ConnectPoint dst,
27 Link.Type type, SparseAnnotations... annotations) {
28 super(annotations);
tom4c6606f2014-09-07 11:11:21 -070029 this.src = src;
30 this.dst = dst;
tomeadbb462014-09-07 16:10:19 -070031 this.type = type;
tom4c6606f2014-09-07 11:11:21 -070032 }
33
34 @Override
35 public ConnectPoint src() {
36 return src;
37 }
38
39 @Override
40 public ConnectPoint dst() {
41 return dst;
42 }
43
tomeadbb462014-09-07 16:10:19 -070044 @Override
45 public Link.Type type() {
tomd176fc42014-09-08 00:12:30 -070046 return type;
tomeadbb462014-09-07 16:10:19 -070047 }
48
tom4c6606f2014-09-07 11:11:21 -070049}