Brian O'Connor | b7baf71 | 2015-07-28 23:27:03 -0700 | [diff] [blame] | 1 | /* |
Thomas Vachuska | 52f2cd1 | 2018-11-08 21:20:04 -0800 | [diff] [blame] | 2 | * Copyright 2018-present Open Networking Foundation |
Brian O'Connor | b7baf71 | 2015-07-28 23:27:03 -0700 | [diff] [blame] | 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.incubator.net.domain; |
| 17 | |
| 18 | import com.google.common.annotations.Beta; |
Aaron Kruglikov | b4916d0 | 2015-09-08 16:22:25 -0700 | [diff] [blame] | 19 | import org.onosproject.core.ApplicationId; |
| 20 | import org.onosproject.net.ConnectPoint; |
| 21 | |
Brian O'Connor | b7baf71 | 2015-07-28 23:27:03 -0700 | [diff] [blame] | 22 | |
| 23 | /** |
| 24 | * The abstract base class for the resource that satisfies an intent primitive. |
| 25 | */ |
| 26 | @Beta |
Aaron Kruglikov | b4916d0 | 2015-09-08 16:22:25 -0700 | [diff] [blame] | 27 | public abstract class IntentResource { |
Brian O'Connor | b7baf71 | 2015-07-28 23:27:03 -0700 | [diff] [blame] | 28 | |
| 29 | private final IntentPrimitive primitive; |
Aaron Kruglikov | b4916d0 | 2015-09-08 16:22:25 -0700 | [diff] [blame] | 30 | |
| 31 | private final ApplicationId appId; |
| 32 | private final ConnectPoint ingress; |
| 33 | private final ConnectPoint egress; |
| 34 | |
| 35 | //* QUESTIONABLE ADDITIONS *// |
Brian O'Connor | b7baf71 | 2015-07-28 23:27:03 -0700 | [diff] [blame] | 36 | |
| 37 | // TODO add other common fields |
| 38 | //String ingressTag; |
| 39 | //String egressTag; |
| 40 | //etc. |
| 41 | |
Aaron Kruglikov | b4916d0 | 2015-09-08 16:22:25 -0700 | [diff] [blame] | 42 | public IntentResource(IntentPrimitive primitive, ApplicationId appId, |
| 43 | ConnectPoint ingress, ConnectPoint egress) { |
| 44 | this.appId = appId; |
| 45 | this.ingress = ingress; |
| 46 | this.egress = egress; |
Brian O'Connor | b7baf71 | 2015-07-28 23:27:03 -0700 | [diff] [blame] | 47 | this.primitive = primitive; |
| 48 | } |
| 49 | |
Aaron Kruglikov | b4916d0 | 2015-09-08 16:22:25 -0700 | [diff] [blame] | 50 | //TODO when is same package tunnelID should be of type tunnelID and netTunnelId not long. |
| 51 | |
| 52 | |
Aaron Kruglikov | c61d2d1 | 2015-09-01 11:10:48 -0700 | [diff] [blame] | 53 | /** |
Aaron Kruglikov | b4916d0 | 2015-09-08 16:22:25 -0700 | [diff] [blame] | 54 | * Returns the intent primitive associated with this resource at creation. |
Aaron Kruglikov | c61d2d1 | 2015-09-01 11:10:48 -0700 | [diff] [blame] | 55 | * |
Aaron Kruglikov | b4916d0 | 2015-09-08 16:22:25 -0700 | [diff] [blame] | 56 | * @return this resource's intent primitive. |
Aaron Kruglikov | c61d2d1 | 2015-09-01 11:10:48 -0700 | [diff] [blame] | 57 | */ |
Brian O'Connor | b7baf71 | 2015-07-28 23:27:03 -0700 | [diff] [blame] | 58 | public IntentPrimitive primitive() { |
| 59 | return primitive; |
| 60 | } |
| 61 | |
Aaron Kruglikov | c61d2d1 | 2015-09-01 11:10:48 -0700 | [diff] [blame] | 62 | /** |
Aaron Kruglikov | b4916d0 | 2015-09-08 16:22:25 -0700 | [diff] [blame] | 63 | * Returns the application ID associated with this resource at creation. |
Aaron Kruglikov | c61d2d1 | 2015-09-01 11:10:48 -0700 | [diff] [blame] | 64 | * |
Aaron Kruglikov | b4916d0 | 2015-09-08 16:22:25 -0700 | [diff] [blame] | 65 | * @return this resource's application ID. |
Aaron Kruglikov | c61d2d1 | 2015-09-01 11:10:48 -0700 | [diff] [blame] | 66 | */ |
Aaron Kruglikov | b4916d0 | 2015-09-08 16:22:25 -0700 | [diff] [blame] | 67 | public ApplicationId appId() { |
| 68 | return appId; |
Brian O'Connor | 59a9285 | 2015-07-30 19:08:24 -0700 | [diff] [blame] | 69 | } |
| 70 | |
Aaron Kruglikov | c61d2d1 | 2015-09-01 11:10:48 -0700 | [diff] [blame] | 71 | /** |
Aaron Kruglikov | b4916d0 | 2015-09-08 16:22:25 -0700 | [diff] [blame] | 72 | * Returns the ingress connect point associated with this resource at creation. |
Aaron Kruglikov | c61d2d1 | 2015-09-01 11:10:48 -0700 | [diff] [blame] | 73 | * |
Aaron Kruglikov | b4916d0 | 2015-09-08 16:22:25 -0700 | [diff] [blame] | 74 | * @return this resource's ingress connect point. |
Aaron Kruglikov | c61d2d1 | 2015-09-01 11:10:48 -0700 | [diff] [blame] | 75 | */ |
Aaron Kruglikov | b4916d0 | 2015-09-08 16:22:25 -0700 | [diff] [blame] | 76 | public ConnectPoint ingress() { |
| 77 | return ingress; |
Aaron Kruglikov | c61d2d1 | 2015-09-01 11:10:48 -0700 | [diff] [blame] | 78 | } |
| 79 | |
Aaron Kruglikov | b4916d0 | 2015-09-08 16:22:25 -0700 | [diff] [blame] | 80 | /** |
| 81 | * Returns the egress connect point associated with this resource at creation. |
| 82 | * |
| 83 | * @return this resource's connect point. |
| 84 | */ |
| 85 | public ConnectPoint egress() { |
| 86 | return egress; |
| 87 | } |
Brian O'Connor | b7baf71 | 2015-07-28 23:27:03 -0700 | [diff] [blame] | 88 | } |