hiroki | 684aa2f | 2018-05-19 20:48:49 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018-present Open Networking Foundation |
| 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 | |
hiroki | f4ed521 | 2018-05-26 22:39:38 -0700 | [diff] [blame] | 17 | package org.onosproject.odtn; |
hiroki | 684aa2f | 2018-05-19 20:48:49 -0700 | [diff] [blame] | 18 | |
| 19 | import java.util.List; |
hiroki | f4ed521 | 2018-05-26 22:39:38 -0700 | [diff] [blame] | 20 | import java.util.Map; |
hiroki | 684aa2f | 2018-05-19 20:48:49 -0700 | [diff] [blame] | 21 | import java.util.NoSuchElementException; |
| 22 | import org.onosproject.net.ConnectPoint; |
| 23 | import org.onosproject.net.ElementId; |
| 24 | import org.onosproject.odtn.utils.tapi.TapiNepRef; |
| 25 | import org.onosproject.odtn.utils.tapi.TapiNodeRef; |
| 26 | |
| 27 | /** |
| 28 | * TAPI Yang object resolver. |
| 29 | * <p> |
| 30 | * This service works as TAPI Yang object cache, and provide |
| 31 | * TAPI object resolve service, e.g. TAPI Node/NodeEdgePoint/Link. |
| 32 | * This is independent with DCS and uses not DCS ModelObject directly |
| 33 | * but DCS-independent object like TapiNodeRef/TapiNepRef. |
| 34 | * This should work together with TapiDataProducer, which acts as |
| 35 | * data producer by reading TAPI modelObjects from DCS and convert them |
| 36 | * to DCS-independent objects. |
| 37 | */ |
| 38 | public interface TapiResolver { |
| 39 | |
| 40 | /** |
| 41 | * Check existence of TAPI node associated with deviceId. |
| 42 | * |
| 43 | * @param deviceId search key |
| 44 | * @return boolean |
| 45 | */ |
| 46 | boolean hasNodeRef(ElementId deviceId); |
| 47 | |
| 48 | /** |
| 49 | * Check existence of TAPI nep associated with ConnectPoint. |
| 50 | * |
| 51 | * @param cp search key |
| 52 | * @return TapiNepRef |
| 53 | */ |
| 54 | boolean hasNepRef(ConnectPoint cp); |
| 55 | |
| 56 | /** |
| 57 | * Check existence of TAPI nep associated with TAPI sipId. |
| 58 | * |
| 59 | * @param sipId search key |
| 60 | * @return TapiNepRef |
| 61 | */ |
| 62 | boolean hasNepRef(String sipId); |
| 63 | |
| 64 | /** |
| 65 | * Resolve TAPI node associated with deviceId. |
| 66 | * |
| 67 | * @param deviceId search key |
| 68 | * @return TapiNodeRef |
| 69 | * @throws NoSuchElementException if target not found |
| 70 | */ |
| 71 | TapiNodeRef getNodeRef(ElementId deviceId); |
| 72 | |
| 73 | /** |
hiroki | f4ed521 | 2018-05-26 22:39:38 -0700 | [diff] [blame] | 74 | * Resolve TAPI node with Node unique keys. |
| 75 | * |
| 76 | * @param nodeRef Node reference object which has node unique keys. |
| 77 | * @return TapiNodeRef |
| 78 | * @throws NoSuchElementException if target not found |
| 79 | */ |
| 80 | TapiNodeRef getNodeRef(TapiNodeRef nodeRef); |
| 81 | |
| 82 | /** |
hiroki | 684aa2f | 2018-05-19 20:48:49 -0700 | [diff] [blame] | 83 | * Get all NodeRefs. |
| 84 | * |
hiroki | f4ed521 | 2018-05-26 22:39:38 -0700 | [diff] [blame] | 85 | * @return List of all NodeRefs |
hiroki | 684aa2f | 2018-05-19 20:48:49 -0700 | [diff] [blame] | 86 | */ |
| 87 | List<TapiNodeRef> getNodeRefs(); |
| 88 | |
| 89 | /** |
hiroki | f4ed521 | 2018-05-26 22:39:38 -0700 | [diff] [blame] | 90 | * Apply filter and get filtered NodeRefs. |
| 91 | * |
| 92 | * @param filter key value map for filter |
| 93 | * @return List of filtered NodeRefs, which matches all of {@code filter} |
| 94 | */ |
| 95 | List<TapiNodeRef> getNodeRefs(Map<String, String> filter); |
| 96 | |
| 97 | /** |
| 98 | * Resolve TAPI nep with Nep unique keys. |
| 99 | * |
| 100 | * @param nepRef Nep reference object which has Nep unique keys. |
| 101 | * @return TapiNepRef |
| 102 | * @throws NoSuchElementException if target not found |
| 103 | */ |
| 104 | TapiNepRef getNepRef(TapiNepRef nepRef); |
| 105 | |
| 106 | /** |
hiroki | 684aa2f | 2018-05-19 20:48:49 -0700 | [diff] [blame] | 107 | * Resolve TAPI nep associated with ConnectPoint. |
| 108 | * |
| 109 | * @param cp search key |
| 110 | * @return TapiNepRef |
| 111 | * @throws NoSuchElementException if target not found |
| 112 | */ |
| 113 | TapiNepRef getNepRef(ConnectPoint cp); |
| 114 | |
| 115 | /** |
| 116 | * Resolve TAPI nep associated with TAPI sipId. |
| 117 | * |
| 118 | * @param sipId search key |
| 119 | * @return TapiNepRef |
| 120 | * @throws NoSuchElementException if target not found |
| 121 | */ |
| 122 | TapiNepRef getNepRef(String sipId); |
| 123 | |
| 124 | /** |
| 125 | * Get all NepRefs. |
| 126 | * |
hiroki | f4ed521 | 2018-05-26 22:39:38 -0700 | [diff] [blame] | 127 | * @return List of all NepRefs |
hiroki | 684aa2f | 2018-05-19 20:48:49 -0700 | [diff] [blame] | 128 | */ |
| 129 | List<TapiNepRef> getNepRefs(); |
| 130 | |
| 131 | /** |
hiroki | f4ed521 | 2018-05-26 22:39:38 -0700 | [diff] [blame] | 132 | * Apply filter and get filtered NepRefs. |
| 133 | * |
| 134 | * @param filter key value map for filter |
| 135 | * @return List of filtered NepRefs, which matches all of {@code filter} |
| 136 | */ |
| 137 | List<TapiNepRef> getNepRefs(Map<String, String> filter); |
| 138 | |
| 139 | /** |
hiroki | 684aa2f | 2018-05-19 20:48:49 -0700 | [diff] [blame] | 140 | * Inform the cache is already got dirty and let it update cache. |
| 141 | * The cache update process is conducted when next resolve request |
| 142 | * (hasXXX or getXXX) comes. |
| 143 | */ |
| 144 | void makeDirty(); |
| 145 | |
| 146 | } |