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.NetworkTunnelId; |
| 21 | import org.onosproject.net.ConnectPoint; |
| 22 | |
| 23 | /** |
| 24 | * A variant of intent resource specialized for use on the inter-domain level. It contains a higher level path. |
| 25 | */ |
| 26 | public class NetworkIntentResource extends IntentResource { |
| 27 | |
| 28 | private final org.onlab.graph.Path<DomainVertex, DomainEdge> netPath; |
| 29 | |
| 30 | private NetworkTunnelId networkTunnelId; |
| 31 | |
| 32 | /** |
| 33 | * Constructor for a network intent resource. |
| 34 | * |
| 35 | * @param primitive the primitive associated with this resource |
| 36 | * @param networkTunnelId the id of this tunnel (used as a sorting mechanism) |
| 37 | * @param appId the id of the application which created this tunnel |
| 38 | * @param ingress the fist connect point associated with this tunnel (order is irrelevant as long as it is |
| 39 | * consistent with the path) |
| 40 | * @param egress the second connect point associated with this tunnel (order is irrelevant as long as it is |
| 41 | * consistent with the path) |
| 42 | * @param path the path followed through the graph of domain vertices and domain edges |
| 43 | */ |
| 44 | public NetworkIntentResource(IntentPrimitive primitive, NetworkTunnelId networkTunnelId, ApplicationId appId, |
| 45 | ConnectPoint ingress, ConnectPoint egress, |
| 46 | org.onlab.graph.Path<DomainVertex, DomainEdge> path) { |
| 47 | super(primitive, appId, ingress, egress); |
| 48 | |
| 49 | this.networkTunnelId = networkTunnelId; |
| 50 | this.netPath = path; |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * Returns the network path associated with this resource at creation. |
| 55 | * |
| 56 | * @return this resource's network lever path or if this resource backs a domain level tunnel then null. |
| 57 | */ |
| 58 | public org.onlab.graph.Path<DomainVertex, DomainEdge> path() { |
| 59 | return netPath; |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * Returns ths network ID associated with this network tunnel at creation. |
| 64 | * |
| 65 | * @return thsi resource's tunnel ID. |
| 66 | */ |
| 67 | public NetworkTunnelId tunnelId() { |
| 68 | return this.networkTunnelId; |
| 69 | } |
| 70 | } |