*/
package org.opendaylight.controller.sal.binding.generator.impl;
-import static org.opendaylight.controller.binding.generator.util.BindingGeneratorUtil.*;
+import static org.opendaylight.controller.binding.generator.util.BindingGeneratorUtil.moduleNamespaceToPackageName;
+import static org.opendaylight.controller.binding.generator.util.BindingGeneratorUtil.packageNameForGeneratedType;
+import static org.opendaylight.controller.binding.generator.util.BindingGeneratorUtil.parseToClassName;
+import static org.opendaylight.controller.binding.generator.util.BindingGeneratorUtil.parseToValidParamName;
+import static org.opendaylight.controller.binding.generator.util.BindingGeneratorUtil.schemaNodeToTransferObjectBuilder;
import static org.opendaylight.controller.yang.model.util.SchemaContextUtil.findDataSchemaNode;
import static org.opendaylight.controller.yang.model.util.SchemaContextUtil.findParentModule;
-import java.util.concurrent.Future;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.Future;
import org.opendaylight.controller.binding.generator.util.ReferencedTypeImpl;
import org.opendaylight.controller.binding.generator.util.Types;
import org.opendaylight.controller.sal.binding.model.api.type.builder.GeneratedTOBuilder;
import org.opendaylight.controller.sal.binding.model.api.type.builder.GeneratedTypeBuilder;
import org.opendaylight.controller.sal.binding.model.api.type.builder.MethodSignatureBuilder;
+import org.opendaylight.controller.sal.binding.yang.types.GroupingDefinitionDependencySort;
import org.opendaylight.controller.sal.binding.yang.types.TypeProviderImpl;
import org.opendaylight.controller.yang.binding.Notification;
import org.opendaylight.controller.yang.common.QName;
import org.opendaylight.controller.yang.model.api.SchemaNode;
import org.opendaylight.controller.yang.model.api.SchemaPath;
import org.opendaylight.controller.yang.model.api.TypeDefinition;
+import org.opendaylight.controller.yang.model.api.UsesNode;
import org.opendaylight.controller.yang.model.api.type.BitsTypeDefinition;
import org.opendaylight.controller.yang.model.api.type.EnumTypeDefinition;
import org.opendaylight.controller.yang.model.api.type.EnumTypeDefinition.EnumPair;
private Map<String, Map<String, GeneratedTypeBuilder>> genTypeBuilders;
private TypeProvider typeProvider;
private SchemaContext schemaContext;
+ private final Map<SchemaPath, GeneratedType> allGroupings = new HashMap<SchemaPath, GeneratedType>();
public BindingGeneratorImpl() {
super();
final Set<Module> modules = context.getModules();
genTypeBuilders = new HashMap<>();
for (final Module module : modules) {
+ generatedTypes.addAll(allGroupingsToGenTypes(module));
generatedTypes.add(moduleToDataType(module));
generatedTypes.addAll(allTypeDefinitionsToGenTypes(module));
generatedTypes.addAll(allContainersToGenTypes(module));
generatedTypes.addAll(allRPCMethodsToGenType(module));
generatedTypes.addAll(allNotificationsToGenType(module));
generatedTypes.addAll(allIdentitiesToGenTypes(module, context));
- generatedTypes.addAll(allGroupingsToGenTypes(module));
+
}
return generatedTypes;
}
for (final Module contextModule : contextModules) {
final List<Type> generatedTypes = new ArrayList<>();
+ generatedTypes.addAll(allGroupingsToGenTypes(contextModule));
generatedTypes.add(moduleToDataType(contextModule));
generatedTypes.addAll(allTypeDefinitionsToGenTypes(contextModule));
generatedTypes.addAll(allContainersToGenTypes(contextModule));
generatedTypes.addAll(allRPCMethodsToGenType(contextModule));
generatedTypes.addAll(allNotificationsToGenType(contextModule));
generatedTypes.addAll(allIdentitiesToGenTypes(contextModule, context));
- generatedTypes.addAll(allGroupingsToGenTypes(contextModule));
if (modules.contains(contextModule)) {
filteredGenTypes.addAll(generatedTypes);
final List<ContainerSchemaNode> schemaContainers = it.allContainers();
final String basePackageName = moduleNamespaceToPackageName(module);
for (final ContainerSchemaNode container : schemaContainers) {
- generatedTypes.add(containerToGenType(basePackageName, container));
+ if (!container.isAddedByUses()) {
+ generatedTypes.add(containerToGenType(basePackageName, container));
+ }
}
return generatedTypes;
}
final String basePackageName = moduleNamespaceToPackageName(module);
if (schemaLists != null) {
for (final ListSchemaNode list : schemaLists) {
- generatedTypes.addAll(listToGenType(basePackageName, list));
+ if (!list.isAddedByUses()) {
+ generatedTypes.addAll(listToGenType(basePackageName, list));
+ }
}
}
return generatedTypes;
final List<GeneratedType> generatedTypes = new ArrayList<>();
for (final ChoiceNode choice : choiceNodes) {
- if (choice != null) {
+ if ((choice != null) && !choice.isAddedByUses()) {
generatedTypes.addAll(choiceToGeneratedType(basePackageName, choice));
}
}
}
final GeneratedTypeBuilder moduleDataTypeBuilder = moduleTypeBuilder(module, "Data");
+ addInterfaceDefinition(module, moduleDataTypeBuilder);
final String basePackageName = moduleNamespaceToPackageName(module);
if (moduleDataTypeBuilder != null) {
if (input != null) {
rpcInOut.add(new DataNodeIterator(input));
GeneratedTypeBuilder inType = addRawInterfaceDefinition(basePackageName, input, rpcName);
+ addInterfaceDefinition(input, inType);
resolveDataSchemaNodes(basePackageName, inType, input.getChildNodes());
Type inTypeInstance = inType.toInstance();
genRPCTypes.add(inTypeInstance);
Type outTypeInstance = Types.typeForClass(Void.class);
if (output != null) {
rpcInOut.add(new DataNodeIterator(output));
-
GeneratedTypeBuilder outType = addRawInterfaceDefinition(basePackageName, output, rpcName);
+ addInterfaceDefinition(output, outType);
resolveDataSchemaNodes(basePackageName, outType, output.getChildNodes());
outTypeInstance = outType.toInstance();
genRPCTypes.add(outTypeInstance);
List<ContainerSchemaNode> nContainers = it.allContainers();
if ((nContainers != null) && !nContainers.isEmpty()) {
for (final ContainerSchemaNode container : nContainers) {
- genRPCTypes.add(containerToGenType(basePackageName, container));
+ if (!container.isAddedByUses()) {
+ genRPCTypes.add(containerToGenType(basePackageName, container));
+ }
}
}
List<ListSchemaNode> nLists = it.allLists();
if ((nLists != null) && !nLists.isEmpty()) {
for (final ListSchemaNode list : nLists) {
- genRPCTypes.addAll(listToGenType(basePackageName, list));
+ if (!list.isAddedByUses()) {
+ genRPCTypes.addAll(listToGenType(basePackageName, list));
+ }
}
}
}
// Containers
for (ContainerSchemaNode node : it.allContainers()) {
- genNotifyTypes.add(containerToGenType(basePackageName, node));
+ if (!node.isAddedByUses()) {
+ genNotifyTypes.add(containerToGenType(basePackageName, node));
+ }
}
// Lists
for (ListSchemaNode node : it.allLists()) {
- genNotifyTypes.addAll(listToGenType(basePackageName, node));
+ if (!node.isAddedByUses()) {
+ genNotifyTypes.addAll(listToGenType(basePackageName, node));
+ }
}
final GeneratedTypeBuilder notificationTypeBuilder = addDefaultInterfaceDefinition(basePackageName,
notification);
final List<Type> genTypes = new ArrayList<>();
final String basePackageName = moduleNamespaceToPackageName(module);
final Set<GroupingDefinition> groupings = module.getGroupings();
- if (groupings != null && !groupings.isEmpty()) {
- for (final GroupingDefinition grouping : groupings) {
- genTypes.add(groupingToGenType(basePackageName, grouping));
- }
+ List<GroupingDefinition> groupingsSortedByDependencies;
+ // groupingsSortedByDependencies =
+ // sortGroupingDefinitionsByUses(groupings);
+ groupingsSortedByDependencies = GroupingDefinitionDependencySort.sort(groupings);
+
+ for (final GroupingDefinition grouping : groupingsSortedByDependencies) {
+ GeneratedType genType = groupingToGenType(basePackageName, grouping);
+ genTypes.add(genType);
+ SchemaPath schemaPath = grouping.getPath();
+ allGroupings.put(schemaPath, genType);
}
return genTypes;
}
if (!(targetSchemaNode instanceof ChoiceNode)) {
final GeneratedTypeBuilder augTypeBuilder = addRawAugmentGenTypeDefinition(augmentPackageName,
targetPackageName, targetSchemaNodeName, augSchema);
+ addInterfaceDefinition(augSchema, augTypeBuilder);
+
final GeneratedType augType = augTypeBuilder.toInstance();
genTypes.add(augType);
} else {
final GeneratedTypeBuilder typeBuilder, final Set<DataSchemaNode> schemaNodes) {
if ((schemaNodes != null) && (typeBuilder != null)) {
for (final DataSchemaNode schemaNode : schemaNodes) {
- if (schemaNode.isAugmenting()) {
+ if (schemaNode.isAugmenting() || schemaNode.isAddedByUses()) {
continue;
}
addSchemaNodeToBuilderAsMethod(basePackageName, schemaNode, typeBuilder);
}
final String choiceName = choiceNode.getQName().getLocalName();
- if (choiceName != null) {
+ if (choiceName != null && !choiceNode.isAddedByUses()) {
final String packageName = packageNameForGeneratedType(basePackageName, choiceNode.getPath());
final GeneratedTypeBuilder choiceType = addDefaultInterfaceDefinition(packageName, choiceNode);
constructGetter(typeBuilder, choiceName, choiceNode.getDescription(), choiceType);
leafDesc = "";
}
- if (leafName != null) {
+ if (leafName != null && !leaf.isAddedByUses()) {
final TypeDefinition<?> typeDef = leaf.getType();
Type returnType = null;
leafDesc = "";
}
- if (leafName != null) {
+ if (leafName != null && !leaf.isAddedByUses()) {
final TypeDefinition<?> typeDef = leaf.getType();
// TODO: properly resolve enum types
nodeDesc = "";
}
- if (nodeName != null) {
+ if (nodeName != null && !node.isAddedByUses()) {
final TypeDefinition<?> type = node.getType();
final Type listType = Types.listTypeFor(typeProvider.javaTypeForSchemaDefinitionType(type));
if ((containerNode != null) && (typeBuilder != null)) {
final String nodeName = containerNode.getQName().getLocalName();
- if (nodeName != null) {
+ if (nodeName != null && !containerNode.isAddedByUses()) {
final String packageName = packageNameForGeneratedType(basePackageName, containerNode.getPath());
final GeneratedTypeBuilder rawGenType = addDefaultInterfaceDefinition(packageName, containerNode);
if ((schemaNode != null) && (typeBuilder != null)) {
final String listName = schemaNode.getQName().getLocalName();
- if (listName != null) {
+ if (listName != null && !schemaNode.isAddedByUses()) {
final String packageName = packageNameForGeneratedType(basePackageName, schemaNode.getPath());
final GeneratedTypeBuilder rawGenType = addDefaultInterfaceDefinition(packageName, schemaNode);
constructGetter(typeBuilder, listName, schemaNode.getDescription(), Types.listTypeFor(rawGenType));
private GeneratedTypeBuilder addDefaultInterfaceDefinition(final String packageName, final SchemaNode schemaNode) {
final GeneratedTypeBuilder builder = addRawInterfaceDefinition(packageName, schemaNode, "");
builder.addImplementsType(Types.DATA_OBJECT);
- builder.addImplementsType(Types.augmentableTypeFor(builder));
+ if (!(schemaNode instanceof GroupingDefinition)) {
+ builder.addImplementsType(Types.augmentableTypeFor(builder));
+ }
+
+ if (schemaNode instanceof DataNodeContainer) {
+ addInterfaceDefinition((DataNodeContainer) schemaNode, builder);
+ }
+
return builder;
}
}
+ /**
+ * Adds the implemented types to type builder. The method passes through the
+ * list of elements which contains {@code dataNodeContainer} and adds them
+ * as <i>implements type</i> to <code>builder</code>
+ *
+ * @param dataNodeContainer
+ * element which contains the list of used YANG groupings
+ * @param builder
+ * builder to which are added implemented types according to
+ * <code>dataNodeContainer</code>
+ * @return generated type builder which contains implemented types
+ */
+ private GeneratedTypeBuilder addInterfaceDefinition(final DataNodeContainer dataNodeContainer,
+ final GeneratedTypeBuilder builder) {
+ for (UsesNode usesNode : dataNodeContainer.getUses()) {
+ if (usesNode.getGroupingPath() != null) {
+ GeneratedType genType = allGroupings.get(usesNode.getGroupingPath());
+ builder.addImplementsType(new ReferencedTypeImpl(genType.getPackageName(), genType.getName()));
+ }
+ }
+ return builder;
+ }
+
}
--- /dev/null
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.sal.binding.yang.types;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.opendaylight.controller.yang.model.api.GroupingDefinition;
+import org.opendaylight.controller.yang.model.api.SchemaPath;
+import org.opendaylight.controller.yang.model.api.UsesNode;
+import org.opendaylight.controller.yang.parser.util.TopologicalSort;
+import org.opendaylight.controller.yang.parser.util.TopologicalSort.Node;
+import org.opendaylight.controller.yang.parser.util.TopologicalSort.NodeImpl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
+
+//import org.opendaylight.controller.yang.model.util.GroupingDefinition;
+
+public class GroupingDefinitionDependencySort {
+ private static final Logger logger = LoggerFactory.getLogger(GroupingDefinitionDependencySort.class);
+
+ public static List<GroupingDefinition> sort(final Set<GroupingDefinition> groupingDefinitions) {
+ if (groupingDefinitions == null) {
+ logger.error("Set of grouping definitions cannot be NULL!");
+ throw new IllegalArgumentException("Set of Type Definitions " + "cannot be NULL!");
+ }
+
+ final List<GroupingDefinition> resultGroupingDefinitions = new ArrayList<GroupingDefinition>();
+ final Set<Node> unsorted = groupingDefinitionsToGroupingNodes(groupingDefinitions);
+ final List<Node> sortedNodes = TopologicalSort.sort(unsorted);
+ for (Node node : sortedNodes) {
+ resultGroupingDefinitions.add(((GroupingNode) node).getGroupingDefinition());
+ }
+ return resultGroupingDefinitions;
+
+ }
+
+ private static Set<Node> groupingDefinitionsToGroupingNodes(final Set<GroupingDefinition> groupingDefinitions) {
+ final Map<SchemaPath, Node> nodeMap = Maps.newHashMap();
+ final Set<Node> resultNodes = Sets.newHashSet();
+
+ for (final GroupingDefinition groupingDefinition : groupingDefinitions) {
+ final Node node = new GroupingNode(groupingDefinition);
+ nodeMap.put(groupingDefinition.getPath(), node);
+ resultNodes.add(node);
+ }
+
+ for (final Node node : resultNodes) {
+ final GroupingNode groupingNode = (GroupingNode) node;
+ final GroupingDefinition groupingDefinition = groupingNode.getGroupingDefinition();
+
+ Set<UsesNode> usesNodes = groupingDefinition.getUses();
+ for (UsesNode usesNode : usesNodes) {
+ SchemaPath schemaPath = usesNode.getGroupingPath();
+ if (schemaPath != null) {
+ Node nodeTo = nodeMap.get(schemaPath);
+ groupingNode.addEdge(nodeTo);
+ }
+ }
+ }
+
+ return resultNodes;
+ }
+
+ private static final class GroupingNode extends NodeImpl {
+ private final GroupingDefinition groupingDefinition;
+
+ GroupingNode(GroupingDefinition groupingDefinition) {
+ this.groupingDefinition = groupingDefinition;
+ }
+
+ GroupingDefinition getGroupingDefinition() {
+ return groupingDefinition;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (!(o instanceof GroupingNode)) {
+ return false;
+ }
+ GroupingNode groupingNode = (GroupingNode) o;
+ if (!groupingDefinition.equals(groupingNode.groupingDefinition)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return groupingDefinition.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return "GroupingNode{" + "groupingType=" + groupingDefinition + '}';
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.sal.binding.generator.impl;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.junit.Test;
+import org.opendaylight.controller.sal.binding.generator.api.BindingGenerator;
+import org.opendaylight.controller.sal.binding.model.api.GeneratedTransferObject;
+import org.opendaylight.controller.sal.binding.model.api.GeneratedType;
+import org.opendaylight.controller.sal.binding.model.api.MethodSignature;
+import org.opendaylight.controller.sal.binding.model.api.ParameterizedType;
+import org.opendaylight.controller.sal.binding.model.api.Type;
+import org.opendaylight.controller.yang.model.api.Module;
+import org.opendaylight.controller.yang.model.api.SchemaContext;
+import org.opendaylight.controller.yang.model.parser.api.YangModelParser;
+import org.opendaylight.controller.yang.parser.impl.YangParserImpl;
+
+public class UsesTest {
+
+ private class MethodSignaturePattern {
+ final String name;
+ final String type;
+
+ public MethodSignaturePattern(String methodName, String methodType) {
+ this.name = methodName;
+ this.type = methodType;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public String getType() {
+ return this.type;
+ }
+ }
+
+ private static void containsSignatures(final List<MethodSignature> searchedSignsIn,
+ final MethodSignaturePattern... searchedSignsWhat) {
+ if (searchedSignsIn == null) {
+ throw new IllegalArgumentException("List of method signatures in which should be searched can't be null");
+ }
+ if (searchedSignsWhat == null) {
+ throw new IllegalArgumentException("Array of method signatures which should be searched can't be null");
+ }
+
+ for (MethodSignaturePattern searchedSignWhat : searchedSignsWhat) {
+ boolean nameMatchFound = false;
+ String typeNameFound = "";
+ for (MethodSignature searchedSignIn : searchedSignsIn) {
+ if (searchedSignWhat.getName().equals(searchedSignIn.getName())) {
+ nameMatchFound = true;
+ typeNameFound = resolveFullNameOfReturnType(searchedSignIn);
+ if (searchedSignWhat.getType().equals(typeNameFound)) {
+ break;
+ }
+ }
+ }
+ assertTrue("Method " + searchedSignWhat.getName() + " wasn't found.", nameMatchFound);
+ assertEquals("Return type in method " + searchedSignWhat.getName() + " doesn't match expected type ",
+ searchedSignWhat.getType(), typeNameFound);
+
+ }
+ }
+
+ private static String resolveFullNameOfReturnType(final MethodSignature methodSignature) {
+ final StringBuilder nameBuilder = new StringBuilder();
+ if (methodSignature.getReturnType() instanceof ParameterizedType) {
+ nameBuilder.append(methodSignature.getReturnType().getName() + "<");
+ ParameterizedType parametrizedTypes = (ParameterizedType) methodSignature.getReturnType();
+ for (Type parametrizedType : parametrizedTypes.getActualTypeArguments()) {
+ nameBuilder.append(parametrizedType.getName() + ",");
+ }
+ if (nameBuilder.charAt(nameBuilder.length() - 1) == ',') {
+ nameBuilder.deleteCharAt(nameBuilder.length() - 1);
+ }
+ nameBuilder.append(">");
+ } else {
+ nameBuilder.append(methodSignature.getReturnType().getName());
+ }
+ return nameBuilder.toString();
+ }
+
+ private static boolean containsInterface(String interfaceName, GeneratedType genType) {
+ List<Type> caseCImplements = genType.getImplements();
+ for (Type caseCImplement : caseCImplements) {
+ if (caseCImplement.getName().equals(interfaceName)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private static List<File> loadTestResources(String testFile) {
+ final List<File> testModels = new ArrayList<File>();
+ final File listModelFile = new File(UsesTest.class.getResource(testFile).getPath());
+ testModels.add(listModelFile);
+ return testModels;
+ }
+
+ @Test
+ public void usesInGroupingDependenciesTest() {
+ List<File> testModels = loadTestResources("/uses-of-grouping/uses-of-grouping-dependencies.yang");
+ final YangModelParser parser = new YangParserImpl();
+ final Set<Module> modules = parser.parseYangModels(testModels);
+ final SchemaContext context = parser.resolveSchemaContext(modules);
+
+ assertNotNull(context);
+ final BindingGenerator bindingGen = new BindingGeneratorImpl();
+ final List<Type> genTypes = bindingGen.generateTypes(context);
+ GeneratedType groupingU = null;
+ GeneratedType groupingX = null;
+ GeneratedType groupingV = null;
+
+ int groupingUCounter = 0;
+ int groupingXCounter = 0;
+ int groupingVCounter = 0;
+
+ for (Type type : genTypes) {
+ if (type instanceof GeneratedType && !(type instanceof GeneratedTransferObject)) {
+ GeneratedType genType = (GeneratedType) type;
+ if (genType.getName().equals("GroupingU")) {
+ groupingU = genType;
+ groupingUCounter++;
+ } else if (genType.getName().equals("GroupingV")) {
+ groupingV = genType;
+ groupingVCounter++;
+ } else if (genType.getName().equals("GroupingX")) {
+ groupingX = genType;
+ groupingXCounter++;
+ }
+ }
+ }
+
+ assertNotNull("Generated type for grouping-U wasn't generated.", groupingU);
+ assertEquals("GroupingU interface generated more than one time.", 1, groupingUCounter);
+ assertEquals("GroupingU is in wrong package.",
+ "org.opendaylight.yang.gen.v1.urn.grouping.dependencies.rev2013718", groupingU.getPackageName());
+
+ assertNotNull("Generated type for grouping-V wasn't generated.", groupingV);
+ assertEquals("GroupingV interface generated more than one time.", 1, groupingVCounter);
+ assertEquals("GroupingV is in wrong package.",
+ "org.opendaylight.yang.gen.v1.urn.grouping.dependencies.rev2013718", groupingV.getPackageName());
+
+ assertNotNull("Generated type for grouping-X wasn't generated.", groupingX);
+ assertEquals("GroupingX interface generated more than one time.", 1, groupingXCounter);
+ assertEquals("GroupingX is in wrong package.",
+ "org.opendaylight.yang.gen.v1.urn.grouping.dependencies.rev2013718", groupingX.getPackageName());
+
+ assertTrue("GroupingV doesn't extend GroupingU.", containsInterface("GroupingV", groupingU));
+ assertTrue("GroupingX doesn't extend GroupingU.", containsInterface("GroupingX", groupingU));
+ assertTrue("GroupingZ doesn't extend GroupingV.", containsInterface("GroupingZ", groupingV));
+ assertTrue("GroupingZZ doesn't extend GroupingV.", containsInterface("GroupingZZ", groupingV));
+ assertTrue("GroupingY doesn't extend GroupingX.", containsInterface("GroupingY", groupingX));
+ }
+
+ @Test
+ public void usesInCaseTest() {
+ List<File> testModels = loadTestResources("/uses-of-grouping/uses-of-grouping-case.yang");
+ final YangModelParser parser = new YangParserImpl();
+ final Set<Module> modules = parser.parseYangModels(testModels);
+ final SchemaContext context = parser.resolveSchemaContext(modules);
+
+ assertNotNull(context);
+ final BindingGenerator bindingGen = new BindingGeneratorImpl();
+ final List<Type> genTypes = bindingGen.generateTypes(context);
+
+ GeneratedType groupingCaseTest = null;
+ int groupingCaseTestCounter = 0;
+ GeneratedType caseC = null;
+ int caseCCounter = 0;
+ for (Type type : genTypes) {
+ if (type instanceof GeneratedType && !(type instanceof GeneratedTransferObject)) {
+ GeneratedType genType = (GeneratedType) type;
+ if (genType.getName().equals("C")) {
+ caseC = genType;
+ caseCCounter++;
+ } else if (genType.getName().equals("GroupingCaseTest")) {
+ groupingCaseTest = genType;
+ groupingCaseTestCounter++;
+ }
+ }
+ }
+
+ assertNotNull("Generated type for case C wasn't generated.", caseC);
+ assertEquals("Case C interface generated more than one time.", 1, caseCCounter);
+ assertEquals(
+ "Case C is in wrong package.",
+ "org.opendaylight.yang.gen.v1.urn.grouping.uses._case.rev2013718.container.with.choicetest.choice.test",
+ caseC.getPackageName());
+
+ assertNotNull("Generated type for grouping-case-test wasn't generated.", groupingCaseTest);
+ assertEquals("GroupingCaseTest interface generated more than one time.", 1, groupingCaseTestCounter);
+ assertEquals("GroupingCaseTest is in wrong package.",
+ "org.opendaylight.yang.gen.v1.urn.grouping.uses._case.rev2013718", groupingCaseTest.getPackageName());
+
+ assertTrue("Case C doesn't extend GroupingCaseTest.", containsInterface("GroupingCaseTest", caseC));
+ assertTrue("Case C shouldn't contain any method.", caseC.getMethodDefinitions().isEmpty());
+
+ assertEquals("Number of method in GroupingCaseTest is incorrect", 1, groupingCaseTest.getMethodDefinitions()
+ .size());
+ containsSignatures(groupingCaseTest.getMethodDefinitions(), new MethodSignaturePattern(
+ "getLeafGroupingCaseTest1", "String"));
+ }
+
+ @Test
+ public void usesInContainerTest() {
+ List<File> testModels = loadTestResources("/uses-of-grouping/uses-of-grouping-container.yang");
+ final YangModelParser parser = new YangParserImpl();
+ final Set<Module> modules = parser.parseYangModels(testModels);
+ final SchemaContext context = parser.resolveSchemaContext(modules);
+
+ assertNotNull(context);
+ final BindingGenerator bindingGen = new BindingGeneratorImpl();
+ final List<Type> genTypes = bindingGen.generateTypes(context);
+
+ int containerTestCount = 0;
+ int groupingContainerTestCounter = 0;
+ GeneratedType containerTest = null;
+ GeneratedType groupingContainerTest = null;
+
+ for (Type type : genTypes) {
+ if (type instanceof GeneratedType && !(type instanceof GeneratedTransferObject)) {
+ GeneratedType genType = (GeneratedType) type;
+ if (genType.getName().equals("GroupingContainerTest")) {
+ groupingContainerTest = genType;
+ groupingContainerTestCounter++;
+ } else if (genType.getName().equals("ContainerTest")) {
+ containerTest = genType;
+ containerTestCount++;
+ }
+ }
+ }
+
+ assertNotNull("Generated type for grouping-container-test wasn't generated", groupingContainerTest);
+ assertEquals("GroupingContainerTest interface - incorrect number of occurences", 1,
+ groupingContainerTestCounter);
+ assertEquals("GroupingContainerTest isn't in correct package",
+ "org.opendaylight.yang.gen.v1.urn.grouping.uses.container.rev2013718",
+ groupingContainerTest.getPackageName());
+
+ assertNotNull("Generated type for container-test wasn't generated", containerTest);
+ assertEquals("ContainerTest interface - incorrect number of occurences", 1, containerTestCount);
+ assertEquals("ContainerTest isn't in correct package",
+ "org.opendaylight.yang.gen.v1.urn.grouping.uses.container.rev2013718", containerTest.getPackageName());
+
+ assertTrue("ContainerTest doesn't extend GroupingContainerTest.",
+ containsInterface("GroupingContainerTest", containerTest));
+
+ assertEquals("Number of method in GroupingContainerTestis incorrect", 2, groupingContainerTest
+ .getMethodDefinitions().size());
+ assertEquals("Number of method in ContainerTest is incorrect", 1, containerTest.getMethodDefinitions().size());
+
+ containsSignatures(groupingContainerTest.getMethodDefinitions(), new MethodSignaturePattern(
+ "getLeafGroupingContainerTest1", "String"), new MethodSignaturePattern("getLeafGroupingContainerTest2",
+ "Short"));
+
+ containsSignatures(containerTest.getMethodDefinitions(), new MethodSignaturePattern("getContainerLeafTest",
+ "String"));
+ }
+
+ @Test
+ public void usesInGroupingTest() {
+ List<File> testModels = loadTestResources("/uses-of-grouping/uses-of-grouping-grouping.yang");
+ final YangModelParser parser = new YangParserImpl();
+ final Set<Module> modules = parser.parseYangModels(testModels);
+ final SchemaContext context = parser.resolveSchemaContext(modules);
+
+ assertNotNull(context);
+ final BindingGenerator bindingGen = new BindingGeneratorImpl();
+ final List<Type> genTypes = bindingGen.generateTypes(context);
+
+ int groupingTestCount = 0;
+ int groupingGroupingTestCounter = 0;
+ GeneratedType groupingTest = null;
+ GeneratedType groupingGroupingTest = null;
+
+ for (Type type : genTypes) {
+ if (type instanceof GeneratedType && !(type instanceof GeneratedTransferObject)) {
+ GeneratedType genType = (GeneratedType) type;
+ if (genType.getName().equals("GroupingGroupingTest")) {
+ groupingGroupingTest = genType;
+ groupingGroupingTestCounter++;
+ } else if (genType.getName().equals("GroupingTest")) {
+ groupingTest = genType;
+ groupingTestCount++;
+ }
+ }
+ }
+
+ assertNotNull("Generated type for grouping-grouping-test wasn't generated", groupingGroupingTest);
+ assertEquals("GroupingGroupingTest interface - incorrect number of occurences", 1, groupingGroupingTestCounter);
+ assertEquals("GroupingGroupingTest isn't in correct package",
+ "org.opendaylight.yang.gen.v1.urn.grouping.uses.grouping.rev2013718",
+ groupingGroupingTest.getPackageName());
+
+ assertNotNull("Generated type for grouping-test wasn't generated", groupingTest);
+ assertEquals("GroupingTest interface - incorrect number of occurences", 1, groupingTestCount);
+ assertEquals("GroupingTest isn't in correct package",
+ "org.opendaylight.yang.gen.v1.urn.grouping.uses.grouping.rev2013718", groupingTest.getPackageName());
+
+ assertTrue("GroupingTest doesn't extend GroupingGroupingTest.",
+ containsInterface("GroupingGroupingTest", groupingTest));
+
+ assertEquals("Number of method in GroupingGroupingTest is incorrect", 1, groupingGroupingTest
+ .getMethodDefinitions().size());
+ assertEquals("Number of method in GroupingTest is incorrect", 1, groupingTest.getMethodDefinitions().size());
+
+ containsSignatures(groupingGroupingTest.getMethodDefinitions(), new MethodSignaturePattern(
+ "getLeafGroupingGrouping", "String"));
+
+ containsSignatures(groupingTest.getMethodDefinitions(), new MethodSignaturePattern("getLeafGroupingTest",
+ "Byte"));
+ }
+
+ @Test
+ public void usesInListTest() {
+ List<File> testModels = loadTestResources("/uses-of-grouping/uses-of-grouping-list.yang");
+ final YangModelParser parser = new YangParserImpl();
+ final Set<Module> modules = parser.parseYangModels(testModels);
+ final SchemaContext context = parser.resolveSchemaContext(modules);
+
+ assertNotNull(context);
+ final BindingGenerator bindingGen = new BindingGeneratorImpl();
+ final List<Type> genTypes = bindingGen.generateTypes(context);
+
+ int listTestCounter = 0;
+ int groupingListTestCounter = 0;
+ int containerGroupingListTestCounter = 0;
+ int listGroupingListTestCounter = 0;
+ GeneratedType listTest = null;
+ GeneratedType groupingListTest = null;
+ GeneratedType containerGroupingListTest = null;
+ GeneratedType listGroupingListTest = null;
+
+ for (Type type : genTypes) {
+ if (type instanceof GeneratedType && !(type instanceof GeneratedTransferObject)) {
+ GeneratedType genType = (GeneratedType) type;
+ if (genType.getName().equals("GroupingListTest")) {
+ groupingListTest = genType;
+ groupingListTestCounter++;
+ } else if (genType.getName().equals("ListTest")) {
+ listTest = genType;
+ listTestCounter++;
+ } else if (genType.getName().equals("ContainerGroupingListTest")) {
+ containerGroupingListTest = genType;
+ containerGroupingListTestCounter++;
+ } else if (genType.getName().equals("ListGroupingListTest")) {
+ listGroupingListTest = genType;
+ listGroupingListTestCounter++;
+ }
+ }
+ }
+
+ assertNotNull("Generated type for grouping-list-test wasn't generated", groupingListTest);
+ assertEquals("GroupingListTest interface - incorrect number of occurences", 1, groupingListTestCounter);
+ assertEquals("GroupingListTest isn't in correct package",
+ "org.opendaylight.yang.gen.v1.urn.grouping.uses.list.rev2013718", groupingListTest.getPackageName());
+
+ assertNotNull("Generated type for list-test wasn't generated", listTest);
+ assertEquals("ListTest interface - incorrect number of occurences", 1, listTestCounter);
+ assertEquals("ListTest isn't in correct package",
+ "org.opendaylight.yang.gen.v1.urn.grouping.uses.list.rev2013718", listTest.getPackageName());
+
+ assertNotNull("Generated type for container-grouping-list-test wasn't generated", containerGroupingListTest);
+ assertEquals("ContainerGroupingListTest interface - incorrect number of occurences", 1,
+ containerGroupingListTestCounter);
+ assertEquals("ContainerGroupingListTest isn't in correct package",
+ "org.opendaylight.yang.gen.v1.urn.grouping.uses.list.rev2013718.grouping.list.test",
+ containerGroupingListTest.getPackageName());
+
+ assertNotNull("Generated type for list-grouping-list-test wasn't generated", listGroupingListTest);
+ assertEquals("ListGroupingListTest interface - incorrect number of occurences", 1, listGroupingListTestCounter);
+ assertEquals("ListGroupingListTest isn't in correct package",
+ "org.opendaylight.yang.gen.v1.urn.grouping.uses.list.rev2013718.grouping.list.test",
+ listGroupingListTest.getPackageName());
+
+ assertTrue("ListTest doesn't extend GroupingGroupingTest.", containsInterface("GroupingListTest", listTest));
+
+ assertEquals("Number of method in GroupingListTest is incorrect", 4, groupingListTest.getMethodDefinitions()
+ .size());
+ assertEquals("Number of method in ListTest is incorrect", 1, listTest.getMethodDefinitions().size());
+ assertEquals("Number of method in ContainerGroupingListTest is incorrect", 1, containerGroupingListTest
+ .getMethodDefinitions().size());
+ assertEquals("Number of method in ListGroupingListTest is incorrect", 1, listGroupingListTest
+ .getMethodDefinitions().size());
+
+ containsSignatures(groupingListTest.getMethodDefinitions(), new MethodSignaturePattern(
+ "getContainerGroupingListTest", "ContainerGroupingListTest"), new MethodSignaturePattern(
+ "getLeafGroupingListTest", "String"), new MethodSignaturePattern("getLeaffllistGroupingListTest",
+ "List<String>"), new MethodSignaturePattern("getListGroupingListTest", "List<ListGroupingListTest>"));
+ containsSignatures(listTest.getMethodDefinitions(), new MethodSignaturePattern("getListLeafTest", "String"));
+ containsSignatures(containerGroupingListTest.getMethodDefinitions(), new MethodSignaturePattern(
+ "getLeafContainerGroupingListTest", "Short"));
+ containsSignatures(listGroupingListTest.getMethodDefinitions(), new MethodSignaturePattern(
+ "getLeafListGroupingListTest", "Integer"));
+ }
+
+ @Test
+ public void usesInModulTest() {
+ List<File> testModels = loadTestResources("/uses-of-grouping/uses-of-grouping-modul.yang");
+ final YangModelParser parser = new YangParserImpl();
+ final Set<Module> modules = parser.parseYangModels(testModels);
+ final SchemaContext context = parser.resolveSchemaContext(modules);
+
+ assertNotNull(context);
+ final BindingGenerator bindingGen = new BindingGeneratorImpl();
+ final List<Type> genTypes = bindingGen.generateTypes(context);
+
+ int groupingModulTestCounter = 0;
+ int groupingUsesModulDataCounter = 0;
+ GeneratedType groupingModulTest = null;
+ GeneratedType groupingUsesModulData = null;
+
+ for (Type type : genTypes) {
+ if (type instanceof GeneratedType && !(type instanceof GeneratedTransferObject)) {
+ GeneratedType genType = (GeneratedType) type;
+ if (genType.getName().equals("GroupingModulTest")) {
+ groupingModulTest = genType;
+ groupingModulTestCounter++;
+ } else if (genType.getName().equals("GroupingUsesModulData")) {
+ groupingUsesModulData = genType;
+ groupingUsesModulDataCounter++;
+ }
+ }
+ }
+
+ assertNotNull("Generated type for grouping-list-test wasn't generated", groupingModulTest);
+ assertEquals("GroupingModulTest interface - incorrect number of occurences", 1, groupingModulTestCounter);
+ assertEquals("GroupingModulTest isn't in correct package",
+ "org.opendaylight.yang.gen.v1.urn.grouping.uses.modul.rev2013718", groupingModulTest.getPackageName());
+
+ assertNotNull("Generated type for modul wasn't generated", groupingUsesModulData);
+ assertEquals("GroupingUsesModulData interface - incorrect number of occurences", 1,
+ groupingUsesModulDataCounter);
+ assertEquals("GroupingUsesModulData isn't in correct package",
+ "org.opendaylight.yang.gen.v1.urn.grouping.uses.modul.rev2013718",
+ groupingUsesModulData.getPackageName());
+
+ assertTrue("GroupingUsesModulData doesn't extend GroupingModulTest.",
+ containsInterface("GroupingModulTest", groupingUsesModulData));
+
+ assertEquals("Number of method in GroupingUsesModulData is incorrect", 0, groupingUsesModulData
+ .getMethodDefinitions().size());
+ assertEquals("Number of method in GroupingModulTest is incorrect", 2, groupingModulTest.getMethodDefinitions()
+ .size());
+
+ containsSignatures(groupingModulTest.getMethodDefinitions(), new MethodSignaturePattern(
+ "getLeafGroupingModulTest", "String"), new MethodSignaturePattern("getLeafGroupingModulTest2", "Short"));
+ }
+
+ @Test
+ public void usesInRpcTest() {
+ List<File> testModels = loadTestResources("/uses-of-grouping/uses-of-grouping-rpc.yang");
+ final YangModelParser parser = new YangParserImpl();
+ final Set<Module> modules = parser.parseYangModels(testModels);
+ final SchemaContext context = parser.resolveSchemaContext(modules);
+
+ assertNotNull(context);
+ final BindingGenerator bindingGen = new BindingGeneratorImpl();
+ final List<Type> genTypes = bindingGen.generateTypes(context);
+
+ int rpcTestInputCounter = 0;
+ int rpcTestOutputCounter = 0;
+ int groupingRpcInputTestCounter = 0;
+ int groupingRpcOutputTestCounter = 0;
+ int containerGroupingRpcInputTestCounter = 0;
+ GeneratedType rpcTestInput = null;
+ GeneratedType rpcTestOutput = null;
+ GeneratedType groupingRpcInputTest = null;
+ GeneratedType groupingRpcOutputTest = null;
+ GeneratedType containerGroupingRpcInputTest = null;
+
+ for (Type type : genTypes) {
+ if (type instanceof GeneratedType && !(type instanceof GeneratedTransferObject)) {
+ GeneratedType genType = (GeneratedType) type;
+ if (genType.getName().equals("RpcTestInput")) {
+ rpcTestInput = genType;
+ rpcTestInputCounter++;
+ } else if (genType.getName().equals("RpcTestOutput")) {
+ rpcTestOutput = genType;
+ rpcTestOutputCounter++;
+ } else if (genType.getName().equals("GroupingRpcInputTest")) {
+ groupingRpcInputTest = genType;
+ groupingRpcInputTestCounter++;
+ } else if (genType.getName().equals("GroupingRpcOutputTest")) {
+ groupingRpcOutputTest = genType;
+ groupingRpcOutputTestCounter++;
+ } else if (genType.getName().equals("ContainerGroupingRpcInputTest")) {
+ containerGroupingRpcInputTest = genType;
+ containerGroupingRpcInputTestCounter++;
+ }
+
+ }
+ }
+
+ assertNotNull("Generated type for RPC test input wasn't generated", rpcTestInput);
+ assertEquals("RpcTestInput interface - incorrect number of occurences", 1, rpcTestInputCounter);
+ assertEquals("RpcTestInput isn't in correct package",
+ "org.opendaylight.yang.gen.v1.urn.grouping.uses.rpc.rev2013718", rpcTestInput.getPackageName());
+
+ assertNotNull("Generated type for RPC test output wasn't generated", rpcTestOutput);
+ assertEquals("RpcTestOutput interface - incorrect number of occurences", 1, rpcTestOutputCounter);
+ assertEquals("RpcTestOutput isn't in correct package",
+ "org.opendaylight.yang.gen.v1.urn.grouping.uses.rpc.rev2013718", rpcTestOutput.getPackageName());
+
+ assertNotNull("Generated type for grouping-rpc-input-test wasn't generated", groupingRpcInputTest);
+ assertEquals("RpcTestOutput interface - incorrect number of occurences", 1, groupingRpcInputTestCounter);
+ assertEquals("GroupingRpcInputTest isn't in correct package",
+ "org.opendaylight.yang.gen.v1.urn.grouping.uses.rpc.rev2013718", groupingRpcInputTest.getPackageName());
+
+ assertNotNull("Generated type for grouping-rpc-output-test wasn't generated", groupingRpcOutputTest);
+ assertEquals("RpcTestOutput interface - incorrect number of occurences", 1, groupingRpcOutputTestCounter);
+ assertEquals("GroupingRpcOutputTest isn't in correct package",
+ "org.opendaylight.yang.gen.v1.urn.grouping.uses.rpc.rev2013718", groupingRpcOutputTest.getPackageName());
+
+ assertNotNull("Generated type for container-grouping-rpc-input-test wasn't generated",
+ containerGroupingRpcInputTest);
+ assertEquals("ContainerGroupingRpcInputTest interface - incorrect number of occurences", 1,
+ containerGroupingRpcInputTestCounter);
+ assertEquals("ContainerGroupingRpcInputTest isn't in correct package",
+ "org.opendaylight.yang.gen.v1.urn.grouping.uses.rpc.rev2013718.grouping.rpc.input.test",
+ containerGroupingRpcInputTest.getPackageName());
+
+ assertTrue("RpcTestInput doesn't extend GroupingRpcInputTest.",
+ containsInterface("GroupingRpcInputTest", rpcTestInput));
+ assertTrue("RpcTestOutput doesn't extend GroupingRpcOutputTest.",
+ containsInterface("GroupingRpcOutputTest", rpcTestOutput));
+
+ assertEquals("Number of method in RpcTestInput is incorrect", 0, rpcTestInput.getMethodDefinitions().size());
+ assertEquals("Number of method in RpcTestOutput is incorrect", 0, rpcTestOutput.getMethodDefinitions().size());
+ assertEquals("Number of method in GroupingRpcInputTest is incorrect", 2, groupingRpcInputTest
+ .getMethodDefinitions().size());
+ assertEquals("Number of method in GroupingRpcOutputTest is incorrect", 1, groupingRpcOutputTest
+ .getMethodDefinitions().size());
+ assertEquals("Number of method in ContainerGroupingRpcInputTest is incorrect", 1, containerGroupingRpcInputTest
+ .getMethodDefinitions().size());
+
+ containsSignatures(groupingRpcInputTest.getMethodDefinitions(), new MethodSignaturePattern(
+ "getContainerGroupingRpcInputTest", "ContainerGroupingRpcInputTest"), new MethodSignaturePattern(
+ "getLeaflistGroupingRpcInputTest", "List<Short>"));
+ containsSignatures(groupingRpcOutputTest.getMethodDefinitions(), new MethodSignaturePattern(
+ "getLeafGroupingRpcOutputTest", "Byte"));
+ containsSignatures(containerGroupingRpcInputTest.getMethodDefinitions(), new MethodSignaturePattern(
+ "getLeafContainerGroupingRpcInputTest", "String"));
+ }
+
+ @Test
+ public void usesInAugmentTest() {
+ List<File> testModels = loadTestResources("/uses-of-grouping/uses-of-grouping-augment.yang");
+ final YangModelParser parser = new YangParserImpl();
+ final Set<Module> modules = parser.parseYangModels(testModels);
+ final SchemaContext context = parser.resolveSchemaContext(modules);
+
+ assertNotNull(context);
+ final BindingGenerator bindingGen = new BindingGeneratorImpl();
+ final List<Type> genTypes = bindingGen.generateTypes(context);
+
+ GeneratedType containerAugment1 = null;
+ GeneratedType groupingAugmentTest = null;
+ int containerAugment1Counter = 0;
+ int groupingAugmentTestCounter = 0;
+
+ for (Type type : genTypes) {
+ if (type instanceof GeneratedType && !(type instanceof GeneratedTransferObject)) {
+ GeneratedType genType = (GeneratedType) type;
+ if (genType.getName().equals("ContainerAugment1")) {
+ containerAugment1 = genType;
+ containerAugment1Counter++;
+ } else if (genType.getName().equals("GroupingAugmentTest")) {
+ groupingAugmentTest = genType;
+ groupingAugmentTestCounter++;
+ }
+ }
+ }
+
+ assertNotNull("Generated type for augment /container-augment wasn't generated.", containerAugment1);
+ assertEquals("ContainerAugment1 interface generated more than one time.", 1, containerAugment1Counter);
+ assertEquals("ContainerAugment1 is in wrong package.",
+ "org.opendaylight.yang.gen.v1.urn.grouping.uses.augment.rev2013718", containerAugment1.getPackageName());
+
+ assertNotNull("Generated type for grouping-augment-test wasn't generated.", groupingAugmentTest);
+ assertEquals("GroupingAugmentTest interface generated more than one time.", 1, groupingAugmentTestCounter);
+ assertEquals("groupingAugmentTest is in wrong package.",
+ "org.opendaylight.yang.gen.v1.urn.grouping.uses.augment.rev2013718",
+ groupingAugmentTest.getPackageName());
+
+ assertTrue("ContainerAugment1 doesn't extend GroupingAugmentTest.",
+ containsInterface("GroupingAugmentTest", containerAugment1));
+
+ assertEquals("Number of method in GroupingCaseTest is incorrect", 0, containerAugment1.getMethodDefinitions()
+ .size());
+
+ assertEquals("Number of method in ContainerAugment1 is incorrect", 0, containerAugment1.getMethodDefinitions()
+ .size());
+ assertEquals("Number of method in GroupingCaseTest is incorrect", 1, groupingAugmentTest.getMethodDefinitions()
+ .size());
+
+ containsSignatures(groupingAugmentTest.getMethodDefinitions(), new MethodSignaturePattern(
+ "getLeafGroupingAugmentTest", "String"));
+ }
+
+ @Test
+ public void usesInNotification() {
+ List<File> testModels = loadTestResources("/uses-of-grouping/uses-of-grouping-notification.yang");
+ final YangModelParser parser = new YangParserImpl();
+ final Set<Module> modules = parser.parseYangModels(testModels);
+ final SchemaContext context = parser.resolveSchemaContext(modules);
+
+ assertNotNull(context);
+ final BindingGenerator bindingGen = new BindingGeneratorImpl();
+ final List<Type> genTypes = bindingGen.generateTypes(context);
+
+ GeneratedType notificationTest = null;
+ GeneratedType groupingNotificationTest = null;
+ GeneratedType containerGroupingNotificationTest = null;
+ int notificationTestCounter = 0;
+ int groupingNotificationTestCounter = 0;
+ int containerGroupingNotificationTestCounter = 0;
+
+ for (Type type : genTypes) {
+ if (type instanceof GeneratedType && !(type instanceof GeneratedTransferObject)) {
+ GeneratedType genType = (GeneratedType) type;
+ if (genType.getName().equals("NotificationTest")) {
+ notificationTest = genType;
+ notificationTestCounter++;
+ } else if (genType.getName().equals("GroupingNotificationTest")) {
+ groupingNotificationTest = genType;
+ groupingNotificationTestCounter++;
+ } else if (genType.getName().equals("ContainerGroupingNotificationTest")) {
+ containerGroupingNotificationTest = genType;
+ containerGroupingNotificationTestCounter++;
+ }
+ }
+ }
+
+ assertNotNull("Generated type for notification-test wasn't generated.", notificationTest);
+ assertEquals("NotificationTest interface generated more than one time.", 1, notificationTestCounter);
+ assertEquals("NotificationTest is in wrong package.",
+ "org.opendaylight.yang.gen.v1.urn.grouping.uses.notification.rev2013718",
+ notificationTest.getPackageName());
+
+ assertNotNull("Generated type for grouping-notification-test wasn't generated.", groupingNotificationTest);
+ assertEquals("GroupingNotificationTest interface generated more than one time.", 1,
+ groupingNotificationTestCounter);
+ assertEquals("groupingNotificationTest is in wrong package.",
+ "org.opendaylight.yang.gen.v1.urn.grouping.uses.notification.rev2013718",
+ groupingNotificationTest.getPackageName());
+
+ assertNotNull("Generated type for container-grouping-notification-test wasn't generated.",
+ containerGroupingNotificationTest);
+ assertEquals("ContainerGroupingNotificationTest interface generated more than one time.", 1,
+ containerGroupingNotificationTestCounter);
+ assertEquals("ContainerGroupingNotificationTest is in wrong package.",
+ "org.opendaylight.yang.gen.v1.urn.grouping.uses.notification.rev2013718.grouping.notification.test",
+ containerGroupingNotificationTest.getPackageName());
+
+ assertTrue("NotificationTest doesn't extend GroupingNotificationTest.",
+ containsInterface("GroupingNotificationTest", notificationTest));
+
+ assertEquals("Number of method in NotificationTest is incorrect", 1, notificationTest.getMethodDefinitions()
+ .size());
+ assertEquals("Number of method in GroupingNotificationTest is incorrect", 2, groupingNotificationTest
+ .getMethodDefinitions().size());
+ assertEquals("Number of method in ContainerGroupingNotificationTest is incorrect", 1,
+ containerGroupingNotificationTest.getMethodDefinitions().size());
+
+ containsSignatures(notificationTest.getMethodDefinitions(), new MethodSignaturePattern(
+ "getLeafNotificationTest", "String"));
+ containsSignatures(groupingNotificationTest.getMethodDefinitions(), new MethodSignaturePattern(
+ "getContainerGroupingNotificationTest", "ContainerGroupingNotificationTest"),
+ new MethodSignaturePattern("getLeaffllistGroupingNotificationTest", "List<String>"));
+ containsSignatures(containerGroupingNotificationTest.getMethodDefinitions(), new MethodSignaturePattern(
+ "getLeafContainerGroupingNotificationTest", "Long"));
+ }
+
+}
--- /dev/null
+module grouping_uses {
+
+ namespace "urn:uses:of:grouping";
+ prefix "sbd";
+
+ organization "OPEN DAYLIGHT";
+ contact "http://www.opendaylight.org/";
+
+ revision 2013-07-18 {
+ }
+
+
+
+ grouping grouping-modul-test {
+ leaf leaf-grouping-modul-test {
+ type string;
+ }
+ leaf leaf-grouping-modul-test2 {
+ type uint8;
+ }
+ }
+
+ grouping grouping-container-test {
+ leaf leaf-grouping-container-test1 {
+ type string;
+ }
+ leaf leaf-grouping-container-test2 {
+ type uint8;
+ }
+ }
+
+ grouping grouping-case-test {
+ leaf leaf-grouping-case-test1 {
+ type string;
+ }
+ }
+
+ grouping grouping-choice-test {
+ choice choice-grouing-choice-test {
+ case case-choice-grouping-choice-test1 {
+ leaf leaf-case-choice-grouping-choice-test1 {
+ type string;
+ }
+ }
+ case case-choice-grouping-choice-test2 {
+ leaf leaf-case-choice-grouping-choice-test2 {
+ type uint8;
+ }
+ }
+ }
+ }
+
+ grouping grouping-list-test {
+ leaf leaf-grouping-list-test {
+ type string;
+ }
+ container container-grouping-list-test {
+ leaf leaf-container-grouping-list-test {
+ type uint8;
+ }
+ }
+ list list-grouping-list-test {
+ leaf leaf-list-grouping-list-test {
+ type int32;
+ }
+ }
+ leaf-list leaflist-grouping-list-test {
+ type string;
+ }
+ }
+
+ grouping grouping-grouping-test {
+ leaf leaf-grouping-grouping {
+ type string;
+ }
+ }
+
+ grouping grouping-rpc-input-test {
+ container container-grouping-rpc-input-test {
+ leaf leaf-container-grouping-rpc-input-test {
+ type string;
+ }
+ }
+ leaf-list leaflist-grouping-rpc-input-test {
+ type uint8;
+ }
+ }
+
+ grouping grouping-rpc-output-test {
+ leaf leaf-grouping-rpc-output-test {
+ type int8;
+ }
+ }
+
+//grouping in GROUPING
+ grouping grouping-atest {
+ leaf leaf-grouping-test {
+ type int8;
+ }
+ uses grouping-grouping-test;
+ }
+
+//grouping in MODUL
+// uses grouping-modul-test;
+
+//grouping in RPC
+ rpc rpc-test {
+ input {
+ uses grouping-rpc-input-test;
+ }
+ output {
+ uses grouping-rpc-output-test;
+ }
+ }
+
+//grouping in CONTAINER
+ container container-test {
+ leaf container-leaf-test {
+ type string;
+ }
+ uses grouping-container-test;
+ }
+
+//grouping in CASE
+ container container-with-choicetest {
+ choice choice-test {
+ case a {
+ leaf leaf-choice-test1 {
+ type string;
+ }
+ }
+ case c {
+ uses grouping-case-test;
+ }
+ }
+ }
+
+//grouping in LIST
+ list list-test {
+ leaf list-leaf-test {
+ type string;
+ }
+ uses grouping-list-test;
+ }
+}
\ No newline at end of file
--- /dev/null
+module grouping_uses_augment {
+
+ namespace "urn:grouping:uses:augment";
+ prefix "sbd";
+
+ organization "OPEN DAYLIGHT";
+ contact "http://www.opendaylight.org/";
+
+ revision 2013-07-18 {
+ }
+
+ grouping grouping-augment-test {
+ leaf leaf-grouping-augment-test {
+ type string;
+ }
+ }
+
+
+ container container-augment {
+ leaf leaf-container-augment1 {
+ type string;
+ }
+ leaf leaf-container-augment2 {
+ type int64;
+ }
+ }
+
+ augment "/container-augment" {
+ uses grouping-augment-test;
+ }
+}
\ No newline at end of file
--- /dev/null
+module grouping_uses_case {
+
+ namespace "urn:grouping:uses:case";
+ prefix "sbd";
+
+ organization "OPEN DAYLIGHT";
+ contact "http://www.opendaylight.org/";
+
+ revision 2013-07-18 {
+ }
+
+
+ grouping grouping-case-test {
+ leaf leaf-grouping-case-test1 {
+ type string;
+ }
+ }
+
+ grouping grouping-choice-test {
+ choice choice-grouing-choice-test {
+ case case-choice-grouping-choice-test1 {
+ leaf leaf-case-choice-grouping-choice-test1 {
+ type string;
+ }
+ }
+ case case-choice-grouping-choice-test2 {
+ leaf leaf-case-choice-grouping-choice-test2 {
+ type uint8;
+ }
+ }
+ }
+ }
+
+//grouping in CASE
+ container container-with-choicetest {
+ choice choice-test {
+ case a {
+ leaf leaf-choice-test1 {
+ type string;
+ }
+ }
+ case c {
+ uses grouping-case-test;
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+module grouping_uses_container {
+
+ namespace "urn:grouping:uses:container";
+ prefix "sbd";
+
+ organization "OPEN DAYLIGHT";
+ contact "http://www.opendaylight.org/";
+
+ revision 2013-07-18 {
+ }
+
+ grouping grouping-container-test {
+ leaf leaf-grouping-container-test1 {
+ type string;
+ }
+ leaf leaf-grouping-container-test2 {
+ type uint8;
+ }
+ }
+
+//grouping in CONTAINER
+ container container-test {
+ leaf container-leaf-test {
+ type string;
+ }
+ uses grouping-container-test;
+ }
+}
\ No newline at end of file
--- /dev/null
+module grouping_dependencies {
+
+ namespace "urn:grouping:dependencies";
+ prefix "sbd";
+
+ organization "OPEN DAYLIGHT";
+ contact "http://www.opendaylight.org/";
+
+ revision 2013-07-18 {
+ }
+
+ grouping grouping-U {
+ leaf leaf-grouping-U {
+ type string;
+ }
+ uses grouping-V;
+ uses grouping-X;
+ }
+
+ grouping grouping-V {
+ leaf leaf-grouping-V {
+ type string;
+ }
+ uses grouping-Z;
+ uses grouping-ZZ;
+ }
+
+ grouping grouping-X {
+ leaf leaf-grouping-X {
+ type string;
+ }
+ uses grouping-Y;
+ }
+
+ grouping grouping-Y {
+ leaf leaf-grouping-Y {
+ type string;
+ }
+ }
+
+ grouping grouping-Z {
+ leaf leaf-grouping-Z {
+ type string;
+ }
+ }
+
+ grouping grouping-ZZ {
+ leaf leaf-grouping-ZZ {
+ type string;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+module grouping_uses_grouping {
+
+ namespace "urn:grouping:uses:grouping";
+ prefix "sbd";
+
+ organization "OPEN DAYLIGHT";
+ contact "http://www.opendaylight.org/";
+
+ revision 2013-07-18 {
+ }
+
+ grouping grouping-grouping-test {
+ leaf leaf-grouping-grouping {
+ type string;
+ }
+ }
+
+
+//grouping in GROUPING
+ grouping grouping-test {
+ leaf leaf-grouping-test {
+ type int8;
+ }
+ uses grouping-grouping-test;
+ }
+
+}
\ No newline at end of file
--- /dev/null
+module grouping_uses_list {
+
+ namespace "urn:grouping:uses:list";
+ prefix "sbd";
+
+ organization "OPEN DAYLIGHT";
+ contact "http://www.opendaylight.org/";
+
+ revision 2013-07-18 {
+ }
+
+
+ grouping grouping-list-test {
+ leaf leaf-grouping-list-test {
+ type string;
+ }
+ container container-grouping-list-test {
+ leaf leaf-container-grouping-list-test {
+ type uint8;
+ }
+ }
+ list list-grouping-list-test {
+ leaf leaf-list-grouping-list-test {
+ type int32;
+ }
+ }
+ leaf-list leaffllist-grouping-list-test {
+ type string;
+ }
+ }
+
+//grouping in LIST
+ list list-test {
+ leaf list-leaf-test {
+ type string;
+ }
+ uses grouping-list-test;
+ }
+}
\ No newline at end of file
--- /dev/null
+module grouping_uses_modul {
+
+ namespace "urn:grouping:uses:modul";
+ prefix "sbd";
+
+ organization "OPEN DAYLIGHT";
+ contact "http://www.opendaylight.org/";
+
+ revision 2013-07-18 {
+ }
+
+ grouping grouping-modul-test {
+ leaf leaf-grouping-modul-test {
+ type string;
+ }
+ leaf leaf-grouping-modul-test2 {
+ type uint8;
+ }
+ }
+
+//grouping in MODUL
+ uses grouping-modul-test;
+}
\ No newline at end of file
--- /dev/null
+module grouping_uses_notification {
+
+ namespace "urn:grouping:uses:notification";
+ prefix "sbd";
+
+ organization "OPEN DAYLIGHT";
+ contact "http://www.opendaylight.org/";
+
+ revision 2013-07-18 {
+ }
+
+ grouping grouping-notification-test {
+ container container-grouping-notification-test {
+ leaf leaf-container-grouping-notification-test {
+ type uint32;
+ }
+ }
+ leaf-list leaffllist-grouping-notification-test {
+ type string;
+ }
+ }
+
+//grouping in NOTIFICATION
+ notification notification-test {
+ leaf leaf-notification-test {
+ type string;
+ }
+ uses grouping-notification-test;
+ }
+}
\ No newline at end of file
--- /dev/null
+module grouping_uses_rpc {
+
+ namespace "urn:grouping:uses:rpc";
+ prefix "sbd";
+
+ organization "OPEN DAYLIGHT";
+ contact "http://www.opendaylight.org/";
+
+ revision 2013-07-18 {
+ }
+
+
+
+ grouping grouping-rpc-input-test {
+ container container-grouping-rpc-input-test {
+ leaf leaf-container-grouping-rpc-input-test {
+ type string;
+ }
+ }
+ leaf-list leaflist-grouping-rpc-input-test {
+ type uint8;
+ }
+ }
+
+ grouping grouping-rpc-output-test {
+ leaf leaf-grouping-rpc-output-test {
+ type int8;
+ }
+ }
+
+//grouping in RPC
+ rpc rpc-test {
+ input {
+ uses grouping-rpc-input-test;
+ }
+ output {
+ uses grouping-rpc-output-test;
+ }
+ }
+}
\ No newline at end of file
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.controller.binding.generator.util;\r
-\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.Set;\r
-\r
-import org.opendaylight.controller.binding.generator.util.generated.type.builder.GeneratedTOBuilderImpl;\r
-import org.opendaylight.controller.sal.binding.model.api.ConcreteType;\r
-import org.opendaylight.controller.sal.binding.model.api.GeneratedTransferObject;\r
-import org.opendaylight.controller.sal.binding.model.api.ParameterizedType;\r
-import org.opendaylight.controller.sal.binding.model.api.Type;\r
-import org.opendaylight.controller.sal.binding.model.api.WildcardType;\r
-import org.opendaylight.controller.yang.binding.Augmentable;\r
-import org.opendaylight.controller.yang.binding.Augmentation;\r
-import org.opendaylight.controller.yang.binding.BaseIdentity;\r
-import org.opendaylight.controller.yang.binding.DataObject;\r
-\r
-public final class Types {\r
- private static final Type SET_TYPE = typeForClass(Set.class);\r
- private static final Type LIST_TYPE = typeForClass(List.class);\r
- private static final Type MAP_TYPE = typeForClass(Map.class);\r
- public static final Type DATA_OBJECT = typeForClass(DataObject.class);\r
-\r
- public static ConcreteType voidType() {\r
- return new ConcreteTypeImpl(Void.class.getPackage().getName(),\r
- Void.class.getSimpleName());\r
- }\r
-\r
- public static final Type primitiveType(final String primitiveType) {\r
- return new ConcreteTypeImpl("", primitiveType);\r
- }\r
-\r
-\r
- /**\r
- * Returns an instance of {@link ConcreteType} describing the class\r
- *\r
- * @param cls\r
- * Class to describe\r
- * @return Description of class\r
- */\r
- public static ConcreteType typeForClass(Class<?> cls) {\r
- return new ConcreteTypeImpl(cls.getPackage().getName(),\r
- cls.getSimpleName());\r
- }\r
-\r
- /**\r
- * Returns an instance of {@link ParameterizedType} describing the typed\r
- * {@link Map}<K,V>\r
- *\r
- * @param keyType\r
- * Key Type\r
- * @param valueType\r
- * Value Type\r
- * @return Description of generic type instance\r
- */\r
- public static ParameterizedType mapTypeFor(Type keyType, Type valueType) {\r
- return parameterizedTypeFor(MAP_TYPE, keyType, valueType);\r
- }\r
-\r
- /**\r
- * Returns an instance of {@link ParameterizedType} describing the typed\r
- * {@link Set}<V> with concrete type of value.\r
- *\r
- * @param valueType\r
- * Value Type\r
- * @return Description of generic type instance of Set\r
- */\r
- public static ParameterizedType setTypeFor(Type valueType) {\r
- return parameterizedTypeFor(SET_TYPE, valueType);\r
- }\r
-\r
- /**\r
- * Returns an instance of {@link ParameterizedType} describing the typed\r
- * {@link List}<V> with concrete type of value.\r
- *\r
- * @param valueType\r
- * Value Type\r
- * @return Description of type instance of List\r
- */\r
- public static ParameterizedType listTypeFor(Type valueType) {\r
- return parameterizedTypeFor(LIST_TYPE, valueType);\r
- }\r
-\r
- public static GeneratedTransferObject getBaseIdentityTO() {\r
- Class<BaseIdentity> cls = BaseIdentity.class;\r
- GeneratedTOBuilderImpl gto = new GeneratedTOBuilderImpl(cls.getPackage().getName(),\r
- cls.getSimpleName());\r
- return gto.toInstance();\r
- }\r
-\r
- /**\r
- *\r
- * @param type\r
- * @param parameters\r
- * @return\r
- */\r
- public static ParameterizedType parameterizedTypeFor(Type type,\r
- Type... parameters) {\r
- return new ParametrizedTypeImpl(type, parameters);\r
- }\r
-\r
- public static WildcardType wildcardTypeFor(String packageName, String typeName) {\r
- return new WildcardTypeImpl(packageName, typeName);\r
- }\r
-\r
- public static ParameterizedType augmentableTypeFor(Type valueType) {\r
- final Type augmentable = typeForClass(Augmentable.class);\r
- return parameterizedTypeFor(augmentable, valueType);\r
- }\r
-\r
- public static ParameterizedType augmentationTypeFor(Type valueType) {\r
- final Type augmentation = typeForClass(Augmentation.class);\r
- return parameterizedTypeFor(augmentation, valueType);\r
- }\r
-\r
- private static class ConcreteTypeImpl extends AbstractBaseType implements\r
- ConcreteType {\r
- private ConcreteTypeImpl(String pkName, String name) {\r
- super(pkName, name);\r
- }\r
- }\r
-\r
- private static class ParametrizedTypeImpl extends AbstractBaseType\r
- implements ParameterizedType {\r
- private Type[] actualTypes;\r
- private Type rawType;\r
-\r
- @Override\r
- public Type[] getActualTypeArguments() {\r
-\r
- return actualTypes;\r
- }\r
-\r
- @Override\r
- public Type getRawType() {\r
- return rawType;\r
- }\r
-\r
- public ParametrizedTypeImpl(Type rawType, Type[] actTypes) {\r
- super(rawType.getPackageName(), rawType.getName());\r
- this.rawType = rawType;\r
- this.actualTypes = actTypes;\r
- }\r
-\r
- }\r
-\r
- private static class WildcardTypeImpl extends AbstractBaseType\r
- implements WildcardType {\r
- public WildcardTypeImpl(String packageName, String typeName) {\r
- super(packageName, typeName);\r
- }\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.binding.generator.util;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.opendaylight.controller.binding.generator.util.generated.type.builder.GeneratedTOBuilderImpl;
+import org.opendaylight.controller.sal.binding.model.api.ConcreteType;
+import org.opendaylight.controller.sal.binding.model.api.GeneratedTransferObject;
+import org.opendaylight.controller.sal.binding.model.api.ParameterizedType;
+import org.opendaylight.controller.sal.binding.model.api.Type;
+import org.opendaylight.controller.sal.binding.model.api.WildcardType;
+import org.opendaylight.controller.yang.binding.Augmentable;
+import org.opendaylight.controller.yang.binding.Augmentation;
+import org.opendaylight.controller.yang.binding.BaseIdentity;
+import org.opendaylight.controller.yang.binding.DataObject;
+
+public final class Types {
+ private static final Type SET_TYPE = typeForClass(Set.class);
+ private static final Type LIST_TYPE = typeForClass(List.class);
+ private static final Type MAP_TYPE = typeForClass(Map.class);
+ public static final Type DATA_OBJECT = typeForClass(DataObject.class);
+
+ public static ConcreteType voidType() {
+ return new ConcreteTypeImpl(Void.class.getPackage().getName(), Void.class.getSimpleName());
+ }
+
+ public static final Type primitiveType(final String primitiveType) {
+ return new ConcreteTypeImpl("", primitiveType);
+ }
+
+ /**
+ * Returns an instance of {@link ConcreteType} describing the class
+ *
+ * @param cls
+ * Class to describe
+ * @return Description of class
+ */
+ public static ConcreteType typeForClass(Class<?> cls) {
+ return new ConcreteTypeImpl(cls.getPackage().getName(), cls.getSimpleName());
+ }
+
+ /**
+ * Returns an instance of {@link ParameterizedType} describing the typed
+ * {@link Map}<K,V>
+ *
+ * @param keyType
+ * Key Type
+ * @param valueType
+ * Value Type
+ * @return Description of generic type instance
+ */
+ public static ParameterizedType mapTypeFor(Type keyType, Type valueType) {
+ return parameterizedTypeFor(MAP_TYPE, keyType, valueType);
+ }
+
+ /**
+ * Returns an instance of {@link ParameterizedType} describing the typed
+ * {@link Set}<V> with concrete type of value.
+ *
+ * @param valueType
+ * Value Type
+ * @return Description of generic type instance of Set
+ */
+ public static ParameterizedType setTypeFor(Type valueType) {
+ return parameterizedTypeFor(SET_TYPE, valueType);
+ }
+
+ /**
+ * Returns an instance of {@link ParameterizedType} describing the typed
+ * {@link List}<V> with concrete type of value.
+ *
+ * @param valueType
+ * Value Type
+ * @return Description of type instance of List
+ */
+ public static ParameterizedType listTypeFor(Type valueType) {
+ return parameterizedTypeFor(LIST_TYPE, valueType);
+ }
+
+ public static GeneratedTransferObject getBaseIdentityTO() {
+ Class<BaseIdentity> cls = BaseIdentity.class;
+ GeneratedTOBuilderImpl gto = new GeneratedTOBuilderImpl(cls.getPackage().getName(), cls.getSimpleName());
+ return gto.toInstance();
+ }
+
+ /**
+ *
+ * @param type
+ * @param parameters
+ * @return
+ */
+ public static ParameterizedType parameterizedTypeFor(Type type, Type... parameters) {
+ return new ParametrizedTypeImpl(type, parameters);
+ }
+
+ public static WildcardType wildcardTypeFor(String packageName, String typeName) {
+ return new WildcardTypeImpl(packageName, typeName);
+ }
+
+ public static ParameterizedType augmentableTypeFor(Type valueType) {
+ final Type augmentable = typeForClass(Augmentable.class);
+ return parameterizedTypeFor(augmentable, valueType);
+ }
+
+ public static ParameterizedType augmentationTypeFor(Type valueType) {
+ final Type augmentation = typeForClass(Augmentation.class);
+ return parameterizedTypeFor(augmentation, valueType);
+ }
+
+ private static class ConcreteTypeImpl extends AbstractBaseType implements ConcreteType {
+ private ConcreteTypeImpl(String pkName, String name) {
+ super(pkName, name);
+ }
+ }
+
+ private static class ParametrizedTypeImpl extends AbstractBaseType implements ParameterizedType {
+ private Type[] actualTypes;
+ private Type rawType;
+
+ @Override
+ public Type[] getActualTypeArguments() {
+
+ return actualTypes;
+ }
+
+ @Override
+ public Type getRawType() {
+ return rawType;
+ }
+
+ public ParametrizedTypeImpl(Type rawType, Type[] actTypes) {
+ super(rawType.getPackageName(), rawType.getName());
+ this.rawType = rawType;
+ this.actualTypes = actTypes;
+ }
+
+ }
+
+ private static class WildcardTypeImpl extends AbstractBaseType implements WildcardType {
+ public WildcardTypeImpl(String packageName, String typeName) {
+ super(packageName, typeName);
+ }
+ }
+
+}
--- /dev/null
+module grouping_uses {
+
+ namespace "urn:uses:of:grouping";
+ prefix "sbd";
+
+ organization "OPEN DAYLIGHT";
+ contact "http://www.opendaylight.org/";
+
+ revision 2013-07-18 {
+ }
+
+ grouping grouping-modul-test {
+ leaf leaf-grouping-modul-test {
+ type string;
+ }
+ leaf leaf-grouping-modul-test2 {
+ type uint8;
+ }
+ }
+
+
+ grouping grouping-container-test {
+ leaf leaf-grouping-container-test1 {
+ type string;
+ }
+ leaf leaf-grouping-container-test2 {
+ type uint8;
+ }
+ }
+
+ grouping grouping-case-test {
+ leaf leaf-grouping-case-test1 {
+ type string;
+ }
+ }
+
+ grouping grouping-choice-test {
+ choice choice-grouing-choice-test {
+ case case-choice-grouping-choice-test1 {
+ leaf leaf-case-choice-grouping-choice-test1 {
+ type string;
+ }
+ }
+ case case-choice-grouping-choice-test2 {
+ leaf leaf-case-choice-grouping-choice-test2 {
+ type uint8;
+ }
+ }
+ }
+ }
+
+ grouping grouping-list-test {
+ leaf leaf-grouping-list-test {
+ type string;
+ }
+ container container-grouping-list-test {
+ leaf leaf-container-grouping-list-test {
+ type uint8;
+ }
+ }
+ list list-grouping-list-test {
+ leaf leaf-list-grouping-list-test {
+ type int32;
+ }
+ }
+ leaf-list leaflist-grouping-list-test {
+ type string;
+ }
+ }
+
+ grouping grouping-grouping-test {
+ leaf leaf-grouping-grouping {
+ type string;
+ }
+ }
+
+ grouping grouping-rpc-input-test {
+ container container-grouping-rpc-input-test {
+ leaf leaf-container-grouping-rpc-input-test {
+ type string;
+ }
+ }
+ leaf-list leaflist-grouping-rpc-input-test {
+ type uint8;
+ }
+ }
+
+ grouping grouping-rpc-output-test {
+ leaf leaf-grouping-rpc-output-test {
+ type int8;
+ }
+ }
+
+ grouping grouping-notification-test {
+ container container-grouping-notification-test {
+ leaf leaf-container-grouping-notification-test {
+ type uint32;
+ }
+ }
+ leaf-list leaffllist-grouping-notification-test {
+ type string;
+ }
+ }
+
+//grouping in GROUPING
+ grouping grouping-atest {
+ leaf leaf-grouping-test {
+ type int8;
+ }
+ uses grouping-grouping-test;
+ }
+
+//grouping in MODUL
+ uses grouping-modul-test;
+
+//grouping in RPC
+ rpc rpc-test {
+ input {
+ uses grouping-rpc-input-test;
+ }
+ output {
+ uses grouping-rpc-output-test;
+ }
+ }
+
+//grouping in CONTAINER
+ container container-test {
+ leaf container-leaf-test {
+ type string;
+ }
+ uses grouping-container-test;
+ }
+
+//grouping in CASE
+ container container-with-choicetest {
+ choice choice-test {
+ case a {
+ leaf leaf-choice-test1 {
+ type string;
+ }
+ }
+ case c {
+ uses grouping-case-test;
+ }
+ }
+ }
+
+//grouping in LIST
+ list list-test {
+ leaf list-leaf-test {
+ type string;
+ }
+ uses grouping-list-test;
+ }
+
+//grouping in NOTIFICATION
+ notification notification-test {
+ leaf leaf-notification-test {
+ type string;
+ }
+ uses grouping-notification-test;
+ }
+
+ grouping grouping-augment-test1 {
+ leaf leaf-grouping-augment-test {
+ type string;
+ }
+ }
+
+ container container-augment {
+ leaf leaf-container-augment1 {
+ type string;
+ }
+ leaf leaf-container-augment2 {
+ type int64;
+ }
+ }
+
+//grouping AUGMENT
+ augment "/container-augment" {
+ uses grouping-augment-test1;
+ uses grouping-choice-test;
+ }
+}
\ No newline at end of file