X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=binding%2Fmdsal-binding-generator-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fyangtools%2Fsal%2Fbinding%2Fgenerator%2Fimpl%2FYangTemplate.xtend;h=09764442ba356c8c79fa32d29f5587e40d621e6a;hb=030f7d42bfd1e63f50387c07e2432daa1efd17ed;hp=6738a665ddb7a5486a99d5cfb9df067aa33a6941;hpb=8d273cee83b985508fb231617f3cd23d121d38eb;p=mdsal.git diff --git a/binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/yangtools/sal/binding/generator/impl/YangTemplate.xtend b/binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/yangtools/sal/binding/generator/impl/YangTemplate.xtend index 6738a665dd..09764442ba 100644 --- a/binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/yangtools/sal/binding/generator/impl/YangTemplate.xtend +++ b/binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/yangtools/sal/binding/generator/impl/YangTemplate.xtend @@ -7,6 +7,7 @@ */ package org.opendaylight.yangtools.sal.binding.generator.impl +import com.google.common.base.CharMatcher import java.util.Collection import java.util.Date import java.util.List @@ -14,6 +15,7 @@ import java.util.Map import java.util.Set import java.util.StringTokenizer import org.opendaylight.yangtools.yang.common.QName +import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode import org.opendaylight.yangtools.yang.model.api.AugmentationSchema import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode @@ -34,13 +36,12 @@ import org.opendaylight.yangtools.yang.model.api.NotificationDefinition import org.opendaylight.yangtools.yang.model.api.RpcDefinition import org.opendaylight.yangtools.yang.model.api.SchemaNode import org.opendaylight.yangtools.yang.model.api.SchemaPath +import org.opendaylight.yangtools.yang.model.api.Status import org.opendaylight.yangtools.yang.model.api.TypeDefinition import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode import org.opendaylight.yangtools.yang.model.api.UsesNode import org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition import org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition.EnumPair -import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil -import com.google.common.base.CharMatcher class YangTemplate { @@ -208,6 +209,7 @@ class YangTemplate { } def static writeRPC(RpcDefinition rpc) { + var boolean isStatusDeprecated = rpc.status == Status::DEPRECATED ''' rpc «rpc.QName.localName» { «IF !rpc.description.nullOrEmpty» @@ -226,7 +228,7 @@ class YangTemplate { reference "«rpc.reference»"; «ENDIF» - «IF rpc.status != null» + «IF isStatusDeprecated» status «rpc.status»; «ENDIF» } @@ -271,6 +273,7 @@ class YangTemplate { } def static writeNotification(NotificationDefinition notification) { + var boolean isStatusDeprecated = notification.status == Status::DEPRECATED ''' notification «notification.QName.localName» { «IF !notification.description.nullOrEmpty» @@ -293,7 +296,7 @@ class YangTemplate { reference "«notification.reference»"; «ENDIF» - «IF notification.status != null» + «IF isStatusDeprecated» status «notification.status»; «ENDIF» } @@ -371,8 +374,12 @@ class YangTemplate { } def static writeTypeDefinition(TypeDefinition typeDefinition) { + var boolean isStatusDeprecated = typeDefinition.status == Status::DEPRECATED ''' - type «typeDefinition.QName.localName»; + type «typeDefinition.QName.localName»«IF !isStatusDeprecated»;«ELSE» { + status «typeDefinition.status»; + } + «ENDIF» ''' } @@ -559,6 +566,7 @@ class YangTemplate { } def static writeGroupingDef(GroupingDefinition groupingDef) { + var boolean isStatusDeprecated = groupingDef.status == Status::DEPRECATED ''' grouping «groupingDef.QName.localName» { «IF !groupingDef.groupings.nullOrEmpty» @@ -567,6 +575,9 @@ class YangTemplate { «IF !groupingDef.childNodes.nullOrEmpty» «writeDataSchemaNodes(groupingDef.childNodes)» «ENDIF» + «IF isStatusDeprecated» + status «groupingDef.status»; + «ENDIF» «IF !groupingDef.unknownSchemaNodes.nullOrEmpty» «writeUnknownSchemaNodes(groupingDef.unknownSchemaNodes)» «ENDIF» @@ -575,6 +586,7 @@ class YangTemplate { } def static writeContSchemaNode(ContainerSchemaNode contSchemaNode) { + var boolean isStatusDeprecated = contSchemaNode.status == Status::DEPRECATED ''' container «contSchemaNode.getQName.localName» { «IF !contSchemaNode.childNodes.nullOrEmpty» @@ -589,6 +601,9 @@ class YangTemplate { «IF !contSchemaNode.uses.nullOrEmpty» «writeUsesNodes(contSchemaNode.uses)» «ENDIF» + «IF isStatusDeprecated» + status «contSchemaNode.status»; + «ENDIF» «IF !contSchemaNode.unknownSchemaNodes.nullOrEmpty» «writeUnknownSchemaNodes(contSchemaNode.unknownSchemaNodes)» «ENDIF» @@ -597,48 +612,70 @@ class YangTemplate { } def static writeAnyXmlSchemaNode(AnyXmlSchemaNode anyXmlSchemaNode) { + var boolean isStatusDeprecated = anyXmlSchemaNode.status == Status::DEPRECATED ''' - anyxml «anyXmlSchemaNode.getQName.localName»; + anyxml «anyXmlSchemaNode.getQName.localName»«IF !isStatusDeprecated»;«ELSE» { + status «anyXmlSchemaNode.status»; + } + «ENDIF» ''' } def static writeLeafSchemaNode(LeafSchemaNode leafSchemaNode) { + var boolean isStatusDeprecated = leafSchemaNode.status == Status::DEPRECATED ''' leaf «leafSchemaNode.getQName.localName» { type «leafSchemaNode.type.getQName.localName»; + «IF isStatusDeprecated» + status «leafSchemaNode.status»; + «ENDIF» } ''' } def static writeLeafListSchemaNode(LeafListSchemaNode leafListSchemaNode) { + var boolean isStatusDeprecated = leafListSchemaNode.status == Status::DEPRECATED ''' leaf-list «leafListSchemaNode.getQName.localName» { type «leafListSchemaNode.type.getQName.localName»; + «IF isStatusDeprecated» + status «leafListSchemaNode.status»; + «ENDIF» } ''' } def static writeChoiceCaseNode(ChoiceCaseNode choiceCaseNode) { + var boolean isStatusDeprecated = choiceCaseNode.status == Status::DEPRECATED ''' case «choiceCaseNode.getQName.localName» { «FOR childNode : choiceCaseNode.childNodes» «writeDataSchemaNode(childNode)» «ENDFOR» + «IF isStatusDeprecated» + status «choiceCaseNode.status»; + «ENDIF» } ''' } def static writeChoiceNode(ChoiceSchemaNode choiceNode) { + var boolean isStatusDeprecated = choiceNode.status == Status::DEPRECATED ''' choice «choiceNode.getQName.localName» { «FOR child : choiceNode.cases» «writeDataSchemaNode(child)» «ENDFOR» + «IF isStatusDeprecated» + status «choiceNode.status»; + «ENDIF» } ''' } def static writeListSchemaNode(ListSchemaNode listSchemaNode) { + var boolean isStatusDeprecated = listSchemaNode.status == Status::DEPRECATED + ''' list «listSchemaNode.getQName.localName» { key «FOR listKey : listSchemaNode.keyDefinition SEPARATOR " "»"«listKey.localName»" @@ -655,6 +692,9 @@ class YangTemplate { «IF !listSchemaNode.uses.nullOrEmpty» «writeUsesNodes(listSchemaNode.uses)» «ENDIF» + «IF isStatusDeprecated» + status «listSchemaNode.status»; + «ENDIF» «IF !listSchemaNode.unknownSchemaNodes.nullOrEmpty» «writeUnknownSchemaNodes(listSchemaNode.unknownSchemaNodes)» «ENDIF»