ONOS-631 #Initial MPLS intent implementation
Change-Id: I6f906b953f06f395cc67e612648802e333c0e581
diff --git a/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficSelector.java b/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficSelector.java
index f3f3bf8..9ce3186 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficSelector.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficSelector.java
@@ -26,6 +26,7 @@
import org.onlab.packet.IpPrefix;
import org.onlab.packet.Ip6Address;
import org.onlab.packet.MacAddress;
+import org.onlab.packet.MplsLabel;
import org.onlab.packet.VlanId;
import com.google.common.base.MoreObjects;
@@ -275,7 +276,7 @@
}
@Override
- public Builder matchMplsLabel(Integer mplsLabel) {
+ public Builder matchMplsLabel(MplsLabel mplsLabel) {
return add(Criteria.matchMplsLabel(mplsLabel));
}
diff --git a/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficTreatment.java b/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficTreatment.java
index 6b5af75..37dcd06 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficTreatment.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficTreatment.java
@@ -17,8 +17,10 @@
import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableList;
+
import org.onlab.packet.IpAddress;
import org.onlab.packet.MacAddress;
+import org.onlab.packet.MplsLabel;
import org.onlab.packet.VlanId;
import org.onosproject.core.GroupId;
import org.onosproject.net.PortNumber;
@@ -222,12 +224,12 @@
}
@Override
- public Builder popMpls(short etherType) {
+ public Builder popMpls(Short etherType) {
return add(Instructions.popMpls(etherType));
}
@Override
- public Builder setMpls(Integer mplsLabel) {
+ public Builder setMpls(MplsLabel mplsLabel) {
return add(Instructions.modMplsLabel(mplsLabel));
}
diff --git a/core/api/src/main/java/org/onosproject/net/flow/TrafficSelector.java b/core/api/src/main/java/org/onosproject/net/flow/TrafficSelector.java
index 7d31b08..533e2f5 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/TrafficSelector.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/TrafficSelector.java
@@ -22,6 +22,7 @@
import org.onlab.packet.IpPrefix;
import org.onlab.packet.Ip6Address;
import org.onlab.packet.MacAddress;
+import org.onlab.packet.MplsLabel;
import org.onlab.packet.VlanId;
/**
@@ -297,7 +298,7 @@
* @param mplsLabel a MPLS label.
* @return a selection builder
*/
- public Builder matchMplsLabel(Integer mplsLabel);
+ public Builder matchMplsLabel(MplsLabel mplsLabel);
/**
* Matches on IPv6 Extension Header pseudo-field fiags.
diff --git a/core/api/src/main/java/org/onosproject/net/flow/TrafficTreatment.java b/core/api/src/main/java/org/onosproject/net/flow/TrafficTreatment.java
index 98cb3b2..bfb8f2e 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/TrafficTreatment.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/TrafficTreatment.java
@@ -19,9 +19,11 @@
import org.onosproject.core.GroupId;
import org.onosproject.net.PortNumber;
+import org.onosproject.net.flow.DefaultTrafficTreatment.Builder;
import org.onosproject.net.flow.instructions.Instruction;
import org.onlab.packet.IpAddress;
import org.onlab.packet.MacAddress;
+import org.onlab.packet.MplsLabel;
import org.onlab.packet.VlanId;
/**
@@ -155,12 +157,12 @@
public Builder popMpls();
/**
- * Pops MPLS ether type.
+ * Pops MPLS ether type and set the new ethertype.
*
- * @param ethType Ethernet type to set
+ * @param etherType an ether type
* @return a treatment builder.
*/
- public Builder popMpls(short ethType);
+ public Builder popMpls(Short etherType);
/**
* Sets the mpls label.
@@ -168,7 +170,7 @@
* @param mplsLabel MPLS label.
* @return a treatment builder.
*/
- public Builder setMpls(Integer mplsLabel);
+ public Builder setMpls(MplsLabel mplsLabel);
/**
* Decrement MPLS TTL.
@@ -199,6 +201,8 @@
* @return traffic treatment
*/
TrafficTreatment build();
+
+
}
}
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/Criteria.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/Criteria.java
index 34893a4..1eff64b 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/Criteria.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/Criteria.java
@@ -18,11 +18,13 @@
import static com.google.common.base.MoreObjects.toStringHelper;
import java.util.Objects;
+
import org.onosproject.net.PortNumber;
import org.onosproject.net.flow.criteria.Criterion.Type;
import org.onlab.packet.IpPrefix;
import org.onlab.packet.Ip6Address;
import org.onlab.packet.MacAddress;
+import org.onlab.packet.MplsLabel;
import org.onlab.packet.VlanId;
/**
@@ -338,7 +340,7 @@
* @param mplsLabel MPLS label (20 bits)
* @return match criterion
*/
- public static Criterion matchMplsLabel(int mplsLabel) {
+ public static Criterion matchMplsLabel(MplsLabel mplsLabel) {
return new MplsCriterion(mplsLabel);
}
@@ -1510,15 +1512,10 @@
*/
public static final class MplsCriterion implements Criterion {
private static final int MASK = 0xfffff;
- private final int mplsLabel; // MPLS label: 20 bits
+ private final MplsLabel mplsLabel;
- /**
- * Constructor.
- *
- * @param mplsLabel the MPLS label to match (20 bits)
- */
- public MplsCriterion(int mplsLabel) {
- this.mplsLabel = mplsLabel & MASK;
+ public MplsCriterion(MplsLabel mplsLabel) {
+ this.mplsLabel = mplsLabel;
}
@Override
@@ -1526,19 +1523,14 @@
return Type.MPLS_LABEL;
}
- /**
- * Gets the MPLS label to match.
- *
- * @return the MPLS label to match (20 bits)
- */
- public int label() {
+ public MplsLabel label() {
return mplsLabel;
}
@Override
public String toString() {
return toStringHelper(type().toString())
- .add("label", Long.toHexString(mplsLabel)).toString();
+ .add("mpls", mplsLabel).toString();
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java b/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java
index 3838cdf..09ec536 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java
@@ -35,6 +35,7 @@
import org.onlab.packet.Ethernet;
import org.onlab.packet.IpAddress;
import org.onlab.packet.MacAddress;
+import org.onlab.packet.MplsLabel;
import org.onlab.packet.VlanId;
/**
@@ -132,7 +133,7 @@
* @param mplsLabel to set.
* @return a L2 Modification
*/
- public static L2ModificationInstruction modMplsLabel(Integer mplsLabel) {
+ public static L2ModificationInstruction modMplsLabel(MplsLabel mplsLabel) {
checkNotNull(mplsLabel, "MPLS label cannot be null");
return new ModMplsLabelInstruction(mplsLabel);
}
diff --git a/core/api/src/main/java/org/onosproject/net/flow/instructions/L2ModificationInstruction.java b/core/api/src/main/java/org/onosproject/net/flow/instructions/L2ModificationInstruction.java
index 723bbe6..6147551 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/instructions/L2ModificationInstruction.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/instructions/L2ModificationInstruction.java
@@ -20,6 +20,7 @@
import java.util.Objects;
import org.onlab.packet.MacAddress;
+import org.onlab.packet.MplsLabel;
import org.onlab.packet.VlanId;
/**
@@ -287,14 +288,14 @@
public static final class ModMplsLabelInstruction extends
L2ModificationInstruction {
- private final Integer mplsLabel;
+ private final MplsLabel mplsLabel;
- public ModMplsLabelInstruction(Integer mplsLabel) {
+ public ModMplsLabelInstruction(MplsLabel mplsLabel) {
this.mplsLabel = mplsLabel;
}
public Integer label() {
- return mplsLabel;
+ return mplsLabel.toInt();
}
@Override
@@ -304,8 +305,8 @@
@Override
public String toString() {
- return toStringHelper(subtype().toString())
- .add("mpls", mplsLabel.intValue()).toString();
+ return toStringHelper(type().toString())
+ .add("mpls", mplsLabel).toString();
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/intent/MplsIntent.java b/core/api/src/main/java/org/onosproject/net/intent/MplsIntent.java
new file mode 100644
index 0000000..22793ae
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/intent/MplsIntent.java
@@ -0,0 +1,159 @@
+package org.onosproject.net.intent;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Optional;
+
+import org.onlab.packet.MplsLabel;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.Link;
+import org.onosproject.net.flow.TrafficSelector;
+import org.onosproject.net.flow.TrafficTreatment;
+import org.onosproject.net.intent.constraint.LinkTypeConstraint;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.collect.ImmutableList;
+
+
+/**
+ * Abstraction of MPLS label-switched connectivity.
+ */
+public class MplsIntent extends ConnectivityIntent {
+
+ private final ConnectPoint ingressPoint;
+ private final Optional<MplsLabel> ingressLabel;
+ private final ConnectPoint egressPoint;
+ private final Optional<MplsLabel> egressLabel;
+
+ /**
+ * Creates a new MPLS intent with the supplied ingress/egress
+ * ports and labels and with built-in link type constraint to avoid optical links.
+ *
+ * @param appId application identifier
+ * @param selector traffic selector
+ * @param treatment treatment
+ * @param ingressPoint ingress port
+ * @param ingressLabel ingress MPLS label
+ * @param egressPoint egress port
+ * @param egressLabel egress MPLS label
+ * @throws NullPointerException if {@code ingressPoint} or {@code egressPoints} is null.
+ */
+ public MplsIntent(ApplicationId appId, TrafficSelector selector,
+ TrafficTreatment treatment,
+ ConnectPoint ingressPoint,
+ Optional<MplsLabel> ingressLabel,
+ ConnectPoint egressPoint,
+ Optional<MplsLabel> egressLabel) {
+ this(appId, selector, treatment, ingressPoint, ingressLabel, egressPoint, egressLabel,
+ ImmutableList.of(new LinkTypeConstraint(false, Link.Type.OPTICAL)));
+ }
+
+ /**
+ * Creates a new point-to-point intent with the supplied ingress/egress
+ * ports, labels and constraints.
+ *
+ * @param appId application identifier
+ * @param selector traffic selector
+ * @param treatment treatment
+ * @param ingressPoint ingress port
+ * @param ingressLabel ingress MPLS label
+ * @param egressPoint egress port
+ * @param egressLabel egress MPLS label
+ * @param constraints optional list of constraints
+ * @throws NullPointerException if {@code ingressPoint} or {@code egressPoints} is null.
+ */
+ public MplsIntent(ApplicationId appId, TrafficSelector selector,
+ TrafficTreatment treatment,
+ ConnectPoint ingressPoint,
+ Optional<MplsLabel> ingressLabel,
+ ConnectPoint egressPoint,
+ Optional<MplsLabel> egressLabel,
+ List<Constraint> constraints) {
+
+ super(appId, Collections.emptyList(), selector, treatment, constraints);
+
+ checkNotNull(ingressPoint);
+ checkNotNull(egressPoint);
+ checkArgument(!ingressPoint.equals(egressPoint),
+ "ingress and egress should be different (ingress: %s, egress: %s)", ingressPoint, egressPoint);
+ checkNotNull(ingressLabel);
+ checkNotNull(egressLabel);
+ this.ingressPoint = ingressPoint;
+ this.ingressLabel = ingressLabel;
+ this.egressPoint = egressPoint;
+ this.egressLabel = egressLabel;
+
+ }
+
+ /**
+ * Constructor for serializer.
+ */
+ protected MplsIntent() {
+ super();
+ this.ingressPoint = null;
+ this.ingressLabel = null;
+ this.egressPoint = null;
+ this.egressLabel = null;
+
+ }
+
+ /**
+ * Returns the port on which the ingress traffic should be connected to
+ * the egress.
+ *
+ * @return ingress switch port
+ */
+ public ConnectPoint ingressPoint() {
+ return ingressPoint;
+ }
+
+ /**
+ * Returns the port on which the traffic should egress.
+ *
+ * @return egress switch port
+ */
+ public ConnectPoint egressPoint() {
+ return egressPoint;
+ }
+
+
+ /**
+ * Returns the MPLS label which the ingress traffic should tagged.
+ *
+ * @return ingress MPLS label
+ */
+ public Optional<MplsLabel> ingressLabel() {
+ return ingressLabel;
+ }
+
+ /**
+ * Returns the MPLS label which the egress traffic should tagged.
+ *
+ * @return egress MPLS label
+ */
+ public Optional<MplsLabel> egressLabel() {
+ return egressLabel;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(getClass())
+ .add("id", id())
+ .add("appId", appId())
+ .add("selector", selector())
+ .add("treatment", treatment())
+ .add("ingressPoint", ingressPoint)
+ .add("ingressLabel", ingressLabel)
+ .add("egressPoint", egressPoint)
+ .add("egressLabel", egressLabel)
+ .add("constraints", constraints())
+ .toString();
+ }
+
+
+
+}
diff --git a/core/api/src/main/java/org/onosproject/net/intent/MplsPathIntent.java b/core/api/src/main/java/org/onosproject/net/intent/MplsPathIntent.java
new file mode 100644
index 0000000..6c7ffd2
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/intent/MplsPathIntent.java
@@ -0,0 +1,88 @@
+package org.onosproject.net.intent;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Optional;
+
+
+import org.onlab.packet.MplsLabel;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.net.Path;
+import org.onosproject.net.flow.TrafficSelector;
+import org.onosproject.net.flow.TrafficTreatment;
+
+
+/**
+ * Abstraction of explicit MPLS label-switched path.
+ */
+
+public class MplsPathIntent extends PathIntent {
+
+ private Optional<MplsLabel> ingressLabel;
+ private Optional<MplsLabel> egressLabel;
+
+ /**
+ * Creates a new point-to-point intent with the supplied ingress/egress
+ * ports and using the specified explicit path.
+ *
+ * @param appId application identifier
+ * @param selector traffic selector
+ * @param treatment treatment
+ * @param path traversed links
+ * @param ingressLabel MPLS egress label
+ * @param egressLabel MPLS ingress label
+ * @throws NullPointerException {@code path} is null
+ */
+ public MplsPathIntent(ApplicationId appId, TrafficSelector selector,
+ TrafficTreatment treatment, Path path, Optional<MplsLabel> ingressLabel,
+ Optional<MplsLabel> egressLabel) {
+ this(appId, selector, treatment, path, ingressLabel, egressLabel,
+ Collections.emptyList());
+
+ }
+
+ /**
+ * Creates a new point-to-point intent with the supplied ingress/egress
+ * ports and using the specified explicit path.
+ *
+ * @param appId application identifier
+ * @param selector traffic selector
+ * @param treatment treatment
+ * @param path traversed links
+ * @param ingressLabel MPLS egress label
+ * @param egressLabel MPLS ingress label
+ * @param constraints optional list of constraints
+ * @throws NullPointerException {@code path} is null
+ */
+ public MplsPathIntent(ApplicationId appId, TrafficSelector selector,
+ TrafficTreatment treatment, Path path, Optional<MplsLabel> ingressLabel,
+ Optional<MplsLabel> egressLabel, List<Constraint> constraints) {
+ super(appId, selector, treatment, path, constraints);
+
+ checkNotNull(ingressLabel);
+ checkNotNull(egressLabel);
+ this.ingressLabel = ingressLabel;
+ this.egressLabel = egressLabel;
+ }
+
+ /**
+ * Returns the MPLS label which the ingress traffic should tagged.
+ *
+ * @return ingress MPLS label
+ */
+ public Optional<MplsLabel> ingressLabel() {
+ return ingressLabel;
+ }
+
+ /**
+ * Returns the MPLS label which the egress traffic should tagged.
+ *
+ * @return egress MPLS label
+ */
+ public Optional<MplsLabel> egressLabel() {
+ return egressLabel;
+ }
+
+}
diff --git a/core/api/src/main/java/org/onosproject/net/resource/DefaultLinkResourceRequest.java b/core/api/src/main/java/org/onosproject/net/resource/DefaultLinkResourceRequest.java
index f4169de..bab3135 100644
--- a/core/api/src/main/java/org/onosproject/net/resource/DefaultLinkResourceRequest.java
+++ b/core/api/src/main/java/org/onosproject/net/resource/DefaultLinkResourceRequest.java
@@ -117,6 +117,17 @@
}
/**
+ * Adds Mpls request.
+ *
+ * @return self
+ */
+ @Override
+ public Builder addMplsRequest() {
+ resources.add(new MplsLabelResourceRequest());
+ return this;
+ }
+
+ /**
* Adds bandwidth request with bandwidth value.
*
* @param bandwidth bandwidth value to be requested
diff --git a/core/api/src/main/java/org/onosproject/net/resource/LinkResourceRequest.java b/core/api/src/main/java/org/onosproject/net/resource/LinkResourceRequest.java
index 1172401..7313266 100644
--- a/core/api/src/main/java/org/onosproject/net/resource/LinkResourceRequest.java
+++ b/core/api/src/main/java/org/onosproject/net/resource/LinkResourceRequest.java
@@ -60,6 +60,13 @@
public Builder addLambdaRequest();
/**
+ * Adds MPLS request.
+ *
+ * @return self
+ */
+ public Builder addMplsRequest();
+
+ /**
* Adds bandwidth request with bandwidth value.
*
* @param bandwidth bandwidth value to be requested
diff --git a/core/api/src/main/java/org/onosproject/net/resource/MplsLabel.java b/core/api/src/main/java/org/onosproject/net/resource/MplsLabel.java
new file mode 100644
index 0000000..7ef4096
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/resource/MplsLabel.java
@@ -0,0 +1,75 @@
+/*
+ * 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.resource;
+
+import java.util.Objects;
+
+/**
+ * Representation of MPLS label resource.
+ */
+public final class MplsLabel extends LinkResource {
+
+ private final org.onlab.packet.MplsLabel mplsLabel;
+
+
+ /**
+ * Creates a new instance with given MPLS label.
+ *
+ * @param mplsLabel MPLS Label value to be assigned
+ */
+ public MplsLabel(int mplsLabel) {
+ this.mplsLabel = org.onlab.packet.MplsLabel.mplsLabel(mplsLabel);
+ }
+
+ /**
+ * Creates a new instance with given MPLS label.
+ *
+ * @param mplsLabel mplsLabel value to be assigned
+ * @return {@link MplsLabel} instance with given bandwidth
+ */
+ public static MplsLabel valueOf(int mplsLabel) {
+ return new MplsLabel(mplsLabel);
+ }
+
+ /**
+ * Returns MPLS Label as an MPLS Label Object.
+ *
+ * @return MPLS label as an MPLS Label Object.
+ */
+ public org.onlab.packet.MplsLabel label() {
+ return mplsLabel;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof MplsLabel) {
+ MplsLabel that = (MplsLabel) obj;
+ return Objects.equals(this.mplsLabel, that.mplsLabel);
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(this.mplsLabel);
+ }
+
+ @Override
+ public String toString() {
+ return String.valueOf(this.mplsLabel);
+ }
+}
diff --git a/core/api/src/main/java/org/onosproject/net/resource/MplsLabelResourceAllocation.java b/core/api/src/main/java/org/onosproject/net/resource/MplsLabelResourceAllocation.java
new file mode 100644
index 0000000..6fa0a04
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/resource/MplsLabelResourceAllocation.java
@@ -0,0 +1,77 @@
+ /*
+ * 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.resource;
+
+import com.google.common.base.MoreObjects;
+
+import java.util.Objects;
+
+/**
+ * Representation of allocated MPLS label resource.
+ */
+public class MplsLabelResourceAllocation extends MplsLabelResourceRequest
+ implements ResourceAllocation {
+ private final MplsLabel mplsLabel;
+
+ @Override
+ public ResourceType type() {
+ return ResourceType.MPLS_LABEL;
+ }
+
+ /**
+ * Creates a new {@link MplsLabelResourceAllocation} with {@link MplsLabel}
+ * object.
+ *
+ * @param mplsLabel allocated MPLS Label
+ */
+ public MplsLabelResourceAllocation(MplsLabel mplsLabel) {
+ this.mplsLabel = mplsLabel;
+ }
+
+ /**
+ * Returns the MPLS label resource.
+ *
+ * @return the MPLS label resource
+ */
+ public MplsLabel mplsLabel() {
+ return mplsLabel;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(mplsLabel);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null || getClass() != obj.getClass()) {
+ return false;
+ }
+ final MplsLabelResourceAllocation other = (MplsLabelResourceAllocation) obj;
+ return Objects.equals(this.mplsLabel, other.mplsLabel);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("mplsLabel", mplsLabel)
+ .toString();
+ }
+}
diff --git a/core/api/src/main/java/org/onosproject/net/resource/MplsLabelResourceRequest.java b/core/api/src/main/java/org/onosproject/net/resource/MplsLabelResourceRequest.java
new file mode 100644
index 0000000..e0a69a0
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/resource/MplsLabelResourceRequest.java
@@ -0,0 +1,35 @@
+/*
+ * 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.resource;
+
+import com.google.common.base.MoreObjects;
+
+/**
+ * Representation of a request for lambda resource.
+ */
+public class MplsLabelResourceRequest implements ResourceRequest {
+
+ @Override
+ public ResourceType type() {
+ return ResourceType.MPLS_LABEL;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .toString();
+ }
+}
diff --git a/core/api/src/main/java/org/onosproject/net/resource/ResourceType.java b/core/api/src/main/java/org/onosproject/net/resource/ResourceType.java
index 1ad0dde..1b75da5 100644
--- a/core/api/src/main/java/org/onosproject/net/resource/ResourceType.java
+++ b/core/api/src/main/java/org/onosproject/net/resource/ResourceType.java
@@ -28,4 +28,9 @@
* Bandwidth resource type.
*/
BANDWIDTH,
+
+ /**
+ * MPLS label resource type.
+ */
+ MPLS_LABEL,
}