2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.yang.model.parser.impl;
10 import static org.opendaylight.controller.yang.model.parser.util.YangModelBuilderUtil.*;
13 import java.text.DateFormat;
14 import java.text.ParseException;
15 import java.text.SimpleDateFormat;
16 import java.util.ArrayList;
17 import java.util.Collections;
18 import java.util.Date;
19 import java.util.List;
20 import java.util.Stack;
21 import java.util.TreeMap;
23 import org.antlr.v4.runtime.tree.ParseTree;
24 import org.opendaylight.controller.antlrv4.code.gen.YangParser;
25 import org.opendaylight.controller.antlrv4.code.gen.YangParser.Contact_stmtContext;
26 import org.opendaylight.controller.antlrv4.code.gen.YangParser.Container_stmtContext;
27 import org.opendaylight.controller.antlrv4.code.gen.YangParser.Description_stmtContext;
28 import org.opendaylight.controller.antlrv4.code.gen.YangParser.Deviate_add_stmtContext;
29 import org.opendaylight.controller.antlrv4.code.gen.YangParser.Deviate_delete_stmtContext;
30 import org.opendaylight.controller.antlrv4.code.gen.YangParser.Deviate_not_supported_stmtContext;
31 import org.opendaylight.controller.antlrv4.code.gen.YangParser.Deviate_replace_stmtContext;
32 import org.opendaylight.controller.antlrv4.code.gen.YangParser.Import_stmtContext;
33 import org.opendaylight.controller.antlrv4.code.gen.YangParser.Key_stmtContext;
34 import org.opendaylight.controller.antlrv4.code.gen.YangParser.Leaf_list_stmtContext;
35 import org.opendaylight.controller.antlrv4.code.gen.YangParser.Leaf_stmtContext;
36 import org.opendaylight.controller.antlrv4.code.gen.YangParser.List_stmtContext;
37 import org.opendaylight.controller.antlrv4.code.gen.YangParser.Module_header_stmtsContext;
38 import org.opendaylight.controller.antlrv4.code.gen.YangParser.Namespace_stmtContext;
39 import org.opendaylight.controller.antlrv4.code.gen.YangParser.Ordered_by_stmtContext;
40 import org.opendaylight.controller.antlrv4.code.gen.YangParser.Organization_stmtContext;
41 import org.opendaylight.controller.antlrv4.code.gen.YangParser.Prefix_stmtContext;
42 import org.opendaylight.controller.antlrv4.code.gen.YangParser.Presence_stmtContext;
43 import org.opendaylight.controller.antlrv4.code.gen.YangParser.Reference_stmtContext;
44 import org.opendaylight.controller.antlrv4.code.gen.YangParser.Revision_date_stmtContext;
45 import org.opendaylight.controller.antlrv4.code.gen.YangParser.Revision_stmtContext;
46 import org.opendaylight.controller.antlrv4.code.gen.YangParser.Revision_stmtsContext;
47 import org.opendaylight.controller.antlrv4.code.gen.YangParser.Status_stmtContext;
48 import org.opendaylight.controller.antlrv4.code.gen.YangParser.Type_body_stmtsContext;
49 import org.opendaylight.controller.antlrv4.code.gen.YangParser.Union_specificationContext;
50 import org.opendaylight.controller.antlrv4.code.gen.YangParser.Yang_version_stmtContext;
51 import org.opendaylight.controller.antlrv4.code.gen.YangParserBaseListener;
52 import org.opendaylight.controller.yang.common.QName;
53 import org.opendaylight.controller.yang.model.api.Status;
54 import org.opendaylight.controller.yang.model.api.TypeDefinition;
55 import org.opendaylight.controller.yang.model.parser.builder.api.AugmentationSchemaBuilder;
56 import org.opendaylight.controller.yang.model.parser.builder.api.GroupingBuilder;
57 import org.opendaylight.controller.yang.model.parser.builder.impl.ContainerSchemaNodeBuilder;
58 import org.opendaylight.controller.yang.model.parser.builder.impl.DeviationBuilder;
59 import org.opendaylight.controller.yang.model.parser.builder.impl.ExtensionBuilder;
60 import org.opendaylight.controller.yang.model.parser.builder.impl.FeatureBuilder;
61 import org.opendaylight.controller.yang.model.parser.builder.impl.LeafListSchemaNodeBuilder;
62 import org.opendaylight.controller.yang.model.parser.builder.impl.LeafSchemaNodeBuilder;
63 import org.opendaylight.controller.yang.model.parser.builder.impl.ListSchemaNodeBuilder;
64 import org.opendaylight.controller.yang.model.parser.builder.impl.ModuleBuilder;
65 import org.opendaylight.controller.yang.model.parser.builder.impl.NotificationBuilder;
66 import org.opendaylight.controller.yang.model.parser.builder.impl.RpcDefinitionBuilder;
67 import org.opendaylight.controller.yang.model.parser.builder.impl.TypedefBuilder;
68 import org.opendaylight.controller.yang.model.parser.builder.impl.UnknownSchemaNodeBuilder;
69 import org.opendaylight.controller.yang.model.util.YangTypesConverter;
70 import org.slf4j.Logger;
71 import org.slf4j.LoggerFactory;
73 final class YangModelParserListenerImpl extends YangParserBaseListener {
75 private static final Logger logger = LoggerFactory
76 .getLogger(YangModelParserListenerImpl.class);
78 private ModuleBuilder moduleBuilder;
80 private String moduleName;
81 private URI namespace;
82 private String yangModelPrefix;
83 private Date revision;
85 private final DateFormat simpleDateFormat = new SimpleDateFormat(
87 private final Stack<String> actualPath = new Stack<String>();
91 public void enterModule_stmt(YangParser.Module_stmtContext ctx) {
92 moduleName = stringFromNode(ctx);
93 actualPath.push(moduleName);
94 moduleBuilder = new ModuleBuilder(moduleName);
96 String description = null;
97 String reference = null;
99 for (int i = 0; i < ctx.getChildCount(); i++) {
100 ParseTree child = ctx.getChild(i);
101 if (child instanceof Description_stmtContext) {
102 description = stringFromNode(child);
103 } else if (child instanceof Reference_stmtContext) {
104 reference = stringFromNode(child);
106 if (description != null && reference != null) {
111 moduleBuilder.setDescription(description);
112 moduleBuilder.setReference(reference);
116 public void exitModule_stmt(YangParser.Module_stmtContext ctx) {
117 final String moduleName = actualPath.pop();
118 logger.debug("Exiting module " + moduleName);
122 public void enterModule_header_stmts(final Module_header_stmtsContext ctx) {
123 super.enterModule_header_stmts(ctx);
125 for (int i = 0; i < ctx.getChildCount(); ++i) {
126 final ParseTree treeNode = ctx.getChild(i);
127 if (treeNode instanceof Namespace_stmtContext) {
128 final String namespaceStr = stringFromNode(treeNode);
129 namespace = URI.create(namespaceStr);
130 moduleBuilder.setNamespace(namespace);
131 } else if (treeNode instanceof Prefix_stmtContext) {
132 yangModelPrefix = stringFromNode(treeNode);
133 moduleBuilder.setPrefix(yangModelPrefix);
134 } else if (treeNode instanceof Yang_version_stmtContext) {
135 final String yangVersion = stringFromNode(treeNode);
136 moduleBuilder.setYangVersion(yangVersion);
142 public void enterMeta_stmts(YangParser.Meta_stmtsContext ctx) {
143 for (int i = 0; i < ctx.getChildCount(); i++) {
144 ParseTree child = ctx.getChild(i);
145 if (child instanceof Organization_stmtContext) {
146 final String organization = stringFromNode(child);
147 moduleBuilder.setOrganization(organization);
148 } else if (child instanceof Contact_stmtContext) {
149 final String contact = stringFromNode(child);
150 moduleBuilder.setContact(contact);
151 } else if (child instanceof Description_stmtContext) {
152 final String description = stringFromNode(child);
153 moduleBuilder.setDescription(description);
154 } else if (child instanceof Reference_stmtContext) {
155 final String reference = stringFromNode(child);
156 moduleBuilder.setReference(reference);
162 public void exitSubmodule_header_stmts(
163 YangParser.Submodule_header_stmtsContext ctx) {
164 final String submodule = actualPath.pop();
165 logger.debug("exiting submodule " + submodule);
169 public void enterRevision_stmts(Revision_stmtsContext ctx) {
170 TreeMap<Date, Revision_stmtContext> revisions = new TreeMap<Date, Revision_stmtContext>();
172 for (int i = 0; i < ctx.getChildCount(); ++i) {
173 final ParseTree treeNode = ctx.getChild(i);
174 if (treeNode instanceof Revision_stmtContext) {
175 final String revisionDateStr = stringFromNode(treeNode);
177 Date revision = simpleDateFormat.parse(revisionDateStr);
178 revisions.put(revision, (Revision_stmtContext)treeNode);
180 } catch (ParseException e) {
181 final String message = "Failed to parse revision string: "+ revisionDateStr;
182 logger.warn(message);
186 if(revisions.size() > 0) {
187 Revision_stmtContext revisionCtx = revisions.firstEntry().getValue();
188 moduleBuilder.setRevision(revisions.firstKey());
190 for(int i = 0; i < revisionCtx.getChildCount(); i++) {
191 ParseTree child = revisionCtx.getChild(i);
192 if(child instanceof Reference_stmtContext) {
193 moduleBuilder.setReference(stringFromNode(child));
200 public void enterImport_stmt(Import_stmtContext ctx) {
201 super.enterImport_stmt(ctx);
203 final String importName = stringFromNode(ctx);
204 String importPrefix = null;
205 Date importRevision = null;
207 for (int i = 0; i < ctx.getChildCount(); ++i) {
208 final ParseTree treeNode = ctx.getChild(i);
209 if (treeNode instanceof Prefix_stmtContext) {
210 importPrefix = stringFromNode(treeNode);
212 if (treeNode instanceof Revision_date_stmtContext) {
213 String importRevisionStr = stringFromNode(treeNode);
215 importRevision = simpleDateFormat.parse(importRevisionStr);
216 } catch(ParseException e) {
217 logger.warn("Failed to parse import revision-date: "+ importRevisionStr);
221 moduleBuilder.addModuleImport(importName, importRevision, importPrefix);
225 public void enterAugment_stmt(YangParser.Augment_stmtContext ctx) {
226 final String augmentPath = stringFromNode(ctx);
227 AugmentationSchemaBuilder builder = moduleBuilder.addAugment(
228 augmentPath, getActualPath());
229 updatePath(augmentPath);
231 for (int i = 0; i < ctx.getChildCount(); i++) {
232 ParseTree child = ctx.getChild(i);
233 if (child instanceof Description_stmtContext) {
234 String desc = stringFromNode(child);
235 builder.setDescription(desc);
236 } else if (child instanceof Reference_stmtContext) {
237 String ref = stringFromNode(child);
238 builder.setReference(ref);
239 } else if (child instanceof Status_stmtContext) {
240 Status status = parseStatus((Status_stmtContext) child);
241 builder.setStatus(status);
247 public void exitAugment_stmt(YangParser.Augment_stmtContext ctx) {
248 final String augment = actualPath.pop();
249 logger.debug("exiting augment " + augment);
253 public void enterExtension_stmt(YangParser.Extension_stmtContext ctx) {
254 String argument = stringFromNode(ctx);
255 QName qname = new QName(namespace, revision, yangModelPrefix, argument);
256 ExtensionBuilder builder = moduleBuilder.addExtension(qname);
257 parseSchemaNodeArgs(ctx, builder);
261 public void enterTypedef_stmt(YangParser.Typedef_stmtContext ctx) {
262 String typedefName = stringFromNode(ctx);
263 QName typedefQName = new QName(namespace, revision, yangModelPrefix,
265 TypedefBuilder builder = moduleBuilder.addTypedef(typedefQName,
267 updatePath(typedefName);
269 builder.setPath(createActualSchemaPath(actualPath, namespace, revision,
271 parseSchemaNodeArgs(ctx, builder);
272 builder.setUnits(parseUnits(ctx));
276 public void exitTypedef_stmt(YangParser.Typedef_stmtContext ctx) {
277 final String actContainer = actualPath.pop();
278 logger.debug("exiting " + actContainer);
282 public void enterType_stmt(YangParser.Type_stmtContext ctx) {
283 String typeName = stringFromNode(ctx);
285 if (typeName.contains(":")) {
286 String[] splittedName = typeName.split(":");
287 String prefix = splittedName[0];
288 String name = splittedName[1];
289 if (prefix.equals(yangModelPrefix)) {
290 typeQName = new QName(namespace, revision, prefix, name);
292 typeQName = new QName(null, null, prefix, name);
295 typeQName = new QName(namespace, revision, yangModelPrefix,
299 TypeDefinition<?> type = null;
300 Type_body_stmtsContext typeBody = null;
301 for (int i = 0; i < ctx.getChildCount(); i++) {
302 if (ctx.getChild(i) instanceof Type_body_stmtsContext) {
303 typeBody = (Type_body_stmtsContext) ctx.getChild(i);
310 // if this is base yang type...
311 if(YangTypesConverter.isBaseYangType(typeName)) {
312 if (typeBody == null) {
313 // if there are no constraints, just grab default base yang type
314 type = YangTypesConverter.javaTypeForBaseYangType(typeName);
315 moduleBuilder.setType(type, actualPath);
317 if(typeName.equals("union")) {
318 List<String> types = new ArrayList<String>();
319 for(int i = 0; i < typeBody.getChildCount(); i++) {
320 ParseTree unionSpec = typeBody.getChild(i);
321 if(unionSpec instanceof Union_specificationContext) {
322 for(int j = 0; j < unionSpec.getChildCount(); j++) {
323 ParseTree typeSpec = unionSpec.getChild(j);
324 types.add(stringFromNode(typeSpec));
328 moduleBuilder.addUnionType(actualPath);
330 type = parseTypeBody(typeName, typeBody, actualPath, namespace, revision, yangModelPrefix);
331 moduleBuilder.setType(type, actualPath);
335 type = parseUnknownTypeBody(typeQName, typeBody);
336 // mark parent node of this type statement as dirty
337 moduleBuilder.addDirtyNode(actualPath);
338 moduleBuilder.setType(type, actualPath);
341 updatePath(typeName);
346 public void exitType_stmt(YangParser.Type_stmtContext ctx) {
347 final String actContainer = actualPath.pop();
348 logger.debug("exiting " + actContainer);
352 public void enterGrouping_stmt(YangParser.Grouping_stmtContext ctx) {
353 final String groupName = stringFromNode(ctx);
354 QName groupQName = new QName(namespace, revision, yangModelPrefix,
356 GroupingBuilder groupBuilder = moduleBuilder.addGrouping(groupQName,
358 updatePath("grouping");
359 updatePath(groupName);
360 parseSchemaNodeArgs(ctx, groupBuilder);
364 public void exitGrouping_stmt(YangParser.Grouping_stmtContext ctx) {
365 String actContainer = actualPath.pop();
366 actContainer += "-" + actualPath.pop();
367 logger.debug("exiting " + actContainer);
371 public void enterContainer_stmt(Container_stmtContext ctx) {
372 super.enterContainer_stmt(ctx);
373 String containerName = stringFromNode(ctx);
374 QName containerQName = new QName(namespace, revision, yangModelPrefix,
376 ContainerSchemaNodeBuilder containerBuilder = moduleBuilder
377 .addContainerNode(containerQName, actualPath);
378 updatePath(containerName);
380 containerBuilder.setPath(createActualSchemaPath(actualPath, namespace, revision, yangModelPrefix));
381 parseSchemaNodeArgs(ctx, containerBuilder);
382 parseConstraints(ctx, containerBuilder.getConstraintsBuilder());
384 for (int i = 0; i < ctx.getChildCount(); ++i) {
385 final ParseTree childNode = ctx.getChild(i);
386 if (childNode instanceof Presence_stmtContext) {
387 containerBuilder.setPresenceContainer(true);
394 public void exitContainer_stmt(Container_stmtContext ctx) {
395 super.exitContainer_stmt(ctx);
396 final String actContainer = actualPath.pop();
397 logger.debug("exiting " + actContainer);
401 public void enterLeaf_stmt(Leaf_stmtContext ctx) {
402 super.enterLeaf_stmt(ctx);
404 final String leafName = stringFromNode(ctx);
405 QName leafQName = new QName(namespace, revision, yangModelPrefix,
407 LeafSchemaNodeBuilder leafBuilder = moduleBuilder.addLeafNode(
408 leafQName, actualPath);
409 updatePath(leafName);
411 leafBuilder.setPath(createActualSchemaPath(actualPath, namespace, revision, yangModelPrefix));
412 parseSchemaNodeArgs(ctx, leafBuilder);
413 parseConstraints(ctx, leafBuilder.getConstraintsBuilder());
417 public void exitLeaf_stmt(YangParser.Leaf_stmtContext ctx) {
418 final String actLeaf = actualPath.pop();
419 logger.debug("exiting " + actLeaf);
423 public void enterUses_stmt(YangParser.Uses_stmtContext ctx) {
424 final String groupingPathStr = stringFromNode(ctx);
425 moduleBuilder.addUsesNode(groupingPathStr, actualPath);
426 updatePath(groupingPathStr);
430 public void exitUses_stmt(YangParser.Uses_stmtContext ctx) {
431 final String actContainer = actualPath.pop();
432 logger.debug("exiting " + actContainer);
436 public void enterLeaf_list_stmt(Leaf_list_stmtContext ctx) {
437 super.enterLeaf_list_stmt(ctx);
439 final String leafListName = stringFromNode(ctx);
440 QName leafListQName = new QName(namespace, revision, yangModelPrefix,
442 LeafListSchemaNodeBuilder leafListBuilder = moduleBuilder
443 .addLeafListNode(leafListQName, actualPath);
444 updatePath(leafListName);
446 parseSchemaNodeArgs(ctx, leafListBuilder);
447 parseConstraints(ctx, leafListBuilder.getConstraintsBuilder());
449 for (int i = 0; i < ctx.getChildCount(); ++i) {
450 final ParseTree childNode = ctx.getChild(i);
451 if (childNode instanceof Ordered_by_stmtContext) {
452 final Ordered_by_stmtContext orderedBy = (Ordered_by_stmtContext) childNode;
453 final boolean userOrdered = parseUserOrdered(orderedBy);
454 leafListBuilder.setUserOrdered(userOrdered);
461 public void exitLeaf_list_stmt(YangParser.Leaf_list_stmtContext ctx) {
462 final String actContainer = actualPath.pop();
463 logger.debug("exiting " + actContainer);
467 public void enterList_stmt(List_stmtContext ctx) {
468 super.enterList_stmt(ctx);
470 final String containerName = stringFromNode(ctx);
471 QName containerQName = new QName(namespace, revision, yangModelPrefix,
473 ListSchemaNodeBuilder listBuilder = moduleBuilder.addListNode(
474 containerQName, actualPath);
475 updatePath(containerName);
477 listBuilder.setPath(createActualSchemaPath(actualPath, namespace, revision, yangModelPrefix));
478 parseSchemaNodeArgs(ctx, listBuilder);
479 parseConstraints(ctx, listBuilder.getConstraintsBuilder());
481 String keyDefinition = "";
482 for (int i = 0; i < ctx.getChildCount(); ++i) {
483 ParseTree childNode = ctx.getChild(i);
484 if (childNode instanceof Ordered_by_stmtContext) {
485 final Ordered_by_stmtContext orderedBy = (Ordered_by_stmtContext) childNode;
486 final boolean userOrdered = parseUserOrdered(orderedBy);
487 listBuilder.setUserOrdered(userOrdered);
488 } else if (childNode instanceof Key_stmtContext) {
489 keyDefinition = stringFromNode(childNode);
490 List<QName> key = createListKey(keyDefinition, namespace,
491 revision, yangModelPrefix);
492 listBuilder.setKeyDefinition(key);
498 public void exitList_stmt(List_stmtContext ctx) {
499 final String actContainer = actualPath.pop();
500 logger.debug("exiting " + actContainer);
504 public void enterNotification_stmt(YangParser.Notification_stmtContext ctx) {
505 final String notificationName = stringFromNode(ctx);
506 QName notificationQName = new QName(namespace, revision,
507 yangModelPrefix, notificationName);
508 NotificationBuilder notificationBuilder = moduleBuilder
509 .addNotification(notificationQName, actualPath);
510 updatePath(notificationName);
512 notificationBuilder.setPath(createActualSchemaPath(actualPath, namespace,
513 revision, yangModelPrefix));
514 parseSchemaNodeArgs(ctx, notificationBuilder);
518 public void exitNotification_stmt(YangParser.Notification_stmtContext ctx) {
519 final String actContainer = actualPath.pop();
520 logger.debug("exiting " + actContainer);
525 public void enterIdentifier_stmt(YangParser.Identifier_stmtContext ctx) {
526 String name = stringFromNode(ctx);
530 String[] splittedName = name.split(":");
531 if(splittedName.length == 2) {
532 qname = new QName(null, null, splittedName[0], splittedName[1]);
534 qname = new QName(namespace, revision, yangModelPrefix, splittedName[0]);
537 qname = new QName(namespace, revision, yangModelPrefix, name);
540 UnknownSchemaNodeBuilder builder = moduleBuilder.addUnknownSchemaNode(qname, getActualPath());
543 builder.setPath(createActualSchemaPath(actualPath, namespace, revision, yangModelPrefix));
544 parseSchemaNodeArgs(ctx, builder);
548 public void exitIdentifier_stmt(YangParser.Identifier_stmtContext ctx) {
549 final String actContainer = actualPath.pop();
550 logger.debug("exiting " + actContainer);
554 public void enterRpc_stmt(YangParser.Rpc_stmtContext ctx) {
555 final String rpcName = stringFromNode(ctx);
556 QName rpcQName = new QName(namespace, revision, yangModelPrefix,
558 RpcDefinitionBuilder rpcBuilder = moduleBuilder.addRpc(rpcQName,
562 rpcBuilder.setPath(createActualSchemaPath(actualPath, namespace, revision,
564 parseSchemaNodeArgs(ctx, rpcBuilder);
568 public void exitRpc_stmt(YangParser.Rpc_stmtContext ctx) {
569 final String actContainer = actualPath.pop();
570 logger.debug("exiting " + actContainer);
574 public void enterInput_stmt(YangParser.Input_stmtContext ctx) {
579 public void exitInput_stmt(YangParser.Input_stmtContext ctx) {
580 final String actContainer = actualPath.pop();
581 logger.debug("exiting " + actContainer);
585 public void enterOutput_stmt(YangParser.Output_stmtContext ctx) {
586 updatePath("output");
590 public void exitOutput_stmt(YangParser.Output_stmtContext ctx) {
591 final String actContainer = actualPath.pop();
592 logger.debug("exiting " + actContainer);
596 public void enterFeature_stmt(YangParser.Feature_stmtContext ctx) {
597 final String featureName = stringFromNode(ctx);
598 QName featureQName = new QName(namespace, revision, yangModelPrefix,
600 FeatureBuilder featureBuilder = moduleBuilder.addFeature(featureQName,
602 updatePath(featureName);
604 featureBuilder.setPath(createActualSchemaPath(actualPath, namespace,
605 revision, yangModelPrefix));
606 parseSchemaNodeArgs(ctx, featureBuilder);
610 public void exitFeature_stmt(YangParser.Feature_stmtContext ctx) {
611 final String actContainer = actualPath.pop();
612 logger.debug("exiting " + actContainer);
616 public void enterDeviation_stmt(YangParser.Deviation_stmtContext ctx) {
617 final String targetPath = stringFromNode(ctx);
618 String reference = null;
619 String deviate = null;
620 DeviationBuilder builder = moduleBuilder.addDeviation(targetPath);
621 updatePath(targetPath);
623 for (int i = 0; i < ctx.getChildCount(); i++) {
624 ParseTree child = ctx.getChild(i);
625 if (child instanceof Reference_stmtContext) {
626 reference = stringFromNode(child);
627 } else if (child instanceof Deviate_not_supported_stmtContext) {
628 deviate = stringFromNode(child);
629 } else if (child instanceof Deviate_add_stmtContext) {
630 deviate = stringFromNode(child);
631 } else if (child instanceof Deviate_replace_stmtContext) {
632 deviate = stringFromNode(child);
633 } else if (child instanceof Deviate_delete_stmtContext) {
634 deviate = stringFromNode(child);
637 builder.setReference(reference);
638 builder.setDeviate(deviate);
642 public void exitDeviation_stmt(YangParser.Deviation_stmtContext ctx) {
643 final String actContainer = actualPath.pop();
644 logger.debug("exiting " + actContainer);
648 public void enterConfig_stmt(YangParser.Config_stmtContext ctx) {
649 boolean configuration = parseConfig(ctx);
650 moduleBuilder.addConfiguration(configuration, actualPath);
653 public ModuleBuilder getModuleBuilder() {
654 return moduleBuilder;
657 private void updatePath(String containerName) {
658 actualPath.push(containerName);
661 private List<String> getActualPath() {
662 return Collections.unmodifiableList(actualPath);