import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
import org.opendaylight.yangtools.yang.model.api.UsesNode;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.StatementSource;
import org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition;
import org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition;
import org.opendaylight.yangtools.yang.model.api.type.UnionTypeDefinition;
final ContainerSchemaNode input = rpc.getInput();
final ContainerSchemaNode output = rpc.getOutput();
- if (input != null) {
+ //in case of implicit RPC input (StatementSource.CONTEXT),
+ // stay compatible (no input argument generated)
+ if (input != null && isExplicitStatement(input)) {
final GeneratedTypeBuilder inType = addRawInterfaceDefinition(basePackageName, input, rpcName);
addImplementedInterfaceFromUses(input, inType);
inType.addImplementsType(DATA_OBJECT);
}
Type outTypeInstance = VOID;
- if (output != null) {
+ //in case of implicit RPC output (StatementSource.CONTEXT),
+ //stay compatible (Future<RpcResult<Void>> return type generated)
+ if (output != null && isExplicitStatement(output)) {
final GeneratedTypeBuilder outType = addRawInterfaceDefinition(basePackageName, output, rpcName);
addImplementedInterfaceFromUses(output, outType);
outType.addImplementsType(DATA_OBJECT);
genCtx.get(module).addTopLevelNodeType(interfaceBuilder);
}
+ private static boolean isExplicitStatement(ContainerSchemaNode node) {
+ return node instanceof EffectiveStatement
+ && ((EffectiveStatement) node).getDeclared().getStatementSource() == StatementSource.DECLARATION;
+ }
+
/**
* Converts all <b>notifications</b> of the module to the list of
* <code>Type</code> objects. In addition are to this list added containers