Gaurav Agrawal
Committed by Gerrit Code Review

YANG: Restriction resolution implementation

Change-Id: I69503e8229def07b289a0c8c762bfe0ae5530232
Showing 33 changed files with 273 additions and 392 deletions
/*
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.yangutils.datamodel;
/**
* Abstraction of location information, this is used during resolution is
* carried out and line/character position in line is required to point
* out the error location in YANG file.
*/
public interface LocationInfo {
/**
* Returns the line number YANG construct in file.
*
* @return the line number YANG construct in file
*/
int getLineNumber();
/**
* Returns the character position in line.
*
* @return the character position in line
*/
int getCharPosition();
/**
* Sets line number of YANG construct.
*
* @param lineNumber the line number of YANG construct in file
*/
void setLineNumber(int lineNumber);
/**
* Sets character position of YANG construct.
*
* @param charPositionInLine character position of YANG construct in file
*/
void setCharPosition(int charPositionInLine);
}
......@@ -228,7 +228,7 @@ public enum YangDataTypes {
public static YangDataTypes getType(String name) {
name = name.replace("\"", "");
for (YangDataTypes yangDataType : values()) {
if (yangDataType.name().equalsIgnoreCase(name)) {
if (yangDataType.name().toLowerCase().equals(name)) {
return yangDataType;
}
}
......
......@@ -46,6 +46,7 @@ import java.util.List;
* | reference | 7.19.4 | 0..1 |
* +---------------+---------+-------------+
*/
/**
* Represents pattern restriction information. The regular expression restriction on string
* data type.
......@@ -58,11 +59,6 @@ public class YangPatternRestriction {
private List<String> patternList;
/**
* Effective pattern restriction that needs inherited from base type.
*/
private List<String> basePattern;
/**
* Creates a YANG pattern restriction object.
*/
public YangPatternRestriction() {
......@@ -95,22 +91,4 @@ public class YangPatternRestriction {
public void addPattern(String newPattern) {
getPatternList().add(newPattern);
}
/**
* Returns the pattern restriction defined in base type.
*
* @return pattern restriction defined in base type.
*/
public List<String> getBasePattern() {
return basePattern;
}
/**
* Sets the pattern restriction defined in base type.
*
* @param basePattern pattern restriction defined in base type.
*/
public void setBasePattern(List<String> basePattern) {
this.basePattern = basePattern;
}
}
......
......@@ -18,7 +18,6 @@ package org.onosproject.yangutils.datamodel;
import java.util.LinkedList;
import java.util.List;
import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
import org.onosproject.yangutils.utils.builtindatatype.YangBuiltInDataTypeInfo;
......@@ -111,8 +110,8 @@ public class YangRangeRestriction<T extends YangBuiltInDataTypeInfo<T>>
/**
* Returns the minimum valid value as per the restriction.
*
* @throws DataModelException data model exception for minimum restriction
* @return minimum restricted value
* @throws DataModelException data model exception for minimum restriction
*/
public T getMinRestrictedvalue() throws DataModelException {
if (getAscendingRangeIntervals() == null) {
......@@ -127,8 +126,8 @@ public class YangRangeRestriction<T extends YangBuiltInDataTypeInfo<T>>
/**
* Returns the maximum valid value as per the restriction.
*
* @throws DataModelException data model exception for maximum restriction
* @return minimum maximum value
* @throws DataModelException data model exception for maximum restriction
*/
public T getMaxRestrictedvalue() throws DataModelException {
if (getAscendingRangeIntervals() == null) {
......@@ -175,7 +174,7 @@ public class YangRangeRestriction<T extends YangBuiltInDataTypeInfo<T>>
}
/**
* Check if the given value is correct as per the restriction.
* Validates if the given value is correct as per the restriction.
*
* @param valueInString value
* @return true, if the value is confirming to restriction, false otherwise
......@@ -206,6 +205,32 @@ public class YangRangeRestriction<T extends YangBuiltInDataTypeInfo<T>>
}
/**
* Validates if the given interval is correct as per the restriction.
*
* @param rangeInterval range interval
* @return true, if the interval is confirming to restriction, false otherwise
* @throws DataModelException data model error
*/
public boolean isValidInterval(YangRangeInterval rangeInterval) throws DataModelException {
if (getAscendingRangeIntervals() == null
|| getAscendingRangeIntervals().isEmpty()) {
// Throw exception, At least one default range needs to be set in constructor or in linker.
throw new DataModelException("Range interval missing in range restriction.");
}
for (YangRangeInterval<T> interval : getAscendingRangeIntervals()) {
int rangeStartCompareRes = interval.getStartValue().compareTo((T) rangeInterval.getStartValue());
int rangeEndCompareRes = interval.getEndValue().compareTo((T) rangeInterval.getEndValue());
if (rangeStartCompareRes <= 0 && rangeEndCompareRes >= 0) {
return true;
}
}
throw new DataModelException("Range interval doesn't fall within the referred restriction ranges");
}
/**
* Returns the textual reference of the length restriction.
*
* @return textual reference of the length restriction
......
......@@ -17,7 +17,6 @@
package org.onosproject.yangutils.datamodel;
import java.util.Stack;
import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
import static org.onosproject.yangutils.datamodel.ResolvableStatus.INTRA_FILE_RESOLVED;
......@@ -30,7 +29,7 @@ import static org.onosproject.yangutils.datamodel.ResolvableStatus.UNRESOLVED;
*
* @param <T> type of resolution entity uses / type
*/
public class YangResolutionInfo<T> {
public class YangResolutionInfo<T> implements LocationInfo {
/**
* Information about the entity that needs to be resolved.
......@@ -64,9 +63,9 @@ public class YangResolutionInfo<T> {
/**
* Creates a resolution information object with all the inputs.
*
* @param dataNode current parsable data node
* @param holderNode parent YANG node
* @param lineNumber error line number
* @param dataNode current parsable data node
* @param holderNode parent YANG node
* @param lineNumber error line number
* @param charPositionInLine error character position in line
*/
public YangResolutionInfo(T dataNode, YangNode holderNode, int lineNumber, int charPositionInLine) {
......@@ -193,7 +192,6 @@ public class YangResolutionInfo<T> {
private void resolveTopOfStack()
throws DataModelException {
((Resolvable) getCurrentEntityToResolveFromStack()).resolve();
if (((Resolvable) getCurrentEntityToResolveFromStack()).getResolvableStatus()
!= INTRA_FILE_RESOLVED) {
// Sets the resolution status in inside the type/uses.
......@@ -453,42 +451,6 @@ public class YangResolutionInfo<T> {
}
/**
* Returns error position.
*
* @return error position
*/
public int getCharPosition() {
return charPosition;
}
/**
* Sets error position.
*
* @param charPosition position of error
*/
public void setCharPosition(int charPosition) {
this.charPosition = charPosition;
}
/**
* Returns error character position in line.
*
* @return error character position in line
*/
public int getLineNumber() {
return lineNumber;
}
/**
* Sets error character position in line.
*
* @param lineNumber error character position in line
*/
public void setLineNumber(int lineNumber) {
this.lineNumber = lineNumber;
}
/**
* Returns stack of YANG type with partially resolved YANG construct
* hierarchy.
*
......@@ -539,9 +501,29 @@ public class YangResolutionInfo<T> {
* Sets information about the entity that needs to be resolved.
*
* @param entityToResolveInfo information about the entity that needs to be
* resolved
* resolved
*/
public void setEntityToResolveInfo(YangEntityToResolveInfo<T> entityToResolveInfo) {
this.entityToResolveInfo = entityToResolveInfo;
}
@Override
public int getLineNumber() {
return lineNumber;
}
@Override
public int getCharPosition() {
return charPosition;
}
@Override
public void setLineNumber(int lineNumber) {
this.lineNumber = lineNumber;
}
@Override
public void setCharPosition(int charPositionInLine) {
this.charPosition = charPositionInLine;
}
}
......
......@@ -24,6 +24,7 @@ import org.onosproject.yangutils.utils.builtindatatype.YangUint64;
* A string can be restricted with the "length" and "pattern" statements.
*
*/
/**
* Represents the restriction for string data type.
*/
......@@ -113,7 +114,7 @@ public class YangStringRestriction {
*
* @param patternRestriction pattern restriction for the type
*/
private void setPatternRestriction(YangPatternRestriction patternRestriction) {
public void setPatternRestriction(YangPatternRestriction patternRestriction) {
this.patternRestriction = patternRestriction;
}
......
......@@ -20,7 +20,6 @@ import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
import org.onosproject.yangutils.parser.Parsable;
import org.onosproject.yangutils.utils.YangConstructType;
import static org.onosproject.yangutils.datamodel.ResolvableStatus.INTRA_FILE_RESOLVED;
import static org.onosproject.yangutils.datamodel.YangDataTypes.DERIVED;
/*
......@@ -78,18 +77,6 @@ public class YangType<T>
private T dataTypeExtendedInfo;
/**
* Effective built-in type, requried in case type of typedef is again a
* derived type. This information is to be added during linking.
*/
private YangDataTypes effectiveBuiltInType;
/**
* Effective pattern restriction, requried in case type of typedef is again
* a derived type. This information is to be added during linking.
*/
private YangPatternRestriction effectivePatternRestriction;
/**
* Status of resolution. If completely resolved enum value is "RESOLVED",
* if not enum value is "UNRESOLVED", in case reference of grouping/typedef
* is added to uses/type but it's not resolved value of enum should be
......@@ -215,42 +202,6 @@ public class YangType<T>
}
/**
* Return effective built-in type.
*
* @return effective built-in type
*/
public YangDataTypes getEffectiveBuiltInType() {
return effectiveBuiltInType;
}
/**
* Sets effective built-in type.
*
* @param effectiveBuiltInType effective built-in type
*/
public void setEffectiveBuiltInType(YangDataTypes effectiveBuiltInType) {
this.effectiveBuiltInType = effectiveBuiltInType;
}
/**
* Returns effective pattern restriction.
*
* @return effective pattern restriction
*/
public YangPatternRestriction getEffectivePatternRestriction() {
return effectivePatternRestriction;
}
/**
* Sets effective pattern restriction.
*
* @param effectivePatternRestriction effective pattern restriction
*/
public void setEffectivePatternRestriction(YangPatternRestriction effectivePatternRestriction) {
this.effectivePatternRestriction = effectivePatternRestriction;
}
/**
* Returns the type of the parsed data.
*
* @return returns TYPE_DATA
......@@ -269,7 +220,6 @@ public class YangType<T>
public void validateDataOnEntry()
throws DataModelException {
// TODO auto-generated method stub, to be implemented by parser
}
/**
......@@ -281,7 +231,6 @@ public class YangType<T>
public void validateDataOnExit()
throws DataModelException {
// TODO auto-generated method stub, to be implemented by parser
}
@Override
......@@ -297,17 +246,19 @@ public class YangType<T>
@Override
public void resolve() throws DataModelException {
/*
Inherit the Restriction from the referred typedef definition.
* Check whether the data type is derived.
*/
if (getDataType() != DERIVED) {
throw new DataModelException("Resolve should only be called for derived data types");
throw new DataModelException("Linker Error: Resolve should only be called for derived data types.");
}
YangDerivedInfo<?> derrivedInfo = (YangDerivedInfo<?>) getDataTypeExtendedInfo();
YangType<?> baseType = derrivedInfo.getReferredTypeDef().getTypeDefBaseType();
if (DERIVED == baseType.getDataType() && baseType.getResolvableStatus() == INTRA_FILE_RESOLVED) {
setResolvableStatus(INTRA_FILE_RESOLVED);
// Check if the derived info is present.
YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) getDataTypeExtendedInfo();
if (derivedInfo == null) {
throw new DataModelException("Linker Error: Derived information is missing.");
}
//TODO:
// Initiate the resolution
setResolvableStatus(derivedInfo.resolve());
}
}
......
......@@ -83,11 +83,6 @@ public class YangTypeDef extends YangNode implements YangCommonInfo, Parsable, Y
private String name;
/**
* Maintain the data type information.
*/
private YangType<?> dataType;
/**
* Units of the data type.
*/
private String units;
......
/*
* Copyright 2016 Open Networking Laboratory
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -16,34 +16,26 @@
package org.onosproject.yangutils.parser.impl.listeners;
import java.util.regex.Pattern;
import org.onosproject.yangutils.datamodel.YangDataTypes;
import org.onosproject.yangutils.datamodel.YangDerivedInfo;
import org.onosproject.yangutils.datamodel.YangRangeRestriction;
import org.onosproject.yangutils.datamodel.YangRangeInterval;
import org.onosproject.yangutils.datamodel.YangStringRestriction;
import org.onosproject.yangutils.datamodel.YangType;
import org.onosproject.yangutils.datamodel.YangDataTypes;
import org.onosproject.yangutils.datamodel.YangDerivedInfo;
import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
import org.onosproject.yangutils.parser.Parsable;
import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.TreeWalkListener;
import org.onosproject.yangutils.utils.YangConstructType;
import org.onosproject.yangutils.utils.builtindatatype.DataTypeException;
import org.onosproject.yangutils.utils.builtindatatype.YangBuiltInDataTypeInfo;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.removeQuotesAndHandleConcat;
import static org.onosproject.yangutils.utils.YangConstructType.LENGTH_DATA;
import static org.onosproject.yangutils.utils.YangConstructType.TYPE_DATA;
import static org.onosproject.yangutils.datamodel.YangDataTypes.DERIVED;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
import static org.onosproject.yangutils.utils.builtindatatype.BuiltInTypeObjectFactory.getDataObjectFromString;
import static org.onosproject.yangutils.utils.RestrictionResolver.processLengthRestriction;
import static org.onosproject.yangutils.utils.YangConstructType.LENGTH_DATA;
import static org.onosproject.yangutils.utils.YangConstructType.TYPE_DATA;
/*
* Reference: RFC6020 and YANG ANTLR Grammar
......@@ -71,11 +63,6 @@ import static org.onosproject.yangutils.utils.builtindatatype.BuiltInTypeObjectF
*/
public final class LengthRestrictionListener {
private static final String PIPE = "|";
private static final String LENGTH_INTERVAL = "..";
private static final int MAX_RANGE_BOUNDARY = 2;
private static final int MIN_RANGE_BOUNDARY = 1;
/**
* Creates a new length restriction listener.
*/
......@@ -88,10 +75,10 @@ public final class LengthRestrictionListener {
* tree.
*
* @param listener listener's object
* @param ctx context object of the grammar rule
* @param ctx context object of the grammar rule
*/
public static void processLengthRestrictionEntry(TreeWalkListener listener,
GeneratedYangParser.LengthStatementContext ctx) {
GeneratedYangParser.LengthStatementContext ctx) {
// Check for stack to be non empty.
checkStackIsNotEmpty(listener, MISSING_HOLDER, LENGTH_DATA, ctx.length().getText(), ENTRY);
......@@ -110,18 +97,22 @@ public final class LengthRestrictionListener {
* Sets the length restriction to type.
*
* @param type Yang type for which length restriction to be set
* @param ctx context object of the grammar rule
* @param ctx context object of the grammar rule
*/
private static void setLengthRestriction(YangType type,
GeneratedYangParser.LengthStatementContext ctx) {
YangStringRestriction stringRestriction;
YangBuiltInDataTypeInfo<?> startValue;
YangBuiltInDataTypeInfo<?> endValue;
YangRangeRestriction lengthRestriction = new YangRangeRestriction<>();
if (type.getDataType() != YangDataTypes.STRING && type.getDataType() != YangDataTypes.DERIVED) {
GeneratedYangParser.LengthStatementContext ctx) {
if (type.getDataType() == DERIVED) {
((YangDerivedInfo<YangRangeRestriction>) type.getDataTypeExtendedInfo())
.setLengthRestrictionString(ctx.length().getText());
((YangDerivedInfo<YangRangeRestriction>) type.getDataTypeExtendedInfo())
.setLineNumber(ctx.getStart().getLine());
((YangDerivedInfo<YangRangeRestriction>) type.getDataTypeExtendedInfo())
.setCharPosition(ctx.getStart().getCharPositionInLine());
return;
}
if (type.getDataType() != YangDataTypes.STRING) {
ParserException parserException = new ParserException("YANG file error : " +
YangConstructType.getYangConstructType(LENGTH_DATA) + " name " + ctx.length().getText() +
" can be used to restrict the built-in type string or types derived from string.");
......@@ -130,71 +121,14 @@ public final class LengthRestrictionListener {
throw parserException;
}
if (type.getDataType() == YangDataTypes.STRING) {
stringRestriction = (YangStringRestriction) type.getDataTypeExtendedInfo();
} else {
stringRestriction = (YangStringRestriction) ((YangDerivedInfo<?>) type
.getDataTypeExtendedInfo()).getExtendedInfo();
}
YangRangeRestriction lengthRestriction = processLengthRestriction(null, ctx.getStart().getLine(),
ctx.getStart().getCharPositionInLine(), false, ctx.length().getText());
YangStringRestriction stringRestriction = (YangStringRestriction) type.getDataTypeExtendedInfo();
if (stringRestriction == null) {
stringRestriction = new YangStringRestriction();
if (type.getDataType() == YangDataTypes.STRING) {
type.setDataTypeExtendedInfo(stringRestriction);
} else {
((YangDerivedInfo<YangStringRestriction>) type.getDataTypeExtendedInfo())
.setExtendedInfo(stringRestriction);
}
}
String rangeArgument = removeQuotesAndHandleConcat(ctx.length().getText());
String[] rangeArguments = rangeArgument.trim().split(Pattern.quote(PIPE));
for (String rangePart : rangeArguments) {
String startInterval;
String endInterval;
YangRangeInterval rangeInterval = new YangRangeInterval<>();
String[] rangeBoundary = rangePart.trim().split(Pattern.quote(LENGTH_INTERVAL));
if (rangeBoundary.length > MAX_RANGE_BOUNDARY) {
ParserException parserException = new ParserException("YANG file error : " +
YangConstructType.getYangConstructType(LENGTH_DATA) + " " + rangeArgument +
" is not valid.");
parserException.setLine(ctx.getStart().getLine());
parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
throw parserException;
}
if (rangeBoundary.length == MIN_RANGE_BOUNDARY) {
startInterval = rangeBoundary[0];
endInterval = rangeBoundary[0];
} else {
startInterval = rangeBoundary[0];
endInterval = rangeBoundary[1];
}
try {
startValue = getDataObjectFromString(startInterval, YangDataTypes.UINT64);
endValue = getDataObjectFromString(endInterval, YangDataTypes.UINT64);
} catch (DataTypeException e) {
ParserException parserException = new ParserException(e.getMessage());
parserException.setLine(ctx.getStart().getLine());
parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
throw parserException;
}
rangeInterval.setStartValue(startValue);
rangeInterval.setEndValue(endValue);
try {
lengthRestriction.addRangeRestrictionInterval(rangeInterval);
} catch (DataModelException e) {
ParserException parserException = new ParserException(constructExtendedListenerErrorMessage(
UNHANDLED_PARSED_DATA, LENGTH_DATA, rangeArgument, ENTRY, e.getMessage()));
parserException.setLine(ctx.getStart().getLine());
parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
throw parserException;
}
type.setDataTypeExtendedInfo(stringRestriction);
}
stringRestriction.setLengthRestriction(lengthRestriction);
......
/*
* Copyright 2016 Open Networking Laboratory
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -16,23 +16,24 @@
package org.onosproject.yangutils.parser.impl.listeners;
import org.onosproject.yangutils.datamodel.YangDataTypes;
import org.onosproject.yangutils.datamodel.YangDerivedInfo;
import org.onosproject.yangutils.datamodel.YangType;
import org.onosproject.yangutils.datamodel.YangPatternRestriction;
import org.onosproject.yangutils.datamodel.YangStringRestriction;
import org.onosproject.yangutils.datamodel.YangDataTypes;
import org.onosproject.yangutils.datamodel.YangType;
import org.onosproject.yangutils.parser.Parsable;
import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.TreeWalkListener;
import org.onosproject.yangutils.utils.YangConstructType;
import static org.onosproject.yangutils.utils.YangConstructType.PATTERN_DATA;
import static org.onosproject.yangutils.utils.YangConstructType.TYPE_DATA;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
import static org.onosproject.yangutils.utils.YangConstructType.PATTERN_DATA;
import static org.onosproject.yangutils.utils.YangConstructType.TYPE_DATA;
/*
* Reference: RFC6020 and YANG ANTLR Grammar
......@@ -72,10 +73,10 @@ public final class PatternRestrictionListener {
* tree.
*
* @param listener listener's object
* @param ctx context object of the grammar rule
* @param ctx context object of the grammar rule
*/
public static void processPatternRestrictionEntry(TreeWalkListener listener,
GeneratedYangParser.PatternStatementContext ctx) {
GeneratedYangParser.PatternStatementContext ctx) {
// Check for stack to be non empty.
checkStackIsNotEmpty(listener, MISSING_HOLDER, PATTERN_DATA, ctx.string().getText(), ENTRY);
......@@ -94,13 +95,11 @@ public final class PatternRestrictionListener {
* Sets the pattern restriction to type.
*
* @param type Yang type for which pattern restriction to be set
* @param ctx context object of the grammar rule
* @param ctx context object of the grammar rule
*/
private static void setPatternRestriction(YangType type,
GeneratedYangParser.PatternStatementContext ctx) {
YangStringRestriction stringRestriction;
if (type.getDataType() != YangDataTypes.STRING && type.getDataType() != YangDataTypes.DERIVED) {
ParserException parserException = new ParserException("YANG file error : " +
......@@ -111,24 +110,28 @@ public final class PatternRestrictionListener {
throw parserException;
}
if (type.getDataType() == YangDataTypes.STRING) {
stringRestriction = (YangStringRestriction) type.getDataTypeExtendedInfo();
} else {
stringRestriction = (YangStringRestriction) ((YangDerivedInfo<?>) type
.getDataTypeExtendedInfo()).getExtendedInfo();
}
String patternArgument = ctx.string().getText().replace("\"", EMPTY_STRING);
if (stringRestriction == null) {
stringRestriction = new YangStringRestriction();
if (type.getDataType() == YangDataTypes.STRING) {
if (type.getDataType() == YangDataTypes.STRING) {
YangStringRestriction stringRestriction = (YangStringRestriction) type.getDataTypeExtendedInfo();
if (stringRestriction == null) {
stringRestriction = new YangStringRestriction();
type.setDataTypeExtendedInfo(stringRestriction);
stringRestriction.addPattern(patternArgument);
} else {
((YangDerivedInfo<YangStringRestriction>) type.getDataTypeExtendedInfo())
.setExtendedInfo(stringRestriction);
stringRestriction.addPattern(patternArgument);
}
} else {
YangPatternRestriction patternRestriction = (YangPatternRestriction) ((YangDerivedInfo<?>) type
.getDataTypeExtendedInfo()).getPatternRestriction();
if (patternRestriction == null) {
patternRestriction = new YangPatternRestriction();
((YangDerivedInfo<?>) type.getDataTypeExtendedInfo()).setPatternRestriction(patternRestriction);
patternRestriction.addPattern(patternArgument);
} else {
((YangDerivedInfo<?>) type.getDataTypeExtendedInfo()).setPatternRestriction(patternRestriction);
patternRestriction.addPattern(patternArgument);
}
}
String patternArgument = ctx.string().getText().replace("\"", EMPTY_STRING);
stringRestriction.addPattern(patternArgument);
}
}
......
......@@ -16,33 +16,24 @@
package org.onosproject.yangutils.parser.impl.listeners;
import java.util.regex.Pattern;
import org.onosproject.yangutils.datamodel.YangRangeInterval;
import org.onosproject.yangutils.datamodel.YangDerivedInfo;
import org.onosproject.yangutils.datamodel.YangRangeRestriction;
import org.onosproject.yangutils.datamodel.YangType;
import org.onosproject.yangutils.datamodel.YangDerivedInfo;
import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
import org.onosproject.yangutils.datamodel.YangDataTypes;
import org.onosproject.yangutils.parser.Parsable;
import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.TreeWalkListener;
import org.onosproject.yangutils.utils.YangConstructType;
import org.onosproject.yangutils.utils.builtindatatype.DataTypeException;
import org.onosproject.yangutils.utils.builtindatatype.YangBuiltInDataTypeInfo;
import static org.onosproject.yangutils.datamodel.YangDataTypes.DERIVED;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.removeQuotesAndHandleConcat;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
import static org.onosproject.yangutils.utils.YangConstructType.TYPE_DATA;
import static org.onosproject.yangutils.utils.RestrictionResolver.isOfRangeRestrictedType;
import static org.onosproject.yangutils.utils.RestrictionResolver.processRangeRestriction;
import static org.onosproject.yangutils.utils.YangConstructType.RANGE_DATA;
import static org.onosproject.yangutils.utils.builtindatatype.BuiltInTypeObjectFactory.getDataObjectFromString;
import static org.onosproject.yangutils.utils.YangConstructType.TYPE_DATA;
/*
* Reference: RFC6020 and YANG ANTLR Grammar
......@@ -68,11 +59,6 @@ import static org.onosproject.yangutils.utils.builtindatatype.BuiltInTypeObjectF
*/
public final class RangeRestrictionListener {
private static final String PIPE = "|";
private static final String RANGE_INTERVAL = "..";
private static final int MAX_RANGE_BOUNDARY = 2;
private static final int MIN_RANGE_BOUNDARY = 1;
/**
* Creates a new range restriction listener.
*/
......@@ -85,10 +71,10 @@ public final class RangeRestrictionListener {
* tree.
*
* @param listener listener's object
* @param ctx context object of the grammar rule
* @param ctx context object of the grammar rule
*/
public static void processRangeRestrictionEntry(TreeWalkListener listener,
GeneratedYangParser.RangeStatementContext ctx) {
GeneratedYangParser.RangeStatementContext ctx) {
// Check for stack to be non empty.
checkStackIsNotEmpty(listener, MISSING_HOLDER, RANGE_DATA, ctx.range().getText(), ENTRY);
......@@ -107,73 +93,34 @@ public final class RangeRestrictionListener {
* Sets the range restriction to type.
*
* @param type YANG type for which range restriction to be added
* @param ctx context object of the grammar rule
* @param ctx context object of the grammar rule
*/
private static void setRangeRestriction(YangType type,
GeneratedYangParser.RangeStatementContext ctx) {
YangBuiltInDataTypeInfo<?> startValue;
YangBuiltInDataTypeInfo<?> endValue;
YangRangeRestriction rangeRestriction = new YangRangeRestriction();
String rangeArgument = removeQuotesAndHandleConcat(ctx.range().getText());
String[] rangeArguments = rangeArgument.trim().split(Pattern.quote(PIPE));
for (String rangePart : rangeArguments) {
String startInterval;
String endInterval;
YangRangeInterval rangeInterval = new YangRangeInterval();
String[] rangeBoundary = rangePart.trim().split(Pattern.quote(RANGE_INTERVAL));
if (rangeBoundary.length > MAX_RANGE_BOUNDARY) {
ParserException parserException = new ParserException("YANG file error : " +
YangConstructType.getYangConstructType(RANGE_DATA) + " " + rangeArgument +
" is not valid.");
parserException.setLine(ctx.getStart().getLine());
parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
throw parserException;
}
if (rangeBoundary.length == MIN_RANGE_BOUNDARY) {
startInterval = rangeBoundary[0];
endInterval = rangeBoundary[0];
} else {
startInterval = rangeBoundary[0];
endInterval = rangeBoundary[1];
}
try {
startValue = getDataObjectFromString(startInterval, type.getDataType());
endValue = getDataObjectFromString(endInterval, type.getDataType());
} catch (DataTypeException e) {
ParserException parserException = new ParserException(e.getMessage());
parserException.setLine(ctx.getStart().getLine());
parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
throw parserException;
}
rangeInterval.setStartValue(startValue);
rangeInterval.setEndValue(endValue);
GeneratedYangParser.RangeStatementContext ctx) {
if (type.getDataType() == DERIVED) {
((YangDerivedInfo<YangRangeRestriction>) type.getDataTypeExtendedInfo())
.setRangeRestrictionString(ctx.range().getText());
((YangDerivedInfo<YangRangeRestriction>) type.getDataTypeExtendedInfo())
.setLineNumber(ctx.getStart().getLine());
((YangDerivedInfo<YangRangeRestriction>) type.getDataTypeExtendedInfo())
.setCharPosition(ctx.getStart().getCharPositionInLine());
return;
}
try {
rangeRestriction.addRangeRestrictionInterval(rangeInterval);
} catch (DataModelException e) {
ParserException parserException = new ParserException(constructExtendedListenerErrorMessage(
UNHANDLED_PARSED_DATA, RANGE_DATA, rangeArgument, ENTRY, e.getMessage()));
parserException.setLine(ctx.getStart().getLine());
parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
throw parserException;
}
if (!(isOfRangeRestrictedType(type.getDataType()))) {
ParserException parserException = new ParserException("YANG file error: Range restriction can't be " +
"applied to a given type");
parserException.setLine(ctx.getStart().getLine());
parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
throw parserException;
}
YangRangeRestriction rangeRestriction = processRangeRestriction(null, ctx.getStart().getLine(),
ctx.getStart().getCharPositionInLine(), false, ctx.range().getText(), type.getDataType());
if (rangeRestriction != null) {
if (type.getDataType() == YangDataTypes.DERIVED) {
((YangDerivedInfo<YangRangeRestriction>) type.getDataTypeExtendedInfo())
.setExtendedInfo(rangeRestriction);
} else {
type.setDataTypeExtendedInfo(rangeRestriction);
}
type.setDataTypeExtendedInfo(rangeRestriction);
}
}
}
\ No newline at end of file
......
/*
* Copyright 2016 Open Networking Laboratory
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.yangutils.utils.builtindatatype;
import org.onosproject.yangutils.datamodel.YangDataTypes;
......@@ -66,7 +67,8 @@ public class YangInt16 implements YangBuiltInDataTypeInfo<YangInt16> {
try {
value = Short.parseShort(valueInString);
} catch (Exception e) {
throw new DataTypeException("YANG file error : " + valueInString + " is not valid.");
throw new DataTypeException("YANG file error : Input value \"" + valueInString + "\" is not a valid " +
"int16.");
}
}
}
......
/*
* Copyright 2016 Open Networking Laboratory
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.yangutils.utils.builtindatatype;
import org.onosproject.yangutils.datamodel.YangDataTypes;
......@@ -65,7 +66,8 @@ public class YangInt32 implements YangBuiltInDataTypeInfo<YangInt32> {
try {
value = Integer.parseInt(valueInString);
} catch (Exception e) {
throw new DataTypeException("YANG file error : " + valueInString + " is not valid.");
throw new DataTypeException("YANG file error : Input value \"" + valueInString + "\" is not a valid " +
"int32.");
}
}
}
......
/*
* Copyright 2016 Open Networking Laboratory
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.yangutils.utils.builtindatatype;
import org.onosproject.yangutils.datamodel.YangDataTypes;
......@@ -65,7 +66,8 @@ public class YangInt64 implements YangBuiltInDataTypeInfo<YangInt64> {
try {
value = Long.parseLong(valueInString);
} catch (Exception e) {
throw new DataTypeException("YANG file error : " + valueInString + " is not valid.");
throw new DataTypeException("YANG file error : Input value \"" + valueInString + "\" is not a valid " +
"int64.");
}
}
}
......
/*
* Copyright 2016 Open Networking Laboratory
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.yangutils.utils.builtindatatype;
import org.onosproject.yangutils.datamodel.YangDataTypes;
......@@ -65,7 +66,8 @@ public class YangInt8 implements YangBuiltInDataTypeInfo<YangInt8> {
try {
value = Byte.parseByte(valueInString);
} catch (Exception e) {
throw new DataTypeException("YANG file error : " + valueInString + " is not valid.");
throw new DataTypeException("YANG file error : Input value \"" + valueInString + "\" is not a valid " +
"int8.");
}
}
}
......
/*
* Copyright 2016 Open Networking Laboratory
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.yangutils.utils.builtindatatype;
import org.onosproject.yangutils.datamodel.YangDataTypes;
......@@ -65,7 +66,8 @@ public class YangUint16 implements YangBuiltInDataTypeInfo<YangUint16> {
try {
value = Integer.parseInt(valueInString);
} catch (Exception e) {
throw new DataTypeException("YANG file error : " + valueInString + " is not valid.");
throw new DataTypeException("YANG file error : Input value \"" + valueInString + "\" is not a valid " +
"uint16.");
}
}
......
/*
* Copyright 2016 Open Networking Laboratory
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.yangutils.utils.builtindatatype;
import org.onosproject.yangutils.datamodel.YangDataTypes;
......@@ -58,7 +59,8 @@ public class YangUint32 implements YangBuiltInDataTypeInfo<YangUint32> {
try {
value = Long.parseLong(valueInString);
} catch (Exception e) {
throw new DataTypeException("YANG file error : " + valueInString + " is not valid.");
throw new DataTypeException("YANG file error : Input value \"" + valueInString + "\" is not a valid " +
"uint32.");
}
}
......
/*
* Copyright 2016 Open Networking Laboratory
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.yangutils.utils.builtindatatype;
import java.math.BigInteger;
......@@ -71,7 +72,8 @@ public class YangUint64 implements YangBuiltInDataTypeInfo<YangUint64> {
} else if (NON_NEGATIVE_INTEGER_PATTERN.matcher(valueInString).matches()) {
value = new BigInteger(valueInString);
} else {
throw new DataTypeException("YANG file error : " + valueInString + " is not valid.");
throw new DataTypeException("YANG file error : Input value \"" + valueInString + "\" is not a valid " +
"uint64.");
}
if (value.compareTo(MIN_VALUE) < 0) {
......
/*
* Copyright 2016 Open Networking Laboratory
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.yangutils.utils.builtindatatype;
import org.onosproject.yangutils.datamodel.YangDataTypes;
......@@ -65,7 +66,8 @@ public class YangUint8 implements YangBuiltInDataTypeInfo<YangUint8> {
try {
value = Short.parseShort(valueInString);
} catch (Exception e) {
throw new DataTypeException("YANG file error : " + valueInString + " is not valid.");
throw new DataTypeException("YANG file error : Input value \"" + valueInString + "\" is not a valid " +
"uint8.");
}
}
......
......@@ -18,7 +18,6 @@ package org.onosproject.yangutils.linker;
import java.io.IOException;
import java.util.ListIterator;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
......@@ -81,7 +80,7 @@ public class IntraFileUsesLinkingTest {
// Check whether the information in the leaf is correct under grouping.
assertThat(leafInfo.getName(), is("hello"));
assertThat(leafInfo.getDataType().getDataTypeName(), is("String"));
assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
// Check whether uses is module's child.
......@@ -97,7 +96,7 @@ public class IntraFileUsesLinkingTest {
// Check whether the information in the leaf is correct under module.
assertThat(leafInfo.getName(), is("hello"));
assertThat(leafInfo.getDataType().getDataTypeName(), is("String"));
assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
}
......@@ -135,7 +134,7 @@ public class IntraFileUsesLinkingTest {
// Check whether the information in the leaf is correct under grouping.
assertThat(leafInfo.getName(), is("treat"));
assertThat(leafInfo.getDataType().getDataTypeName(), is("String"));
assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
// Check whether container is the child of grouping.
......@@ -150,7 +149,7 @@ public class IntraFileUsesLinkingTest {
// Check whether the information in the leaf is correct under container which is under grouping.
assertThat(leafInfo.getName(), is("leaf2"));
assertThat(leafInfo.getDataType().getDataTypeName(), is("String"));
assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
// Check whether uses is module's child.
......@@ -166,7 +165,7 @@ public class IntraFileUsesLinkingTest {
// Check whether the information in the leaf is correct under module.
assertThat(leafInfo.getName(), is("treat"));
assertThat(leafInfo.getDataType().getDataTypeName(), is("String"));
assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
// Check whether container is the child of module.
......@@ -181,7 +180,7 @@ public class IntraFileUsesLinkingTest {
// Check whether the information in the leaf is correct under container which is under module.
assertThat(leafInfo.getName(), is("leaf2"));
assertThat(leafInfo.getDataType().getDataTypeName(), is("String"));
assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
}
......@@ -688,7 +687,7 @@ public class IntraFileUsesLinkingTest {
// Check whether the information in the leaf is correct under grouping.
assertThat(leafInfo.getName(), is("hello"));
assertThat(leafInfo.getDataType().getDataTypeName(), is("String"));
assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
}
......@@ -762,7 +761,7 @@ public class IntraFileUsesLinkingTest {
// Check whether the information in the leaf is correct under grouping.
assertThat(leafInfo.getName(), is("hello"));
assertThat(leafInfo.getDataType().getDataTypeName(), is("String"));
assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
}
......
......@@ -19,20 +19,18 @@ package org.onosproject.yangutils.parser.impl.listeners;
import java.io.IOException;
import java.math.BigInteger;
import java.util.ListIterator;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangModule;
import org.onosproject.yangutils.datamodel.YangNodeType;
import org.onosproject.yangutils.datamodel.YangDataTypes;
import org.onosproject.yangutils.datamodel.YangLeaf;
import org.onosproject.yangutils.datamodel.YangLeafList;
import org.onosproject.yangutils.datamodel.YangDataTypes;
import org.onosproject.yangutils.datamodel.YangStringRestriction;
import org.onosproject.yangutils.datamodel.YangModule;
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangNodeType;
import org.onosproject.yangutils.datamodel.YangRangeInterval;
import org.onosproject.yangutils.datamodel.YangRangeRestriction;
import org.onosproject.yangutils.datamodel.YangStringRestriction;
import org.onosproject.yangutils.datamodel.YangTypeDef;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
......@@ -71,11 +69,11 @@ public class LengthRestrictionListenerTest {
assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
YangStringRestriction stringRestriction = (YangStringRestriction) leafInfo
.getDataType().getDataTypeExtendedInfo();
.getDataType().getDataTypeExtendedInfo();
YangRangeRestriction lengthRestriction = stringRestriction.getLengthRestriction();
ListIterator<YangRangeInterval> lengthListIterator = lengthRestriction.getAscendingRangeIntervals()
.listIterator();
.listIterator();
YangRangeInterval rangeInterval = lengthListIterator.next();
......@@ -220,7 +218,7 @@ public class LengthRestrictionListenerTest {
@Test
public void processLengthWithInvalidIntegerPattern() throws IOException, ParserException {
thrown.expect(ParserException.class);
thrown.expectMessage("YANG file error : a is not valid.");
thrown.expectMessage("YANG file error : Input value \"a\" is not a valid uint64.");
YangNode node = manager.getDataModel("src/test/resources/LengthWithInvalidIntegerPattern.yang");
}
......
......@@ -18,18 +18,17 @@ package org.onosproject.yangutils.parser.impl.listeners;
import java.io.IOException;
import java.util.ListIterator;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangDataTypes;
import org.onosproject.yangutils.datamodel.YangLeaf;
import org.onosproject.yangutils.datamodel.YangLeafList;
import org.onosproject.yangutils.datamodel.YangRangeRestriction;
import org.onosproject.yangutils.datamodel.YangRangeInterval;
import org.onosproject.yangutils.datamodel.YangModule;
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangNodeType;
import org.onosproject.yangutils.datamodel.YangDataTypes;
import org.onosproject.yangutils.datamodel.YangRangeInterval;
import org.onosproject.yangutils.datamodel.YangRangeRestriction;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
import org.onosproject.yangutils.utils.builtindatatype.YangInt32;
......@@ -70,7 +69,7 @@ public class RangeRestrictionListenerTest {
.getDataType().getDataTypeExtendedInfo();
ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
.listIterator();
.listIterator();
YangRangeInterval rangeInterval = rangeListIterator.next();
assertThat(((YangInt32) rangeInterval.getStartValue()).getValue(), is(1));
assertThat(((YangInt32) rangeInterval.getEndValue()).getValue(), is(4));
......@@ -172,7 +171,7 @@ public class RangeRestrictionListenerTest {
@Test
public void processRangeWithInvalidIntegerPattern() throws IOException, ParserException {
thrown.expect(ParserException.class);
thrown.expectMessage("YANG file error : a is not valid.");
thrown.expectMessage("YANG file error : Input value \"a\" is not a valid int32.");
YangNode node = manager.getDataModel("src/test/resources/RangeWithInvalidIntegerPattern.yang");
}
}
......
......@@ -10,7 +10,7 @@ module Test {
}
}
typedef hello {
type String;
type string;
}
}
}
......
......@@ -11,6 +11,6 @@ module Test {
}
}
typedef hello {
type String;
type string;
}
}
......
......@@ -3,7 +3,7 @@ module Test {
namespace http://huawei.com;
prefix Ant;
typedef hello {
type String;
type string;
}
container ospf {
list valid {
......
......@@ -7,14 +7,14 @@ module Test {
}
grouping Percentage {
leaf hello{
type String;
type string;
}
}
container ospf {
list valid {
key "invalid";
leaf invalid{
type String;
leaf invalid{
type string;
}
uses Ant:FirstClass;
grouping FirstClass {
......
......@@ -3,15 +3,15 @@ module Test {
namespace http://huawei.com;
prefix Ant;
grouping Percentage {
leaf hello{
type String;
leaf hello{
type string;
}
}
container ospf {
list valid {
key "invalid";
leaf invalid{
type String;
leaf invalid{
type string;
}
uses Ant:FirstClass;
grouping FirstClass {
......
......@@ -6,6 +6,6 @@ module Test {
type hello;
}
typedef hello {
type String;
type string;
}
}
......
......@@ -4,8 +4,8 @@ module Test {
prefix Ant;
uses hello;
grouping hello {
leaf hello{
type String;
leaf hello{
type string;
}
}
}
......
......@@ -4,12 +4,12 @@ module Test {
prefix Ant;
uses treat;
grouping treat {
leaf treat{
type String;
leaf treat{
type string;
}
container test{
leaf leaf2{
type String;
type string;
}
}
}
......