blob: e283f5795bd60c3c23c70da145c3ab5dd86927f6 [file] [log] [blame]
Bharat saraswalf53b29a2016-09-27 15:35:15 +05301/*
2 * Copyright 2016-present 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
17package org.onosproject.yms.app.ysr;
18
19import org.onosproject.yangutils.datamodel.YangSchemaNode;
sonu guptaeff184b2016-11-24 12:43:49 +053020import org.onosproject.yms.ysr.YangModuleIdentifier;
21import org.onosproject.yms.ysr.YangModuleLibrary;
Bharat saraswalf53b29a2016-09-27 15:35:15 +053022
23/**
24 * Abstraction of entity which provides interfaces to YANG schema registry.
25 */
26public interface YangSchemaRegistry {
27
28 /**
29 * Registers applications to YMS.
30 *
Gaurav Agrawalfcc6c192016-09-20 14:29:15 +053031 * @param managerObject application's object
sonu guptaeff184b2016-11-24 12:43:49 +053032 * @param serviceClass service class which needs to be
33 * registered
Bharat saraswalf53b29a2016-09-27 15:35:15 +053034 */
Gaurav Agrawalfcc6c192016-09-20 14:29:15 +053035 void registerApplication(Object managerObject, Class<?> serviceClass);
Bharat saraswalf53b29a2016-09-27 15:35:15 +053036
37 /**
38 * Unregisters applications to YMS.
39 *
40 * @param managerObject application's object
41 * @param serviceClass service class which needs to be unregistered
42 */
43 void unRegisterApplication(Object managerObject, Class<?> serviceClass);
44
45 /**
46 * Returns application's implementation's class object.
47 *
48 * @param yangSchemaNode application's schema node
49 * @return application's implementation's class object
50 */
51 Object getRegisteredApplication(YangSchemaNode yangSchemaNode);
52
53 /**
54 * Returns YANG schema node using schema name.
55 *
56 * @param schemaName module name.
57 * @return YANG schema node using schema name
58 */
59 YangSchemaNode getYangSchemaNodeUsingSchemaName(String schemaName);
60
61 /**
62 * Returns YANG schema nodes using application name.
63 *
64 * @param appName application's service name
65 * @return YANG schema nodes using application name
66 */
67 YangSchemaNode getYangSchemaNodeUsingAppName(String appName);
68
69 /**
70 * Returns YANG schema nodes using root interface file name.
71 *
72 * @param rootInterfaceFileName name of generated interface file
73 * for root node
74 * @return YANG schema nodes using root interface file name
75 */
76 YangSchemaNode
77 getYangSchemaNodeUsingGeneratedRootNodeInterfaceFileName(
78 String rootInterfaceFileName);
79
80 /**
81 * Returns YANG schema nodes using root op param file name.
82 *
83 * @param rootOpParamFileName name of generated op param file for root node
84 * @return YANG schema nodes using root op param file name
85 */
86 YangSchemaNode
87 getYangSchemaNodeUsingGeneratedRootNodeOpPramFileName(
88 String rootOpParamFileName);
89
90 /**
91 * Returns YANG schema node of root for notifications.
92 *
93 * @param eventSubject event subject
94 * @return YANG schema node of root for notifications
95 */
96 YangSchemaNode getRootYangSchemaNodeForNotification(String eventSubject);
97
98 /**
99 * Returns registered service class.
100 *
101 * @param schemaNode YANG schema node
Bharat saraswalf53b29a2016-09-27 15:35:15 +0530102 * @return registered service class
103 */
sonu guptaeff184b2016-11-24 12:43:49 +0530104 Class<?> getRegisteredClass(YangSchemaNode schemaNode);
105
106 /**
107 * Verifies if the manager object is already registered with notification
108 * handler.
109 *
110 * @param appObj application object
111 * @param service service class
112 * @return true if the manager object is already registered with
113 * notification handler
114 */
115 boolean verifyNotificationObject(Object appObj, Class<?> service);
116
117 /**
118 * Clears database for YSR.
119 */
120 void flushYsrData();
121
122 /**
123 * Protocols like RESTCONF, use the definitions within the YANG modules
124 * advertised by the server are used to construct an RPC operation or
125 * data resource identifier.
126 * <p>
127 * Schema Resource:
128 * The server can optionally support retrieval of the YANG modules it
129 * supports.
130 *
131 * @param moduleIdentifier module's identifier
132 * @return YANG file contents of the requested YANG module.
133 */
134 String getYangFile(YangModuleIdentifier moduleIdentifier);
135
136 /**
137 * Process module library for a registered service.
138 *
139 * @param serviceName service class name
140 * @param library YANG module library
141 */
142 void processModuleLibrary(String serviceName, YangModuleLibrary library);
Bharat saraswalf53b29a2016-09-27 15:35:15 +0530143
Bharat saraswal1b0a39a2016-12-16 16:29:02 +0530144 /**
145 * Returns YANG schema node for a given namespace while xml decoding.
146 * <p>
147 * According to rfc 6020 Xml should not have module name in it but when
148 * decoder wants to convert xml to YANG object it will need module schema
149 * which it can get only by using module name from YSR. So if YCH sends
150 * namespace of a module we can given it the schema node of module. In
151 * this case namespace should be unique.
152 * </p>
153 *
154 * @param nameSpace name space of module
155 * @return module schema node
156 */
157 YangSchemaNode getSchemaWrtNameSpace(String nameSpace);
158
Bharat saraswalf53b29a2016-09-27 15:35:15 +0530159}