blob: 2c2f271bbdd6666bb3fc36c70f416990ac22ff58 [file] [log] [blame]
hiroki684aa2f2018-05-19 20:48:49 -07001/*
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
hirokif4ed5212018-05-26 22:39:38 -070017package org.onosproject.odtn;
hiroki684aa2f2018-05-19 20:48:49 -070018
19import java.util.List;
hirokif4ed5212018-05-26 22:39:38 -070020import java.util.Map;
hiroki684aa2f2018-05-19 20:48:49 -070021import java.util.NoSuchElementException;
22import org.onosproject.net.ConnectPoint;
23import org.onosproject.net.ElementId;
24import org.onosproject.odtn.utils.tapi.TapiNepRef;
25import 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 */
38public 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 /**
hirokif4ed5212018-05-26 22:39:38 -070074 * 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 /**
hiroki684aa2f2018-05-19 20:48:49 -070083 * Get all NodeRefs.
84 *
hirokif4ed5212018-05-26 22:39:38 -070085 * @return List of all NodeRefs
hiroki684aa2f2018-05-19 20:48:49 -070086 */
87 List<TapiNodeRef> getNodeRefs();
88
89 /**
hirokif4ed5212018-05-26 22:39:38 -070090 * 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 /**
hiroki684aa2f2018-05-19 20:48:49 -0700107 * 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 *
hirokif4ed5212018-05-26 22:39:38 -0700127 * @return List of all NepRefs
hiroki684aa2f2018-05-19 20:48:49 -0700128 */
129 List<TapiNepRef> getNepRefs();
130
131 /**
hirokif4ed5212018-05-26 22:39:38 -0700132 * 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 /**
hiroki684aa2f2018-05-19 20:48:49 -0700140 * 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}