Aaron Kruglikov | b4916d0 | 2015-09-08 16:22:25 -0700 | [diff] [blame] | 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 | |
| 17 | package org.onosproject.incubator.net.domain; |
| 18 | |
| 19 | import org.onosproject.core.ApplicationId; |
| 20 | import org.onosproject.incubator.net.tunnel.DomainTunnelId; |
| 21 | import org.onosproject.net.ConnectPoint; |
| 22 | import org.onosproject.net.Path; |
| 23 | |
| 24 | /** |
| 25 | * A variant of intent resource specialized for use on the intra-domain level. It contains a lower level path. |
| 26 | */ |
| 27 | public class DomainIntentResource extends IntentResource { |
| 28 | |
| 29 | private final Path domainPath; |
| 30 | |
| 31 | private final DomainTunnelId domainTunnelId; |
| 32 | |
| 33 | private final IntentDomainId intentDomainId; |
| 34 | |
| 35 | /** |
| 36 | * Constructor for a domain intent resource. |
| 37 | * |
| 38 | * @param primitive the primitive associated with this resource |
| 39 | * @param domainTunnelId the id of this tunnel (used as a sorting mechanism) |
| 40 | * @param domainId the ID of the intent domain containing this tunnel |
| 41 | * @param appId the id of the application which created this tunnel |
| 42 | * @param ingress the fist connect point associated with this tunnel (order is irrelevant as long as it is |
| 43 | * consistent with the path) |
| 44 | * @param egress the second connect point associated with this tunnel (order is irrelevant as long as it is |
| 45 | * consistent with the path) |
| 46 | * @param path the path followed through the domain |
| 47 | */ |
| 48 | public DomainIntentResource(IntentPrimitive primitive, DomainTunnelId domainTunnelId, IntentDomainId domainId, |
| 49 | ApplicationId appId, ConnectPoint ingress, ConnectPoint egress, Path path) { |
| 50 | super(primitive, appId, ingress, egress); |
| 51 | |
| 52 | this.domainPath = path; |
| 53 | this.domainTunnelId = domainTunnelId; |
| 54 | this.intentDomainId = domainId; |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Returns the domain path associated with this resource at creation. |
| 59 | * |
| 60 | * @return this resource's domain level path or if this resource backs a network tunnel then null. |
| 61 | */ |
| 62 | public Path path() { |
| 63 | return domainPath; |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * Returns the tunnel ID associated with this domain at creation. |
| 68 | * |
| 69 | * @return this resource's tunnel ID. |
| 70 | */ |
| 71 | public DomainTunnelId tunnelId() { |
| 72 | return domainTunnelId; |
| 73 | } |
| 74 | |
| 75 | /** |
| 76 | * Returns the domain ID associated with this resource at creation. |
| 77 | * |
| 78 | * @return this resource's domain ID. |
| 79 | */ |
| 80 | public IntentDomainId domainId() { |
| 81 | return intentDomainId; |
| 82 | } |
| 83 | |
| 84 | } |