blob: 6c7ffd292cc33efae5d1e30f229109eec7a40d44 [file] [log] [blame]
Michele Santuari4b6019e2014-12-19 11:31:45 +01001package org.onosproject.net.intent;
2
3import static com.google.common.base.Preconditions.checkNotNull;
4
5import java.util.Collections;
6import java.util.List;
7import java.util.Optional;
8
9
10import org.onlab.packet.MplsLabel;
11import org.onosproject.core.ApplicationId;
12import org.onosproject.net.Path;
13import org.onosproject.net.flow.TrafficSelector;
14import org.onosproject.net.flow.TrafficTreatment;
15
16
17/**
18 * Abstraction of explicit MPLS label-switched path.
19 */
20
21public class MplsPathIntent extends PathIntent {
22
23 private Optional<MplsLabel> ingressLabel;
24 private Optional<MplsLabel> egressLabel;
25
26 /**
27 * Creates a new point-to-point intent with the supplied ingress/egress
28 * ports and using the specified explicit path.
29 *
30 * @param appId application identifier
31 * @param selector traffic selector
32 * @param treatment treatment
33 * @param path traversed links
34 * @param ingressLabel MPLS egress label
35 * @param egressLabel MPLS ingress label
36 * @throws NullPointerException {@code path} is null
37 */
38 public MplsPathIntent(ApplicationId appId, TrafficSelector selector,
39 TrafficTreatment treatment, Path path, Optional<MplsLabel> ingressLabel,
40 Optional<MplsLabel> egressLabel) {
41 this(appId, selector, treatment, path, ingressLabel, egressLabel,
42 Collections.emptyList());
43
44 }
45
46 /**
47 * Creates a new point-to-point intent with the supplied ingress/egress
48 * ports and using the specified explicit path.
49 *
50 * @param appId application identifier
51 * @param selector traffic selector
52 * @param treatment treatment
53 * @param path traversed links
54 * @param ingressLabel MPLS egress label
55 * @param egressLabel MPLS ingress label
56 * @param constraints optional list of constraints
57 * @throws NullPointerException {@code path} is null
58 */
59 public MplsPathIntent(ApplicationId appId, TrafficSelector selector,
60 TrafficTreatment treatment, Path path, Optional<MplsLabel> ingressLabel,
61 Optional<MplsLabel> egressLabel, List<Constraint> constraints) {
62 super(appId, selector, treatment, path, constraints);
63
64 checkNotNull(ingressLabel);
65 checkNotNull(egressLabel);
66 this.ingressLabel = ingressLabel;
67 this.egressLabel = egressLabel;
68 }
69
70 /**
71 * Returns the MPLS label which the ingress traffic should tagged.
72 *
73 * @return ingress MPLS label
74 */
75 public Optional<MplsLabel> ingressLabel() {
76 return ingressLabel;
77 }
78
79 /**
80 * Returns the MPLS label which the egress traffic should tagged.
81 *
82 * @return egress MPLS label
83 */
84 public Optional<MplsLabel> egressLabel() {
85 return egressLabel;
86 }
87
88}