Removing YANG compiler generated code dependency on config
Change-Id: I01e880ba5d61168fc21fd126dd00eeee9fb41321
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/JavaImportData.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/JavaImportData.java
index 5b53ef1..0eaf757 100644
--- a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/JavaImportData.java
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/JavaImportData.java
@@ -29,9 +29,7 @@
import static org.onosproject.yang.compiler.utils.UtilConstants.BIG_INTEGER;
import static org.onosproject.yang.compiler.utils.UtilConstants.BITSET;
import static org.onosproject.yang.compiler.utils.UtilConstants.COLLECTION_IMPORTS;
-import static org.onosproject.yang.compiler.utils.UtilConstants.CONFIG_PKG;
import static org.onosproject.yang.compiler.utils.UtilConstants.DATA_NODE;
-import static org.onosproject.yang.compiler.utils.UtilConstants.DYNAMIC_CONFIG_SERVICE;
import static org.onosproject.yang.compiler.utils.UtilConstants.EMPTY_STRING;
import static org.onosproject.yang.compiler.utils.UtilConstants.EVENT_LISTENER;
import static org.onosproject.yang.compiler.utils.UtilConstants.EXECUTORS;
@@ -59,6 +57,7 @@
import static org.onosproject.yang.compiler.utils.UtilConstants.RPC_OUTPUT_STATUS_PKG;
import static org.onosproject.yang.compiler.utils.UtilConstants.RPC_SUCCESS;
import static org.onosproject.yang.compiler.utils.UtilConstants.SET;
+import static org.onosproject.yang.compiler.utils.UtilConstants.YANG_RPC_SERVICE;
/**
* Represents that generated Java file can contain imports.
@@ -373,7 +372,7 @@
* @return import for RPC command
*/
public String getImportForRpcCommand() {
- return getImportString(CONFIG_PKG, RPC_COMMAND);
+ return getImportString(MODEL_PKG, RPC_COMMAND);
}
/**
@@ -382,7 +381,7 @@
* @return import for RPC handler
*/
public String getImportForRpcHandler() {
- return getImportString(CONFIG_PKG, RPC_HANDLER);
+ return getImportString(MODEL_PKG, RPC_HANDLER);
}
/**
@@ -391,7 +390,7 @@
* @return import for dynamic store service
*/
public String getImportForDynamicStoreService() {
- return getImportString(CONFIG_PKG, DYNAMIC_CONFIG_SERVICE);
+ return getImportString(MODEL_PKG, YANG_RPC_SERVICE);
}
/**
@@ -418,7 +417,7 @@
* @return import for RPC input
*/
public String getImportForRpcInput() {
- return getImportString(CONFIG_PKG, RPC_INPUT);
+ return getImportString(MODEL_PKG, RPC_INPUT);
}
/**
@@ -427,7 +426,7 @@
* @return import for RPC output
*/
public String getImportForRpcOutput() {
- return getImportString(CONFIG_PKG, RPC_OUTPUT);
+ return getImportString(MODEL_PKG, RPC_OUTPUT);
}
/**
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaRpcCommandFragmentFiles.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaRpcCommandFragmentFiles.java
index f714eff..3913955 100644
--- a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaRpcCommandFragmentFiles.java
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaRpcCommandFragmentFiles.java
@@ -48,7 +48,6 @@
import static org.onosproject.yang.compiler.utils.UtilConstants.DEFAULT_CAPS;
import static org.onosproject.yang.compiler.utils.UtilConstants.DEFAULT_MODEL_OBJECT_DATA;
import static org.onosproject.yang.compiler.utils.UtilConstants.DEFAULT_RESOURCE_DATA;
-import static org.onosproject.yang.compiler.utils.UtilConstants.DYNAMIC_CONFIG_SERVICE;
import static org.onosproject.yang.compiler.utils.UtilConstants.EIGHT_SPACE_INDENTATION;
import static org.onosproject.yang.compiler.utils.UtilConstants.EQUAL;
import static org.onosproject.yang.compiler.utils.UtilConstants.FOUR_SPACE_INDENTATION;
@@ -72,7 +71,6 @@
import static org.onosproject.yang.compiler.utils.UtilConstants.RPC_INPUT;
import static org.onosproject.yang.compiler.utils.UtilConstants.RPC_OUTPUT;
import static org.onosproject.yang.compiler.utils.UtilConstants.RPC_SUCCESS;
-import static org.onosproject.yang.compiler.utils.UtilConstants.RUNTIME_PKG;
import static org.onosproject.yang.compiler.utils.UtilConstants.SEMI_COLON;
import static org.onosproject.yang.compiler.utils.UtilConstants.SERVICE;
import static org.onosproject.yang.compiler.utils.UtilConstants.SIXTEEN_SPACE_INDENTATION;
@@ -82,6 +80,7 @@
import static org.onosproject.yang.compiler.utils.UtilConstants.SUPER;
import static org.onosproject.yang.compiler.utils.UtilConstants.THIS;
import static org.onosproject.yang.compiler.utils.UtilConstants.VOID;
+import static org.onosproject.yang.compiler.utils.UtilConstants.YANG_RPC_SERVICE;
import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.getJavaDocForExecuteMethod;
import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.getJavaDocForRpcCommandConstructor;
import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.getAbsolutePackagePath;
@@ -104,8 +103,7 @@
private static final String VAR_INPUT = "input";
private static final String VAR_OUTPUT = "output";
private static final String VAR_MSG_ID = "msgId";
- private static final String VAR_STORE = "store";
- private static final String VAR_STORE_SERVICE = "storeService";
+ private static final String VAR_CFG_SERVICE = "cfgService";
private static final String VAR_MODEL_CONVERTER = "modelConverter";
private static final String EXECUTE = "execute";
private static final String GET_RESOURCE_ID = "getResourceId";
@@ -120,6 +118,7 @@
private static final String ADD_DATA_NODE = "addDataNode";
private static final String ADD_MODEL_OBJECT = "addModelObject";
private static final String VAR_RESOURCE_ID = "resourceId";
+ private static final String VAR_APP_SERVICE = "appService";
@Override
public void generateJavaFile(int fileType, YangNode curNode) throws IOException {
@@ -130,7 +129,7 @@
String parentClassName = getCapitalCase(getCamelCase(
curNode.getParent().getJavaClassNameOrBuiltInType(), null));
String className = getCapitalCase(getCamelCase(
- curNode.getJavaClassNameOrBuiltInType(), null) + COMMAND);
+ curNode.getJavaClassNameOrBuiltInType(), null)) + COMMAND;
createPackage(curNode);
// add RPC input import
@@ -198,7 +197,7 @@
imports.add(getImportString(MODEL_PKG, MODEL_OBJECT_DATA));
}
if (inputNode != null) {
- imports.add(getImportString(RUNTIME_PKG, DEFAULT_RESOURCE_DATA));
+ imports.add(getImportString(MODEL_PKG, DEFAULT_RESOURCE_DATA));
}
if (outputNode != null) {
imports.add(getImportString(MODEL_PKG, DEFAULT_MODEL_OBJECT_DATA));
@@ -257,17 +256,18 @@
// parameters for constructors
Map<String, String> param = new LinkedHashMap<>();
- param.put(VAR_STORE, DYNAMIC_CONFIG_SERVICE);
+ param.put(VAR_CFG_SERVICE, YANG_RPC_SERVICE);
param.put(VAR_MODEL_CONVERTER, MODEL_CONVERTER);
- param.put(appService, getCapitalCase(appService));
+ param.put(VAR_APP_SERVICE, getCapitalCase(appService));
StringBuilder builder = new StringBuilder();
// add attributes
builder.append(getVariableDeclaration(VAR_MODEL_CONVERTER, MODEL_CONVERTER,
FOUR_SPACE_INDENTATION, PRIVATE))
- .append(getVariableDeclaration(appService, getCapitalCase(appService),
+ .append(getVariableDeclaration(VAR_APP_SERVICE, getCapitalCase(appService),
FOUR_SPACE_INDENTATION, PRIVATE))
- .append(getVariableDeclaration(VAR_STORE_SERVICE, DYNAMIC_CONFIG_SERVICE,
+ .append(getVariableDeclaration(VAR_CFG_SERVICE,
+ YANG_RPC_SERVICE,
FOUR_SPACE_INDENTATION, PRIVATE))
.append(NEW_LINE)
@@ -282,19 +282,19 @@
.append(OPEN_PARENTHESIS).append(GET_RESOURCE_ID)
.append(OPEN_PARENTHESIS).append(CLOSE_PARENTHESIS)
.append(CLOSE_PARENTHESIS).append(SEMI_COLON).append(NEW_LINE)
- .append(valueAssign(THIS + PERIOD + VAR_STORE_SERVICE, VAR_STORE,
- EIGHT_SPACE_INDENTATION))
+ .append(valueAssign(THIS + PERIOD + VAR_CFG_SERVICE,
+ VAR_CFG_SERVICE, EIGHT_SPACE_INDENTATION))
.append(valueAssign(THIS + PERIOD + VAR_MODEL_CONVERTER,
VAR_MODEL_CONVERTER,
EIGHT_SPACE_INDENTATION))
- .append(valueAssign(THIS + PERIOD + appService, appService,
- EIGHT_SPACE_INDENTATION))
+ .append(valueAssign(THIS + PERIOD + VAR_APP_SERVICE,
+ VAR_APP_SERVICE, EIGHT_SPACE_INDENTATION))
.append(FOUR_SPACE_INDENTATION).append(CLOSE_CURLY_BRACKET)
.append(NEW_LINE)
//add execute method
- .append(getRpcCommandExecuteMethod(appService, node))
+ .append(getRpcCommandExecuteMethod(node))
//add get resource id method
.append(getResourceIdMethod(node));
@@ -306,10 +306,10 @@
/**
* Returns RPC command execute method.
*
+ * @param node Yang RPC node
* @return RPC command execute method
*/
- private static String getRpcCommandExecuteMethod(String appService,
- YangNode node) {
+ private static String getRpcCommandExecuteMethod(YangNode node) {
StringBuilder builder = new StringBuilder(getOverRideString())
// execute method with only RPC input
@@ -330,7 +330,7 @@
.append(SPACE).append(VAR_MSG_ID).append(CLOSE_PARENTHESIS)
.append(SPACE).append(OPEN_CURLY_BRACKET).append(NEW_LINE)
- .append(getExecuteMethodContents(node, appService))
+ .append(getExecuteMethodContents(node))
.append(FOUR_SPACE_INDENTATION).append(CLOSE_CURLY_BRACKET)
.append(NEW_LINE);
@@ -340,6 +340,7 @@
/**
* Returns get resource id method.
*
+ * @param node YANG RPC node
* @return get resource id method
*/
private static String getResourceIdMethod(YangNode node) {
@@ -376,13 +377,13 @@
/**
* Returns execute method contents.
*
+ * @param node YANG RPC node
* @return execute method contents
*/
- private static String getExecuteMethodContents(YangNode node, String
- appService) {
+ private static String getExecuteMethodContents(YangNode node) {
StringBuilder builder = new StringBuilder();
builder.append(invokeCreateModelString(node))
- .append(invokeRpcString(node, appService))
+ .append(invokeRpcString(node))
.append(invokeCreateDataNodeString(node))
.append(createRpcOutputString(node))
.append(invokeRpcResponseString());
@@ -392,6 +393,7 @@
/**
* Returns create model for input data node statement.
*
+ * @param node YANG RPC node
* @return create model for input data node statement
*/
private static String invokeCreateModelString(YangNode node) {
@@ -413,6 +415,7 @@
/**
* Returns creating data node for output object.
*
+ * @param node YANG RPC node
* @return creating data node for output object
*/
private static String invokeCreateDataNodeString(YangNode node) {
@@ -423,10 +426,11 @@
builder.append(buildModelObjectData());
builder.append(EIGHT_SPACE_INDENTATION).append(RESOURCE_DATA)
.append(SPACE).append(VAR_OUTPUT_DATA).append(SPACE)
- .append(EQUAL).append(SPACE).append(VAR_MODEL_CONVERTER).append(PERIOD)
- .append(CREATE_DATA_NODE).append(OPEN_PARENTHESIS)
- .append(VAR_OUTPUT_MO).append(CLOSE_PARENTHESIS)
- .append(SEMI_COLON).append(NEW_LINE);
+ .append(EQUAL).append(SPACE).append(VAR_MODEL_CONVERTER)
+ .append(PERIOD).append(CREATE_DATA_NODE)
+ .append(OPEN_PARENTHESIS).append(VAR_OUTPUT_MO)
+ .append(CLOSE_PARENTHESIS).append(SEMI_COLON)
+ .append(NEW_LINE);
}
return builder.toString();
}
@@ -434,11 +438,10 @@
/**
* Returns execute method contents.
*
- * @param node YANG RPC node
- * @param appService application service name
+ * @param node YANG RPC node
* @return execute method contents
*/
- private static String invokeRpcString(YangNode node, String appService) {
+ private static String invokeRpcString(YangNode node) {
StringBuilder builder = new StringBuilder();
String rpc = getCamelCase(node.getJavaClassNameOrBuiltInType(), null);
YangNode inputNode = findRpcInput(node);
@@ -455,12 +458,12 @@
.append(outputName).append(SPACE).append(VAR_OUTPUT_OBJECT)
.append(SPACE).append(EQUAL).append(SPACE).append(OPEN_PARENTHESIS)
.append(DEFAULT_CAPS).append(outputName).append(CLOSE_PARENTHESIS)
- .append(SPACE).append(appService).append(PERIOD).append(rpc)
+ .append(SPACE).append(VAR_APP_SERVICE).append(PERIOD).append(rpc)
.append(OPEN_PARENTHESIS).append(VAR_INPUT_OBJECT).append(CLOSE_PARENTHESIS)
.append(SEMI_COLON).append(NEW_LINE);
} else if (inputNode != null && outputNode == null) {
builder.append(getInputObject(inputNode));
- builder.append(EIGHT_SPACE_INDENTATION).append(appService)
+ builder.append(EIGHT_SPACE_INDENTATION).append(VAR_APP_SERVICE)
.append(PERIOD).append(rpc).append(OPEN_PARENTHESIS)
.append(VAR_INPUT_OBJECT).append(CLOSE_PARENTHESIS)
.append(SEMI_COLON).append(NEW_LINE);
@@ -469,11 +472,11 @@
.append(outputName).append(SPACE).append(VAR_OUTPUT_OBJECT)
.append(SPACE).append(EQUAL).append(SPACE).append(OPEN_PARENTHESIS)
.append(DEFAULT_CAPS).append(outputName).append(CLOSE_PARENTHESIS)
- .append(SPACE).append(appService).append(PERIOD).append(rpc)
+ .append(SPACE).append(VAR_APP_SERVICE).append(PERIOD).append(rpc)
.append(OPEN_PARENTHESIS).append(CLOSE_PARENTHESIS).append(SEMI_COLON)
.append(NEW_LINE);
} else {
- builder.append(EIGHT_SPACE_INDENTATION).append(appService)
+ builder.append(EIGHT_SPACE_INDENTATION).append(VAR_APP_SERVICE)
.append(PERIOD).append(rpc).append(OPEN_PARENTHESIS)
.append(CLOSE_PARENTHESIS).append(SEMI_COLON)
.append(NEW_LINE);
@@ -510,7 +513,7 @@
*/
private static String invokeRpcResponseString() {
StringBuilder builder = new StringBuilder();
- builder.append(EIGHT_SPACE_INDENTATION).append(VAR_STORE_SERVICE)
+ builder.append(EIGHT_SPACE_INDENTATION).append(VAR_CFG_SERVICE)
.append(PERIOD).append(RPC_RESPONSE).append(OPEN_PARENTHESIS)
.append(VAR_MSG_ID).append(COMMA).append(SPACE)
.append(VAR_OUTPUT).append(CLOSE_PARENTHESIS).append(SEMI_COLON)
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaRpcFragmentFiles.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaRpcFragmentFiles.java
index 21e5f98..61341b0 100644
--- a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaRpcFragmentFiles.java
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/TempJavaRpcFragmentFiles.java
@@ -50,7 +50,6 @@
import static org.onosproject.yang.compiler.utils.UtilConstants.COMMAND;
import static org.onosproject.yang.compiler.utils.UtilConstants.CREATE_RPC_CMD_JAVADOC;
import static org.onosproject.yang.compiler.utils.UtilConstants.DEFAULT_RPC_HANDLER;
-import static org.onosproject.yang.compiler.utils.UtilConstants.DYNAMIC_CONFIG_SERVICE;
import static org.onosproject.yang.compiler.utils.UtilConstants.EIGHT_SPACE_INDENTATION;
import static org.onosproject.yang.compiler.utils.UtilConstants.EMPTY_STRING;
import static org.onosproject.yang.compiler.utils.UtilConstants.EQUAL;
@@ -86,6 +85,7 @@
import static org.onosproject.yang.compiler.utils.UtilConstants.THIS;
import static org.onosproject.yang.compiler.utils.UtilConstants.TWELVE_SPACE_INDENTATION;
import static org.onosproject.yang.compiler.utils.UtilConstants.VOID;
+import static org.onosproject.yang.compiler.utils.UtilConstants.YANG_RPC_SERVICE;
import static org.onosproject.yang.compiler.utils.io.impl.FileSystemUtil.closeFile;
import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.getJavaDocForExtendedExecuteMethod;
import static org.onosproject.yang.compiler.utils.io.impl.JavaDocGen.getJavaDocForRpcExecuterConstructor;
@@ -126,11 +126,11 @@
private static final String VAR_CMD = "cmd";
private static final String VAR_INPUT = "input";
private static final String VAR_MSG_ID = "msgId";
- private static final String VAR_STORE = "store";
private static final String VAR_RPC_COMMANDS = "rpcCommands";
private static final String VAR_RPC_COMMAND = "rpcCommand";
- private static final String VAR_STORE_SERVICE = "storeService";
+ private static final String VAR_CFG_SERVICE = "cfgService";
private static final String VAR_MODEL_CONVERTER = "modelConverter";
+ private static final String VAR_APP_SERVICE = "appService";
private static final String EXECUTE = "execute";
private static final String EXECUTE_RPC = "executeRpc";
private static final String REGISTER_RPC_METHOD = "registerRpc";
@@ -342,22 +342,22 @@
null) + SERVICE;
Map<String, String> param = new LinkedHashMap<>();
- param.put(VAR_STORE, DYNAMIC_CONFIG_SERVICE);
+ param.put(VAR_CFG_SERVICE, YANG_RPC_SERVICE);
param.put(VAR_MODEL_CONVERTER, MODEL_CONVERTER);
- param.put(appService, getCapitalCase(appService));
+ param.put(VAR_APP_SERVICE, getCapitalCase(appService));
// add attributes
builder.append(getVariableDeclaration(VAR_RPC_COMMANDS, "List<RpcCommand>",
FOUR_SPACE_INDENTATION, PRIVATE))
.append(getVariableDeclaration(VAR_RPC_HANDLER, RPC_HANDLER,
FOUR_SPACE_INDENTATION, PRIVATE))
- .append(getVariableDeclaration(VAR_STORE_SERVICE,
- DYNAMIC_CONFIG_SERVICE,
+ .append(getVariableDeclaration(VAR_CFG_SERVICE,
+ YANG_RPC_SERVICE,
FOUR_SPACE_INDENTATION, PRIVATE))
.append(getVariableDeclaration(VAR_MODEL_CONVERTER,
MODEL_CONVERTER,
FOUR_SPACE_INDENTATION, PRIVATE))
- .append(getVariableDeclaration(appService, getCapitalCase(appService),
+ .append(getVariableDeclaration(VAR_APP_SERVICE, getCapitalCase(appService),
FOUR_SPACE_INDENTATION, PRIVATE))
.append(NEW_LINE)
@@ -372,12 +372,12 @@
.append(valueAssign("this." + VAR_RPC_HANDLER,
"new DefaultRpcHandler()",
EIGHT_SPACE_INDENTATION))
- .append(valueAssign(THIS + PERIOD + VAR_STORE_SERVICE, VAR_STORE,
- EIGHT_SPACE_INDENTATION))
+ .append(valueAssign(THIS + PERIOD + VAR_CFG_SERVICE,
+ VAR_CFG_SERVICE, EIGHT_SPACE_INDENTATION))
.append(valueAssign(THIS + PERIOD + VAR_MODEL_CONVERTER,
VAR_MODEL_CONVERTER,
EIGHT_SPACE_INDENTATION))
- .append(valueAssign(THIS + PERIOD + appService, appService,
+ .append(valueAssign(THIS + PERIOD + VAR_APP_SERVICE, VAR_APP_SERVICE,
EIGHT_SPACE_INDENTATION))
.append(FOUR_SPACE_INDENTATION).append(CLOSE_CURLY_BRACKET)
@@ -512,7 +512,7 @@
.append(getForLoopString(EIGHT_SPACE_INDENTATION, RPC_COMMAND,
VAR_RPC_COMMAND, VAR_RPC_COMMANDS))
- .append(TWELVE_SPACE_INDENTATION).append(VAR_STORE_SERVICE)
+ .append(TWELVE_SPACE_INDENTATION).append(VAR_CFG_SERVICE)
.append(PERIOD).append(REGISTER_HANDLER).append(OPEN_PARENTHESIS)
.append(VAR_RPC_HANDLER).append(COMMA).append(SPACE)
.append(VAR_RPC_COMMAND).append(CLOSE_PARENTHESIS)
@@ -570,8 +570,6 @@
*/
public static String getCreateRpcCommand(YangNode node) {
StringBuilder builder = new StringBuilder();
- String appService = node.getParent().getJavaClassNameOrBuiltInType()
- + SERVICE;
String cmdName = getSmallCase(node.getJavaClassNameOrBuiltInType());
// creates RPC command
@@ -579,9 +577,9 @@
.append(cmdName).append(SPACE).append(EQUAL).append(SPACE)
.append(NEW).append(SPACE).append(getCapitalCase(
node.getJavaClassNameOrBuiltInType())).append(COMMAND)
- .append(OPEN_PARENTHESIS).append(VAR_STORE_SERVICE).append(COMMA).append(SPACE)
+ .append(OPEN_PARENTHESIS).append(VAR_CFG_SERVICE).append(COMMA).append(SPACE)
.append(VAR_MODEL_CONVERTER).append(COMMA)
- .append(SPACE).append(appService).append(CLOSE_PARENTHESIS)
+ .append(SPACE).append(VAR_APP_SERVICE).append(CLOSE_PARENTHESIS)
.append(SEMI_COLON).append(NEW_LINE)
// adds RPC command to list
diff --git a/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/UtilConstants.java b/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/UtilConstants.java
index f81f5e7..29ab285 100644
--- a/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/UtilConstants.java
+++ b/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/UtilConstants.java
@@ -906,7 +906,8 @@
*/
public static final String LEAF_IDENTIFIER = "LeafIdentifier";
- public static final String MODEL_LEAF_IDENTIFIER = "org.onosproject.yang.model.LeafIdentifier";
+ public static final String MODEL_LEAF_IDENTIFIER = "org.onosproject.yang" +
+ ".model.LeafIdentifier";
/**
* Static attribute for is leaf.
@@ -1790,25 +1791,15 @@
".concurrent";
/**
- * Static attribute for config import package.
- */
- public static final String CONFIG_PKG = "org.onosproject.config";
-
- /**
* Static attribute for model import package.
*/
public static final String MODEL_PKG = "org.onosproject.yang.model";
/**
- * Static attribute for runtime import package.
- */
- public static final String RUNTIME_PKG = "org.onosproject.yang.runtime";
-
- /**
* Static attribute for RPC execution status import package.
*/
- public static final String RPC_OUTPUT_STATUS_PKG = "org.onosproject.config" +
- ".RpcOutput.Status";
+ public static final String RPC_OUTPUT_STATUS_PKG = "org.onosproject.yang" +
+ ".model.RpcOutput.Status";
/**
* Static param for model converter.
@@ -1821,9 +1812,9 @@
public static final String RESOURCE_ID = "ResourceId";
/**
- * Static param for dynamic config service.
+ * Static param for YANG RPC service.
*/
- public static final String DYNAMIC_CONFIG_SERVICE = "DynamicConfigService";
+ public static final String YANG_RPC_SERVICE = "YangRpcService";
/**
* Static param for RPC handler.
diff --git a/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/impl/JavaDocGen.java b/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/impl/JavaDocGen.java
index 050fd52..33393a2 100644
--- a/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/impl/JavaDocGen.java
+++ b/compiler/base/utils/src/main/java/org/onosproject/yang/compiler/utils/io/impl/JavaDocGen.java
@@ -729,11 +729,10 @@
*/
public static String getJavaDocForRpcCommandConstructor(String rpcName) {
return " /**\n" +
- " * Constructs a " + rpcName + " command for the given " +
- "cmd id, model converter,\n * application service.\n *\n" +
- " * @param cmdId identifier of RPC command\n" +
+ " * Constructs a " + rpcName + " command.\n" +
+ " * @param cfgService dynamic config service\n" +
" * @param modelConverter model converter for convertion\n" +
- " * @param allService application service\n */";
+ " * @param appService application service\n */";
}
/**
@@ -758,7 +757,7 @@
return " /**\n" +
" * Executes the RPC command.\n" +
" *\n" +
- " * @param input input data to the RPC command\n" +
+ " * @param rpcInput input data to the RPC command\n" +
" * @param msgId of the RPC message to be executed\n" +
" */";
}
@@ -784,12 +783,13 @@
*/
public static String getJavadocForRegisterRpcConstructor() {
return " /**\n" +
- " * Constructs a register rpc for the given store service, mode converter and\n" +
+ " * Constructs a register rpc for the given cfg service, " +
+ "model converter and\n" +
" * application service.\n" +
" *\n" +
- " * @param store dynamic config service\n" +
+ " * @param cfgService dynamic config service\n" +
" * @param modelConverter model converter for convertion\n" +
- " * @param allService application service\n" +
+ " * @param appService application service\n" +
" */";
}
diff --git a/compiler/plugin/maven/src/test/resources/augmentTranslator/test.yang b/compiler/plugin/maven/src/test/resources/augmentTranslator/test.yang
index 608482d..bf779f1 100644
--- a/compiler/plugin/maven/src/test/resources/augmentTranslator/test.yang
+++ b/compiler/plugin/maven/src/test/resources/augmentTranslator/test.yang
@@ -138,7 +138,7 @@
}
}
- /* augment /test1:rpc-input/test1:input {
+ augment /test1:rpc-input/test1:input {
leaf leaf2 {
type int32;
}
@@ -160,8 +160,5 @@
leaf leaf2 {
type int32;
}
- }*/
-
-
+ }
}
-
diff --git a/compiler/plugin/maven/src/test/resources/augmentTranslator/test2.yang b/compiler/plugin/maven/src/test/resources/augmentTranslator/test2.yang
index 5d19838..5208344 100644
--- a/compiler/plugin/maven/src/test/resources/augmentTranslator/test2.yang
+++ b/compiler/plugin/maven/src/test/resources/augmentTranslator/test2.yang
@@ -27,7 +27,7 @@
}
}
- /* rpc rpc-input {
+ rpc rpc-input {
input {
leaf leaf1 {
type int32;
@@ -54,7 +54,5 @@
type int32;
}
}
- }*/
-
+ }
}
-
diff --git a/compiler/plugin/maven/src/test/resources/choiceTranslator/all.yang b/compiler/plugin/maven/src/test/resources/choiceTranslator/all.yang
index e124d43..36611be 100644
--- a/compiler/plugin/maven/src/test/resources/choiceTranslator/all.yang
+++ b/compiler/plugin/maven/src/test/resources/choiceTranslator/all.yang
@@ -65,7 +65,7 @@
}
}
- /* rpc r {
+ rpc r {
input {
choice name {
case a {
@@ -94,9 +94,9 @@
}
}
}
- }*/
+ }
- /*augment /name {
+ augment /name {
choice name {
case a {
leaf udp {
@@ -153,6 +153,5 @@
}
}
}
- } */
-
+ }
}
\ No newline at end of file
diff --git a/compiler/plugin/maven/src/test/resources/groupingNodeSameAsModule/portpair.yang b/compiler/plugin/maven/src/test/resources/groupingNodeSameAsModule/portpair.yang
index 65f9009..867263c 100644
--- a/compiler/plugin/maven/src/test/resources/groupingNodeSameAsModule/portpair.yang
+++ b/compiler/plugin/maven/src/test/resources/groupingNodeSameAsModule/portpair.yang
@@ -1,27 +1,22 @@
module port-pair {
yang-version 1;
-
namespace "sfc.portpair";
-
prefix "port-pair";
-
+
grouping port-pair {
container port-pair {
-
leaf name {
type string;
}
-
leaf description {
type string;
}
}
}
-
- /* rpc get-port-pair {
+ rpc get-port-pair {
output {
uses port-pair;
}
- } */
+ }
}
diff --git a/compiler/plugin/maven/src/test/resources/ietfyang/l3vpnservice/ietf-sd-onos-service-l3vpn.yang b/compiler/plugin/maven/src/test/resources/ietfyang/l3vpnservice/ietf-sd-onos-service-l3vpn.yang
index 8721af1..11a895b 100644
--- a/compiler/plugin/maven/src/test/resources/ietfyang/l3vpnservice/ietf-sd-onos-service-l3vpn.yang
+++ b/compiler/plugin/maven/src/test/resources/ietfyang/l3vpnservice/ietf-sd-onos-service-l3vpn.yang
@@ -112,7 +112,7 @@
- /*rpc create-l3vpn-instance {
+ rpc create-l3vpn-instance {
description "Create l3vpn instance." ;
input {
container l3vpn-instance {
@@ -120,7 +120,7 @@
uses l3vpn;
}
}
- }
+ }
rpc delete-l3vpn-instance {
description "Delete l3vpn instance." ;
@@ -312,5 +312,5 @@
}
}
}
- } */
+ }
}
diff --git a/runtime/src/main/java/org/onosproject/yang/runtime/DefaultResourceData.java b/model/src/main/java/org/onosproject/yang/model/DefaultResourceData.java
similarity index 94%
rename from runtime/src/main/java/org/onosproject/yang/runtime/DefaultResourceData.java
rename to model/src/main/java/org/onosproject/yang/model/DefaultResourceData.java
index ecf7971..503e782 100644
--- a/runtime/src/main/java/org/onosproject/yang/runtime/DefaultResourceData.java
+++ b/model/src/main/java/org/onosproject/yang/model/DefaultResourceData.java
@@ -14,11 +14,7 @@
* limitations under the License.
*/
-package org.onosproject.yang.runtime;
-
-import org.onosproject.yang.model.DataNode;
-import org.onosproject.yang.model.ResourceData;
-import org.onosproject.yang.model.ResourceId;
+package org.onosproject.yang.model;
import java.util.LinkedList;
import java.util.List;
diff --git a/model/src/main/java/org/onosproject/yang/model/RpcCaller.java b/model/src/main/java/org/onosproject/yang/model/RpcCaller.java
new file mode 100644
index 0000000..7039fc8
--- /dev/null
+++ b/model/src/main/java/org/onosproject/yang/model/RpcCaller.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.model;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * Service for entities that would invoke RPCs and receive RPC responses,
+ * through the Dynamic Config brokerage.
+ */
+@Beta
+public interface RpcCaller {
+ /*
+ * Receives an RPC response.
+ *
+ * @param msgId of a previously invoked RPC
+ * @param output from the RPC execution
+ */
+ void receiveResponse(Integer msgId, RpcOutput output);
+}
\ No newline at end of file
diff --git a/model/src/main/java/org/onosproject/yang/model/RpcCommand.java b/model/src/main/java/org/onosproject/yang/model/RpcCommand.java
new file mode 100644
index 0000000..3aeb562
--- /dev/null
+++ b/model/src/main/java/org/onosproject/yang/model/RpcCommand.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.model;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * Abstract implementation of an RPC command.
+ */
+@Beta
+public abstract class RpcCommand {
+ /**
+ * Identifier of an RPC command.
+ */
+ ResourceId cmdId;
+
+ /**
+ * Creates an instance of RpcCommand.
+ *
+ * @param cmdId of RPC command
+ */
+ public RpcCommand(ResourceId cmdId) {
+ this.cmdId = cmdId;
+ }
+
+ /**
+ * Returns the RPC command id.
+ *
+ * @return cmdId
+ */
+ public ResourceId cmdId() {
+ return this.cmdId;
+ }
+
+ /**
+ * Executes the RPC command.
+ *
+ * @param input input data to the RPC command.
+ */
+ public abstract void execute(RpcInput input);
+}
\ No newline at end of file
diff --git a/model/src/main/java/org/onosproject/yang/model/RpcHandler.java b/model/src/main/java/org/onosproject/yang/model/RpcHandler.java
new file mode 100644
index 0000000..c1d92cd
--- /dev/null
+++ b/model/src/main/java/org/onosproject/yang/model/RpcHandler.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.model;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * Service for entities that would execute RPC methods invoked through
+ * Dynamic Config RPC brokerage.
+ */
+@Beta
+public interface RpcHandler {
+ /*
+ * Executes the RPC.
+ *
+ * @param msgId of the RPC message to be executed
+ * @param cmd to be executed
+ * @param input data to the RPC command
+ */
+ void executeRpc(Integer msgId, RpcCommand cmd, RpcInput input);
+}
\ No newline at end of file
diff --git a/model/src/main/java/org/onosproject/yang/model/RpcInput.java b/model/src/main/java/org/onosproject/yang/model/RpcInput.java
new file mode 100644
index 0000000..08e54bb
--- /dev/null
+++ b/model/src/main/java/org/onosproject/yang/model/RpcInput.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.model;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * Abstraction for RPC input.
+ */
+@Beta
+public class RpcInput {
+ /**
+ * Input data to the RPC execution.
+ */
+ DataNode input;
+
+ /**
+ * TODO
+ * Any other meta data or contextual information
+ * to help the RPC execution can be here.
+ * Examples: List<DataNodes> to provide multiple inputs
+ * Additional info for the broker, to choose a suitable executor
+ */
+
+ /**
+ * Creates an instance of RpcInput.
+ *
+ * @param input to RPC execution
+ */
+ public RpcInput(DataNode input) {
+ this.input = input;
+ }
+
+ /**
+ * Returns RPC input.
+ *
+ * @return DataNode
+ */
+ public DataNode input() {
+ return this.input;
+ }
+}
\ No newline at end of file
diff --git a/model/src/main/java/org/onosproject/yang/model/RpcOutput.java b/model/src/main/java/org/onosproject/yang/model/RpcOutput.java
new file mode 100644
index 0000000..8e6b255
--- /dev/null
+++ b/model/src/main/java/org/onosproject/yang/model/RpcOutput.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.model;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * Abstraction for RPC output.
+ */
+@Beta
+public class RpcOutput {
+ public enum Status {
+ /**
+ * RPC execution was successful.
+ */
+ RPC_SUCCESS,
+ /**
+ * RPC execution failed.
+ */
+ RPC_FAILURE,
+ /**
+ * RPC execution don't have any output data.
+ */
+ RPC_NODATA,
+ /**
+ * Failed to receive a response from the receiver, within the broker specified timeout.
+ */
+ RPC_TIMEOUT,
+ }
+
+ /**
+ * Status of RPC execution.
+ */
+ Status status;
+ /**
+ * Output data from the RPC execution.
+ */
+ DataNode output;
+
+ /**
+ * Creates an instance of RpcOutput.
+ *
+ * @param status of RPC execution
+ * @param output of RPC execution
+ */
+ public RpcOutput(Status status, DataNode output) {
+ this.status = status;
+ this.output = output;
+ }
+
+ /**
+ * Returns RPC status.
+ *
+ * @return Status
+ */
+ public RpcOutput.Status status() {
+ return this.status;
+ }
+
+ /**
+ * Returns RPC output.
+ *
+ * @return DataNode
+ */
+ public DataNode output() {
+ return this.output;
+ }
+}
\ No newline at end of file
diff --git a/model/src/main/java/org/onosproject/yang/model/YangRpcService.java b/model/src/main/java/org/onosproject/yang/model/YangRpcService.java
new file mode 100644
index 0000000..c9d28f2
--- /dev/null
+++ b/model/src/main/java/org/onosproject/yang/model/YangRpcService.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.model;
+
+/**
+ * Representation of an entity that provides YANG RPC service.
+ */
+public interface YangRpcService {
+
+ /**
+ * Registers an RPC handler.
+ *
+ * @param handler RPC handler
+ * @param command RPC command
+ */
+ void registerHandler(RpcHandler handler, RpcCommand command);
+
+ /**
+ * Unregisters an RPC receiver.
+ *
+ * @param handler RPC handler
+ * @param command RPC command
+ */
+ void unRegisterHandler(RpcHandler handler, RpcCommand command);
+
+ /**
+ * Invokes an RPC.
+ *
+ * @param caller of the of the RPC
+ * @param msgId RPC message id
+ * @param command RPC command
+ * @param input RPC input
+ */
+ void invokeRpc(RpcCaller caller, Integer msgId, RpcCommand command,
+ RpcInput input);
+
+ /**
+ * Provides response to a a previously invoked RPC.
+ *
+ * @param msgId of a previously invoked RPC
+ * @param output data from the RPC execution
+ */
+ void rpcResponse(Integer msgId, RpcOutput output);
+}
diff --git a/runtime/src/main/java/org/onosproject/yang/runtime/impl/DefaultDataTreeBuilder.java b/runtime/src/main/java/org/onosproject/yang/runtime/impl/DefaultDataTreeBuilder.java
index 0b25e83..ff7ba27 100644
--- a/runtime/src/main/java/org/onosproject/yang/runtime/impl/DefaultDataTreeBuilder.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/impl/DefaultDataTreeBuilder.java
@@ -40,7 +40,7 @@
import org.onosproject.yang.model.ModelObjectId;
import org.onosproject.yang.model.ResourceData;
import org.onosproject.yang.model.ResourceId;
-import org.onosproject.yang.runtime.DefaultResourceData;
+import org.onosproject.yang.model.DefaultResourceData;
import java.util.Iterator;
import java.util.List;
diff --git a/runtime/src/test/java/org/onosproject/yang/runtime/impl/YobAugmentTest.java b/runtime/src/test/java/org/onosproject/yang/runtime/impl/YobAugmentTest.java
index 3572f0c..d075fc6 100644
--- a/runtime/src/test/java/org/onosproject/yang/runtime/impl/YobAugmentTest.java
+++ b/runtime/src/test/java/org/onosproject/yang/runtime/impl/YobAugmentTest.java
@@ -33,7 +33,7 @@
import org.onosproject.yang.model.ModelObject;
import org.onosproject.yang.model.ModelObjectData;
import org.onosproject.yang.model.ResourceData;
-import org.onosproject.yang.runtime.DefaultResourceData;
+import org.onosproject.yang.model.DefaultResourceData;
import java.util.List;
diff --git a/runtime/src/test/java/org/onosproject/yang/runtime/impl/YobBasicYangConstructTest.java b/runtime/src/test/java/org/onosproject/yang/runtime/impl/YobBasicYangConstructTest.java
index be21b0c..11f90f7 100644
--- a/runtime/src/test/java/org/onosproject/yang/runtime/impl/YobBasicYangConstructTest.java
+++ b/runtime/src/test/java/org/onosproject/yang/runtime/impl/YobBasicYangConstructTest.java
@@ -28,7 +28,7 @@
import org.onosproject.yang.model.ModelObjectData;
import org.onosproject.yang.model.ResourceData;
import org.onosproject.yang.model.ResourceId;
-import org.onosproject.yang.runtime.DefaultResourceData;
+import org.onosproject.yang.model.DefaultResourceData;
import java.io.IOException;
import java.util.List;
diff --git a/runtime/src/test/java/org/onosproject/yang/runtime/impl/YobChoiceTest.java b/runtime/src/test/java/org/onosproject/yang/runtime/impl/YobChoiceTest.java
index a063b8a..5103f2f 100644
--- a/runtime/src/test/java/org/onosproject/yang/runtime/impl/YobChoiceTest.java
+++ b/runtime/src/test/java/org/onosproject/yang/runtime/impl/YobChoiceTest.java
@@ -27,7 +27,7 @@
import org.onosproject.yang.model.ModelObjectData;
import org.onosproject.yang.model.ResourceData;
import org.onosproject.yang.model.ResourceId;
-import org.onosproject.yang.runtime.DefaultResourceData;
+import org.onosproject.yang.model.DefaultResourceData;
import java.util.List;
diff --git a/runtime/src/test/java/org/onosproject/yang/runtime/impl/YobGroupingUsesTest.java b/runtime/src/test/java/org/onosproject/yang/runtime/impl/YobGroupingUsesTest.java
index 13dec1a..6ba0a73 100644
--- a/runtime/src/test/java/org/onosproject/yang/runtime/impl/YobGroupingUsesTest.java
+++ b/runtime/src/test/java/org/onosproject/yang/runtime/impl/YobGroupingUsesTest.java
@@ -25,7 +25,7 @@
import org.onosproject.yang.model.ModelObject;
import org.onosproject.yang.model.ModelObjectData;
import org.onosproject.yang.model.ResourceData;
-import org.onosproject.yang.runtime.DefaultResourceData;
+import org.onosproject.yang.model.DefaultResourceData;
import java.util.List;
diff --git a/runtime/src/test/java/org/onosproject/yang/runtime/impl/YobL3VpnSvcTest.java b/runtime/src/test/java/org/onosproject/yang/runtime/impl/YobL3VpnSvcTest.java
index 62d2693..e2cacda 100644
--- a/runtime/src/test/java/org/onosproject/yang/runtime/impl/YobL3VpnSvcTest.java
+++ b/runtime/src/test/java/org/onosproject/yang/runtime/impl/YobL3VpnSvcTest.java
@@ -43,7 +43,7 @@
import org.onosproject.yang.model.ResourceData;
import org.onosproject.yang.model.ResourceId;
import org.onosproject.yang.model.SingleInstanceNode;
-import org.onosproject.yang.runtime.DefaultResourceData;
+import org.onosproject.yang.model.DefaultResourceData;
import java.util.List;
diff --git a/runtime/src/test/java/org/onosproject/yang/runtime/impl/YobRIdToMoIdConverterTest.java b/runtime/src/test/java/org/onosproject/yang/runtime/impl/YobRIdToMoIdConverterTest.java
index aa3938f..0d1bb61 100644
--- a/runtime/src/test/java/org/onosproject/yang/runtime/impl/YobRIdToMoIdConverterTest.java
+++ b/runtime/src/test/java/org/onosproject/yang/runtime/impl/YobRIdToMoIdConverterTest.java
@@ -38,7 +38,7 @@
import org.onosproject.yang.model.ResourceId;
import org.onosproject.yang.model.SingleInstanceLeaf;
import org.onosproject.yang.model.SingleInstanceNode;
-import org.onosproject.yang.runtime.DefaultResourceData;
+import org.onosproject.yang.model.DefaultResourceData;
import java.util.List;
diff --git a/runtime/src/test/java/org/onosproject/yang/runtime/impl/YobSimpleDataTypeTest.java b/runtime/src/test/java/org/onosproject/yang/runtime/impl/YobSimpleDataTypeTest.java
index c219434..cc979e5 100644
--- a/runtime/src/test/java/org/onosproject/yang/runtime/impl/YobSimpleDataTypeTest.java
+++ b/runtime/src/test/java/org/onosproject/yang/runtime/impl/YobSimpleDataTypeTest.java
@@ -23,7 +23,7 @@
import org.onosproject.yang.model.ModelObject;
import org.onosproject.yang.model.ModelObjectData;
import org.onosproject.yang.model.ResourceData;
-import org.onosproject.yang.runtime.DefaultResourceData;
+import org.onosproject.yang.model.DefaultResourceData;
import java.util.List;
diff --git a/serializers/json/src/main/java/org/onosproject/yang/serializers/json/JsonSerializer.java b/serializers/json/src/main/java/org/onosproject/yang/serializers/json/JsonSerializer.java
index 84fb761..11f434c 100644
--- a/serializers/json/src/main/java/org/onosproject/yang/serializers/json/JsonSerializer.java
+++ b/serializers/json/src/main/java/org/onosproject/yang/serializers/json/JsonSerializer.java
@@ -27,7 +27,7 @@
import org.onosproject.yang.runtime.CompositeStream;
import org.onosproject.yang.runtime.DefaultCompositeData;
import org.onosproject.yang.runtime.DefaultCompositeStream;
-import org.onosproject.yang.runtime.DefaultResourceData;
+import org.onosproject.yang.model.DefaultResourceData;
import org.onosproject.yang.runtime.YangSerializer;
import org.onosproject.yang.runtime.YangSerializerContext;
import org.slf4j.Logger;
diff --git a/serializers/json/src/test/java/org/onosproject/yang/serializers/json/JsonSerializerTest.java b/serializers/json/src/test/java/org/onosproject/yang/serializers/json/JsonSerializerTest.java
index 62fce37..7ca6f9c 100644
--- a/serializers/json/src/test/java/org/onosproject/yang/serializers/json/JsonSerializerTest.java
+++ b/serializers/json/src/test/java/org/onosproject/yang/serializers/json/JsonSerializerTest.java
@@ -33,7 +33,7 @@
import org.onosproject.yang.runtime.CompositeStream;
import org.onosproject.yang.runtime.DefaultCompositeData;
import org.onosproject.yang.runtime.DefaultCompositeStream;
-import org.onosproject.yang.runtime.DefaultResourceData;
+import org.onosproject.yang.model.DefaultResourceData;
import org.onosproject.yang.runtime.DefaultRuntimeContext;
import org.onosproject.yang.runtime.RuntimeContext;
import org.onosproject.yang.runtime.YangSerializer;
diff --git a/serializers/xml/src/main/java/org/onosproject/yang/serializers/xml/XmlSerializer.java b/serializers/xml/src/main/java/org/onosproject/yang/serializers/xml/XmlSerializer.java
index 67bc423..b343fd0 100644
--- a/serializers/xml/src/main/java/org/onosproject/yang/serializers/xml/XmlSerializer.java
+++ b/serializers/xml/src/main/java/org/onosproject/yang/serializers/xml/XmlSerializer.java
@@ -30,7 +30,7 @@
import org.onosproject.yang.runtime.CompositeStream;
import org.onosproject.yang.runtime.DefaultCompositeData;
import org.onosproject.yang.runtime.DefaultCompositeStream;
-import org.onosproject.yang.runtime.DefaultResourceData;
+import org.onosproject.yang.model.DefaultResourceData;
import org.onosproject.yang.runtime.YangSerializer;
import org.onosproject.yang.runtime.YangSerializerContext;