Fixed bug which cause that nodes added by uses were generated duplicated.
Updated tests, minor code refactoring.
Change-Id: I695fef3ec65baae40c2b57bc68054f930f1fdd84
Signed-off-by: Martin Vitez <mvitez@cisco.com>
} else {
// ... or 'uses' statement
if (parent instanceof UsesNodeBuilder) {
+ if (augmentTargetStr.startsWith("/")) {
+ throw new YangParseException(name, line,
+ "If 'augment' statement is a substatement to the 'uses' statement, it cannot contain absolute path ("
+ + augmentTargetStr + ")");
+ }
((UsesNodeBuilder) parent).addAugment(builder);
} else {
throw new YangParseException(name, line, "Augment can be declared only under module or uses statement.");
// child nodes
for (DataSchemaNodeBuilder child : usesNode.getTargetChildren()) {
if (child instanceof GroupingMember) {
- ((GroupingMember) child).setAddedByUses(true);
+ setAddedByUsesToNode((GroupingMember)child);
}
if (child instanceof GroupingMember) {
}
}
+ private static void setAddedByUsesToNode(GroupingMember node) {
+ node.setAddedByUses(true);
+ if (node instanceof DataNodeContainerBuilder) {
+ for (DataSchemaNodeBuilder child : ((DataNodeContainerBuilder)node).getChildNodeBuilders()) {
+ if (child instanceof GroupingMember) {
+ setAddedByUsesToNode((GroupingMember)child);
+ }
+ }
+ }
+ }
+
/**
* Read data defined in target grouping builder, make a copy and add them to
* uses node builder.
}
if (!exists) {
DataSchemaNodeBuilder copy = CopyUtils.copy(childNode, parent, true);
+ if (copy instanceof GroupingMember) {
+ setAddedByUsesToNode((GroupingMember)copy);
+ }
collection.add(copy);
}
}
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Set;
-import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
import org.opendaylight.yangtools.yang.model.util.BaseTypes;
public class AugmentTest {
+ private static final DateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+
+ private static final URI fooNS = URI.create("urn:opendaylight.foo");
+ private static final URI barNS = URI.create("urn:opendaylight.bar");
+ private static final URI bazNS = URI.create("urn:opendaylight.baz");
+ private static Date fooRev;
+ private static Date barRev;
+ private static Date bazRev;
+ private static final String foo = "foo";
+ private static final String bar = "bar";
+ private static final String baz = "baz";
+ private static QName q0;
+ private static QName q1;
+ private static QName q2;
- private final URI types1NS = URI.create("urn:simple.nodes.test");
- private final URI types2NS = URI.create("urn:simple.types.test");
- private final URI types3NS = URI.create("urn:custom.nodes.test");
- private Date types1Rev;
- private Date types2Rev;
- private Date types3Rev;
- private final String t1 = "n";
- private final String t2 = "t";
- private final String t3 = "c";
- private QName q0;
- private QName q1;
- private QName q2;
-
- private final DateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
private Set<Module> modules;
- @Before
- public void init() throws FileNotFoundException, ParseException {
- types1Rev = simpleDateFormat.parse("2013-02-27");
- types2Rev = simpleDateFormat.parse("2013-07-03");
- types3Rev = simpleDateFormat.parse("2013-02-27");
+ @BeforeClass
+ public static void init() throws FileNotFoundException, ParseException {
+ fooRev = simpleDateFormat.parse("2013-10-13");
+ barRev = simpleDateFormat.parse("2013-10-14");
+ bazRev = simpleDateFormat.parse("2013-10-15");
- q0 = new QName(types2NS, types2Rev, t2, "interfaces");
- q1 = new QName(types2NS, types2Rev, t2, "ifEntry");
- q2 = new QName(types3NS, types3Rev, t3, "augment-holder");
-
- modules = TestUtils.loadModules(getClass().getResource("/model").getPath());
- assertEquals(3, modules.size());
+ q0 = new QName(barNS, barRev, bar, "interfaces");
+ q1 = new QName(barNS, barRev, bar, "ifEntry");
+ q2 = new QName(bazNS, bazRev, baz, "augment-holder");
}
@Test
- public void testAugmentParsing() {
+ public void testAugmentParsing() throws Exception {
+ modules = TestUtils.loadModules(getClass().getResource("/augment-test/augment-in-augment").getPath());
SchemaPath expectedSchemaPath;
- QName[] qnames = new QName[3];
- qnames[0] = q0;
- qnames[1] = q1;
- qnames[2] = q2;
+ List<QName> qnames = new ArrayList<>();
+ qnames.add(q0);
+ qnames.add(q1);
+ qnames.add(q2);
- // testfile1
- Module module1 = TestUtils.findModule(modules, "nodes");
+ // foo.yang
+ Module module1 = TestUtils.findModule(modules, "foo");
Set<AugmentationSchema> augmentations = module1.getAugmentations();
assertEquals(1, augmentations.size());
AugmentationSchema augment = augmentations.iterator().next();
assertNotNull(augment);
- expectedSchemaPath = new SchemaPath(Arrays.asList(qnames), true);
+ expectedSchemaPath = new SchemaPath(qnames, true);
assertEquals(expectedSchemaPath, augment.getTargetPath());
Set<DataSchemaNode> augmentChildren = augment.getChildNodes();
- assertEquals(5, augmentChildren.size());
+ assertEquals(4, augmentChildren.size());
for (DataSchemaNode dsn : augmentChildren) {
TestUtils.checkIsAugmenting(dsn, false);
}
LeafSchemaNode ds0ChannelNumber = (LeafSchemaNode) augment.getDataChildByName("ds0ChannelNumber");
LeafSchemaNode interfaceId = (LeafSchemaNode) augment.getDataChildByName("interface-id");
- LeafSchemaNode myType = (LeafSchemaNode) augment.getDataChildByName("my-type");
ContainerSchemaNode schemas = (ContainerSchemaNode) augment.getDataChildByName("schemas");
ChoiceNode odl = (ChoiceNode) augment.getDataChildByName("odl");
assertNotNull(ds0ChannelNumber);
assertNotNull(interfaceId);
- assertNotNull(myType);
assertNotNull(schemas);
assertNotNull(odl);
- qnames = new QName[4];
- qnames[0] = q0;
- qnames[1] = q1;
- qnames[2] = q2;
-
// leaf ds0ChannelNumber
- qnames[3] = new QName(types1NS, types1Rev, t1, "ds0ChannelNumber");
- expectedSchemaPath = new SchemaPath(Arrays.asList(qnames), true);
+ QName qname = new QName(fooNS, fooRev, foo, "ds0ChannelNumber");
+ qnames.add(qname);
+ assertEquals(qname, ds0ChannelNumber.getQName());
+ expectedSchemaPath = new SchemaPath(qnames, true);
assertEquals(expectedSchemaPath, ds0ChannelNumber.getPath());
assertFalse(ds0ChannelNumber.isAugmenting());
// type of leaf ds0ChannelNumber
assertEquals(expectedSchemaPath, ds0ChannelNumber.getType().getPath());
// leaf interface-id
- qnames[3] = new QName(types1NS, types1Rev, t1, "interface-id");
- expectedSchemaPath = new SchemaPath(Arrays.asList(qnames), true);
+ qname = new QName(fooNS, fooRev, foo, "interface-id");
+ assertEquals(qname, interfaceId.getQName());
+ qnames.set(3, qname);
+ expectedSchemaPath = new SchemaPath(qnames, true);
assertEquals(expectedSchemaPath, interfaceId.getPath());
assertFalse(interfaceId.isAugmenting());
- // leaf my-type
- qnames[3] = new QName(types1NS, types1Rev, t1, "my-type");
- expectedSchemaPath = new SchemaPath(Arrays.asList(qnames), true);
- assertEquals(expectedSchemaPath, myType.getPath());
- assertFalse(myType.isAugmenting());
-
// container schemas
- qnames[3] = new QName(types1NS, types1Rev, t1, "schemas");
- expectedSchemaPath = new SchemaPath(Arrays.asList(qnames), true);
+ qname = new QName(fooNS, fooRev, foo, "schemas");
+ assertEquals(qname, schemas.getQName());
+ qnames.set(3, qname);
+ expectedSchemaPath = new SchemaPath(qnames, true);
assertEquals(expectedSchemaPath, schemas.getPath());
assertFalse(schemas.isAugmenting());
// choice odl
- qnames[3] = new QName(types1NS, types1Rev, t1, "odl");
- expectedSchemaPath = new SchemaPath(Arrays.asList(qnames), true);
+ qname = new QName(fooNS, fooRev, foo, "odl");
+ assertEquals(qname, odl.getQName());
+ qnames.set(3, qname);
+ expectedSchemaPath = new SchemaPath(qnames, true);
assertEquals(expectedSchemaPath, odl.getPath());
assertFalse(odl.isAugmenting());
- // testfile3
- Module module3 = TestUtils.findModule(modules, "custom");
+ // baz.yang
+ Module module3 = TestUtils.findModule(modules, "baz");
augmentations = module3.getAugmentations();
- assertEquals(2, augmentations.size());
+ assertEquals(3, augmentations.size());
AugmentationSchema augment1 = null;
AugmentationSchema augment2 = null;
+ AugmentationSchema augment3 = null;
for (AugmentationSchema as : augmentations) {
- if ("if:ifType='ds0'".equals(as.getWhenCondition().toString())) {
+ if (as.getWhenCondition() == null) {
+ augment3 = as;
+ } else if ("if:ifType='ds0'".equals(as.getWhenCondition().toString())) {
augment1 = as;
} else if ("if:ifType='ds2'".equals(as.getWhenCondition().toString())) {
augment2 = as;
}
assertNotNull(augment1);
assertNotNull(augment2);
+ assertNotNull(augment3);
assertEquals(1, augment1.getChildNodes().size());
ContainerSchemaNode augmentHolder = (ContainerSchemaNode) augment1.getDataChildByName("augment-holder");
assertEquals(1, augment2.getChildNodes().size());
ContainerSchemaNode augmentHolder2 = (ContainerSchemaNode) augment2.getDataChildByName("augment-holder2");
assertNotNull(augmentHolder2);
+
+ assertEquals(1, augment3.getChildNodes().size());
+ LeafSchemaNode pause = (LeafSchemaNode) augment3.getDataChildByName("pause");
+ assertNotNull(pause);
}
@Test
- public void testAugmentResolving() throws ParseException {
- Module module2 = TestUtils.findModule(modules, "types");
+ public void testAugmentResolving() throws Exception {
+ modules = TestUtils.loadModules(getClass().getResource("/augment-test/augment-in-augment").getPath());
+ Module module2 = TestUtils.findModule(modules, "bar");
ContainerSchemaNode interfaces = (ContainerSchemaNode) module2.getDataChildByName("interfaces");
ListSchemaNode ifEntry = (ListSchemaNode) interfaces.getDataChildByName("ifEntry");
- ContainerSchemaNode augmentedContainer = (ContainerSchemaNode) ifEntry.getDataChildByName("augment-holder");
- TestUtils.checkIsAugmenting(augmentedContainer, true);
- // testfile1.yang
- // augment "/data:interfaces/data:ifEntry/t3:augment-holder"
- LeafSchemaNode ds0ChannelNumber = (LeafSchemaNode) augmentedContainer.getDataChildByName("ds0ChannelNumber");
- LeafSchemaNode interfaceId = (LeafSchemaNode) augmentedContainer.getDataChildByName("interface-id");
- LeafSchemaNode myType = (LeafSchemaNode) augmentedContainer.getDataChildByName("my-type");
- ContainerSchemaNode schemas = (ContainerSchemaNode) augmentedContainer.getDataChildByName("schemas");
- ChoiceNode odl = (ChoiceNode) augmentedContainer.getDataChildByName("odl");
+ SchemaPath expectedPath;
+ List<QName> qnames = new ArrayList<>();
+ qnames.add(q0);
+ qnames.add(q1);
+ qnames.add(q2);
+
+ // baz.yang
+ // augment "/br:interfaces/br:ifEntry" {
+ ContainerSchemaNode augmentHolder = (ContainerSchemaNode) ifEntry.getDataChildByName("augment-holder");
+ TestUtils.checkIsAugmenting(augmentHolder, true);
+ assertEquals(q2, augmentHolder.getQName());
+ expectedPath = new SchemaPath(qnames, true);
+ assertEquals(expectedPath, augmentHolder.getPath());
+
+ // foo.yang
+ // augment "/br:interfaces/br:ifEntry/bz:augment-holder"
+ LeafSchemaNode ds0ChannelNumber = (LeafSchemaNode) augmentHolder.getDataChildByName("ds0ChannelNumber");
+ LeafSchemaNode interfaceId = (LeafSchemaNode) augmentHolder.getDataChildByName("interface-id");
+ ContainerSchemaNode schemas = (ContainerSchemaNode) augmentHolder.getDataChildByName("schemas");
+ ChoiceNode odl = (ChoiceNode) augmentHolder.getDataChildByName("odl");
assertNotNull(ds0ChannelNumber);
assertNotNull(interfaceId);
- assertNotNull(myType);
assertNotNull(schemas);
assertNotNull(odl);
- SchemaPath expectedPath;
- QName[] qnames = new QName[4];
- qnames[0] = q0;
- qnames[1] = q1;
- qnames[2] = q2;
-
// leaf ds0ChannelNumber
- qnames[3] = new QName(types1NS, types1Rev, t1, "ds0ChannelNumber");
- expectedPath = new SchemaPath(Arrays.asList(qnames), true);
+ QName qname = new QName(fooNS, fooRev, foo, "ds0ChannelNumber");
+ assertEquals(qname, ds0ChannelNumber.getQName());
+ qnames.add(qname);
+ expectedPath = new SchemaPath(qnames, true);
assertEquals(expectedPath, ds0ChannelNumber.getPath());
// leaf interface-id
- qnames[3] = new QName(types1NS, types1Rev, t1, "interface-id");
- expectedPath = new SchemaPath(Arrays.asList(qnames), true);
+ qname = new QName(fooNS, fooRev, foo, "interface-id");
+ assertEquals(qname, interfaceId.getQName());
+ qnames.set(3, qname);
+ expectedPath = new SchemaPath(qnames, true);
assertEquals(expectedPath, interfaceId.getPath());
- // leaf my-type
- qnames[3] = new QName(types1NS, types1Rev, t1, "my-type");
- expectedPath = new SchemaPath(Arrays.asList(qnames), true);
- assertEquals(expectedPath, myType.getPath());
-
// container schemas
- qnames[3] = new QName(types1NS, types1Rev, t1, "schemas");
- expectedPath = new SchemaPath(Arrays.asList(qnames), true);
+ qname = new QName(fooNS, fooRev, foo, "schemas");
+ assertEquals(qname, schemas.getQName());
+ qnames.set(3, qname);
+ expectedPath = new SchemaPath(qnames, true);
assertEquals(expectedPath, schemas.getPath());
// choice odl
- qnames[3] = new QName(types1NS, types1Rev, t1, "odl");
- expectedPath = new SchemaPath(Arrays.asList(qnames), true);
+ qname = new QName(fooNS, fooRev, foo, "odl");
+ assertEquals(qname, odl.getQName());
+ qnames.set(3, qname);
+ expectedPath = new SchemaPath(qnames, true);
assertEquals(expectedPath, odl.getPath());
}
@Test
- public void testAugmentChoice() throws ParseException {
- Module module2 = TestUtils.findModule(modules, "types");
+ public void testAugmentedChoice() throws Exception {
+ modules = TestUtils.loadModules(getClass().getResource("/augment-test/augment-in-augment").getPath());
+ Module module2 = TestUtils.findModule(modules, "bar");
ContainerSchemaNode interfaces = (ContainerSchemaNode) module2.getDataChildByName("interfaces");
ListSchemaNode ifEntry = (ListSchemaNode) interfaces.getDataChildByName("ifEntry");
- ContainerSchemaNode augmentedContainer = (ContainerSchemaNode) ifEntry.getDataChildByName("augment-holder");
- TestUtils.checkIsAugmenting(augmentedContainer, true);
+ ContainerSchemaNode augmentedHolder = (ContainerSchemaNode) ifEntry.getDataChildByName("augment-holder");
+ TestUtils.checkIsAugmenting(augmentedHolder, true);
- // testfile1.yang
- // augment "/data:interfaces/data:ifEntry/t3:augment-holder"
- ChoiceNode odl = (ChoiceNode) augmentedContainer.getDataChildByName("odl");
+ // foo.yang
+ // augment "/br:interfaces/br:ifEntry/bz:augment-holder"
+ ChoiceNode odl = (ChoiceNode) augmentedHolder.getDataChildByName("odl");
assertNotNull(odl);
Set<ChoiceCaseNode> cases = odl.getCases();
assertEquals(4, cases.size());
assertNotNull(node3);
SchemaPath expectedPath;
- QName[] qnames = new QName[5];
- qnames[0] = q0;
- qnames[1] = q1;
- qnames[2] = q2;
- qnames[3] = new QName(types1NS, types1Rev, t1, "odl");
+ List<QName> qnames = new ArrayList<>();
+ qnames.add(q0);
+ qnames.add(q1);
+ qnames.add(q2);
+ qnames.add(new QName(fooNS, fooRev, foo, "odl"));
// case id
- qnames[4] = new QName(types1NS, types1Rev, t1, "id");
- expectedPath = new SchemaPath(Arrays.asList(qnames), true);
+ QName qname = new QName(fooNS, fooRev, foo, "id");
+ assertEquals(qname, id.getQName());
+ qnames.add(qname);
+ expectedPath = new SchemaPath(qnames, true);
assertEquals(expectedPath, id.getPath());
Set<DataSchemaNode> idChildren = id.getChildNodes();
assertEquals(1, idChildren.size());
// case node1
- qnames[4] = new QName(types1NS, types1Rev, t1, "node1");
- expectedPath = new SchemaPath(Arrays.asList(qnames), true);
+ qname = new QName(fooNS, fooRev, foo, "node1");
+ assertEquals(qname, node1.getQName());
+ qnames.set(4, qname);
+ expectedPath = new SchemaPath(qnames, true);
assertEquals(expectedPath, node1.getPath());
Set<DataSchemaNode> node1Children = node1.getChildNodes();
assertTrue(node1Children.isEmpty());
// case node2
- qnames[4] = new QName(types1NS, types1Rev, t1, "node2");
- expectedPath = new SchemaPath(Arrays.asList(qnames), true);
+ qname = new QName(fooNS, fooRev, foo, "node2");
+ assertEquals(qname, node2.getQName());
+ qnames.set(4, qname);
+ expectedPath = new SchemaPath(qnames, true);
assertEquals(expectedPath, node2.getPath());
Set<DataSchemaNode> node2Children = node2.getChildNodes();
assertTrue(node2Children.isEmpty());
// case node3
- qnames[4] = new QName(types1NS, types1Rev, t1, "node3");
- expectedPath = new SchemaPath(Arrays.asList(qnames), true);
+ qname = new QName(fooNS, fooRev, foo, "node3");
+ assertEquals(qname, node3.getQName());
+ qnames.set(4, qname);
+ expectedPath = new SchemaPath(qnames, true);
assertEquals(expectedPath, node3.getPath());
Set<DataSchemaNode> node3Children = node3.getChildNodes();
assertEquals(1, node3Children.size());
// test cases
- qnames = new QName[6];
- qnames[0] = q0;
- qnames[1] = q1;
- qnames[2] = q2;
- qnames[3] = new QName(types1NS, types1Rev, t1, "odl");
+ qnames.clear();
+ qnames.add(q0);
+ qnames.add(q1);
+ qnames.add(q2);
+ qnames.add(new QName(fooNS, fooRev, foo, "odl"));
// case id child
- qnames[4] = new QName(types1NS, types1Rev, t1, "id");
- qnames[5] = new QName(types1NS, types1Rev, t1, "id");
+ qnames.add(new QName(fooNS, fooRev, foo, "id"));
+ qnames.add(new QName(fooNS, fooRev, foo, "id"));
LeafSchemaNode caseIdChild = (LeafSchemaNode) idChildren.iterator().next();
assertNotNull(caseIdChild);
- expectedPath = new SchemaPath(Arrays.asList(qnames), true);
+ expectedPath = new SchemaPath(qnames, true);
assertEquals(expectedPath, caseIdChild.getPath());
// case node3 child
- qnames[4] = new QName(types1NS, types1Rev, t1, "node3");
- qnames[5] = new QName(types1NS, types1Rev, t1, "node3");
+ qnames.set(4, new QName(fooNS, fooRev, foo, "node3"));
+ qnames.set(5, new QName(fooNS, fooRev, foo, "node3"));
ContainerSchemaNode caseNode3Child = (ContainerSchemaNode) node3Children.iterator().next();
assertNotNull(caseNode3Child);
- expectedPath = new SchemaPath(Arrays.asList(qnames), true);
+ expectedPath = new SchemaPath(qnames, true);
assertEquals(expectedPath, caseNode3Child.getPath());
}
assertEquals(expectedPath, destroy.getPath());
Set<DataSchemaNode> destroyChildren = destroy.getChildNodes();
assertEquals(1, destroyChildren.size());
-
}
}
@Test
public void testRefine() {
- Module testModule = TestUtils.findModule(modules, "nodes");
+ Module testModule = TestUtils.findModule(modules, "foo");
ContainerSchemaNode peer = (ContainerSchemaNode) testModule.getDataChildByName("peer");
ContainerSchemaNode destination = (ContainerSchemaNode) peer.getDataChildByName("destination");
@Test
public void testGrouping() {
- Module testModule = TestUtils.findModule(modules, "custom");
+ Module testModule = TestUtils.findModule(modules, "baz");
Set<GroupingDefinition> groupings = testModule.getGroupings();
assertEquals(1, groupings.size());
GroupingDefinition grouping = groupings.iterator().next();
// suffix _u = added by uses
// suffix _g = defined in grouping
- Module testModule = TestUtils.findModule(modules, "custom");
+ Module testModule = TestUtils.findModule(modules, "baz");
// get grouping
Set<GroupingDefinition> groupings = testModule.getGroupings();
assertEquals(1, groupings.size());
GroupingDefinition grouping = groupings.iterator().next();
- testModule = TestUtils.findModule(modules, "nodes");
+ testModule = TestUtils.findModule(modules, "foo");
// get node containing uses
ContainerSchemaNode peer = (ContainerSchemaNode) testModule.getDataChildByName("peer");
// suffix _u = added by uses
// suffix _g = defined in grouping
- Module testModule = TestUtils.findModule(modules, "custom");
+ Module testModule = TestUtils.findModule(modules, "baz");
// get grouping
Set<GroupingDefinition> groupings = testModule.getGroupings();
GroupingDefinition grouping = groupings.iterator().next();
// get node containing uses
- Module destination = TestUtils.findModule(modules, "nodes");
+ Module destination = TestUtils.findModule(modules, "foo");
// check uses
Set<UsesNode> uses = destination.getUses();
GroupingDefinition gz = null;
GroupingDefinition gzz = null;
for (GroupingDefinition gd : groupings) {
- if ("grouping-U".equals(gd.getQName().getLocalName()))
+ String name = gd.getQName().getLocalName();
+ switch (name) {
+ case "grouping-U":
gu = gd;
- if ("grouping-V".equals(gd.getQName().getLocalName()))
+ break;
+ case "grouping-V":
gv = gd;
- if ("grouping-X".equals(gd.getQName().getLocalName()))
+ break;
+ case "grouping-X":
gx = gd;
- if ("grouping-Y".equals(gd.getQName().getLocalName()))
+ break;
+ case "grouping-Y":
gy = gd;
- if ("grouping-Z".equals(gd.getQName().getLocalName()))
+ break;
+ case "grouping-Z":
gz = gd;
- if ("grouping-ZZ".equals(gd.getQName().getLocalName()))
+ break;
+ case "grouping-ZZ":
gzz = gd;
+ break;
+ }
}
assertNotNull(gu);
assertNotNull(gv);
ContainerSchemaNode containerV = (ContainerSchemaNode)gv.getDataChildByName("container-grouping-V");
assertNotNull(containerV);
expectedPath = TestUtils.createPath(true, expectedNS, expectedRev, expectedPref, "grouping-V", "container-grouping-V");
+ assertEquals(expectedPath, containerV.getPath());
assertEquals(2, containerV.getChildNodes().size());
// grouping-V/container-grouping-V/leaf-grouping-X
LeafSchemaNode leafXinContainerV = (LeafSchemaNode)containerV.getDataChildByName("leaf-grouping-X");
YangModelParser parser = new YangParserImpl();
final File testDir = new File(resourceDirectory);
final String[] fileList = testDir.list();
- final List<File> testFiles = new ArrayList<File>();
- if(fileList == null) {
+ final List<File> testFiles = new ArrayList<>();
+ if (fileList == null) {
throw new FileNotFoundException(resourceDirectory);
}
- for (int i = 0; i < fileList.length; i++) {
- String fileName = fileList[i];
+ for (String fileName : fileList) {
testFiles.add(new File(testDir, fileName));
}
return parser.parseYangModels(testFiles);
public static Set<Module> loadModules(List<InputStream> input) throws IOException {
final YangModelParser parser = new YangParserImpl();
- final Set<Module> modules = new HashSet<Module>(
- parser.parseYangModelsFromStreams(input));
- for(InputStream stream : input) {
+ final Set<Module> modules = new HashSet<>(parser.parseYangModelsFromStreams(input));
+ for (InputStream stream : input) {
stream.close();
}
return modules;
}
- public static Module loadModule(final InputStream stream) throws
- IOException {
+ public static Module loadModule(final InputStream stream) throws IOException {
final YangModelParser parser = new YangParserImpl();
final List<InputStream> input = Collections.singletonList(stream);
- final Set<Module> modules = new HashSet<Module>(
- parser.parseYangModelsFromStreams(input));
+ final Set<Module> modules = new HashSet<>(parser.parseYangModelsFromStreams(input));
stream.close();
return modules.iterator().next();
}
- public static Module loadModuleWithContext(final InputStream stream, final SchemaContext context) throws IOException {
+ public static Module loadModuleWithContext(final InputStream stream, final SchemaContext context)
+ throws IOException {
final YangModelParser parser = new YangParserImpl();
final List<InputStream> input = Collections.singletonList(stream);
- final Set<Module> modules = new HashSet<Module>(parser.parseYangModelsFromStreams(input, context));
+ final Set<Module> modules = new HashSet<>(parser.parseYangModelsFromStreams(input, context));
stream.close();
return modules.iterator().next();
}
- public static Set<Module> loadModulesWithContext(final List<InputStream> input, final SchemaContext context) throws IOException {
+ public static Set<Module> loadModulesWithContext(final List<InputStream> input, final SchemaContext context)
+ throws IOException {
final YangModelParser parser = new YangParserImpl();
- final Set<Module> modules = new HashSet<Module>(parser.parseYangModelsFromStreams(input, context));
- for(InputStream is : input) {
- if(is != null) {
+ final Set<Module> modules = new HashSet<>(parser.parseYangModelsFromStreams(input, context));
+ for (InputStream is : input) {
+ if (is != null) {
is.close();
}
}
return result;
}
- public static ModuleImport findImport(Set<ModuleImport> imports,
- String prefix) {
+ public static ModuleImport findImport(Set<ModuleImport> imports, String prefix) {
ModuleImport result = null;
for (ModuleImport moduleImport : imports) {
if (moduleImport.getPrefix().equals(prefix)) {
return result;
}
- public static TypeDefinition<?> findTypedef(
- Set<TypeDefinition<?>> typedefs, String name) {
+ public static TypeDefinition<?> findTypedef(Set<TypeDefinition<?>> typedefs, String name) {
TypeDefinition<?> result = null;
for (TypeDefinition<?> td : typedefs) {
if (td.getQName().getLocalName().equals(name)) {
return result;
}
- public static SchemaPath createPath(boolean absolute, URI namespace,
- Date revision, String prefix, String... names) {
- List<QName> path = new ArrayList<QName>();
+ public static SchemaPath createPath(boolean absolute, URI namespace, Date revision, String prefix, String... names) {
+ List<QName> path = new ArrayList<>();
for (String name : names) {
path.add(new QName(namespace, revision, prefix, name));
}
path.offer(expectedQName);
expectedPath = new SchemaPath(path, true);
assertEquals(expectedPath, order.getPath());
- assertFalse(order.isAddedByUses());
+ assertTrue(order.isAddedByUses());
assertTrue(order.isAugmenting());
assertEquals(2, order.getChildNodes().size());
// * |-- |-- |-- |-- |-- leaf delete
import org.opendaylight.yangtools.yang.model.util.UnionType;
public class YangParserTest {
- private final URI nodesNS = URI.create("urn:simple.nodes.test");
- private final URI typesNS = URI.create("urn:simple.types.test");
- private final URI customNS = URI.create("urn:custom.nodes.test");
- private Date nodesRev;
- private Date typesRev;
- private Date customRev;
+ private final URI fooNS = URI.create("urn:opendaylight.foo");
+ private final URI barNS = URI.create("urn:opendaylight.bar");
+ private final URI bazNS = URI.create("urn:opendaylight.baz");
+ private Date fooRev;
+ private Date barRev;
+ private Date bazRev;
private Set<Module> modules;
@Before
public void init() throws FileNotFoundException, ParseException {
- nodesRev = TestUtils.simpleDateFormat.parse("2013-02-27");
- typesRev = TestUtils.simpleDateFormat.parse("2013-07-03");
- customRev = TestUtils.simpleDateFormat.parse("2013-02-27");
+ fooRev = TestUtils.simpleDateFormat.parse("2013-02-27");
+ barRev = TestUtils.simpleDateFormat.parse("2013-07-03");
+ bazRev = TestUtils.simpleDateFormat.parse("2013-02-27");
modules = TestUtils.loadModules(getClass().getResource("/model").getPath());
assertEquals(3, modules.size());
@Test
public void testHeaders() throws ParseException {
- Module test = TestUtils.findModule(modules, "nodes");
+ Module foo = TestUtils.findModule(modules, "foo");
- assertEquals("nodes", test.getName());
- assertEquals("1", test.getYangVersion());
- assertEquals(nodesNS, test.getNamespace());
- assertEquals("n", test.getPrefix());
+ assertEquals("foo", foo.getName());
+ assertEquals("1", foo.getYangVersion());
+ assertEquals(fooNS, foo.getNamespace());
+ assertEquals("foo", foo.getPrefix());
- Set<ModuleImport> imports = test.getImports();
+ Set<ModuleImport> imports = foo.getImports();
assertEquals(2, imports.size());
- ModuleImport import2 = TestUtils.findImport(imports, "t");
- assertEquals("types", import2.getModuleName());
- assertEquals(typesRev, import2.getRevision());
+ ModuleImport import2 = TestUtils.findImport(imports, "br");
+ assertEquals("bar", import2.getModuleName());
+ assertEquals(barRev, import2.getRevision());
- ModuleImport import3 = TestUtils.findImport(imports, "c");
- assertEquals("custom", import3.getModuleName());
- assertEquals(customRev, import3.getRevision());
+ ModuleImport import3 = TestUtils.findImport(imports, "bz");
+ assertEquals("baz", import3.getModuleName());
+ assertEquals(bazRev, import3.getRevision());
- assertEquals("opendaylight", test.getOrganization());
- assertEquals("http://www.opendaylight.org/", test.getContact());
+ assertEquals("opendaylight", foo.getOrganization());
+ assertEquals("http://www.opendaylight.org/", foo.getContact());
Date expectedRevision = TestUtils.createDate("2013-02-27");
- assertEquals(expectedRevision, test.getRevision());
- assertEquals(" WILL BE DEFINED LATER", test.getReference());
+ assertEquals(expectedRevision, foo.getRevision());
+ assertEquals(" WILL BE DEFINED LATER", foo.getReference());
}
@Test
public void testOrderingTypedef() {
- Module test = TestUtils.findModule(modules, "types");
- Set<TypeDefinition<?>> typedefs = test.getTypeDefinitions();
+ Module bar = TestUtils.findModule(modules, "bar");
+ Set<TypeDefinition<?>> typedefs = bar.getTypeDefinitions();
String[] expectedOrder = new String[] { "int32-ext1", "int32-ext2", "my-decimal-type", "my-union",
"my-union-ext", "nested-union2", "string-ext1", "string-ext2", "string-ext3", "string-ext4" };
String[] actualOrder = new String[typedefs.size()];
@Test
public void testOrderingChildNodes() {
- Module test = TestUtils.findModule(modules, "nodes");
+ Module foo = TestUtils.findModule(modules, "foo");
AugmentationSchema augment1 = null;
- for (AugmentationSchema as : test.getAugmentations()) {
+ for (AugmentationSchema as : foo.getAugmentations()) {
if ("if:ifType='ds0'".equals(as.getWhenCondition().toString())) {
augment1 = as;
break;
@Test
public void testOrderingNestedChildNodes1() {
- Module test = TestUtils.findModule(modules, "nodes");
+ Module foo = TestUtils.findModule(modules, "foo");
- Set<DataSchemaNode> childNodes = test.getChildNodes();
+ Set<DataSchemaNode> childNodes = foo.getChildNodes();
String[] expectedOrder = new String[] { "address", "addresses", "custom-union-leaf", "data", "datas",
"decimal-leaf", "decimal-leaf2", "ext", "how", "int32-leaf", "length-leaf", "mycont", "peer", "port",
"string-leaf", "transfer", "union-leaf" };
@Test
public void testOrderingNestedChildNodes2() {
- Module test = TestUtils.findModule(modules, "custom");
- Set<GroupingDefinition> groupings = test.getGroupings();
+ Module baz = TestUtils.findModule(modules, "baz");
+ Set<GroupingDefinition> groupings = baz.getGroupings();
assertEquals(1, groupings.size());
GroupingDefinition target = groupings.iterator().next();
@Test
public void testParseList() {
- Module test = TestUtils.findModule(modules, "types");
- URI expectedNamespace = URI.create("urn:simple.types.test");
- String expectedPrefix = "t";
+ Module bar = TestUtils.findModule(modules, "bar");
+ URI expectedNamespace = URI.create("urn:opendaylight.bar");
+ String expectedPrefix = "bar";
- ContainerSchemaNode interfaces = (ContainerSchemaNode) test.getDataChildByName("interfaces");
+ ContainerSchemaNode interfaces = (ContainerSchemaNode) bar.getDataChildByName("interfaces");
ListSchemaNode ifEntry = (ListSchemaNode) interfaces.getDataChildByName("ifEntry");
// test SchemaNode args
- QName expectedQName = new QName(expectedNamespace, typesRev, expectedPrefix, "ifEntry");
+ QName expectedQName = new QName(expectedNamespace, barRev, expectedPrefix, "ifEntry");
assertEquals(expectedQName, ifEntry.getQName());
- SchemaPath expectedPath = TestUtils.createPath(true, expectedNamespace, typesRev, expectedPrefix, "interfaces",
+ SchemaPath expectedPath = TestUtils.createPath(true, expectedNamespace, barRev, expectedPrefix, "interfaces",
"ifEntry");
assertEquals(expectedPath, ifEntry.getPath());
assertNull(ifEntry.getDescription());
Set<AugmentationSchema> availableAugmentations = ifEntry.getAvailableAugmentations();
assertEquals(2, availableAugmentations.size());
// test ListSchemaNode args
- List<QName> expectedKey = new ArrayList<QName>();
- expectedKey.add(new QName(expectedNamespace, typesRev, expectedPrefix, "ifIndex"));
+ List<QName> expectedKey = new ArrayList<>();
+ expectedKey.add(new QName(expectedNamespace, barRev, expectedPrefix, "ifIndex"));
assertEquals(expectedKey, ifEntry.getKeyDefinition());
assertFalse(ifEntry.isUserOrdered());
// test DataNodeContainer args
@Test
public void testTypedefRangesResolving() throws ParseException {
- Module testModule = TestUtils.findModule(modules, "nodes");
- LeafSchemaNode int32Leaf = (LeafSchemaNode) testModule.getDataChildByName("int32-leaf");
+ Module foo = TestUtils.findModule(modules, "foo");
+ LeafSchemaNode int32Leaf = (LeafSchemaNode) foo.getDataChildByName("int32-leaf");
ExtendedType leafType = (ExtendedType) int32Leaf.getType();
QName leafTypeQName = leafType.getQName();
assertEquals("int32-ext2", leafTypeQName.getLocalName());
- assertEquals("n", leafTypeQName.getPrefix());
- assertEquals(nodesNS, leafTypeQName.getNamespace());
- assertEquals(nodesRev, leafTypeQName.getRevision());
+ assertEquals("foo", leafTypeQName.getPrefix());
+ assertEquals(fooNS, leafTypeQName.getNamespace());
+ assertEquals(fooRev, leafTypeQName.getRevision());
assertNull(leafType.getUnits());
assertNull(leafType.getDefaultValue());
assertTrue(leafType.getLengthConstraints().isEmpty());
ExtendedType baseType = (ExtendedType) leafType.getBaseType();
QName baseTypeQName = baseType.getQName();
assertEquals("int32-ext2", baseTypeQName.getLocalName());
- assertEquals("t", baseTypeQName.getPrefix());
- assertEquals(typesNS, baseTypeQName.getNamespace());
- assertEquals(typesRev, baseTypeQName.getRevision());
+ assertEquals("bar", baseTypeQName.getPrefix());
+ assertEquals(barNS, baseTypeQName.getNamespace());
+ assertEquals(barRev, baseTypeQName.getRevision());
assertEquals("mile", baseType.getUnits());
assertEquals("11", baseType.getDefaultValue());
assertTrue(leafType.getLengthConstraints().isEmpty());
ExtendedType base = (ExtendedType) baseType.getBaseType();
QName baseQName = base.getQName();
assertEquals("int32-ext1", baseQName.getLocalName());
- assertEquals("t", baseQName.getPrefix());
- assertEquals(typesNS, baseQName.getNamespace());
- assertEquals(typesRev, baseQName.getRevision());
+ assertEquals("bar", baseQName.getPrefix());
+ assertEquals(barNS, baseQName.getNamespace());
+ assertEquals(barRev, baseQName.getRevision());
assertNull(base.getUnits());
assertNull(base.getDefaultValue());
assertTrue(leafType.getLengthConstraints().isEmpty());
@Test
public void testTypedefPatternsResolving() {
- Module testModule = TestUtils.findModule(modules, "nodes");
- LeafSchemaNode stringleaf = (LeafSchemaNode) testModule.getDataChildByName("string-leaf");
+ Module foo = TestUtils.findModule(modules, "foo");
+ LeafSchemaNode stringleaf = (LeafSchemaNode) foo.getDataChildByName("string-leaf");
ExtendedType type = (ExtendedType) stringleaf.getType();
QName typeQName = type.getQName();
assertEquals("string-ext4", typeQName.getLocalName());
- assertEquals("t", typeQName.getPrefix());
- assertEquals(typesNS, typeQName.getNamespace());
- assertEquals(typesRev, typeQName.getRevision());
+ assertEquals("bar", typeQName.getPrefix());
+ assertEquals(barNS, typeQName.getNamespace());
+ assertEquals(barRev, typeQName.getRevision());
assertNull(type.getUnits());
assertNull(type.getDefaultValue());
List<PatternConstraint> patterns = type.getPatternConstraints();
ExtendedType baseType1 = (ExtendedType) type.getBaseType();
QName baseType1QName = baseType1.getQName();
assertEquals("string-ext3", baseType1QName.getLocalName());
- assertEquals("t", baseType1QName.getPrefix());
- assertEquals(typesNS, baseType1QName.getNamespace());
- assertEquals(typesRev, baseType1QName.getRevision());
+ assertEquals("bar", baseType1QName.getPrefix());
+ assertEquals(barNS, baseType1QName.getNamespace());
+ assertEquals(barRev, baseType1QName.getRevision());
assertNull(baseType1.getUnits());
assertNull(baseType1.getDefaultValue());
patterns = baseType1.getPatternConstraints();
ExtendedType baseType2 = (ExtendedType) baseType1.getBaseType();
QName baseType2QName = baseType2.getQName();
assertEquals("string-ext2", baseType2QName.getLocalName());
- assertEquals("t", baseType2QName.getPrefix());
- assertEquals(typesNS, baseType2QName.getNamespace());
- assertEquals(typesRev, baseType2QName.getRevision());
+ assertEquals("bar", baseType2QName.getPrefix());
+ assertEquals(barNS, baseType2QName.getNamespace());
+ assertEquals(barRev, baseType2QName.getRevision());
assertNull(baseType2.getUnits());
assertNull(baseType2.getDefaultValue());
assertTrue(baseType2.getPatternConstraints().isEmpty());
ExtendedType baseType3 = (ExtendedType) baseType2.getBaseType();
QName baseType3QName = baseType3.getQName();
assertEquals("string-ext1", baseType3QName.getLocalName());
- assertEquals("t", baseType3QName.getPrefix());
- assertEquals(typesNS, baseType3QName.getNamespace());
- assertEquals(typesRev, baseType3QName.getRevision());
+ assertEquals("bar", baseType3QName.getPrefix());
+ assertEquals(barNS, baseType3QName.getNamespace());
+ assertEquals(barRev, baseType3QName.getRevision());
assertNull(baseType3.getUnits());
assertNull(baseType3.getDefaultValue());
patterns = baseType3.getPatternConstraints();
@Test
public void testTypedefLengthsResolving() {
- Module testModule = TestUtils.findModule(modules, "nodes");
+ Module foo = TestUtils.findModule(modules, "foo");
- LeafSchemaNode lengthLeaf = (LeafSchemaNode) testModule.getDataChildByName("length-leaf");
+ LeafSchemaNode lengthLeaf = (LeafSchemaNode) foo.getDataChildByName("length-leaf");
ExtendedType type = (ExtendedType) lengthLeaf.getType();
QName typeQName = type.getQName();
assertEquals("string-ext2", typeQName.getLocalName());
- assertEquals("n", typeQName.getPrefix());
- assertEquals(nodesNS, typeQName.getNamespace());
- assertEquals(nodesRev, typeQName.getRevision());
+ assertEquals("foo", typeQName.getPrefix());
+ assertEquals(fooNS, typeQName.getNamespace());
+ assertEquals(fooRev, typeQName.getRevision());
assertNull(type.getUnits());
assertNull(type.getDefaultValue());
assertTrue(type.getPatternConstraints().isEmpty());
ExtendedType baseType1 = (ExtendedType) type.getBaseType();
QName baseType1QName = baseType1.getQName();
assertEquals("string-ext2", baseType1QName.getLocalName());
- assertEquals("t", baseType1QName.getPrefix());
- assertEquals(typesNS, baseType1QName.getNamespace());
- assertEquals(typesRev, baseType1QName.getRevision());
+ assertEquals("bar", baseType1QName.getPrefix());
+ assertEquals(barNS, baseType1QName.getNamespace());
+ assertEquals(barRev, baseType1QName.getRevision());
assertNull(baseType1.getUnits());
assertNull(baseType1.getDefaultValue());
assertTrue(baseType1.getPatternConstraints().isEmpty());
ExtendedType baseType2 = (ExtendedType) baseType1.getBaseType();
QName baseType2QName = baseType2.getQName();
assertEquals("string-ext1", baseType2QName.getLocalName());
- assertEquals("t", baseType2QName.getPrefix());
- assertEquals(typesNS, baseType2QName.getNamespace());
- assertEquals(typesRev, baseType2QName.getRevision());
+ assertEquals("bar", baseType2QName.getPrefix());
+ assertEquals(barNS, baseType2QName.getNamespace());
+ assertEquals(barRev, baseType2QName.getRevision());
assertNull(baseType2.getUnits());
assertNull(baseType2.getDefaultValue());
List<PatternConstraint> patterns = baseType2.getPatternConstraints();
@Test
public void testTypedefDecimal1() {
- Module testModule = TestUtils.findModule(modules, "nodes");
- LeafSchemaNode testleaf = (LeafSchemaNode) testModule.getDataChildByName("decimal-leaf");
+ Module foo = TestUtils.findModule(modules, "foo");
+ LeafSchemaNode testleaf = (LeafSchemaNode) foo.getDataChildByName("decimal-leaf");
ExtendedType type = (ExtendedType) testleaf.getType();
QName typeQName = type.getQName();
assertEquals("my-decimal-type", typeQName.getLocalName());
- assertEquals("n", typeQName.getPrefix());
- assertEquals(nodesNS, typeQName.getNamespace());
- assertEquals(nodesRev, typeQName.getRevision());
+ assertEquals("foo", typeQName.getPrefix());
+ assertEquals(fooNS, typeQName.getNamespace());
+ assertEquals(fooRev, typeQName.getRevision());
assertNull(type.getUnits());
assertNull(type.getDefaultValue());
assertEquals(4, (int) type.getFractionDigits());
ExtendedType typeBase = (ExtendedType) type.getBaseType();
QName typeBaseQName = typeBase.getQName();
assertEquals("my-decimal-type", typeBaseQName.getLocalName());
- assertEquals("t", typeBaseQName.getPrefix());
- assertEquals(typesNS, typeBaseQName.getNamespace());
- assertEquals(typesRev, typeBaseQName.getRevision());
+ assertEquals("bar", typeBaseQName.getPrefix());
+ assertEquals(barNS, typeBaseQName.getNamespace());
+ assertEquals(barRev, typeBaseQName.getRevision());
assertNull(typeBase.getUnits());
assertNull(typeBase.getDefaultValue());
assertNull(typeBase.getFractionDigits());
@Test
public void testTypedefDecimal2() {
- Module testModule = TestUtils.findModule(modules, "nodes");
- LeafSchemaNode testleaf = (LeafSchemaNode) testModule.getDataChildByName("decimal-leaf2");
+ Module foo = TestUtils.findModule(modules, "foo");
+ LeafSchemaNode testleaf = (LeafSchemaNode) foo.getDataChildByName("decimal-leaf2");
ExtendedType type = (ExtendedType) testleaf.getType();
QName typeQName = type.getQName();
assertEquals("my-decimal-type", typeQName.getLocalName());
- assertEquals("t", typeQName.getPrefix());
- assertEquals(typesNS, typeQName.getNamespace());
- assertEquals(typesRev, typeQName.getRevision());
+ assertEquals("bar", typeQName.getPrefix());
+ assertEquals(barNS, typeQName.getNamespace());
+ assertEquals(barRev, typeQName.getRevision());
assertNull(type.getUnits());
assertNull(type.getDefaultValue());
assertNull(type.getFractionDigits());
@Test
public void testTypedefUnion() {
- Module testModule = TestUtils.findModule(modules, "nodes");
- LeafSchemaNode unionleaf = (LeafSchemaNode) testModule.getDataChildByName("union-leaf");
+ Module foo = TestUtils.findModule(modules, "foo");
+ LeafSchemaNode unionleaf = (LeafSchemaNode) foo.getDataChildByName("union-leaf");
ExtendedType type = (ExtendedType) unionleaf.getType();
QName typeQName = type.getQName();
assertEquals("my-union-ext", typeQName.getLocalName());
- assertEquals("t", typeQName.getPrefix());
- assertEquals(typesNS, typeQName.getNamespace());
- assertEquals(typesRev, typeQName.getRevision());
+ assertEquals("bar", typeQName.getPrefix());
+ assertEquals(barNS, typeQName.getNamespace());
+ assertEquals(barRev, typeQName.getRevision());
assertNull(type.getUnits());
assertNull(type.getDefaultValue());
assertNull(type.getFractionDigits());
ExtendedType baseType = (ExtendedType) type.getBaseType();
QName baseTypeQName = baseType.getQName();
assertEquals("my-union", baseTypeQName.getLocalName());
- assertEquals("t", baseTypeQName.getPrefix());
- assertEquals(typesNS, baseTypeQName.getNamespace());
- assertEquals(typesRev, baseTypeQName.getRevision());
+ assertEquals("bar", baseTypeQName.getPrefix());
+ assertEquals(barNS, baseTypeQName.getNamespace());
+ assertEquals(barRev, baseTypeQName.getRevision());
assertNull(baseType.getUnits());
assertNull(baseType.getDefaultValue());
assertNull(baseType.getFractionDigits());
ExtendedType unionType1 = (ExtendedType) unionTypes.get(0);
QName unionType1QName = baseType.getQName();
assertEquals("my-union", unionType1QName.getLocalName());
- assertEquals("t", unionType1QName.getPrefix());
- assertEquals(typesNS, unionType1QName.getNamespace());
- assertEquals(typesRev, unionType1QName.getRevision());
+ assertEquals("bar", unionType1QName.getPrefix());
+ assertEquals(barNS, unionType1QName.getNamespace());
+ assertEquals(barRev, unionType1QName.getRevision());
assertNull(unionType1.getUnits());
assertNull(unionType1.getDefaultValue());
assertNull(unionType1.getFractionDigits());
@Test
public void testNestedUnionResolving() {
- Module testModule = TestUtils.findModule(modules, "nodes");
- LeafSchemaNode testleaf = (LeafSchemaNode) testModule.getDataChildByName("custom-union-leaf");
+ Module foo = TestUtils.findModule(modules, "foo");
+ LeafSchemaNode testleaf = (LeafSchemaNode) foo.getDataChildByName("custom-union-leaf");
ExtendedType type = (ExtendedType) testleaf.getType();
QName testleafTypeQName = type.getQName();
- assertEquals(customNS, testleafTypeQName.getNamespace());
- assertEquals(customRev, testleafTypeQName.getRevision());
- assertEquals("c", testleafTypeQName.getPrefix());
+ assertEquals(bazNS, testleafTypeQName.getNamespace());
+ assertEquals(bazRev, testleafTypeQName.getRevision());
+ assertEquals("baz", testleafTypeQName.getPrefix());
assertEquals("union1", testleafTypeQName.getLocalName());
assertNull(type.getUnits());
assertNull(type.getDefaultValue());
ExtendedType typeBase = (ExtendedType) type.getBaseType();
QName typeBaseQName = typeBase.getQName();
- assertEquals(customNS, typeBaseQName.getNamespace());
- assertEquals(customRev, typeBaseQName.getRevision());
- assertEquals("c", typeBaseQName.getPrefix());
+ assertEquals(bazNS, typeBaseQName.getNamespace());
+ assertEquals(bazRev, typeBaseQName.getRevision());
+ assertEquals("baz", typeBaseQName.getPrefix());
assertEquals("union2", typeBaseQName.getLocalName());
assertNull(typeBase.getUnits());
assertNull(typeBase.getDefaultValue());
ExtendedType unionType1 = (ExtendedType) unionTypes.get(1);
QName uniontType1QName = unionType1.getQName();
- assertEquals(typesNS, uniontType1QName.getNamespace());
- assertEquals(typesRev, uniontType1QName.getRevision());
- assertEquals("t", uniontType1QName.getPrefix());
+ assertEquals(barNS, uniontType1QName.getNamespace());
+ assertEquals(barRev, uniontType1QName.getRevision());
+ assertEquals("bar", uniontType1QName.getPrefix());
assertEquals("nested-union2", uniontType1QName.getLocalName());
assertNull(unionType1.getUnits());
assertNull(unionType1.getDefaultValue());
ExtendedType myUnionExt = (ExtendedType) nestedUnion2Types.get(1);
QName myUnionExtQName = myUnionExt.getQName();
- assertEquals(typesNS, myUnionExtQName.getNamespace());
- assertEquals(typesRev, myUnionExtQName.getRevision());
- assertEquals("t", myUnionExtQName.getPrefix());
+ assertEquals(barNS, myUnionExtQName.getNamespace());
+ assertEquals(barRev, myUnionExtQName.getRevision());
+ assertEquals("bar", myUnionExtQName.getPrefix());
assertEquals("my-union-ext", myUnionExtQName.getLocalName());
assertNull(myUnionExt.getUnits());
assertNull(myUnionExt.getDefaultValue());
ExtendedType myUnion = (ExtendedType) myUnionExt.getBaseType();
QName myUnionQName = myUnion.getQName();
- assertEquals(typesNS, myUnionQName.getNamespace());
- assertEquals(typesRev, myUnionQName.getRevision());
- assertEquals("t", myUnionQName.getPrefix());
+ assertEquals(barNS, myUnionQName.getNamespace());
+ assertEquals(barRev, myUnionQName.getRevision());
+ assertEquals("bar", myUnionQName.getPrefix());
assertEquals("my-union", myUnionQName.getLocalName());
assertNull(myUnion.getUnits());
assertNull(myUnion.getDefaultValue());
ExtendedType int16Ext = (ExtendedType) myUnionBaseTypes.get(0);
QName int16ExtQName = int16Ext.getQName();
- assertEquals(typesNS, int16ExtQName.getNamespace());
- assertEquals(typesRev, int16ExtQName.getRevision());
- assertEquals("t", int16ExtQName.getPrefix());
+ assertEquals(barNS, int16ExtQName.getNamespace());
+ assertEquals(barRev, int16ExtQName.getRevision());
+ assertEquals("bar", int16ExtQName.getPrefix());
assertEquals("int16", int16ExtQName.getLocalName());
assertNull(int16Ext.getUnits());
assertNull(int16Ext.getDefaultValue());
@Test
public void testChoice() {
- Module testModule = TestUtils.findModule(modules, "nodes");
- ContainerSchemaNode transfer = (ContainerSchemaNode) testModule.getDataChildByName("transfer");
+ Module foo = TestUtils.findModule(modules, "foo");
+ ContainerSchemaNode transfer = (ContainerSchemaNode) foo.getDataChildByName("transfer");
ChoiceNode how = (ChoiceNode) transfer.getDataChildByName("how");
Set<ChoiceCaseNode> cases = how.getCases();
assertEquals(5, cases.size());
@Test
public void testDeviation() {
- Module testModule = TestUtils.findModule(modules, "nodes");
- Set<Deviation> deviations = testModule.getDeviations();
+ Module foo = TestUtils.findModule(modules, "foo");
+ Set<Deviation> deviations = foo.getDeviations();
assertEquals(1, deviations.size());
Deviation dev = deviations.iterator().next();
-
assertEquals("system/user ref", dev.getReference());
- List<QName> path = new ArrayList<QName>();
- path.add(new QName(typesNS, typesRev, "t", "interfaces"));
- path.add(new QName(typesNS, typesRev, "t", "ifEntry"));
+ List<QName> path = new ArrayList<>();
+ path.add(new QName(barNS, barRev, "br", "interfaces"));
+ path.add(new QName(barNS, barRev, "br", "ifEntry"));
SchemaPath expectedPath = new SchemaPath(path, true);
assertEquals(expectedPath, dev.getTargetPath());
@Test
public void testUnknownNode() {
- Module testModule = TestUtils.findModule(modules, "custom");
- ContainerSchemaNode network = (ContainerSchemaNode) testModule.getDataChildByName("network");
+ Module baz = TestUtils.findModule(modules, "baz");
+ ContainerSchemaNode network = (ContainerSchemaNode) baz.getDataChildByName("network");
List<UnknownSchemaNode> unknownNodes = network.getUnknownSchemaNodes();
assertEquals(1, unknownNodes.size());
UnknownSchemaNode unknownNode = unknownNodes.get(0);
@Test
public void testFeature() {
- Module testModule = TestUtils.findModule(modules, "custom");
- Set<FeatureDefinition> features = testModule.getFeatures();
+ Module baz = TestUtils.findModule(modules, "baz");
+ Set<FeatureDefinition> features = baz.getFeatures();
assertEquals(1, features.size());
}
@Test
public void testExtension() {
- Module testModule = TestUtils.findModule(modules, "custom");
- List<ExtensionDefinition> extensions = testModule.getExtensionSchemaNodes();
+ Module baz = TestUtils.findModule(modules, "baz");
+ List<ExtensionDefinition> extensions = baz.getExtensionSchemaNodes();
assertEquals(1, extensions.size());
ExtensionDefinition extension = extensions.get(0);
assertEquals("name", extension.getArgument());
@Test
public void testNotification() {
- Module testModule = TestUtils.findModule(modules, "custom");
+ Module baz = TestUtils.findModule(modules, "baz");
String expectedPrefix = "c";
- Set<NotificationDefinition> notifications = testModule.getNotifications();
+ Set<NotificationDefinition> notifications = baz.getNotifications();
assertEquals(1, notifications.size());
NotificationDefinition notification = notifications.iterator().next();
// test SchemaNode args
- QName expectedQName = new QName(customNS, customRev, expectedPrefix, "event");
+ QName expectedQName = new QName(bazNS, bazRev, expectedPrefix, "event");
assertEquals(expectedQName, notification.getQName());
- SchemaPath expectedPath = TestUtils.createPath(true, customNS, customRev, expectedPrefix, "event");
+ SchemaPath expectedPath = TestUtils.createPath(true, bazNS, bazRev, expectedPrefix, "event");
assertEquals(expectedPath, notification.getPath());
assertNull(notification.getDescription());
assertNull(notification.getReference());
@Test
public void testRpc() {
- Module testModule = TestUtils.findModule(modules, "custom");
+ Module baz = TestUtils.findModule(modules, "baz");
- Set<RpcDefinition> rpcs = testModule.getRpcs();
+ Set<RpcDefinition> rpcs = baz.getRpcs();
assertEquals(1, rpcs.size());
RpcDefinition rpc = rpcs.iterator().next();
@Test
public void testTypePath() throws ParseException {
- Module test = TestUtils.findModule(modules, "types");
- Set<TypeDefinition<?>> types = test.getTypeDefinitions();
+ Module bar = TestUtils.findModule(modules, "bar");
+ Set<TypeDefinition<?>> types = bar.getTypeDefinitions();
// int32-ext1
ExtendedType int32ext1 = (ExtendedType) TestUtils.findTypedef(types, "int32-ext1");
QName int32TypedefQName = int32ext1.getQName();
- assertEquals(typesNS, int32TypedefQName.getNamespace());
- assertEquals(typesRev, int32TypedefQName.getRevision());
- assertEquals("t", int32TypedefQName.getPrefix());
+ assertEquals(barNS, int32TypedefQName.getNamespace());
+ assertEquals(barRev, int32TypedefQName.getRevision());
+ assertEquals("bar", int32TypedefQName.getPrefix());
assertEquals("int32-ext1", int32TypedefQName.getLocalName());
SchemaPath typeSchemaPath = int32ext1.getPath();
@Test
public void testTypePath2() throws ParseException {
- Module test = TestUtils.findModule(modules, "types");
- Set<TypeDefinition<?>> types = test.getTypeDefinitions();
+ Module bar = TestUtils.findModule(modules, "bar");
+ Set<TypeDefinition<?>> types = bar.getTypeDefinitions();
// my-decimal-type
ExtendedType myDecType = (ExtendedType) TestUtils.findTypedef(types, "my-decimal-type");
QName myDecTypeQName = myDecType.getQName();
- assertEquals(typesNS, myDecTypeQName.getNamespace());
- assertEquals(typesRev, myDecTypeQName.getRevision());
- assertEquals("t", myDecTypeQName.getPrefix());
+ assertEquals(barNS, myDecTypeQName.getNamespace());
+ assertEquals(barRev, myDecTypeQName.getRevision());
+ assertEquals("bar", myDecTypeQName.getPrefix());
assertEquals("my-decimal-type", myDecTypeQName.getLocalName());
SchemaPath typeSchemaPath = myDecType.getPath();
@Test
public void testTypeFromContext() throws Exception {
- SchemaContext context = null;
String resource = "/ietf/ietf-inet-types@2010-09-24.yang";
InputStream stream = new FileInputStream(getClass().getResource(resource).getPath());
- context = parser.resolveSchemaContext(TestUtils.loadModules(Lists.newArrayList(stream)));
+ SchemaContext context = parser.resolveSchemaContext(TestUtils.loadModules(Lists.newArrayList(stream)));
stream.close();
- Module module = null;
resource = "/context-test/test1.yang";
InputStream stream2 = new FileInputStream(getClass().getResource(resource).getPath());
- module = TestUtils.loadModuleWithContext(stream2, context);
+ Module module = TestUtils.loadModuleWithContext(stream2, context);
stream2.close();
assertNotNull(module);
@Test
public void testUsesFromContext() throws Exception {
- SchemaContext context = null;
- try (InputStream stream1 = new FileInputStream(getClass().getResource("/model/custom.yang").getPath());
- InputStream stream2 = new FileInputStream(getClass().getResource("/model/types.yang").getPath());
- InputStream stream3 = new FileInputStream(getClass().getResource("/model/nodes.yang").getPath())) {
+ SchemaContext context;
+ try (InputStream stream1 = new FileInputStream(getClass().getResource("/model/baz.yang").getPath());
+ InputStream stream2 = new FileInputStream(getClass().getResource("/model/bar.yang").getPath());
+ InputStream stream3 = new FileInputStream(getClass().getResource("/model/foo.yang").getPath())) {
context = parser.resolveSchemaContext(TestUtils.loadModules(Lists.newArrayList(stream1, stream2, stream3)));
}
- Module testModule = null;
+ Module testModule;
try (InputStream stream = new FileInputStream(getClass().getResource("/context-test/test2.yang").getPath())) {
testModule = TestUtils.loadModuleWithContext(stream, context);
}
// suffix _g = defined in grouping from context
// get grouping
- Module contextModule = context.findModuleByNamespace(URI.create("urn:custom.nodes.test")).iterator().next();
+ Module contextModule = context.findModuleByNamespace(URI.create("urn:opendaylight.baz")).iterator().next();
assertNotNull(contextModule);
Set<GroupingDefinition> groupings = contextModule.getGroupings();
assertEquals(1, groupings.size());
@Test
public void testUsesRefineFromContext() throws Exception {
- SchemaContext context = null;
- try (InputStream stream1 = new FileInputStream(getClass().getResource("/model/custom.yang").getPath());
- InputStream stream2 = new FileInputStream(getClass().getResource("/model/types.yang").getPath());
- InputStream stream3 = new FileInputStream(getClass().getResource("/model/nodes.yang").getPath())) {
+ SchemaContext context;
+ try (InputStream stream1 = new FileInputStream(getClass().getResource("/model/baz.yang").getPath());
+ InputStream stream2 = new FileInputStream(getClass().getResource("/model/bar.yang").getPath());
+ InputStream stream3 = new FileInputStream(getClass().getResource("/model/foo.yang").getPath())) {
context = parser.resolveSchemaContext(TestUtils.loadModules(Lists.newArrayList(stream1, stream2, stream3)));
}
- Module module = null;
+ Module module;
try (InputStream stream = new FileInputStream(getClass().getResource("/context-test/test2.yang").getPath())) {
module = TestUtils.loadModuleWithContext(stream, context);
}
UsesNode usesNode = usesNodes.iterator().next();
// test grouping path
- List<QName> path = new ArrayList<QName>();
- QName qname = new QName(URI.create("urn:custom.nodes.test"), simpleDateFormat.parse("2013-02-27"), "c",
+ List<QName> path = new ArrayList<>();
+ QName qname = new QName(URI.create("urn:opendaylight.baz"), simpleDateFormat.parse("2013-02-27"), "baz",
"target");
path.add(qname);
SchemaPath expectedPath = new SchemaPath(path, true);
@Test
public void testIdentity() throws Exception {
- SchemaContext context = null;
+ SchemaContext context;
File yangFile = new File(getClass().getResource("/types/custom-types-test@2012-4-4.yang").getPath());
File dependenciesDir = new File(getClass().getResource("/ietf").getPath());
YangModelParser parser = new YangParserImpl();
context = parser.resolveSchemaContext(parser.parseYangModels(yangFile, dependenciesDir));
- Module module = null;
+ Module module;
try (InputStream stream = new FileInputStream(getClass().getResource("/context-test/test3.yang").getPath())) {
module = TestUtils.loadModuleWithContext(stream, context);
}
@Test
public void testUnknownNodes() throws Exception {
- SchemaContext context = null;
+ SchemaContext context;
File yangFile = new File(getClass().getResource("/types/custom-types-test@2012-4-4.yang").getPath());
File dependenciesDir = new File(getClass().getResource("/ietf").getPath());
YangModelParser parser = new YangParserImpl();
context = parser.resolveSchemaContext(parser.parseYangModels(yangFile, dependenciesDir));
- Module module = null;
+ Module module;
try (InputStream stream = new FileInputStream(getClass().getResource("/context-test/test3.yang").getPath())) {
module = TestUtils.loadModuleWithContext(stream, context);
}
@Test
public void testAugment() throws Exception {
// load first module
- SchemaContext context = null;
+ SchemaContext context;
String resource = "/context-augment-test/test4.yang";
try (InputStream stream = new FileInputStream(getClass().getResource(resource).getPath())) {
ListSchemaNode ifEntry = (ListSchemaNode) interfaces.getDataChildByName("ifEntry");
// load another modules and parse them against already existing context
- Set<Module> modules = null;
+ Set<Module> modules;
try (InputStream stream1 = new FileInputStream(getClass().getResource("/context-augment-test/test1.yang")
.getPath());
InputStream stream2 = new FileInputStream(getClass().getResource("/context-augment-test/test2.yang")
@Test
public void testDeviation() throws Exception {
// load first module
- SchemaContext context = null;
- String resource = "/model/types.yang";
+ SchemaContext context;
+ String resource = "/model/bar.yang";
try (InputStream stream = new FileInputStream(getClass().getResource(resource).getPath())) {
context = parser.resolveSchemaContext(TestUtils.loadModules(Lists.newArrayList(stream)));
}
// load another modules and parse them against already existing context
- Set<Module> modules = null;
+ Set<Module> modules;
try (InputStream stream = new FileInputStream(getClass().getResource("/context-test/deviation-test.yang")
.getPath())) {
List<InputStream> input = Lists.newArrayList(stream);
assertEquals("system/user ref", dev.getReference());
- URI expectedNS = URI.create("urn:simple.types.test");
+ URI expectedNS = URI.create("urn:opendaylight.bar");
DateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date expectedRev = simpleDateFormat.parse("2013-07-03");
- List<QName> path = new ArrayList<QName>();
- path.add(new QName(expectedNS, expectedRev, "t", "interfaces"));
- path.add(new QName(expectedNS, expectedRev, "t", "ifEntry"));
+ List<QName> path = new ArrayList<>();
+ path.add(new QName(expectedNS, expectedRev, "bar", "interfaces"));
+ path.add(new QName(expectedNS, expectedRev, "bar", "ifEntry"));
SchemaPath expectedPath = new SchemaPath(path, true);
assertEquals(expectedPath, dev.getTargetPath());
--- /dev/null
+module bar {
+ yang-version 1;
+ namespace "urn:opendaylight.bar";
+ prefix "bar";
+
+ organization "opendaylight";
+ contact "http://www.opendaylight.org/";
+
+ revision "2013-10-14" {
+ reference " WILL BE DEFINED LATER";
+ }
+
+ container interfaces {
+ grouping ifEntry {
+ container augment-holder;
+ }
+ list ifEntry {
+ key "ifIndex";
+
+ leaf ifIndex {
+ type uint32;
+ units minutes;
+ }
+
+ leaf ifMtu {
+ type int32;
+ }
+
+ min-elements 1;
+ max-elements 11;
+ }
+ }
+
+ container controller {
+ choice switch {
+ case start {
+ leaf start {
+ type int8;
+ }
+ }
+ case stop {
+ leaf stop {
+ type int16;
+ }
+ }
+ }
+ }
+
+}
--- /dev/null
+module baz {
+ yang-version 1;
+ namespace "urn:opendaylight.baz";
+ prefix "baz";
+
+ import bar {
+ prefix "br";
+ revision-date 2013-10-14;
+ }
+
+ organization "opendaylight";
+ contact "http://www.opendaylight.org/";
+
+ revision "2013-10-15" {
+ reference " WILL BE DEFINED LATER";
+ }
+
+
+ augment "/br:interfaces/br:ifEntry" {
+ when "if:ifType='ds0'";
+ container augment-holder {
+ description "Description for augment holder";
+ }
+ }
+
+ augment "/br:interfaces/br:ifEntry" {
+ when "if:ifType='ds2'";
+ container augment-holder2 {
+ description "Description for augment holder";
+ }
+ }
+
+ augment "/br:controller/br:switch" {
+ leaf pause {
+ type int32;
+ }
+ }
+
+ grouping target {
+ anyxml data {
+ config true;
+ description "Copy of the source datastore subset.";
+ mandatory false;
+ must "test-condition-text";
+ reference "test-no-reference";
+ status "obsolete";
+ when "test-when-text";
+ }
+ choice how {
+ description "test choice description";
+ default interval;
+ case interval {
+ leaf interval {
+ type uint16;
+ default 30;
+ units minutes;
+ }
+ }
+ case daily {
+ leaf daily {
+ type empty;
+ }
+ leaf time-of-day {
+ type string;
+ units 24-hour-clock;
+ default 1am;
+ }
+ }
+ }
+ leaf address {
+ type string;
+ description "Target IP address";
+ mandatory true;
+ }
+ container port {
+ description "Target port container";
+ }
+ list addresses {
+ key "id";
+ leaf id {
+ type int8;
+ }
+ }
+ grouping target-inner {
+ description "target-inner default description";
+ leaf inner-grouping-id {
+ type int8;
+ }
+ }
+
+ opendaylight;
+ }
+
+}
--- /dev/null
+module foo {
+ yang-version 1;
+ namespace "urn:opendaylight.foo";
+ prefix "foo";
+
+ import bar {
+ prefix "br";
+ revision-date 2013-10-14;
+ }
+
+ import baz {
+ prefix "bz";
+ revision-date 2013-10-15;
+ }
+
+ organization "opendaylight";
+ contact "http://www.opendaylight.org/";
+
+ revision "2013-10-13" {
+ reference " WILL BE DEFINED LATER";
+ }
+
+
+ augment "/br:interfaces/br:ifEntry/bz:augment-holder" {
+ when "if:ifType='ds0'";
+ leaf ds0ChannelNumber {
+ type string;
+ }
+ leaf interface-id {
+ type leafref {
+ path "/if:interfaces/if:interface/if:name";
+ }
+ }
+ container schemas {
+ }
+ choice odl {
+ leaf id {
+ type int8;
+ }
+ case node1 {
+ description "node1";
+ }
+ case node2 {
+ description "node2";
+ }
+ container node3 {
+ description "node3";
+ }
+ }
+ }
+
+
+ uses bz:target {
+ augment "how/interval" {
+ description "inner augment";
+ leaf name {
+ type string;
+ }
+ }
+ }
+
+}
namespace "urn:simple.deviation.test";
prefix "dev";
- import types {
+ import bar {
prefix "t";
revision-date 2013-07-03;
}
namespace "urn:simple.demo.test2";
prefix "t2";
- import custom {
+ import baz {
prefix "data";
}
-module types {
+module bar {
yang-version 1;
- namespace "urn:simple.types.test";
- prefix "t";
+ namespace "urn:opendaylight.bar";
+ prefix "bar";
organization "opendaylight";
contact "http://www.opendaylight.org/";
- description "This is types-data test description";
+ description "This model define custom type definitions";
revision "2013-07-03" {
reference " WILL BE DEFINED LATER";
-module custom {
+module baz {
yang-version 1;
- namespace "urn:custom.nodes.test";
- prefix "c";
+ namespace "urn:opendaylight.baz";
+ prefix "baz";
- import types {
- prefix "types";
+ import bar {
+ prefix "br";
revision-date 2013-07-03;
}
typedef union2 {
type union {
type int32;
- type types:nested-union2;
+ type br:nested-union2;
}
}
- augment "/types:interfaces/types:ifEntry" {
+ augment "/br:interfaces/br:ifEntry" {
when "if:ifType='ds0'";
container augment-holder {
description "Description for augment holder";
}
}
- augment "/types:interfaces/types:ifEntry" {
+ augment "/br:interfaces/br:ifEntry" {
when "if:ifType='ds2'";
container augment-holder2 {
description "Description for augment holder";
}
extension c-define {
- description
- "Takes as argument a name string. Makes the code generator use the given name in the #define.";
+ description "Takes as argument a name string. Makes the code generator use the given name in the #define.";
argument "name" {
yin-element "true";
}
}
rpc get-config {
- description
- "Retrieve all or part of a specified configuration.";
-
+ description "Retrieve all or part of a specified configuration.";
reference "RFC 6241, Section 7.1";
input {
}
anyxml filter {
- description
- "Subtree or XPath filter to use.";
- c:c-define element-attributes;
+ description "Subtree or XPath filter to use.";
+ baz:c-define element-attributes;
}
}
}
}
typedef group-type {
- type types:my-decimal-type;
+ type br:my-decimal-type;
}
opendaylight;
-module nodes {
+module foo {
yang-version 1;
- namespace "urn:simple.nodes.test";
- prefix "n";
+ namespace "urn:opendaylight.foo";
+ prefix "foo";
- import types {
- prefix "t";
+ import bar {
+ prefix "br";
revision-date 2013-07-03;
}
- import custom {
- prefix "c";
+ import baz {
+ prefix "bz";
revision-date 2013-02-27;
}
}
leaf int32-leaf {
- type t:int32-ext2 {
+ type br:int32-ext2 {
range "12..max";
}
}
leaf string-leaf {
- type t:string-ext4;
+ type br:string-ext4;
}
leaf length-leaf {
- type t:string-ext2 {
+ type br:string-ext2 {
length "7..max";
}
}
leaf decimal-leaf {
- type t:my-decimal-type {
+ type br:my-decimal-type {
fraction-digits 4;
}
}
leaf decimal-leaf2 {
- type t:my-decimal-type;
+ type br:my-decimal-type;
}
container ext {
- c:c-define "MY_INTERFACES";
+ bz:c-define "MY_INTERFACES";
}
leaf union-leaf {
- type t:my-union-ext;
+ type br:my-union-ext;
}
- deviation /t:interfaces/t:ifEntry {
+ deviation /br:interfaces/br:ifEntry {
deviate add {
- default "admin"; // new users are 'admin' by default
+ default "admin";
config "true";
}
reference "system/user ref";
}
leaf custom-union-leaf {
- type c:union1;
+ type bz:union1;
}
container transfer {
status obsolete;
}
- augment "/t:interfaces/t:ifEntry/c:augment-holder" {
+ augment "/br:interfaces/br:ifEntry/bz:augment-holder" {
when "if:ifType='ds0'";
leaf ds0ChannelNumber {
type string;
}
}
leaf my-type {
- type t:int32-ext2;
+ type br:int32-ext2;
}
container schemas {
}
}
}
- uses c:target {
- augment "/mycont/innercont" {
+ uses bz:target {
+ augment "how/interval" {
description "inner augment";
leaf name {
type string;
container peer {
container destination {
- uses c:target {
+ uses bz:target {
refine address {
default "1.2.3.4";
description "IP address of target node";