Committed by
Gerrit Code Review
[ONOS-3116] Implementation of Flow classifier Id for service function chain.
Change-Id: Ia696b8042281050e50d8ba5c34b2f1d6db5cc856
Showing
1 changed file
with
72 additions
and
0 deletions
| 1 | +/* | ||
| 2 | + * Copyright 2015 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 | + */ | ||
| 16 | +package org.onosproject.vtnrsc; | ||
| 17 | + | ||
| 18 | +import java.util.Objects; | ||
| 19 | +import java.util.UUID; | ||
| 20 | + | ||
| 21 | +import com.google.common.base.MoreObjects; | ||
| 22 | + | ||
| 23 | +/** | ||
| 24 | + * Flow classification identifier. | ||
| 25 | + */ | ||
| 26 | +public final class FlowClassifierId { | ||
| 27 | + | ||
| 28 | + private final UUID flowClassifierId; | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * Constructor to create flow classifier id. | ||
| 32 | + * | ||
| 33 | + * @param flowClassifierId flow classifier id. | ||
| 34 | + */ | ||
| 35 | + private FlowClassifierId(final UUID flowClassifierId) { | ||
| 36 | + this.flowClassifierId = flowClassifierId; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * Returns new flow classifier id. | ||
| 41 | + * | ||
| 42 | + * @param flowClassifierId flow classifier id | ||
| 43 | + * @return new flow classifier id | ||
| 44 | + */ | ||
| 45 | + public static FlowClassifierId flowClassifierId(final UUID flowClassifierId) { | ||
| 46 | + return new FlowClassifierId(flowClassifierId); | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + @Override | ||
| 50 | + public int hashCode() { | ||
| 51 | + return Objects.hashCode(this.flowClassifierId); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + @Override | ||
| 55 | + public boolean equals(Object obj) { | ||
| 56 | + if (this == obj) { | ||
| 57 | + return true; | ||
| 58 | + } | ||
| 59 | + if (obj instanceof FlowClassifierId) { | ||
| 60 | + final FlowClassifierId other = (FlowClassifierId) obj; | ||
| 61 | + return Objects.equals(this.flowClassifierId, other.flowClassifierId); | ||
| 62 | + } | ||
| 63 | + return false; | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + @Override | ||
| 67 | + public String toString() { | ||
| 68 | + return MoreObjects.toStringHelper(getClass()) | ||
| 69 | + .add("FlowClassifierId", flowClassifierId) | ||
| 70 | + .toString(); | ||
| 71 | + } | ||
| 72 | +} |
-
Please register or login to post a comment