Moving yangtools to separate repo
https://gerrit.onosproject.org/onos-yang-tools
Change-Id: I0dc994264b9b698cba2344b48e4e226b22951f55
diff --git a/utils/pom.xml b/utils/pom.xml
index 9364988..0a50dc7 100644
--- a/utils/pom.xml
+++ b/utils/pom.xml
@@ -33,7 +33,6 @@
<modules>
<module>junit</module>
<module>misc</module>
- <module>yangutils</module>
<module>osgi</module>
<module>rest</module>
<module>osgiwrap</module>
diff --git a/utils/yangutils/datamodel/pom.xml b/utils/yangutils/datamodel/pom.xml
deleted file mode 100644
index aaf1803..0000000
--- a/utils/yangutils/datamodel/pom.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<!--
- ~ 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.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-yangutils</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>yangutils-datamodel</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- <name>onos-yang-utils-datamodel</name>
- <packaging>jar</packaging>
-
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
-</project>
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/BuiltInTypeObjectFactory.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/BuiltInTypeObjectFactory.java
deleted file mode 100644
index b77b6ae..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/BuiltInTypeObjectFactory.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*-
- * 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;
-
-import java.io.Serializable;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.DataTypeException;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangBuiltInDataTypeInfo;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangInt16;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangInt32;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangInt64;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangInt8;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangUint16;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangUint32;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangUint64;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangUint8;
-
-/**
- * Factory to create an object of required type.
- */
-public final class BuiltInTypeObjectFactory implements Serializable {
-
- private static final long serialVersionUID = 8006201671L;
-
- /**
- * Utility factory class, hence the object creation is forbidden.
- */
- private BuiltInTypeObjectFactory() {
- }
-
- /**
- * Given the value represented in string return the corresponding types
- * object with the value initialized.
- *
- * @param valueInStr value represented in string
- * @param builtInType built in data type
- * @param <T> the data type of the target object
- * @return the target data type object with the value initialized
- */
- public static <T extends YangBuiltInDataTypeInfo<?>> T getDataObjectFromString(String valueInStr,
- YangDataTypes builtInType) {
-
- switch (builtInType) {
- case INT8: {
- return (T) new YangInt8(valueInStr);
- }
- case INT16: {
- return (T) new YangInt16(valueInStr);
- }
- case INT32: {
- return (T) new YangInt32(valueInStr);
- }
- case INT64: {
- return (T) new YangInt64(valueInStr);
- }
- case UINT8: {
- return (T) new YangUint8(valueInStr);
- }
- case UINT16: {
- return (T) new YangUint16(valueInStr);
- }
- case UINT32: {
- return (T) new YangUint32(valueInStr);
- }
- case UINT64: {
- return (T) new YangUint64(valueInStr);
- }
- case DECIMAL64: {
- return (T) new YangDecimal64(valueInStr);
- }
- default: {
- throw new DataTypeException("YANG file error : Unsupported data type");
- }
- }
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/CollisionDetector.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/CollisionDetector.java
deleted file mode 100644
index ad6a904..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/CollisionDetector.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-/**
- * Abstraction of YANG collision function. Abstracted to unify the collision
- * detection functionality.
- */
-public interface CollisionDetector {
- /**
- * Checks for the colliding child.
- *
- * @param identifierName name of identifier for which collision to be
- * checked
- * @param dataType type of the YANG construct for which collision to be
- * checked
- * @throws DataModelException if there is any collision in YANG rules in
- * parsed data, corresponding exception should be thrown
- */
- void detectCollidingChild(String identifierName, YangConstructType dataType)
- throws DataModelException;
-
- /**
- * Check for the self collision.
- *
- * @param identifierName name of identifier for which collision to be
- * checked
- * @param dataType type of the YANG construct for which collision to be
- * checked
- * @throws DataModelException if there is any collision in YANG rules in
- * parsed data, corresponding exception should be thrown
- */
- void detectSelfCollision(String identifierName, YangConstructType dataType)
- throws DataModelException;
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/LocationInfo.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/LocationInfo.java
deleted file mode 100644
index edd8849..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/LocationInfo.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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);
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/Resolvable.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/Resolvable.java
deleted file mode 100644
index c4091a9..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/Resolvable.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.ResolvableStatus;
-
-/**
- * Abstraction of YANG resolvable information. Abstracted to obtain the
- * information required for linking resolution.
- *
- * @param <T> YANG resolvable info
- */
-public interface Resolvable<T> {
-
- /**
- * Returns the status of resolution. If completely resolved returns enum
- * value "RESOLVED", if not returns "UNRESOLVED", in case reference of
- * grouping/typedef is added to uses/type but it's not resolved
- * "INTRA_FILE_RESOLVED" is returned.
- *
- * @return status of resolution
- */
- ResolvableStatus getResolvableStatus();
-
- /**
- * Set the status of type/uses resolution. If completely resolved set enum
- * value "RESOLVED", if not set it to "UNRESOLVED", in case reference of
- * grouping/typedef is added to uses/type but it's not resolved
- * "INTRA_FILE_RESOLVED" should be set.
- *
- * @param resolvableStatus status of resolution
- */
- void setResolvableStatus(ResolvableStatus resolvableStatus);
-
- /**
- * Resolves the linking.
- *
- * @return list of entities to be added for resolution
- * @throws DataModelException data model exception
- */
- T resolve()
- throws DataModelException;
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/ResolvableType.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/ResolvableType.java
deleted file mode 100644
index 1be5cac..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/ResolvableType.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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;
-
-/**
- * Type of the resolvable info.
- */
-public enum ResolvableType {
-
- /**
- * Identifies the derived data type.
- */
- YANG_DERIVED_DATA_TYPE,
-
- /**
- * Identifies the uses.
- */
- YANG_USES,
-
- /**
- * Identifies the if-feature.
- */
- YANG_IF_FEATURE,
-
- /**
- * Identifies the leafref.
- */
- YANG_LEAFREF,
-
- /**
- * Identifies the base.
- */
- YANG_BASE,
-
- /**
- * Identifies the identityref.
- */
- YANG_IDENTITYREF,
-
- /**
- * Identifies the augment.
- */
- YANG_AUGMENT
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/RpcNotificationContainer.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/RpcNotificationContainer.java
deleted file mode 100644
index 2d29f9e..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/RpcNotificationContainer.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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;
-
-/**
- * Represents class having rpc and notification.
- */
-public interface RpcNotificationContainer {
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/TraversalType.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/TraversalType.java
deleted file mode 100644
index e1a25c6..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/TraversalType.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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;
-
-/**
- * Represents data model tree traversal types.
- */
-public enum TraversalType {
-
- /**
- * Start of traversal at the tree root.
- */
- ROOT,
-
- /**
- * Child node traversal.
- */
- CHILD,
-
- /**
- * Sibling node traversal.
- */
- SIBILING,
-
- /**
- * Parent node traversal.
- */
- PARENT
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAppDataStructure.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAppDataStructure.java
deleted file mode 100644
index 80ea6c6..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAppDataStructure.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * 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;
-
-import java.util.LinkedList;
-import java.util.List;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-/**
- * Represents data model node to maintain information defined in YANG app-data-structure.
- */
-public class YangAppDataStructure implements Parsable {
-
- /**
- * Data structure information.
- */
- private YangDataStructure dataStructure;
-
- /**
- * List of key names.
- */
- private List<String> keyList;
-
- /**
- * Prefix of app-data-structure.
- */
- private String prefix;
-
- /**
- * Returns the YANG data structure information.
- *
- * @return the YANG data structure information
- */
- public YangDataStructure getDataStructure() {
- return dataStructure;
- }
-
- /**
- * Sets the YANG data structure information.
- *
- * @param dataStructure the YANG data structure to set
- */
- public void setDataStructure(YangDataStructure dataStructure) {
- this.dataStructure = dataStructure;
- }
-
- /**
- * Returns the list of key field names.
- *
- * @return the list of key field names
- */
- public List<String> getKeyList() {
- return keyList;
- }
-
- /**
- * Sets the list of key field names.
- *
- * @param keyList the list of key field names
- */
- public void setKeyList(List<String> keyList) {
- this.keyList = keyList;
- }
-
- /**
- * Adds a key field name.
- *
- * @param key key field name
- */
- public void addKey(String key) {
- if (getKeyList() == null) {
- setKeyList(new LinkedList<>());
- }
- getKeyList().add(key);
- }
-
- /**
- * Returns the prefix.
- *
- * @return the prefix
- */
- public String getPrefix() {
- return prefix;
- }
-
- /**
- * Sets the prefix information.
- *
- * @param prefix the prefix to set
- */
- public void setPrefix(String prefix) {
- this.prefix = prefix;
- }
-
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.APP_DATA_STRUCTURE;
- }
-
- @Override
- public void validateDataOnEntry() throws DataModelException {
- // TODO : to be implemented
- }
-
- @Override
- public void validateDataOnExit() throws DataModelException {
- // TODO : to be implemented
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAppErrorHolder.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAppErrorHolder.java
deleted file mode 100644
index 484aec1..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAppErrorHolder.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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;
-
-/**
- * Represents data model node to maintain YANG app error message information.
- */
-public interface YangAppErrorHolder {
-
- /**
- * Sets the application's error information.
- *
- * @param yangAppErrorInfo the application's error information
- */
- void setAppErrorInfo(YangAppErrorInfo yangAppErrorInfo);
-
- /**
- * Returns application's error information.
- *
- * @return application's error information
- */
- YangAppErrorInfo getAppErrorInfo();
-
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAppErrorInfo.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAppErrorInfo.java
deleted file mode 100644
index 213dccf..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAppErrorInfo.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * 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;
-
-import java.io.Serializable;
-
-/**
- * Represents data model to maintain yang app error information.
- */
-public class YangAppErrorInfo implements Serializable {
-
- private static final long serialVersionUID = 807201693L;
-
- /**
- * Application's error message, to be used for data error.
- */
- private String errorMessage;
-
- /**
- * Error tag, to be filled in data validation error response.
- */
- private String errorTag;
-
- /**
- * Application's error tag, to be filled in data validation error response.
- */
- private String errorAppTag;
-
- /**
- * Application's error path, to be filled in data validation error response.
- */
- private String errorAppPath;
-
- /**
- * Application's error info, to be filled in data validation error response.
- */
- private String errorAppInfo;
-
- /**
- * Creates a YANG app error info object.
- */
- @SuppressWarnings("unused")
- public YangAppErrorInfo() {
- }
-
- /**
- * Returns application's error message, to be used for data error.
- *
- * @return Application's error message, to be used for data error
- */
- public String getGetErrorMessage() {
- return errorMessage;
- }
-
- /**
- * Sets Application's error message, to be used for data error.
- *
- * @param errMsg Application's error message, to be used for data error
- */
- public void setErrorMessage(String errMsg) {
- errorMessage = errMsg;
- }
-
- /**
- * Returns error tag, to be used for data error.
- *
- * @return error tag, to be used for data error
- */
- public String getGetErrorTag() {
- return errorTag;
- }
-
- /**
- * Sets error tag, to be used for data error.
- *
- * @param errTag error tag, to be used for data error
- */
- public void setErrorTag(String errTag) {
- errorTag = errTag;
- }
-
- /**
- * Returns application's error tag, to be used for data error.
- *
- * @return application's error tag, to be used for data error
- */
- public String getGetErrorAppTag() {
- return errorAppTag;
- }
-
- /**
- * Sets application's error tag, to be used for data error.
- *
- * @param errTag application's error tag, to be used for data error
- */
- public void setErrorAppTag(String errTag) {
- errorAppTag = errTag;
- }
-
- /**
- * Returns application's error path, to be used for data error.
- *
- * @return application's error path, to be used for data error
- */
- public String getGetErrorAppPath() {
- return errorAppPath;
- }
-
- /**
- * Sets application's error path, to be used for data error.
- *
- * @param errPath application's error path, to be used for data error
- */
- public void setErrorAppPath(String errPath) {
- errorAppPath = errPath;
- }
-
- /**
- * Returns application's error info, to be used for data error.
- *
- * @return application's error info, to be used for data error
- */
- public String getGetErrorAppInfo() {
- return errorAppInfo;
- }
-
- /**
- * Sets application's error info, to be used for data error.
- *
- * @param errInfo application's error info, to be used for data error
- */
- public void setErrorAppInfo(String errInfo) {
- errorAppInfo = errInfo;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAppExtendedName.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAppExtendedName.java
deleted file mode 100644
index 2ab743e..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAppExtendedName.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-/**
- * Represents data model node to maintain information defined in YANG extended name.
- */
-public class YangAppExtendedName implements Parsable {
-
- /**
- * App extended name information.
- */
- private String yangAppExtendedName;
-
- /**
- * Prefix of extended name.
- */
- private String prefix;
-
- /**
- * Returns the YANG app extended name information.
- *
- * @return the YANG app extended name information
- */
- public String getYangAppExtendedName() {
- return yangAppExtendedName;
- }
-
- /**
- * Sets the YANG app extended name information.
- *
- * @param yangAppExtendedName the YANG app extended name to set
- */
- public void setYangAppExtendedName(String yangAppExtendedName) {
- this.yangAppExtendedName = yangAppExtendedName;
- }
-
- /**
- * Returns the prefix.
- *
- * @return the prefix
- */
- public String getPrefix() {
- return prefix;
- }
-
- /**
- * Sets the prefix information.
- *
- * @param prefix the prefix to set
- */
- public void setPrefix(String prefix) {
- this.prefix = prefix;
- }
-
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.APP_EXTENDED_NAME_DATA;
- }
-
- @Override
- public void validateDataOnEntry() throws DataModelException {
- // TODO : to be implemented
- }
-
- @Override
- public void validateDataOnExit() throws DataModelException {
- // TODO : to be implemented
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAtomicPath.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAtomicPath.java
deleted file mode 100644
index f0bb617..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAtomicPath.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * 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;
-
-import java.io.Serializable;
-import java.util.List;
-
-/**
- * Representation of data model node to maintain absolute path defined in YANG path-arg.
- */
-public class YangAtomicPath implements Serializable {
-
- private static final long serialVersionUID = 806201688L;
-
- // YANG node identifier.
- private YangNodeIdentifier nodeIdentifier;
-
- // List of path predicates expression.
- private List<YangPathPredicate> pathPredicatesList;
-
- /**
- * Resolved node for the absolute path.
- */
- private YangNode resolvedNode;
-
- /**
- * Returns the node identifier.
- *
- * @return the node identifier
- */
- public YangNodeIdentifier getNodeIdentifier() {
- return nodeIdentifier;
- }
-
- /**
- * Sets the node identifier.
- *
- * @param nodeIdentifier Sets the node identifier
- */
- public void setNodeIdentifier(YangNodeIdentifier nodeIdentifier) {
- this.nodeIdentifier = nodeIdentifier;
- }
-
- /**
- * Returns the path predicate expression.
- *
- * @return the path predicate expression
- */
- public List<YangPathPredicate> getPathPredicatesList() {
- return pathPredicatesList;
- }
-
- /**
- * Sets the path predicate expression.
- *
- * @param pathPredicatesList Sets the path predicate expression
- */
- public void setPathPredicatesList(List<YangPathPredicate> pathPredicatesList) {
- this.pathPredicatesList = pathPredicatesList;
- }
-
- /**
- * Adds predicate expression in data holder.
- *
- * @param predicatesExp the predicate expression to be added
- */
- public void addLeavesPredicate(YangPathPredicate predicatesExp) {
- getPathPredicatesList().add(predicatesExp);
- }
-
-
- /**
- * Returns resolved node.
- *
- * @return resolved node
- */
- public YangNode getResolvedNode() {
- return resolvedNode;
- }
-
- /**
- * Sets resolved node.
- *
- * @param resolvedNode resolved node
- */
- public void setResolvedNode(YangNode resolvedNode) {
- this.resolvedNode = resolvedNode;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java
deleted file mode 100644
index 13e43ac..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java
+++ /dev/null
@@ -1,442 +0,0 @@
-/*
- * 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;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.ResolvableStatus;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
-
-/*-
- * Reference RFC 6020.
- *
- * The "augment" statement allows a module or submodule to add to the
- * schema tree defined in an external module, or the current module and
- * its submodules, and to add to the nodes from a grouping in a "uses"
- * statement. The argument is a string that identifies a node in the
- * schema tree. This node is called the augment's target node. The
- * target node MUST be either a container, list, choice, case, input,
- * output, or notification node. It is augmented with the nodes defined
- * in the sub-statements that follow the "augment" statement.
- *
- * The argument string is a schema node identifier.
- * If the "augment" statement is on the top level in a module or
- * submodule, the absolute form of a schema node identifier
- * MUST be used. If the "augment" statement is a sub-statement to the
- * "uses" statement, the descendant form MUST be used.
- *
- * If the target node is a container, list, case, input, output, or
- * notification node, the "container", "leaf", "list", "leaf-list",
- * "uses", and "choice" statements can be used within the "augment"
- * statement.
- *
- * If the target node is a choice node, the "case" statement, or a case
- * shorthand statement can be used within the "augment" statement.
- *
- * If the target node is in another module, then nodes added by the
- * augmentation MUST NOT be mandatory nodes.
- *
- * The "augment" statement MUST NOT add multiple nodes with the same
- * name from the same module to the target node.
- * The augment's sub-statements
- *
- * +--------------+---------+-------------+------------------+
- * | substatement | section | cardinality |data model mapping|
- * +--------------+---------+-------------+------------------+
- * | anyxml | 7.10 | 0..n |-not supported |
- * | case | 7.9.2 | 0..n |-child nodes |
- * | choice | 7.9 | 0..n |-child nodes |
- * | container | 7.5 | 0..n |-child nodes |
- * | description | 7.19.3 | 0..1 |-string |
- * | if-feature | 7.18.2 | 0..n |-YangIfFeature |
- * | leaf | 7.6 | 0..n |-YangLeaf |
- * | leaf-list | 7.7 | 0..n |-YangLeafList |
- * | list | 7.8 | 0..n |-child nodes |
- * | reference | 7.19.4 | 0..1 |-String |
- * | status | 7.19.2 | 0..1 |-YangStatus |
- * | uses | 7.12 | 0..n |-child nodes |
- * | when | 7.19.5 | 0..1 |-YangWhen |
- * +--------------+---------+-------------+------------------+
- */
-
-/**
- * Representation of data model node to maintain information defined in YANG augment.
- */
-public class YangAugment
- extends YangNode
- implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector, YangAugmentedInfo, Resolvable,
- YangXPathResolver, YangWhenHolder, YangIfFeatureHolder, YangTranslatorOperatorNode {
-
- private static final long serialVersionUID = 806201602L;
-
- /**
- * Augment target node.
- */
- private String name;
-
- /**
- * Description of augment.
- */
- private String description;
-
- /**
- * List of leaves.
- */
- private List<YangLeaf> listOfLeaf;
-
- /**
- * List of leaf-lists.
- */
- private List<YangLeafList> listOfLeafList;
-
- /**
- * List of node identifiers.
- */
- private List<YangAtomicPath> targetNode;
-
- /**
- * Reference of the YANG augment.
- */
- private String reference;
-
- /**
- * Status of the node.
- */
- private YangStatusType status;
-
- /**
- * Resolved augmented node.
- */
- private YangNode augmentedNode;
-
- /**
- * 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
- * "INTRA_FILE_RESOLVED".
- */
- private ResolvableStatus resolvableStatus;
-
- /**
- * When data of the node.
- */
- private YangWhen when;
-
- /**
- * List of if-feature.
- */
- private List<YangIfFeature> ifFeatureList;
-
- /**
- * Create a YANG augment node.
- */
- public YangAugment() {
- super(YangNodeType.AUGMENT_NODE);
- resolvableStatus = ResolvableStatus.UNRESOLVED;
- }
-
- /**
- * Returns the augmented node.
- *
- * @return the augmented node
- */
- public List<YangAtomicPath> getTargetNode() {
- return targetNode;
- }
-
- /**
- * Sets the augmented node.
- *
- * @param nodeIdentifiers the augmented node
- */
- public void setTargetNode(List<YangAtomicPath> nodeIdentifiers) {
- targetNode = nodeIdentifiers;
- }
-
- /**
- * Returns the when.
- *
- * @return the when
- */
- @Override
- public YangWhen getWhen() {
- return when;
- }
-
- /**
- * Sets the when.
- *
- * @param when the when to set
- */
- @Override
- public void setWhen(YangWhen when) {
- this.when = when;
- }
-
- /**
- * Returns the description.
- *
- * @return the description
- */
- @Override
- public String getDescription() {
- return description;
- }
-
- /**
- * Set the description.
- *
- * @param description set the description
- */
- @Override
- public void setDescription(String description) {
- this.description = description;
- }
-
- @Override
- public void detectCollidingChild(String identifierName, YangConstructType dataType)
- throws DataModelException {
- // Detect colliding child.
- detectCollidingChildUtil(identifierName, dataType, this);
- }
-
- @Override
- public void detectSelfCollision(String identifierName, YangConstructType dataType)
- throws DataModelException {
- if (getName().equals(identifierName)) {
- throw new DataModelException("YANG file error: Duplicate input identifier detected, same as input \""
- + getName() + "\"");
- }
- }
-
- /**
- * Returns the list of leaves.
- *
- * @return the list of leaves
- */
- @Override
- public List<YangLeaf> getListOfLeaf() {
- return listOfLeaf;
- }
-
- /**
- * Sets the list of leaves.
- *
- * @param leafsList the list of leaf to set
- */
- @Override
- public void setListOfLeaf(List<YangLeaf> leafsList) {
- listOfLeaf = leafsList;
- }
-
- /**
- * Adds a leaf.
- *
- * @param leaf the leaf to be added
- */
- @Override
- public void addLeaf(YangLeaf leaf) {
- if (getListOfLeaf() == null) {
- setListOfLeaf(new LinkedList<>());
- }
-
- getListOfLeaf().add(leaf);
- }
-
- /**
- * Returns the list of leaf-list.
- *
- * @return the list of leaf-list
- */
- @Override
- public List<YangLeafList> getListOfLeafList() {
- return listOfLeafList;
- }
-
- /**
- * Sets the list of leaf-list.
- *
- * @param listOfLeafList the list of leaf-list to set
- */
- @Override
- public void setListOfLeafList(List<YangLeafList> listOfLeafList) {
- this.listOfLeafList = listOfLeafList;
- }
-
- /**
- * Adds a leaf-list.
- *
- * @param leafList the leaf-list to be added
- */
- @Override
- public void addLeafList(YangLeafList leafList) {
- if (getListOfLeafList() == null) {
- setListOfLeafList(new LinkedList<>());
- }
-
- getListOfLeafList().add(leafList);
- }
-
- /**
- * Returns the textual reference.
- *
- * @return the reference
- */
- @Override
- public String getReference() {
- return reference;
- }
-
- /**
- * Sets the textual reference.
- *
- * @param reference the reference to set
- */
- @Override
- public void setReference(String reference) {
- this.reference = reference;
- }
-
- /**
- * Returns the status.
- *
- * @return the status
- */
- @Override
- public YangStatusType getStatus() {
- return status;
- }
-
- /**
- * Sets the status.
- *
- * @param status the status to set
- */
- @Override
- public void setStatus(YangStatusType status) {
- this.status = status;
- }
-
- /**
- * Returns the type of the data as belongs-to.
- *
- * @return returns AUGMENT_DATA
- */
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.AUGMENT_DATA;
- }
-
- /**
- * Validates the data on entering the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnEntry()
- throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-
- /**
- * Validates the data on exiting the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnExit()
- throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-
- /**
- * Returns the target nodes name where the augmentation is being done.
- *
- * @return target nodes name where the augmentation is being done
- */
- @Override
- public String getName() {
- return name;
- }
-
- /**
- * Sets the target nodes name where the augmentation is being done.
- *
- * @param name target nodes name where the augmentation is being done
- */
- @Override
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Returns augmented node.
- *
- * @return augmented node
- */
- public YangNode getAugmentedNode() {
- return augmentedNode;
- }
-
- /**
- * Sets augmented node.
- *
- * @param augmentedNode augmented node
- */
- public void setAugmentedNode(YangNode augmentedNode) {
- this.augmentedNode = augmentedNode;
- }
-
- @Override
- public List<YangIfFeature> getIfFeatureList() {
- return ifFeatureList;
- }
-
- @Override
- public void setIfFeatureList(List<YangIfFeature> ifFeatureList) {
- this.ifFeatureList = ifFeatureList;
- }
-
- @Override
- public void addIfFeatureList(YangIfFeature ifFeature) {
- if (getIfFeatureList() == null) {
- setIfFeatureList(new LinkedList<>());
- }
- getIfFeatureList().add(ifFeature);
- }
-
- @Override
- public ResolvableStatus getResolvableStatus() {
- return resolvableStatus;
- }
-
- @Override
- public void setResolvableStatus(ResolvableStatus resolvableStatus) {
- this.resolvableStatus = resolvableStatus;
-
- }
-
- @Override
- public Object resolve() throws DataModelException {
- // Resolving of target node is being done in XPathLinker.
- return null;
- }
-
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAugmentableNode.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAugmentableNode.java
deleted file mode 100644
index f3952c6..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAugmentableNode.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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;
-
-import java.util.List;
-
-/**
- * Represents YANG constructs which can be augmented.
- */
-public interface YangAugmentableNode {
-
- /**
- * Adds augment info to the augment info list.
- *
- * @param augmentInfo augment info of node
- */
- void addAugmentation(YangAugmentedInfo augmentInfo);
-
- /**
- * Removes augment info from the node.
- *
- * @param augmentInfo augment info of node
- */
- void removeAugmentation(YangAugmentedInfo augmentInfo);
-
- /**
- * Returns list of augment info.
- *
- * @return list of augment info
- */
- List<YangAugmentedInfo> getAugmentedInfoList();
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAugmentedInfo.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAugmentedInfo.java
deleted file mode 100644
index b6e55e6..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAugmentedInfo.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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 an entity which represents YANG augmented info.
- */
-public interface YangAugmentedInfo {
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAugmentedOpParamInfo.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAugmentedOpParamInfo.java
deleted file mode 100644
index b9c1a3a..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAugmentedOpParamInfo.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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 an entity which represent operation parameter info for augmentable node.
- */
-public interface YangAugmentedOpParamInfo extends YangAugmentedInfo {
-
- /**
- * Returns class object of base class.
- *
- * @return class object of base class
- */
- Class<?> getBaseClass();
-
- /**
- * Returns if augmented info's contents matches.
- *
- * @param augmentedInfo augmented info
- * @return true or false
- */
- boolean isFilterContentMatch(Object augmentedInfo);
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangBase.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangBase.java
deleted file mode 100644
index 8d118d2..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangBase.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * 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;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.ResolvableStatus;
-
-import java.io.Serializable;
-
-/**
- * Reference RFC 6020.
- *
- * Represents data model node to maintain information defined in YANG base.
- * The "base" statement, which is optional, takes as an argument a
- * string that is the name of an existing identity, from which the new
- * identity is derived. If no "base" statement is present, the identity
- * is defined from scratch.
- *
- * If a prefix is present on the base name, it refers to an identity
- * defined in the module that was imported with that prefix, or the
- * local module if the prefix matches the local module's prefix.
- * Otherwise, an identity with the matching name MUST be defined in the
- * current module or an included submodule.
- */
-
-/**
- * Represents data model node to maintain information defined in YANG base.
- */
- public class YangBase implements Resolvable, Serializable {
-
- private static final long serialVersionUID = 806201693L;
-
- // YANG node identifier.
- private YangNodeIdentifier baseIdentifier;
-
- // Referred identity parent information.
- private YangIdentity referredIdentity;
-
- /**
- * Status of resolution. If completely resolved enum value is "RESOLVED",
- * if not enum value is "UNRESOLVED", in case reference of grouping/typedef/base/identityref
- * is added to uses/type/base/identityref but it's not resolved value of enum should be
- * "INTRA_FILE_RESOLVED".
- */
- private ResolvableStatus resolvableStatus;
-
- // Creates a base type of node.
- public YangBase() {
- resolvableStatus = ResolvableStatus.UNRESOLVED;
- }
-
- /**
- * Returns the YANG node identifier.
- *
- * @return the YANG node identifier
- */
- public YangNodeIdentifier getBaseIdentifier() {
- return baseIdentifier;
- }
-
- /**
- * Sets the YANG node identifier.
- *
- * @param baseIdentifier the YANG node identifier to set
- */
- public void setBaseIdentifier(YangNodeIdentifier baseIdentifier) {
- this.baseIdentifier = baseIdentifier;
- }
-
- /**
- * Returns the parent identity node.
- *
- * @return the parent identity node
- */
- public YangIdentity getReferredIdentity() {
- return referredIdentity;
- }
-
- /**
- * Sets the parent identity node.
- *
- * @param referredIdentity the parent identity node to set
- */
- public void setReferredIdentity(YangIdentity referredIdentity) {
- this.referredIdentity = referredIdentity;
- }
-
- @Override
- public ResolvableStatus getResolvableStatus() {
- return resolvableStatus;
- }
-
- @Override
- public void setResolvableStatus(ResolvableStatus resolvableStatus) {
- this.resolvableStatus = resolvableStatus;
- }
-
- @Override
- public Object resolve() throws DataModelException {
- return null;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangBelongsTo.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangBelongsTo.java
deleted file mode 100644
index 9cb8dde..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangBelongsTo.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * 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;
-
-import java.io.Serializable;
-import java.util.Set;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.findReferredNode;
-
-/*-
- * Reference 6020.
- *
- * The "belongs-to" statement specifies the module to which the
- * submodule belongs. The argument is an identifier that is the name of
- * the module.
- *
- * A submodule MUST only be included by the module to which it belongs,
- * or by another submodule that belongs to that module.
- *
- * The mandatory "prefix" sub-statement assigns a prefix for the module
- * to which the submodule belongs. All definitions in the local
- * submodule and any included submodules can be accessed by using the
- * prefix.
- *
- * The belongs-to's sub-statements
- *
- * +--------------+---------+-------------+
- * | substatement | section | cardinality |
- * +--------------+---------+-------------+
- * | prefix | 7.1.4 | 1 |
- * +--------------+---------+-------------+
- */
-
-/**
- * Represents the belongs-to data type information.
- */
-public class YangBelongsTo implements Parsable, LocationInfo, Serializable {
-
- private static final long serialVersionUID = 806201639L;
-
- /**
- * Reference RFC 6020.
- *
- * The "belongs-to" statement specifies the module to which the submodule
- * belongs. The argument is an identifier that is the name of the module.
- */
- private String belongsToModuleName;
-
- /**
- * Module node to which sub-module belongs to.
- */
- private YangNode moduleNode;
-
- /**
- * Reference RFC 6020.
- *
- * The mandatory "prefix" substatement assigns a prefix for the module to
- * which the submodule belongs. All definitions in the local submodule and
- * any included submodules can be accessed by using the prefix.
- */
- private String prefix;
-
- // Error Line number.
- private transient int lineNumber;
-
- // Error character position.
- private transient int charPosition;
-
- /**
- * Create a belongs to object.
- */
- public YangBelongsTo() {
-
- }
-
- /**
- * Returns the belongs to module name.
- *
- * @return the belongs to module name
- */
- public String getBelongsToModuleName() {
- return belongsToModuleName;
- }
-
- /**
- * Sets the belongs to module name.
- *
- * @param belongsToModuleName the belongs to module name to set
- */
- public void setBelongsToModuleName(String belongsToModuleName) {
- this.belongsToModuleName = belongsToModuleName;
- }
-
- /**
- * Returns the prefix.
- *
- * @return the prefix
- */
- public String getPrefix() {
- return prefix;
- }
-
- /**
- * Sets the prefix.
- *
- * @param prefix the prefix to set
- */
- public void setPrefix(String prefix) {
- this.prefix = prefix;
- }
-
- /**
- * Returns the module data model node.
- *
- * @return the module data model node
- */
- public YangNode getModuleNode() {
- return moduleNode;
- }
-
- /**
- * Sets the module node.
- *
- * @param moduleNode module data model node
- */
- public void setModuleNode(YangNode moduleNode) {
- this.moduleNode = moduleNode;
- }
-
- /**
- * Returns the type of the data as belongs-to.
- *
- * @return ParsedDataType returns BELONGS_TO_DATA
- */
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.BELONGS_TO_DATA;
- }
-
- /**
- * Validates the data on entering the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnEntry() throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-
- /**
- * Validates the data on exiting the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnExit() throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-
- @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) {
- charPosition = charPositionInLine;
- }
-
- /**
- * Links the belongs to with a module.
- *
- * @param yangNodeSet YANG file information set
- * @throws DataModelException a violation in data model rule
- */
- public void linkWithModule(Set<YangNode> yangNodeSet)
- throws DataModelException {
- String belongsToModuleName = getBelongsToModuleName();
- YangNode moduleNode = findReferredNode(yangNodeSet, belongsToModuleName);
- if (moduleNode != null) {
- if (moduleNode instanceof YangModule) {
- setModuleNode(moduleNode);
- return;
- }
- }
- DataModelException exception = new DataModelException("YANG file error : Module " + belongsToModuleName +
- "to which sub-module belongs to is not found.");
- exception.setLine(getLineNumber());
- exception.setCharPosition(getCharPosition());
- throw exception;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangBinary.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangBinary.java
deleted file mode 100644
index a43e9cd..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangBinary.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * 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;
-
-import java.io.Serializable;
-import java.util.Base64;
-
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangBuiltInDataTypeInfo;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-
-/*
- * Reference RFC 6020.
- *
- * The binary built-in type represents any binary data,
- * i.e., a sequence of octets.
- */
-public class YangBinary implements YangBuiltInDataTypeInfo<YangBinary>, Serializable, Comparable<YangBinary> {
-
- private static final long serialVersionUID = 2106201608L;
-
- // Binary data is a decoded value by base64 decoding scheme from data input (jason)
- private byte[] binaryData;
-
- /**
- * Creates a binary object corresponding to the base 64 encoding value.
- *
- * @param strValue base64 encoded value
- */
- public YangBinary(String strValue) {
- setBinaryData(Base64.getDecoder().decode(strValue));
- }
-
- /**
- * Retrieves decoded binary data.
- *
- * @return binary data
- */
- public byte[] getBinaryData() {
- return binaryData;
- }
-
- /**
- * Sets binary data.
- *
- * @param binaryData binary data
- */
- public void setBinaryData(byte[] binaryData) {
- this.binaryData = binaryData;
- }
-
- /**
- * Encodes binary data by base64 encoding scheme.
- *
- * @return encoded binary data
- */
- public String toString() {
- return Base64.getEncoder()
- .encodeToString(binaryData);
- }
-
- @Override
- public YangDataTypes getYangType() {
- return YangDataTypes.BINARY;
- }
-
- @Override
- public int compareTo(YangBinary o) {
- for (int i = 0, j = 0; i < this.binaryData.length && j < o.binaryData.length; i++, j++) {
- int a = (this.binaryData[i] & 0xff);
- int b = (o.binaryData[j] & 0xff);
- if (a != b) {
- return a - b;
- }
- }
- return this.binaryData.length - o.binaryData.length;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangBit.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangBit.java
deleted file mode 100644
index 5db6b54..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangBit.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * 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;
-
-import java.io.Serializable;
-import java.util.Objects;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-/*-
- * The "bit" statement, which is a sub-statement to the "type" statement,
- * MUST be present if the type is "bits". It is repeatedly used to
- * specify each assigned named bit of a bits type. It takes as an
- * argument a string that is the assigned name of the bit. It is
- * followed by a block of sub-statements that holds detailed bit
- * information.
- * All assigned names in a bits type MUST be unique.
- *
- * The bit's sub-statements
- *
- * +--------------+---------+-------------+------------------+
- * | substatement | section | cardinality |data model mapping|
- * +--------------+---------+-------------+------------------+
- * | description | 7.19.3 | 0..1 | - string |
- * | reference | 7.19.4 | 0..1 | - string |
- * | status | 7.19.2 | 0..1 | - YangStatus |
- * | position | 9.7.4.2 | 0..1 | - int |
- * +--------------+---------+-------------+------------------+
- */
-
-/**
- * Represents the bit data type information.
- */
-public class YangBit implements YangCommonInfo, Parsable, Serializable {
-
- private static final long serialVersionUID = 806201640L;
-
- /**
- * Name of the bit.
- */
- private String bitName;
-
- /**
- * Description of the bit field.
- */
- private String description;
-
- /**
- * Reference info of the bit field.
- */
- private String reference;
-
- /**
- * Status of the bit field.
- */
- private YangStatusType status;
-
- /**
- * Position of the bit whose name bit is described.
- */
- private int position;
-
- /**
- * Create a YANG bit type object.
- */
- public YangBit() {
-
- }
-
- /**
- * Returns bit name.
- *
- * @return the bit name
- */
- public String getBitName() {
- return bitName;
- }
-
- /**
- * Sets the bit name.
- *
- * @param bitName the bit name to set
- */
- public void setBitName(String bitName) {
- this.bitName = bitName;
- }
-
- /**
- * Returns description.
- *
- * @return the description
- */
- @Override
- public String getDescription() {
- return description;
- }
-
- /**
- * Sets the description.
- *
- * @param description set the description
- */
- @Override
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Returns textual reference.
- *
- * @return the reference
- */
- @Override
- public String getReference() {
- return reference;
- }
-
- /**
- * Sets the textual reference.
- *
- * @param reference the reference to set
- */
- @Override
- public void setReference(String reference) {
- this.reference = reference;
- }
-
- /**
- * Returns status.
- *
- * @return the status
- */
- @Override
- public YangStatusType getStatus() {
- return status;
- }
-
- /**
- * Sets the status.
- *
- * @param status the status to set
- */
- @Override
- public void setStatus(YangStatusType status) {
- this.status = status;
- }
-
- /**
- * Returns bit position.
- *
- * @return the position
- */
- public int getPosition() {
- return position;
- }
-
- /**
- * Sets the bit position.
- *
- * @param position the position to set
- */
- public void setPosition(int position) {
- this.position = position;
- }
-
- /**
- * Returns the type of the data.
- *
- * @return ParsedDataType returns BIT_DATA
- */
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.BIT_DATA;
- }
-
- @Override
- public boolean equals(Object obj) {
-
- if (this == obj) {
- return true;
- }
- if (obj instanceof YangBit) {
- final YangBit other = (YangBit) obj;
- return Objects.equals(bitName, other.bitName);
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(bitName);
- }
-
- /**
- * Validates the data on entering the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnEntry() throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-
- /**
- * Validates the data on exiting the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnExit() throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangBits.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangBits.java
deleted file mode 100644
index 3f9cd59..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangBits.java
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * 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;
-
-import java.io.Serializable;
-import java.util.BitSet;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.regex.Pattern;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-/*
- * Reference RFC 6020.
- *
- * The bits built-in type represents a bit set. That is, a bits value
- * is a set of flags identified by small integer position numbers
- * starting at 0. Each bit number has an assigned name.
- */
-
-/**
- * Represents the bits data type information.
- */
-public class YangBits implements Parsable, Serializable {
-
- private static final long serialVersionUID = 806201641L;
- private static final String SPACE = " ";
-
- // Bits name
- private String bitsName;
- // Bits data contains bit-positions will be used to send to ONOS application
- private BitSet bitDataSet;
- /**
- * Mapping bit name to YangBit. In data input (jason), only bit name will be received.
- * By using the bit name corresponding (yang) bit-position will be retrieved from bitNameMap map.
- */
- private Map<String, YangBit> bitNameMap;
- /**
- * Mapping bit position to YangBit. The bit-position received from ONOS application
- * will be converted into bit-name by using bitPositionMap map to send (jason) output data as response.
- */
- private Map<Integer, YangBit> bitPositionMap;
-
- /**
- * Creates a YANG bits type object.
- */
- public YangBits() {
- bitDataSet = new BitSet();
- setBitNameMap(new HashMap<>());
- setBitPositionMap(new HashMap<>());
- }
-
- /**
- * Returns the bits name.
- *
- * @return the bits name
- */
- public String getBitsName() {
- return bitsName;
- }
-
- /**
- * Sets the bits name.
- *
- * @param bitsName the bits name
- */
- public void setBitsName(String bitsName) {
- this.bitsName = bitsName;
- }
-
- /**
- * Returns the bit data set.
- *
- * @return the bit data set
- */
- public BitSet getBitDataSet() {
- return bitDataSet;
- }
-
- /**
- * Sets the bit data set.
- *
- * @param bitNames the set of bit names
- * @throws DataModelException due to violation in data model rules
- */
- public void setBitDataSet(String[] bitNames) throws DataModelException {
- YangBit bit;
- for (String bitName : bitNames) {
- bit = bitNameMap.get(bitName);
- if (bit == null) {
- throw new DataModelException("YANG file error: Unable to find " +
- "corresponding bit position for bit name: " + bitName);
- }
- bitDataSet.set(bit.getPosition());
- }
- }
-
- /**
- * Returns the bit name map.
- *
- * @return the bit name map
- */
- public Map<String, YangBit> getBitNameMap() {
- return bitNameMap;
- }
-
- /**
- * Sets the bit name map.
- *
- * @param bitNameMap the bit name map
- */
- public void setBitNameMap(Map<String, YangBit> bitNameMap) {
- this.bitNameMap = bitNameMap;
- }
-
- /**
- * Checks whether bit name already available.
- *
- * @param bitName bit name
- * @return true if bit name already available otherwise returns false
- */
- public boolean isBitNameExists(String bitName) {
- return bitNameMap.containsKey(bitName);
- }
-
- /**
- * Returns the bit position map.
- *
- * @return the bit position map
- */
- public Map<Integer, YangBit> getBitPositionMap() {
- return bitPositionMap;
- }
-
- /**
- * Sets the bit position map.
- *
- * @param bitPositionMap the bit position map
- */
- public void setBitPositionMap(Map<Integer, YangBit> bitPositionMap) {
- this.bitPositionMap = bitPositionMap;
- }
-
- /**
- * Checks whether bit position already available.
- *
- * @param bitPosition bit position
- * @return true if bit position already available otherwise returns false
- */
- public boolean isBitPositionExists(Integer bitPosition) {
- return bitPositionMap.containsKey(bitPosition);
- }
-
- /**
- * Adds bit info.
- *
- * @param bitInfo the bit information to be added
- * @throws DataModelException due to violation in data model rules
- */
- public void addBitInfo(YangBit bitInfo) throws DataModelException {
- if (bitNameMap.put(bitInfo.getBitName(), bitInfo) != null) {
- throw new DataModelException("YANG file error: Duplicate bit name detected, same as bit name \""
- + bitInfo.getBitName() + "\"");
- }
- if (bitPositionMap.put(bitInfo.getPosition(), bitInfo) != null) {
- throw new DataModelException("YANG file error: Duplicate bit position detected, same as bit position \""
- + bitInfo.getPosition() + "\"");
- }
- }
-
- /**
- * Returns the type of the data.
- *
- * @return ParsedDataType returns BITS_DATA
- */
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.BITS_DATA;
- }
-
- @Override
- public String toString() {
- YangBit bit;
- String bits = new String();
- for (int i = bitDataSet.nextSetBit(0); i >= 0; i = bitDataSet.nextSetBit(i + 1)) {
- bit = bitPositionMap.get(i);
- if (bit == null) {
- return null;
- }
- if (bits.isEmpty()) {
- bits = bit.getBitName();
- } else {
- bits += " " + bit.getBitName();
- }
- }
- return bits.trim();
- }
-
- /**
- * Returns the object of YANG bits based on specific set of bit names.
- *
- * @param bits set of bit names
- * @return Object of YANG bits
- */
- public YangBits fromString(String bits) {
- try {
- String[] bitNames = bits.trim().split(Pattern.quote(SPACE));
- setBitDataSet(bitNames);
- return this;
- } catch (Exception e) {
- }
- return null;
- }
-
- /**
- * Validates the data on entering the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnEntry() throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-
- /**
- * Validates the data on exiting the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnExit() throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java
deleted file mode 100644
index e1e037a..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java
+++ /dev/null
@@ -1,415 +0,0 @@
-/*
- * 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;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.CASE_DATA;
-
-/*-
- * Reference RFC 6020.
- *
- * The "case" statement is used to define branches of the choice. It takes as an
- * argument an identifier, followed by a block of sub-statements that holds
- * detailed case information.
- *
- * The identifier is used to identify the case node in the schema tree. A case
- * node does not exist in the data tree.
- *
- * Within a "case" statement, the "anyxml", "choice", "container", "leaf",
- * "list", "leaf-list", and "uses" statements can be used to define child nodes
- * to the case node. The identifiers of all these child nodes MUST be unique
- * within all cases in a choice. For example, the following is illegal:
- *
- * choice interface-type { // This example is illegal YANG
- * case a {
- * leaf ethernet { ... }
- * }
- * case b {
- * container ethernet { ...}
- * }
- * }
- *
- * As a shorthand, the "case" statement can be omitted if the branch
- * contains a single "anyxml", "container", "leaf", "list", or
- * "leaf-list" statement. In this case, the identifier of the case node
- * is the same as the identifier in the branch statement. The following
- * example:
- *
- * choice interface-type {
- * container ethernet { ... }
- * }
- *
- * is equivalent to:
- *
- * choice interface-type {
- * case ethernet {
- * container ethernet { ... }
- * }
- * }
- *
- * The case identifier MUST be unique within a choice.
- *
- * The case's sub-statements
- *
- * +--------------+---------+-------------+------------------+
- * | substatement | section | cardinality |data model mapping|
- * +--------------+---------+-------------+------------------+
- * | anyxml | 7.10 | 0..n |-not supported |
- * | choice | 7.9 | 0..n |-child nodes |
- * | container | 7.5 | 0..n |-child nodes |
- * | description | 7.19.3 | 0..1 |-string |
- * | if-feature | 7.18.2 | 0..n |-YangIfFeature |
- * | leaf | 7.6 | 0..n |-YangLeaf |
- * | leaf-list | 7.7 | 0..n |-YangLeafList |
- * | list | 7.8 | 0..n |-child nodes |
- * | reference | 7.19.4 | 0..1 |-string |
- * | status | 7.19.2 | 0..1 |-YangStatus |
- * | uses | 7.12 | 0..n |-child node |
- * | when | 7.19.5 | 0..1 |-YangWhen |
- * +--------------+---------+-------------+------------------+
- */
-
-/**
- * Represents data model node to maintain information defined in YANG case.
- */
-public class YangCase
- extends YangNode
- implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector, YangAugmentableNode,
- YangWhenHolder, YangIfFeatureHolder, YangIsFilterContentNodes {
-
- private static final long serialVersionUID = 806201603L;
-
- /**
- * Case name.
- */
- private String name;
-
- // TODO: default field identification for the case
-
- /**
- * Description of case.
- */
- private String description;
-
- /**
- * List of leaves.
- */
- private List<YangLeaf> listOfLeaf;
-
- /**
- * List of leaf lists.
- */
- private List<YangLeafList> listOfLeafList;
-
- /**
- * Reference of the module.
- */
- private String reference;
-
- /**
- * Status of the node.
- */
- private YangStatusType status;
-
- /**
- * When data of the node.
- */
- private YangWhen when;
-
- /**
- * List of if-feature.
- */
- private List<YangIfFeature> ifFeatureList;
-
- private List<YangAugmentedInfo> yangAugmentedInfo = new ArrayList<>();
-
- /**
- * Creates a choice node.
- */
- public YangCase() {
- super(YangNodeType.CASE_NODE);
- listOfLeaf = new LinkedList<>();
- listOfLeafList = new LinkedList<>();
- }
-
- /**
- * Returns the when.
- *
- * @return the when
- */
- @Override
- public YangWhen getWhen() {
- return when;
- }
-
- /**
- * Sets the when.
- *
- * @param when the when to set
- */
- @Override
- public void setWhen(YangWhen when) {
- this.when = when;
- }
-
- /**
- * Returns the case name.
- *
- * @return case name
- */
- @Override
- public String getName() {
- return name;
- }
-
- /**
- * Sets the case name.
- *
- * @param name case name
- */
- @Override
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Returns the description.
- *
- * @return the description
- */
- @Override
- public String getDescription() {
- return description;
- }
-
- /**
- * Sets the description.
- *
- * @param description set the description
- */
- @Override
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Returns the list of leaves.
- *
- * @return the list of leaves
- */
- @Override
- public List<YangLeaf> getListOfLeaf() {
- return listOfLeaf;
- }
-
- /**
- * Sets the list of leaves.
- *
- * @param leafsList the list of leaf to set
- */
- @Override
- public void setListOfLeaf(List<YangLeaf> leafsList) {
- listOfLeaf = leafsList;
- }
-
- /**
- * Adds a leaf.
- *
- * @param leaf the leaf to be added
- */
- @Override
- public void addLeaf(YangLeaf leaf) {
- if (getListOfLeaf() == null) {
- setListOfLeaf(new LinkedList<>());
- }
-
- getListOfLeaf().add(leaf);
- }
-
- /**
- * Returns the list of leaf-list.
- *
- * @return the list of leaf-list
- */
- @Override
- public List<YangLeafList> getListOfLeafList() {
- return listOfLeafList;
- }
-
- /**
- * Sets the list of leaf-list.
- *
- * @param listOfLeafList the list of leaf-list to set
- */
- @Override
- public void setListOfLeafList(List<YangLeafList> listOfLeafList) {
- this.listOfLeafList = listOfLeafList;
- }
-
- /**
- * Adds a leaf-list.
- *
- * @param leafList the leaf-list to be added
- */
- @Override
- public void addLeafList(YangLeafList leafList) {
- if (getListOfLeafList() == null) {
- setListOfLeafList(new LinkedList<YangLeafList>());
- }
-
- getListOfLeafList().add(leafList);
- }
-
- /**
- * Returns the textual reference.
- *
- * @return the reference
- */
- @Override
- public String getReference() {
- return reference;
- }
-
- /**
- * Sets the textual reference.
- *
- * @param reference the reference to set
- */
- @Override
- public void setReference(String reference) {
- this.reference = reference;
- }
-
- /**
- * Returns the status.
- *
- * @return the status
- */
- @Override
- public YangStatusType getStatus() {
- return status;
- }
-
- /**
- * Sets the status.
- *
- * @param status the status to set
- */
- @Override
- public void setStatus(YangStatusType status) {
- this.status = status;
- }
-
- /**
- * Returns the type of the data.
- *
- * @return returns CASE_DATA
- */
- @Override
- public YangConstructType getYangConstructType() {
- return CASE_DATA;
- }
-
- /**
- * Validates the data on entering the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnEntry()
- throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-
- /**
- * Validates the data on exiting the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnExit()
- throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-
- @Override
- public void detectCollidingChild(String identifierName, YangConstructType dataType)
- throws DataModelException {
- if (!(getParent() instanceof YangChoice || getParent() instanceof YangAugment)) {
- throw new DataModelException("Internal Data Model Tree Error: Invalid/Missing holder in case " +
- getName());
- }
- // Traverse up in tree to ask parent choice start collision detection.
- ((CollisionDetector) getParent()).detectCollidingChild(identifierName, dataType);
- }
-
- @Override
- public void detectSelfCollision(String identifierName, YangConstructType dataType)
- throws DataModelException {
-
- if (dataType == CASE_DATA) {
- if (getName().equals(identifierName)) {
- throw new DataModelException("YANG File Error: Identifier collision detected in case \"" +
- getName() + "\"");
- }
- return;
- }
-
- // Asks helper to detect colliding child.
- detectCollidingChildUtil(identifierName, dataType, this);
- }
-
- @Override
- public List<YangIfFeature> getIfFeatureList() {
- return ifFeatureList;
- }
-
- @Override
- public void addIfFeatureList(YangIfFeature ifFeature) {
- if (getIfFeatureList() == null) {
- setIfFeatureList(new LinkedList<>());
- }
- getIfFeatureList().add(ifFeature);
- }
-
- @Override
- public void setIfFeatureList(List<YangIfFeature> ifFeatureList) {
- this.ifFeatureList = ifFeatureList;
- }
-
- @Override
- public void addAugmentation(YangAugmentedInfo augmentInfo) {
- yangAugmentedInfo.add(augmentInfo);
- }
-
- @Override
- public void removeAugmentation(YangAugmentedInfo augmentInfo) {
- yangAugmentedInfo.remove(augmentInfo);
- }
-
- @Override
- public List<YangAugmentedInfo> getAugmentedInfoList() {
- return yangAugmentedInfo;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangChoice.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangChoice.java
deleted file mode 100644
index 48b763b..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangChoice.java
+++ /dev/null
@@ -1,456 +0,0 @@
-/*
- * 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;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.CHOICE_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangErrMsgConstants.DATA_MISSING_ERROR_TAG;
-import static org.onosproject.yangutils.datamodel.utils.YangErrMsgConstants.ERROR_PATH_MISSING_CHOICE;
-import static org.onosproject.yangutils.datamodel.utils.YangErrMsgConstants.MISSING_CHOICE_ERROR_APP_TAG;
-
-/*-
- * Reference RFC 6020.
- *
- * The "choice" statement defines a set of alternatives, only one of
- * which may exist at any one time. The argument is an identifier,
- * followed by a block of sub-statements that holds detailed choice
- * information. The identifier is used to identify the choice node in
- * the schema tree. A choice node does not exist in the data tree.
- *
- * A choice consists of a number of branches, defined with the "case"
- * sub-statement. Each branch contains a number of child nodes. The
- * nodes from at most one of the choice's branches exist at the same
- * time.
- *
- * The choice's sub-statements
- *
- * +--------------+---------+-------------+------------------+
- * | substatement | section | cardinality |data model mapping|
- * +--------------+---------+-------------+------------------+
- * | anyxml | 7.10 | 0..n |-not supported |
- * | case | 7.9.2 | 0..n |-YangChoice |
- * | config | 7.19.1 | 0..1 |-boolean |
- * | container | 7.5 | 0..n |-child case nodes |
- * | default | 7.9.3 | 0..1 |-string |
- * | description | 7.19.3 | 0..1 |-string |
- * | if-feature | 7.18.2 | 0..n |-YangIfFeature |
- * | leaf | 7.6 | 0..n |-child case nodes |
- * | leaf-list | 7.7 | 0..n |-child case nodes |
- * | list | 7.8 | 0..n |-child case nodes |
- * | mandatory | 7.9.4 | 0..1 |-string |
- * | reference | 7.19.4 | 0..1 |-string |
- * | status | 7.19.2 | 0..1 |-string |
- * | when | 7.19.5 | 0..1 |-YangWhen |
- * +--------------+---------+-------------+------------------+
- */
-
-/**
- * Represents data model node to maintain information defined in YANG choice.
- */
-public class YangChoice extends YangNode
- implements YangCommonInfo, Parsable, CollisionDetector, YangAugmentableNode,
- YangWhenHolder, YangIfFeatureHolder, YangAppErrorHolder {
-
- private static final long serialVersionUID = 806201604L;
-
- /**
- * Name of choice.
- */
- private String name;
-
- /**
- * If the choice represents config data.
- */
- private boolean isConfig;
-
- /**
- * Description of choice.
- */
- private String description;
-
- /**
- * Reference RFC 6020.
- *
- * The "mandatory" statement, which is optional, takes as an argument the
- * string "true" or "false", and puts a constraint on valid data. If
- * "mandatory" is "true", at least one node from exactly one of the choice's
- * case branches MUST exist.
- *
- * If not specified, the default is "false".
- *
- * The behavior of the constraint depends on the type of the choice's
- * closest ancestor node in the schema tree which is not a non-presence
- * container:
- *
- * o If this ancestor is a case node, the constraint is enforced if any
- * other node from the case exists.
- *
- * o Otherwise, it is enforced if the ancestor node exists.
- */
- private String mandatory;
-
- /**
- * Reference of the choice.
- */
- private String reference;
-
- /**
- * Status of the node.
- */
- private YangStatusType status;
-
- /**
- * Reference RFC 6020.
- * <p>
- * The "default" statement indicates if a case should be considered as the
- * default if no child nodes from any of the choice's cases exist. The
- * argument is the identifier of the "case" statement. If the "default"
- * statement is missing, there is no default case.
- * <p>
- * The "default" statement MUST NOT be present on choices where "mandatory"
- * is true.
- * <p>
- * The default case is only important when considering the default values of
- * nodes under the cases. The default values for nodes under the default
- * case are used if none of the nodes under any of the cases are present.
- * <p>
- * There MUST NOT be any mandatory nodes directly under the default case.
- * <p>
- * Default values for child nodes under a case are only used if one of the
- * nodes under that case is present, or if that case is the default case. If
- * none of the nodes under a case are present and the case is not the
- * default case, the default values of the cases' child nodes are ignored.
- * <p>
- * the default case to be used if no case members is present.
- */
- private String defaultValueInString;
-
- /**
- * When data of the node.
- */
- private YangWhen when;
-
- /**
- * List of if-feature.
- */
- private List<YangIfFeature> ifFeatureList;
-
- private List<YangAugmentedInfo> yangAugmentedInfo = new ArrayList<>();
-
- /**
- * YANG application error information.
- */
- private YangAppErrorInfo yangAppErrorInfo;
-
- /**
- * Create a choice node.
- */
- public YangChoice() {
- super(YangNodeType.CHOICE_NODE);
- yangAppErrorInfo = new YangAppErrorInfo();
- yangAppErrorInfo.setErrorTag(DATA_MISSING_ERROR_TAG);
- yangAppErrorInfo.setErrorAppTag(MISSING_CHOICE_ERROR_APP_TAG);
- yangAppErrorInfo.setErrorAppPath(ERROR_PATH_MISSING_CHOICE);
- }
-
- /**
- * Returns the when.
- *
- * @return the when
- */
- @Override
- public YangWhen getWhen() {
- return when;
- }
-
- /**
- * Sets the when.
- *
- * @param when the when to set
- */
- @Override
- public void setWhen(YangWhen when) {
- this.when = when;
- }
-
- /**
- * Returns the choice name.
- *
- * @return choice name
- */
- @Override
- public String getName() {
- return name;
- }
-
- /**
- * Sets the choice name.
- *
- * @param name choice name
- */
- @Override
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Returns config flag.
- *
- * @return the config flag
- */
- public boolean isConfig() {
- return isConfig;
- }
-
- /**
- * Sets config flag.
- *
- * @param isCfg the config flag
- */
- public void setConfig(boolean isCfg) {
- isConfig = isCfg;
- }
-
- /**
- * Returns the mandatory status.
- *
- * @return the mandatory status
- */
- public String getMandatory() {
- return mandatory;
- }
-
- /**
- * Sets the mandatory status.
- *
- * @param mandatory the mandatory status
- */
- public void setMandatory(String mandatory) {
- this.mandatory = mandatory;
- }
-
- /**
- * Returns the description.
- *
- * @return the description
- */
- @Override
- public String getDescription() {
- return description;
- }
-
- /**
- * Sets the description.
- *
- * @param description set the description
- */
- @Override
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Returns the textual reference.
- *
- * @return the reference
- */
- @Override
- public String getReference() {
- return reference;
- }
-
- /**
- * Sets the textual reference.
- *
- * @param reference the reference to set
- */
- @Override
- public void setReference(String reference) {
- this.reference = reference;
- }
-
- /**
- * Returns the status.
- *
- * @return the status
- */
- @Override
- public YangStatusType getStatus() {
- return status;
- }
-
- /**
- * Sets the status.
- *
- * @param status the status to set
- */
- @Override
- public void setStatus(YangStatusType status) {
- this.status = status;
- }
-
- /**
- * Returns the default value.
- *
- * @return the default value
- */
- public String getDefaultValueInString() {
- return defaultValueInString;
- }
-
- /**
- * Sets the default value.
- *
- * @param defaultValueInString the default value
- */
- public void setDefaultValueInString(String defaultValueInString) {
- this.defaultValueInString = defaultValueInString;
- }
-
- /**
- * Returns the type of the data.
- *
- * @return choice data
- */
- @Override
- public YangConstructType getYangConstructType() {
- return CHOICE_DATA;
- }
-
- /**
- * Validates the data on entering the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnEntry() throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-
- /**
- * Validates the data on exiting the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnExit() throws DataModelException {
- if (defaultValueInString != null && !defaultValueInString.isEmpty()) {
- YangNode node = getChild();
- boolean matched = false;
- // Check whether default string matches the case
- while (node != null) {
- if (node instanceof YangCase) {
- if (defaultValueInString.equals(((YangCase) node).getName())) {
- matched = true;
- break;
- }
- }
- node = node.getNextSibling();
- }
-
- if (!matched) {
- throw new DataModelException("YANG file error: default string \"" + defaultValueInString
- + "\" not matching choice \"" + getName() + "\" case.");
- }
- }
- }
-
- @Override
- public void detectCollidingChild(String identifierName, YangConstructType dataType) throws DataModelException {
-
- if (getParent() instanceof YangCase && dataType != YangConstructType.CASE_DATA) {
- ((CollisionDetector) getParent()).detectCollidingChild(identifierName, dataType);
- }
- YangNode node = getChild();
- while (node != null) {
- if (node instanceof CollisionDetector) {
- ((CollisionDetector) node).detectSelfCollision(identifierName, dataType);
- }
- node = node.getNextSibling();
- }
- }
-
- @Override
- public void detectSelfCollision(String identifierName, YangConstructType dataType) throws DataModelException {
-
- if (dataType == CHOICE_DATA) {
- if (getName().equals(identifierName)) {
- throw new DataModelException("YANG file error: Identifier collision detected in choice \"" +
- getName() + "\"");
- }
- return;
- }
-
- YangNode node = getChild();
- while (node != null) {
- if (node instanceof CollisionDetector) {
- ((CollisionDetector) node).detectSelfCollision(identifierName, dataType);
- }
- node = node.getNextSibling();
- }
- }
-
- @Override
- public List<YangIfFeature> getIfFeatureList() {
- return ifFeatureList;
- }
-
- @Override
- public void addIfFeatureList(YangIfFeature ifFeature) {
- if (getIfFeatureList() == null) {
- setIfFeatureList(new LinkedList<>());
- }
- getIfFeatureList().add(ifFeature);
- }
-
- @Override
- public void setIfFeatureList(List<YangIfFeature> ifFeatureList) {
- this.ifFeatureList = ifFeatureList;
- }
-
- @Override
- public void addAugmentation(YangAugmentedInfo augmentInfo) {
- yangAugmentedInfo.add(augmentInfo);
- }
-
- @Override
- public void removeAugmentation(YangAugmentedInfo augmentInfo) {
- yangAugmentedInfo.remove(augmentInfo);
- }
-
- @Override
- public List<YangAugmentedInfo> getAugmentedInfoList() {
- return yangAugmentedInfo;
- }
-
- @Override
- public void setAppErrorInfo(YangAppErrorInfo yangAppErrorInfo) {
- this.yangAppErrorInfo = yangAppErrorInfo;
- }
-
- @Override
- public YangAppErrorInfo getAppErrorInfo() {
- return yangAppErrorInfo;
- }
-
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangCommonInfo.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangCommonInfo.java
deleted file mode 100644
index 89b7dc0..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangCommonInfo.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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 YANG entity's common meta data. Abstracted to unify the
- * parsing and translator processing.
- */
-public interface YangCommonInfo extends YangDesc, YangReference, YangStatus {
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangCompilerAnnotation.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangCompilerAnnotation.java
deleted file mode 100644
index 4d0c2ce..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangCompilerAnnotation.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * 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;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-/**
- * Represents data model node to maintain information defined in YANG compiler-annotation.
- */
-public class YangCompilerAnnotation implements Parsable {
-
- /**
- * App data structure information.
- */
- private YangAppDataStructure yangAppDataStructure;
-
- /**
- * App extended name information.
- */
- private YangAppExtendedName yangAppExtendedName;
-
- /**
- * Prefix of compiler-annotation.
- */
- private String prefix;
-
- /**
- * Path of compiler-annotation.
- */
- private String path;
-
- /**
- * Returns the YANG app data structure information.
- *
- * @return the YANG app data structure information
- */
- public YangAppDataStructure getYangAppDataStructure() {
- return yangAppDataStructure;
- }
-
- /**
- * Sets the YANG app data structure information.
- *
- * @param yangAppDataStructure the YANG app data structure to set
- */
- public void setYangAppDataStructure(YangAppDataStructure yangAppDataStructure) {
- this.yangAppDataStructure = yangAppDataStructure;
- }
-
- /**
- * Returns the prefix.
- *
- * @return the prefix
- */
- public String getPrefix() {
- return prefix;
- }
-
- /**
- * Sets the prefix information.
- *
- * @param prefix the prefix to set
- */
- public void setPrefix(String prefix) {
- this.prefix = prefix;
- }
-
- /**
- * Returns the path.
- *
- * @return the path
- */
- public String getPath() {
- return path;
- }
-
- /**
- * Sets the path.
- *
- * @param path the path to set
- */
- public void setPath(String path) {
- this.path = path;
- }
-
- /**
- * Returns the YANG app extended name information.
- *
- * @return the YANG app extended name information
- */
- public YangAppExtendedName getYangAppExtendedName() {
- return yangAppExtendedName;
- }
-
- /**
- * Sets the YANG app extended name information.
- *
- * @param yangAppExtendedName the YANG app extended name to set
- */
- public void setYangAppExtendedName(YangAppExtendedName yangAppExtendedName) {
- this.yangAppExtendedName = yangAppExtendedName;
- }
-
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.COMPILER_ANNOTATION_DATA;
- }
-
- @Override
- public void validateDataOnEntry() throws DataModelException {
- // TODO : to be implemented
- }
-
- @Override
- public void validateDataOnExit() throws DataModelException {
- // TODO : to be implemented
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangContainer.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangContainer.java
deleted file mode 100644
index ddace18..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangContainer.java
+++ /dev/null
@@ -1,540 +0,0 @@
-/*
- * 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;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
-
-/*-
- * Reference RFC 6020.
- *
- * The "container" statement is used to define an interior data node in the
- * schema tree. It takes one argument, which is an identifier, followed by a
- * block of sub-statements that holds detailed container information.
- *
- * A container node does not have a value, but it has a list of child nodes in
- * the data tree. The child nodes are defined in the container's sub-statements.
- *
- * Containers with Presence
- *
- * YANG supports two styles of containers, those that exist only for organizing
- * the hierarchy of data nodes, and those whose presence in the configuration
- * has an explicit meaning.
- *
- * In the first style, the container has no meaning of its own, existing only to
- * contain child nodes. This is the default style.
- *
- * For example, the set of scrambling options for Synchronous Optical Network
- * (SONET) interfaces may be placed inside a "scrambling" container to enhance
- * the organization of the configuration hierarchy, and to keep these nodes
- * together. The "scrambling" node itself has no meaning, so removing the node
- * when it becomes empty relieves the user from performing this task.
- *
- * In the second style, the presence of the container itself is configuration
- * data, representing a single bit of configuration data. The container acts as
- * both a configuration knob and a means of organizing related configuration.
- * These containers are explicitly created and deleted.
- *
- * YANG calls this style a "presence container" and it is indicated using the
- * "presence" statement, which takes as its argument a text string indicating
- * what the presence of the node means.
- *
- * The container's Substatements
- *
- * +--------------+---------+-------------+------------------+
- * | substatement | section | cardinality |data model mapping|
- * +--------------+---------+-------------+------------------+
- * | anyxml | 7.10 | 0..n | -not supported |
- * | choice | 7.9 | 0..n | -child nodes |
- * | config | 7.19.1 | 0..1 | -boolean |
- * | container | 7.5 | 0..n | -child nodes |
- * | description | 7.19.3 | 0..1 | -string |
- * | grouping | 7.11 | 0..n | -child nodes |
- * | if-feature | 7.18.2 | 0..n | -YangIfFeature |
- * | leaf | 7.6 | 0..n | -YangLeaf |
- * | leaf-list | 7.7 | 0..n | -YangLeafList |
- * | list | 7.8 | 0..n | -child nodes |
- * | must | 7.5.3 | 0..n | -YangMust |
- * | presence | 7.5.5 | 0..1 | -boolean |
- * | reference | 7.19.4 | 0..1 | -string |
- * | status | 7.19.2 | 0..1 | -YangStatus |
- * | typedef | 7.3 | 0..n | -child nodes |
- * | uses | 7.12 | 0..n | -child nodes |
- * | when | 7.19.5 | 0..1 | -YangWhen |
- * +--------------+---------+-------------+------------------+
- */
-
-/**
- * Represents data model node to maintain information defined in YANG container.
- */
-public class YangContainer
- extends YangNode
- implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector,
- YangAugmentableNode, YangMustHolder, YangWhenHolder, YangIfFeatureHolder, YangIsFilterContentNodes {
-
- private static final long serialVersionUID = 806201605L;
-
- /**
- * Name of the container.
- */
- private String name;
-
- /**
- * If container maintains config data.
- */
- private Boolean isConfig;
-
- /**
- * Description of container.
- */
- private String description;
-
- /**
- * List of leaves contained.
- */
- private List<YangLeaf> listOfLeaf;
-
- /**
- * List of leaf-lists contained.
- */
- private List<YangLeafList> listOfLeafList;
-
- /**
- * If it is a presence container, then the textual documentation of presence
- * usage.
- */
- private String presence;
-
- /**
- * Reference of the module.
- */
- private String reference;
-
- private List<YangAugmentedInfo> yangAugmentedInfo = new ArrayList<>();
-
- /**
- * Status of the node.
- */
- private YangStatusType status = YangStatusType.CURRENT;
-
- /**
- * List of must statement constraints.
- */
- private List<YangMust> mustConstraintList;
-
- /**
- * When data of the node.
- */
- private YangWhen when;
-
- /**
- * List of if-feature.
- */
- private List<YangIfFeature> ifFeatureList;
-
- /**
- * Create a container node.
- */
- public YangContainer() {
- super(YangNodeType.CONTAINER_NODE);
- listOfLeaf = new LinkedList<>();
- listOfLeafList = new LinkedList<>();
- }
-
- /**
- * Returns the when.
- *
- * @return the when
- */
- @Override
- public YangWhen getWhen() {
- return when;
- }
-
- /**
- * Sets the when.
- *
- * @param when the when to set
- */
- @Override
- public void setWhen(YangWhen when) {
- this.when = when;
- }
-
- /**
- * Returns the YANG name of container.
- *
- * @return the name of container as defined in YANG file
- */
- @Override
- public String getName() {
- return name;
- }
-
- /**
- * Sets the YANG name of container.
- *
- * @param name the name of container as defined in YANG file
- */
- @Override
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Returns the config flag.
- *
- * @return the isConfig
- */
- public Boolean isConfig() {
- return isConfig;
- }
-
- /**
- * Sets the config flag.
- *
- * @param isCfg the config flag
- */
- public void setConfig(boolean isCfg) {
- isConfig = isCfg;
- }
-
- /**
- * Returns the description.
- *
- * @return the description
- */
- @Override
- public String getDescription() {
- return description;
- }
-
- /**
- * Sets the description.
- *
- * @param description set the description
- */
- @Override
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Returns the list of leaves.
- *
- * @return the list of leaves
- */
- @Override
- public List<YangLeaf> getListOfLeaf() {
- return listOfLeaf;
- }
-
- /**
- * Sets the list of leaves.
- *
- * @param leafsList the list of leaf to set
- */
- @Override
- public void setListOfLeaf(List<YangLeaf> leafsList) {
- listOfLeaf = leafsList;
- }
-
- /**
- * Adds a leaf.
- *
- * @param leaf the leaf to be added
- */
- @Override
- public void addLeaf(YangLeaf leaf) {
-
- if (getListOfLeaf() == null) {
- setListOfLeaf(new LinkedList<YangLeaf>());
- }
-
- getListOfLeaf().add(leaf);
- }
-
- /**
- * Returns the list of leaf-list.
- *
- * @return the list of leaf-list
- */
- @Override
- public List<YangLeafList> getListOfLeafList() {
- return listOfLeafList;
- }
-
- /**
- * Sets the list of leaf-list.
- *
- * @param listOfLeafList the list of leaf-list to set
- */
- @Override
- public void setListOfLeafList(List<YangLeafList> listOfLeafList) {
- this.listOfLeafList = listOfLeafList;
- }
-
- /**
- * Adds a leaf-list.
- *
- * @param leafList the leaf-list to be added
- */
- @Override
- public void addLeafList(YangLeafList leafList) {
-
- if (getListOfLeafList() == null) {
- setListOfLeafList(new LinkedList<YangLeafList>());
- }
-
- getListOfLeafList().add(leafList);
- }
-
- /**
- * Returns the presence string if present.
- *
- * @return the presence
- */
- public String getPresence() {
- return presence;
- }
-
- /**
- * Sets the presence string.
- *
- * @param presence the presence flag
- */
- public void setPresence(String presence) {
- this.presence = presence;
- }
-
- /**
- * Returns the textual reference.
- *
- * @return the reference
- */
- @Override
- public String getReference() {
- return reference;
- }
-
- /**
- * Sets the textual reference.
- *
- * @param reference the reference to set
- */
- @Override
- public void setReference(String reference) {
- this.reference = reference;
- }
-
- /**
- * Returns the status.
- *
- * @return the status
- */
- @Override
- public YangStatusType getStatus() {
- return status;
- }
-
- /**
- * Sets the status.
- *
- * @param status the status to set
- */
- @Override
- public void setStatus(YangStatusType status) {
- this.status = status;
- }
-
- /**
- * Returns the type of the data.
- *
- * @return returns CONTAINER_DATA
- */
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.CONTAINER_DATA;
- }
-
- /**
- * Validates the data on entering the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnEntry()
- throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-
- /**
- * Validates the data on exiting the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnExit()
- throws DataModelException {
- List<YangLeaf> leaves = getListOfLeaf();
- List<YangLeafList> leafLists = getListOfLeafList();
-
- setDefaultConfigValueToChild(leaves, leafLists);
- validateConfig(leaves, leafLists);
- }
-
- /**
- * Sets the config's value to all leaf if leaf's config statement is not
- * specified.
- *
- * @param leaves list of leaf attributes of container
- * @param leafLists list of leaf-list attributes of container
- */
- private void setDefaultConfigValueToChild(List<YangLeaf> leaves, List<YangLeafList> leafLists) {
-
- /*
- * If "config" is not specified, the default is the same as the parent
- * schema node's "config" value.
- */
- if (leaves != null) {
- for (YangLeaf leaf : leaves) {
- if (leaf.isConfig() == null) {
- leaf.setConfig(isConfig);
- }
- }
- }
-
- /*
- * If "config" is not specified, the default is the same as the parent
- * schema node's "config" value.
- */
- if (leafLists != null) {
- for (YangLeafList leafList : leafLists) {
- if (leafList.isConfig() == null) {
- leafList.setConfig(isConfig);
- }
- }
- }
- }
-
- /**
- * Validates config statement of container.
- *
- * @param leaves list of leaf attributes of container
- * @param leafLists list of leaf-list attributes of container
- * @throws DataModelException a violation of data model rules
- */
- private void validateConfig(List<YangLeaf> leaves, List<YangLeafList> leafLists)
- throws DataModelException {
-
- /*
- * If a node has "config" set to "false", no node underneath it can have
- * "config" set to "true".
- */
- if (!isConfig && leaves != null) {
- for (YangLeaf leaf : leaves) {
- if (leaf.isConfig()) {
- throw new DataModelException("If a container has \"config\" set to \"false\", no node underneath " +
- "it can have \"config\" set to \"true\".");
- }
- }
- }
-
- if (!isConfig && leafLists != null) {
- for (YangLeafList leafList : leafLists) {
- if (leafList.isConfig()) {
- throw new DataModelException("If a container has \"config\" set to \"false\", no node underneath " +
- "it can have \"config\" set to \"true\".");
- }
- }
- }
- }
-
- @Override
- public void detectCollidingChild(String identifierName, YangConstructType dataType)
- throws DataModelException {
- // Asks helper to detect colliding child.
- detectCollidingChildUtil(identifierName, dataType, this);
- }
-
- @Override
- public void detectSelfCollision(String identifierName, YangConstructType dataType)
- throws DataModelException {
- if (getName().equals(identifierName)) {
- throw new DataModelException("YANG file error: Duplicate input identifier detected, same as container \""
- + getName() + "\"");
- }
- }
-
- @Override
- public List<YangIfFeature> getIfFeatureList() {
- return ifFeatureList;
- }
-
- @Override
- public void addIfFeatureList(YangIfFeature ifFeature) {
- if (getIfFeatureList() == null) {
- setIfFeatureList(new LinkedList<>());
- }
- getIfFeatureList().add(ifFeature);
- }
-
- @Override
- public void setIfFeatureList(List<YangIfFeature> ifFeatureList) {
- this.ifFeatureList = ifFeatureList;
- }
-
- @Override
- public List<YangMust> getListOfMust() {
- return mustConstraintList;
- }
-
- @Override
- public void setListOfMust(List<YangMust> mustConstraintList) {
- this.mustConstraintList = mustConstraintList;
- }
-
- @Override
- public void addMust(YangMust must) {
- if (getListOfMust() == null) {
- setListOfMust(new LinkedList<>());
- }
- getListOfMust().add(must);
- }
-
- @Override
- public void addAugmentation(YangAugmentedInfo augmentInfo) {
- yangAugmentedInfo.add(augmentInfo);
- }
-
- @Override
- public void removeAugmentation(YangAugmentedInfo augmentInfo) {
- yangAugmentedInfo.remove(augmentInfo);
- }
-
- @Override
- public List<YangAugmentedInfo> getAugmentedInfoList() {
- return yangAugmentedInfo;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDataNode.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDataNode.java
deleted file mode 100644
index 80dede4..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDataNode.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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 YANG data node, used by YMS to abstractly refer the data
- * nodes in YANG data tree.
- */
-public interface YangDataNode {
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDataStructure.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDataStructure.java
deleted file mode 100644
index 785d460..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDataStructure.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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;
-
-/**
- * Represents ENUM to identify the YANG data type.
- */
-public enum YangDataStructure {
-
- MAP,
-
- LIST,
-
- SET;
-
- /**
- * Returns YANG data structure type for corresponding data structure name.
- *
- * @param name data structure name from YANG file.
- * @return YANG data structure for corresponding data structure name.
- */
- public static YangDataStructure getType(String name) {
- name = name.replace("\"", "");
- for (YangDataStructure dataStructure : values()) {
- if (dataStructure.name().toLowerCase().equals(name)) {
- return dataStructure;
- }
- }
- return null;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDecimal64.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDecimal64.java
deleted file mode 100644
index a4c40b1..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDecimal64.java
+++ /dev/null
@@ -1,329 +0,0 @@
-/*
- * 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;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.FractionDigits;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.DataTypeException;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangBuiltInDataTypeInfo;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.util.ListIterator;
-
-/**
- * Represents YANG decimal 64.
- */
-public class YangDecimal64<T>
- implements YangBuiltInDataTypeInfo<YangDecimal64>, Parsable, Serializable, Comparable<YangDecimal64> {
-
- private static final long serialVersionUID = 8006201668L;
-
- /**
- * YANG's min keyword.
- */
- private static final String MIN_KEYWORD = "min";
-
- /**
- * YANG's max keyword.
- */
- private static final String MAX_KEYWORD = "max";
-
- /**
- * Valid minimum value of YANG's fraction-digits.
- */
- public static final int MIN_FRACTION_DIGITS_VALUE = 1;
-
- /**
- * Valid maximum value of YANG's fraction-digits.
- */
- public static final int MAX_FRACTION_DIGITS_VALUE = 18;
-
- /**
- * Valid minimum value of YANG's decimal64.
- */
- public static final BigDecimal MIN_VALUE = BigDecimal.valueOf(-922337203685477580.8);
-
- /**
- * Valid maximum value of YANG's decimal64.
- */
- public static final BigDecimal MAX_VALUE = BigDecimal.valueOf(922337203685477580.7);
-
- // Decimal64 value
- private BigDecimal value;
-
- // fraction-digits
- private int fractionDigit;
-
- /**
- * Additional information about range restriction.
- */
- private T rangeRestrictedExtendedInfo;
-
- /**
- * Creates an instance of YANG decimal64.
- */
- public YangDecimal64() {
- }
-
- /**
- * Creates an instance of YANG decimal64.
- *
- * @param value of decimal64
- */
- public YangDecimal64(BigDecimal value) {
- setValue(value);
- }
-
- /**
- * Creates an instance of YANG decimal64.
- *
- * @param valueInString of decimal64 in string
- */
- public YangDecimal64(String valueInString) {
- if (valueInString.matches(MIN_KEYWORD)) {
- value = MIN_VALUE;
- } else if (valueInString.matches(MAX_KEYWORD)) {
- value = MAX_VALUE;
- } else {
- try {
- value = new BigDecimal(valueInString);
- } catch (Exception e) {
- throw new DataTypeException("YANG file error : Input value \"" + valueInString + "\" is not a valid " +
- "decimal64.");
- }
- }
-
- if (value.doubleValue() < MIN_VALUE.doubleValue()) {
- throw new DataTypeException("YANG file error : " + valueInString + " is lesser than minimum value "
- + MIN_VALUE + ".");
- } else if (value.doubleValue() > MAX_VALUE.doubleValue()) {
- throw new DataTypeException("YANG file error : " + valueInString + " is greater than maximum value "
- + MAX_VALUE + ".");
- }
- }
-
- /**
- * Returns decimal64 value.
- *
- * @return value
- */
- public BigDecimal getValue() {
- return value;
- }
-
- /**
- * Sets the decimal64 value.
- *
- * @param value of decimal64
- */
- public void setValue(BigDecimal value) {
- this.value = value;
- }
-
- /**
- * Returns fraction digit.
- *
- * @return the fractionDigit
- */
- public int getFractionDigit() {
- return fractionDigit;
- }
-
- /**
- * Sets fraction digit.
- *
- * @param fractionDigit fraction digits.
- */
- public void setFractionDigit(int fractionDigit) {
- this.fractionDigit = fractionDigit;
- }
-
- /**
- * Returns additional information about range restriction.
- *
- * @return resolved range restricted extended information
- */
- public T getRangeRestrictedExtendedInfo() {
- return rangeRestrictedExtendedInfo;
- }
-
- /**
- * Sets additional information about range restriction.
- *
- * @param resolvedExtendedInfo resolved range restricted extended information
- */
- public void setRangeRestrictedExtendedInfo(T resolvedExtendedInfo) {
- this.rangeRestrictedExtendedInfo = resolvedExtendedInfo;
- }
-
- /**
- * Returns object of YANG decimal64.
- *
- * @param value of decimal64
- * @return YANG decimal64 object
- */
- public static YangDecimal64 of(BigDecimal value) {
- return new YangDecimal64(value);
- }
-
- @Override
- public YangDataTypes getYangType() {
- return YangDataTypes.DECIMAL64;
- }
-
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.DECIMAL64_DATA;
- }
-
- @Override
- public String toString() {
- return value.toString();
- }
-
- /**
- * Returns the object of YANG decimal64 from input string.
- *
- * @param valInString input String
- * @return Object of YANG decimal64
- * @throws DataModelException a violation of data model rules
- */
- public static YangDecimal64 fromString(String valInString) throws DataModelException {
- return new YangDecimal64(valInString);
- }
-
- /**
- * Checks whether specific fraction-digit in its range.
- *
- * @return true if fraction-digit is in its range otherwise false
- */
- public boolean isValidFractionDigit() {
- if ((fractionDigit >= 1) && (fractionDigit <= 18)) {
- return true;
- }
- return false;
- }
-
-
- /**
- * Checks whether value is in correct decimal64 value range.
- *
- * @throws DataModelException a violation of data model rules
- */
- public void validateDecimal64() throws DataModelException {
- YangRangeRestriction rangeRestriction = (YangRangeRestriction) getRangeRestrictedExtendedInfo();
- if (rangeRestriction != null) {
- // Check whether value is within provided range value
- ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
- .listIterator();
- boolean isMatched = false;
- while (rangeListIterator.hasNext()) {
- YangRangeInterval rangeInterval = rangeListIterator.next();
- BigDecimal startValue = ((YangDecimal64) rangeInterval.getStartValue()).getValue();
- BigDecimal endValue = ((YangDecimal64) rangeInterval.getEndValue()).getValue();
- if ((this.value.doubleValue() >= startValue.doubleValue()) &&
- (this.value.doubleValue() <= endValue.doubleValue())) {
- isMatched = true;
- break;
- }
- }
- // If range is not matched then throw error
- if (!isMatched) {
- throw new DataModelException("YANG file error : decimal64 validation failed.");
- }
- } else {
- // Check value is in fraction-digits decimal64 value range
- if (!FractionDigits.isValueInDecimal64Range(this.value, getFractionDigit())) {
- throw new DataModelException("YANG file error : decimal64 validation failed.");
- }
- }
- }
-
- /**
- * Validate range restriction values based on fraction-digits decimal64 range value.
- *
- * @throws DataModelException a violation of data model rules
- */
- public void validateRange() throws DataModelException {
- YangRangeRestriction rangeRestriction = (YangRangeRestriction) getRangeRestrictedExtendedInfo();
- if (rangeRestriction == null) {
- // No need to validate. Range is optional.
- return;
- }
-
- ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
- .listIterator();
- while (rangeListIterator.hasNext()) {
- YangRangeInterval rangeInterval = rangeListIterator.next();
- if (!(FractionDigits.isValueInDecimal64Range(((YangDecimal64) rangeInterval.getStartValue()).getValue(),
- getFractionDigit()))) {
- throw new DataModelException("YANG file error : range validation failed.");
- }
-
- if (!(FractionDigits.isValueInDecimal64Range(((YangDecimal64) rangeInterval.getEndValue()).getValue(),
- getFractionDigit()))) {
- throw new DataModelException("YANG file error : range validation failed.");
- }
- }
- }
-
- @Override
- public int compareTo(YangDecimal64 o) {
- return Double.compare(value.doubleValue(), o.value.doubleValue());
- }
-
- /**
- * Returns decimal64 default range restriction based on fraction-digits.
- * If range restriction is not provided then this default range value will be applicable.
- *
- * @return range restriction
- * @throws DataModelException a violation of data model rules
- */
- public YangRangeRestriction getDefaultRangeRestriction() throws DataModelException {
- YangRangeRestriction refRangeRestriction = new YangRangeRestriction();
- YangRangeInterval rangeInterval = new YangRangeInterval<>();
- FractionDigits.Range range = FractionDigits.getRange(this.fractionDigit);
- rangeInterval.setStartValue(new YangDecimal64(new BigDecimal((range.getMin()))));
- rangeInterval.setEndValue(new YangDecimal64(new BigDecimal((range.getMax()))));
- refRangeRestriction.addRangeRestrictionInterval(rangeInterval);
- return refRangeRestriction;
- }
-
- /**
- * Validates the data on entering the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnEntry() throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-
- /**
- * Validates the data on exiting the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnExit() throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDerivedInfo.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDerivedInfo.java
deleted file mode 100644
index dee1c98..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDerivedInfo.java
+++ /dev/null
@@ -1,780 +0,0 @@
-/*
- * 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;
-
-import java.io.Serializable;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.ResolvableStatus;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-
-import com.google.common.base.Strings;
-
-import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.INTRA_FILE_RESOLVED;
-import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.RESOLVED;
-import static org.onosproject.yangutils.datamodel.utils.RestrictionResolver.processLengthRestriction;
-import static org.onosproject.yangutils.datamodel.utils.RestrictionResolver.processRangeRestriction;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypeUtils.isOfRangeRestrictedType;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.BINARY;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.BITS;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.BOOLEAN;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.DECIMAL64;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.DERIVED;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.EMPTY;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.ENUMERATION;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.IDENTITYREF;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.LEAFREF;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.STRING;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.UNION;
-
-/**
- * Represents the derived information.
- *
- * @param <T> extended information.
- */
-public class YangDerivedInfo<T>
- implements LocationInfo, Cloneable, Serializable {
-
- private static final long serialVersionUID = 806201641L;
-
- /**
- * YANG typedef reference.
- */
- private YangTypeDef referredTypeDef;
-
- /**
- * Resolved additional information about data type after linking, example
- * restriction info, named values, etc. The extra information is based
- * on the data type. Based on the data type, the extended info can vary.
- */
- private T resolvedExtendedInfo;
-
- /**
- * Line number of pattern restriction in YANG file.
- */
- private int lineNumber;
-
- /**
- * Position of pattern restriction in line.
- */
- private int charPositionInLine;
-
- /**
- * 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;
-
- /**
- * Length restriction string to temporary store the length restriction when the type
- * is derived.
- */
- private String lengthRestrictionString;
-
- /**
- * Range restriction string to temporary store the range restriction when the type
- * is derived.
- */
- private String rangeRestrictionString;
-
- /**
- * Pattern restriction string to temporary store the pattern restriction when the type
- * is derived.
- */
- private YangPatternRestriction patternRestriction;
-
- /**
- * Returns the referred typedef reference.
- *
- * @return referred typedef reference
- */
- public YangTypeDef getReferredTypeDef() {
- return referredTypeDef;
- }
-
- /**
- * Sets the referred typedef reference.
- *
- * @param referredTypeDef referred typedef reference
- */
- public void setReferredTypeDef(YangTypeDef referredTypeDef) {
- this.referredTypeDef = referredTypeDef;
- }
-
- /**
- * Returns resolved extended information after successful linking.
- *
- * @return resolved extended information
- */
- public T getResolvedExtendedInfo() {
- return resolvedExtendedInfo;
- }
-
- /**
- * Sets resolved extended information after successful linking.
- *
- * @param resolvedExtendedInfo resolved extended information
- */
- public void setResolvedExtendedInfo(T resolvedExtendedInfo) {
- this.resolvedExtendedInfo = resolvedExtendedInfo;
- }
-
- @Override
- public int getLineNumber() {
- return lineNumber;
- }
-
- @Override
- public int getCharPosition() {
- return charPositionInLine;
- }
-
- @Override
- public void setLineNumber(int lineNumber) {
- this.lineNumber = lineNumber;
- }
-
- @Override
- public void setCharPosition(int charPositionInLine) {
- this.charPositionInLine = charPositionInLine;
- }
-
- /**
- * Returns the length restriction string.
- *
- * @return the length restriction string
- */
- public String getLengthRestrictionString() {
- return lengthRestrictionString;
- }
-
- /**
- * Sets the length restriction string.
- *
- * @param lengthRestrictionString the length restriction string
- */
- public void setLengthRestrictionString(String lengthRestrictionString) {
- this.lengthRestrictionString = lengthRestrictionString;
- }
-
- /**
- * Returns the range restriction string.
- *
- * @return the range restriction string
- */
- public String getRangeRestrictionString() {
- return rangeRestrictionString;
- }
-
- /**
- * Sets the range restriction string.
- *
- * @param rangeRestrictionString the range restriction string
- */
- public void setRangeRestrictionString(String rangeRestrictionString) {
- this.rangeRestrictionString = rangeRestrictionString;
- }
-
- /**
- * Returns the pattern restriction.
- *
- * @return the pattern restriction
- */
- public YangPatternRestriction getPatternRestriction() {
- return patternRestriction;
- }
-
- /**
- * Sets the pattern restriction.
- *
- * @param patternRestriction the pattern restriction
- */
- public void setPatternRestriction(YangPatternRestriction patternRestriction) {
- this.patternRestriction = patternRestriction;
- }
-
- /**
- * Returns 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;
- }
-
- /**
- * Resolves the type derived info, by obtaining the effective built-in type
- * and resolving the restrictions.
- *
- * @return resolution status
- * @throws DataModelException a violation in data mode rule
- */
- public ResolvableStatus resolve()
- throws DataModelException {
-
- YangType<?> baseType = getReferredTypeDef().getTypeDefBaseType();
-
- /*
- * Checks the data type of the referred typedef, if it's derived, obtain
- * effective built-in type and restrictions from it's derived info,
- * otherwise take from the base type of type itself.
- */
- if (baseType.getDataType() == DERIVED) {
- ResolvableStatus resolvableStatus = resolveTypeDerivedInfo(baseType);
- if (resolvableStatus != null) {
- return resolvableStatus;
- }
- } else if ((baseType.getDataType() == LEAFREF) || (baseType.getDataType() == IDENTITYREF)) {
- setEffectiveBuiltInType(baseType.getDataType());
- return RESOLVED;
- } else {
- setEffectiveBuiltInType(baseType.getDataType());
- /*
- * Check whether the effective built-in type can have range
- * restrictions, if yes call resolution of range.
- */
- if (isOfRangeRestrictedType(getEffectiveBuiltInType())) {
- if (baseType.getDataTypeExtendedInfo() == null) {
- resolveRangeRestriction(null);
- /*
- * Return the resolution status as resolved, if it's not
- * resolve range/string restriction will throw exception in
- * previous function.
- */
- return RESOLVED;
- } else {
- if (!(baseType.getDataTypeExtendedInfo() instanceof YangRangeRestriction)) {
- throw new DataModelException("Linker error: Referred typedef restriction info is of invalid " +
- "type.");
- }
- resolveRangeRestriction((YangRangeRestriction) baseType.getDataTypeExtendedInfo());
- /*
- * Return the resolution status as resolved, if it's not
- * resolve range/string restriction will throw exception in
- * previous function.
- */
- return RESOLVED;
- }
- /*
- * If the effective built-in type is of type string calls for
- * string resolution.
- */
- } else if (getEffectiveBuiltInType() == STRING) {
- if (baseType.getDataTypeExtendedInfo() == null) {
- resolveStringRestriction(null);
- /*
- * Return the resolution status as resolved, if it's not
- * resolve range/string restriction will throw exception in
- * previous function.
- */
- return RESOLVED;
- } else {
- if (!(baseType.getDataTypeExtendedInfo() instanceof YangStringRestriction)) {
- throw new DataModelException("Linker error: Referred typedef restriction info is of invalid " +
- "type.");
- }
- resolveStringRestriction((YangStringRestriction) baseType.getDataTypeExtendedInfo());
- /*
- * Return the resolution status as resolved, if it's not
- * resolve range/string restriction will throw exception in
- * previous function.
- */
- return RESOLVED;
- }
- } else if (getEffectiveBuiltInType() == BINARY) {
- if (baseType.getDataTypeExtendedInfo() == null) {
- resolveBinaryRestriction(null);
- /*
- * Return the resolution status as resolved, if it's not
- * resolve length restriction will throw exception in
- * previous function.
- */
- return RESOLVED;
- } else {
- if (!(baseType.getDataTypeExtendedInfo() instanceof YangRangeRestriction)) {
- throw new DataModelException("Linker error: Referred typedef restriction info is of invalid " +
- "type.");
- }
- resolveBinaryRestriction((YangRangeRestriction) baseType.getDataTypeExtendedInfo());
- /*
- * Return the resolution status as resolved, if it's not
- * resolve length restriction will throw exception in
- * previous function.
- */
- return RESOLVED;
- }
- } else if (getEffectiveBuiltInType() == DECIMAL64) {
- if (baseType.getDataTypeExtendedInfo() != null) {
- if (((YangDecimal64) baseType.getDataTypeExtendedInfo()).getRangeRestrictedExtendedInfo() == null) {
- resolveRangeRestriction(null);
- /*
- * Return the resolution status as resolved, if it's not;
- * resolve range restriction will throw exception in
- * previous function.
- */
- return RESOLVED;
- } else {
- if (!(((YangDecimal64) baseType.getDataTypeExtendedInfo())
- .getRangeRestrictedExtendedInfo() instanceof YangRangeRestriction)) {
- throw new DataModelException("Linker error: Referred typedef restriction info is" +
- " of invalid type.");
- }
- resolveRangeRestriction((YangRangeRestriction) ((YangDecimal64) baseType
- .getDataTypeExtendedInfo()).getRangeRestrictedExtendedInfo());
- /*
- * Return the resolution status as resolved, if it's not
- * resolve range/string restriction will throw exception in
- * previous function.
- */
- return RESOLVED;
- }
-
- } else {
- throw new DataModelException("Linker error: Unable to find type extended info for decimal64.");
- }
- }
- }
-
- /*
- * Check if the data type is the one which can't be restricted, in this
- * case check whether no self restrictions should be present.
- */
- if (isOfValidNonRestrictedType(getEffectiveBuiltInType())) {
- if (Strings.isNullOrEmpty(getLengthRestrictionString())
- && Strings.isNullOrEmpty(getRangeRestrictionString())
- && getPatternRestriction() == null) {
- return RESOLVED;
- } else {
- throw new DataModelException("YANG file error: Restrictions can't be applied to a given type");
- }
- }
-
- // Throw exception for unsupported types
- throw new DataModelException("Linker error: Unable to process the derived type.");
- }
-
- /**
- * Resolves the type derived info, by obtaining the effective built-in type
- * and resolving the restrictions.
- *
- * @param baseType base type of typedef
- * @return resolution status
- * @throws DataModelException a violation in data mode rule
- */
- public ResolvableStatus resolveTypeDerivedInfo(YangType<?> baseType)
- throws DataModelException {
- /*
- * Check whether the referred typedef is resolved.
- */
- if (baseType.getResolvableStatus() != INTRA_FILE_RESOLVED && baseType.getResolvableStatus() != RESOLVED) {
- throw new DataModelException("Linker Error: Referred typedef is not resolved for type.");
- }
-
- /*
- * Check if the referred typedef is intra file resolved, if yes sets
- * current status also to intra file resolved .
- */
- if (getReferredTypeDef().getTypeDefBaseType().getResolvableStatus() == INTRA_FILE_RESOLVED) {
- return INTRA_FILE_RESOLVED;
- }
- setEffectiveBuiltInType(((YangDerivedInfo<?>) baseType.getDataTypeExtendedInfo())
- .getEffectiveBuiltInType());
- YangDerivedInfo refDerivedInfo = (YangDerivedInfo<?>) baseType.getDataTypeExtendedInfo();
- /*
- * Check whether the effective built-in type can have range
- * restrictions, if yes call resolution of range.
- */
- if (isOfRangeRestrictedType(getEffectiveBuiltInType())) {
- if (refDerivedInfo.getResolvedExtendedInfo() == null) {
- resolveRangeRestriction(null);
- /*
- * Return the resolution status as resolved, if it's not
- * resolve range/string restriction will throw exception in
- * previous function.
- */
- return RESOLVED;
- } else {
- if (!(refDerivedInfo.getResolvedExtendedInfo() instanceof YangRangeRestriction)) {
- throw new DataModelException("Linker error: Referred typedef restriction info is of invalid " +
- "type.");
- }
- resolveRangeRestriction((YangRangeRestriction) refDerivedInfo.getResolvedExtendedInfo());
- /*
- * Return the resolution status as resolved, if it's not
- * resolve range/string restriction will throw exception in
- * previous function.
- */
- return RESOLVED;
- }
- /*
- * If the effective built-in type is of type string calls for
- * string resolution.
- */
- } else if (getEffectiveBuiltInType() == STRING) {
- if (refDerivedInfo.getResolvedExtendedInfo() == null) {
- resolveStringRestriction(null);
- /*
- * Return the resolution status as resolved, if it's not
- * resolve range/string restriction will throw exception in
- * previous function.
- */
- return RESOLVED;
- } else {
- if (!(refDerivedInfo.getResolvedExtendedInfo() instanceof YangStringRestriction)) {
- throw new DataModelException("Linker error: Referred typedef restriction info is of invalid " +
- "type.");
- }
- resolveStringRestriction((YangStringRestriction) refDerivedInfo.getResolvedExtendedInfo());
- /*
- * Return the resolution status as resolved, if it's not
- * resolve range/string restriction will throw exception in
- * previous function.
- */
- return RESOLVED;
- }
- } else if (getEffectiveBuiltInType() == BINARY) {
- if (refDerivedInfo.getResolvedExtendedInfo() == null) {
- resolveBinaryRestriction(null);
- /*
- * Return the resolution status as resolved, if it's not
- * resolve length restriction will throw exception in
- * previous function.
- */
- return RESOLVED;
- } else {
- if (!(refDerivedInfo.getResolvedExtendedInfo() instanceof YangRangeRestriction)) {
- throw new DataModelException("Linker error: Referred typedef restriction info is of invalid " +
- "type.");
- }
- resolveBinaryRestriction((YangRangeRestriction) refDerivedInfo.getResolvedExtendedInfo());
- /*
- * Return the resolution status as resolved, if it's not
- * resolve length restriction will throw exception in
- * previous function.
- */
- return RESOLVED;
- }
- } else if (getEffectiveBuiltInType() == DECIMAL64) {
- if (refDerivedInfo.getResolvedExtendedInfo() == null) {
- resolveRangeRestriction(null);
- /*
- * Return the resolution status as resolved, if it's not;
- * resolve range restriction will throw exception in
- * previous function.
- */
- return RESOLVED;
- } else {
- if (!(refDerivedInfo.getResolvedExtendedInfo() instanceof YangRangeRestriction)) {
- throw new DataModelException("Linker error: Referred typedef restriction info is of invalid " +
- "type.");
- }
- resolveRangeRestriction((YangRangeRestriction) refDerivedInfo
- .getResolvedExtendedInfo());
- /*
- * Return the resolution status as resolved, if it's not
- * resolve range/string restriction will throw exception in
- * previous function.
- */
- return RESOLVED;
- }
- }
-
- return null;
- }
-
- /**
- * Resolves the string restrictions.
- *
- * @param refStringRestriction referred string restriction of typedef
- * @throws DataModelException a violation in data model rule
- */
- private void resolveStringRestriction(YangStringRestriction refStringRestriction)
- throws DataModelException {
- YangStringRestriction curStringRestriction = null;
- YangRangeRestriction refRangeRestriction = null;
- YangPatternRestriction refPatternRestriction = null;
-
- /*
- * Check that range restriction should be null when built-in type is
- * string.
- */
- if (!Strings.isNullOrEmpty(getRangeRestrictionString())) {
- DataModelException dataModelException = new DataModelException("YANG file error: Range restriction " +
- "should't be present for string data type.");
- dataModelException.setLine(lineNumber);
- dataModelException.setCharPosition(charPositionInLine);
- throw dataModelException;
- }
-
- /*
- * If referred restriction and self restriction both are null, no
- * resolution is required.
- */
- if (refStringRestriction == null && Strings.isNullOrEmpty(getLengthRestrictionString())
- && getPatternRestriction() == null) {
- return;
- }
-
- /*
- * If referred string restriction is not null, take value of length and
- * pattern restriction and assign.
- */
- if (refStringRestriction != null) {
- refRangeRestriction = refStringRestriction.getLengthRestriction();
- refPatternRestriction = refStringRestriction.getPatternRestriction();
- }
-
- YangRangeRestriction lengthRestriction = resolveLengthRestriction(refRangeRestriction);
- YangPatternRestriction patternRestriction = resolvePatternRestriction(refPatternRestriction);
-
- /*
- * Check if either of length or pattern restriction is present, if yes
- * create string restriction and assign value.
- */
- if (lengthRestriction != null || patternRestriction != null) {
- curStringRestriction = new YangStringRestriction();
- curStringRestriction.setLengthRestriction(lengthRestriction);
- curStringRestriction.setPatternRestriction(patternRestriction);
- }
- setResolvedExtendedInfo((T) curStringRestriction);
- }
-
- /**
- * Resolves the binary restrictions.
- *
- * @param refLengthRestriction referred length restriction of typedef
- * @throws DataModelException a violation in data model rule
- */
- private void resolveBinaryRestriction(YangRangeRestriction refLengthRestriction)
- throws DataModelException {
-
- if (rangeRestrictionString != null || patternRestriction != null) {
- DataModelException dataModelException =
- new DataModelException("YANG file error: for binary " +
- "range restriction or pattern restriction is not allowed.");
- dataModelException.setLine(lineNumber);
- dataModelException.setCharPosition(charPositionInLine);
- throw dataModelException;
- }
-
- // Get the final resolved length restriction
- YangRangeRestriction lengthRestriction = resolveLengthRestriction(refLengthRestriction);
- // Set the lenght restriction.
- setResolvedExtendedInfo((T) lengthRestriction);
- }
-
- /**
- * Resolves pattern restriction.
- *
- * @param refPatternRestriction referred pattern restriction of typedef
- * @return resolved pattern restriction
- */
- private YangPatternRestriction resolvePatternRestriction(YangPatternRestriction refPatternRestriction) {
- /*
- * If referred restriction and self restriction both are null, no
- * resolution is required.
- */
- if (refPatternRestriction == null && getPatternRestriction() == null) {
- return null;
- }
-
- /*
- * If self restriction is null, and referred restriction is present
- * shallow copy the referred to self.
- */
- if (getPatternRestriction() == null) {
- return refPatternRestriction;
- }
-
- /*
- * If referred restriction is null, and self restriction is present
- * carry out self resolution.
- */
- if (refPatternRestriction == null) {
- return getPatternRestriction();
- }
-
- /*
- * Get patterns of referred type and add it to current pattern
- * restrictions.
- */
- for (String pattern : refPatternRestriction.getPatternList()) {
- getPatternRestriction().addPattern(pattern);
- }
- return getPatternRestriction();
- }
-
- /**
- * Resolves the length restrictions.
- *
- * @param refLengthRestriction referred length restriction of typedef
- * @return resolved length restriction
- * @throws DataModelException a violation in data model rule
- */
- private YangRangeRestriction resolveLengthRestriction(YangRangeRestriction refLengthRestriction)
- throws DataModelException {
-
- /*
- * If referred restriction and self restriction both are null, no
- * resolution is required.
- */
- if (refLengthRestriction == null && Strings.isNullOrEmpty(getLengthRestrictionString())) {
- return null;
- }
-
- /*
- * If self restriction is null, and referred restriction is present
- * shallow copy the referred to self.
- */
- if (Strings.isNullOrEmpty(getLengthRestrictionString())) {
- return refLengthRestriction;
- }
-
- /*
- * If referred restriction is null, and self restriction is present
- * carry out self resolution.
- */
- if (refLengthRestriction == null) {
- YangRangeRestriction curLengthRestriction = processLengthRestriction(null, lineNumber,
- charPositionInLine, false, getLengthRestrictionString());
- return curLengthRestriction;
- }
-
- /*
- * Carry out self resolution based with obtained effective built-in type
- * and MIN/MAX values as per the referred typedef's values.
- */
- YangRangeRestriction curLengthRestriction = processLengthRestriction(refLengthRestriction, lineNumber,
- charPositionInLine, true, getLengthRestrictionString());
-
- // Resolve the range with referred typedef's restriction.
- resolveLengthAndRangeRestriction(refLengthRestriction, curLengthRestriction);
- return curLengthRestriction;
- }
-
- /**
- * Resolves the length/range self and referred restriction, to check whether
- * the all the range interval in self restriction is stricter than the
- * referred typedef's restriction.
- *
- * @param refRestriction referred restriction
- * @param curRestriction self restriction
- */
- private void resolveLengthAndRangeRestriction(YangRangeRestriction refRestriction,
- YangRangeRestriction curRestriction)
- throws DataModelException {
- for (Object curInterval : curRestriction.getAscendingRangeIntervals()) {
- if (!(curInterval instanceof YangRangeInterval)) {
- throw new DataModelException("Linker error: Current range intervals not processed correctly.");
- }
- try {
- refRestriction.isValidInterval((YangRangeInterval) curInterval);
- } catch (DataModelException e) {
- DataModelException dataModelException = new DataModelException(e);
- dataModelException.setLine(lineNumber);
- dataModelException.setCharPosition(charPositionInLine);
- throw dataModelException;
- }
- }
- }
-
- /**
- * Resolves the range restrictions.
- *
- * @param refRangeRestriction referred range restriction of typedef
- * @throws DataModelException a violation in data model rule
- */
- private void resolveRangeRestriction(YangRangeRestriction refRangeRestriction)
- throws DataModelException {
-
- /*
- * Check that string restriction should be null when built-in type is of
- * range type.
- */
- if (!Strings.isNullOrEmpty(getLengthRestrictionString()) || getPatternRestriction() != null) {
- DataModelException dataModelException = new DataModelException("YANG file error: Length/Pattern " +
- "restriction should't be present for int/uint/decimal data type.");
- dataModelException.setLine(lineNumber);
- dataModelException.setCharPosition(charPositionInLine);
- throw dataModelException;
- }
-
- /*
- * If referred restriction and self restriction both are null, no
- * resolution is required.
- */
- if (refRangeRestriction == null && Strings.isNullOrEmpty(getRangeRestrictionString())) {
- return;
- }
-
- /*
- * If self restriction is null, and referred restriction is present
- * shallow copy the referred to self.
- */
- if (Strings.isNullOrEmpty(getRangeRestrictionString())) {
- setResolvedExtendedInfo((T) refRangeRestriction);
- return;
- }
-
- /*
- * If referred restriction is null, and self restriction is present
- * carry out self resolution.
- */
- if (refRangeRestriction == null) {
- YangRangeRestriction curRangeRestriction = processRangeRestriction(null, lineNumber,
- charPositionInLine, false, getRangeRestrictionString(), getEffectiveBuiltInType());
- setResolvedExtendedInfo((T) curRangeRestriction);
- return;
- }
-
- /*
- * Carry out self resolution based with obtained effective built-in type
- * and MIN/MAX values as per the referred typedef's values.
- */
- YangRangeRestriction curRangeRestriction = processRangeRestriction(refRangeRestriction, lineNumber,
- charPositionInLine, true, getRangeRestrictionString(), getEffectiveBuiltInType());
-
- // Resolve the range with referred typedef's restriction.
- resolveLengthAndRangeRestriction(refRangeRestriction, curRangeRestriction);
- setResolvedExtendedInfo((T) curRangeRestriction);
- }
-
- /**
- * Returns whether the data type is of non restricted type.
- *
- * @param dataType data type to be checked
- * @return true, if data type can't be restricted, false otherwise
- */
- private boolean isOfValidNonRestrictedType(YangDataTypes dataType) {
- return dataType == BOOLEAN
- || dataType == ENUMERATION
- || dataType == BITS
- || dataType == EMPTY
- || dataType == UNION
- || dataType == IDENTITYREF
- || dataType == LEAFREF;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDesc.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDesc.java
deleted file mode 100644
index 8c9d60e..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDesc.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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 textual description for a YANG entity. Abstracted to unify the
- * parsing and translator processing of description.
- */
-public interface YangDesc {
-
- /**
- * Returns the description of YANG entity.
- *
- * @return the description of YANG entity.
- */
- String getDescription();
-
- /**
- * Set the description of YANG entity.
- *
- * @param description set the description of YANG entity.
- */
- void setDescription(String description);
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangEntityToResolveInfo.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangEntityToResolveInfo.java
deleted file mode 100644
index 77323f1..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangEntityToResolveInfo.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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 information about entity being resolved.
- *
- * @param <T> type of entity being resolved, uses / grouping
- */
-public interface YangEntityToResolveInfo<T> {
-
- /**
- * Retrieves the entity to be resolved.
- *
- * @return entity to be resolved
- */
- T getEntityToResolve();
-
- /**
- * Sets entity to be resolved.
- *
- * @param entityToResolve entity to be resolved
- */
- void setEntityToResolve(T entityToResolve);
-
- /**
- * Retrieves the parent node which contains the entity to be resolved.
- *
- * @return parent node which contains the entity to be resolved
- */
- YangNode getHolderOfEntityToResolve();
-
- /**
- * Sets parent node which contains the entity to be resolved.
- *
- * @param holderOfEntityToResolve parent node which contains the entity to
- * be resolved
- */
- void setHolderOfEntityToResolve(YangNode holderOfEntityToResolve);
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangEntityToResolveInfoImpl.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangEntityToResolveInfoImpl.java
deleted file mode 100644
index 8fe6b22..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangEntityToResolveInfoImpl.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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;
-
-import java.io.Serializable;
-
-/**
- * Represents implementation of information about entity being resolved.
- *
- * @param <T> type of entity being resolved, uses / grouping
- */
-public class YangEntityToResolveInfoImpl<T> implements YangEntityToResolveInfo<T>, Serializable, LocationInfo {
-
- private static final long serialVersionUID = 806201659L;
-
- /**
- * Parsable node for which resolution is to be performed.
- */
- private T entityToResolve;
-
- /**
- * Holder of the YANG construct for which resolution has to be carried out.
- */
- private YangNode holderOfEntityToResolve;
-
- /**
- * Error line number.
- */
- private transient int lineNumber;
-
- /**
- * Error character position in number.
- */
- private transient int charPositionInLine;
-
- @Override
- public T getEntityToResolve() {
- return entityToResolve;
- }
-
- @Override
- public void setEntityToResolve(T entityToResolve) {
- this.entityToResolve = entityToResolve;
- }
-
- @Override
- public YangNode getHolderOfEntityToResolve() {
- return holderOfEntityToResolve;
- }
-
- @Override
- public void setHolderOfEntityToResolve(YangNode holderOfEntityToResolve) {
- this.holderOfEntityToResolve = holderOfEntityToResolve;
- }
-
- @Override
- public int getLineNumber() {
- return lineNumber;
- }
-
- @Override
- public int getCharPosition() {
- return charPositionInLine;
- }
-
- @Override
- public void setLineNumber(int lineNumber) {
- this.lineNumber = lineNumber;
- }
-
- @Override
- public void setCharPosition(int charPositionInLine) {
- this.charPositionInLine = charPositionInLine;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangEnum.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangEnum.java
deleted file mode 100644
index 04ea232..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangEnum.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * 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;
-
-import java.io.Serializable;
-import java.util.Objects;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-/*-
- * The "ENUM" statement, which is a sub-statement to the "type"
- * statement, MUST be present if the type is "enumeration". It is
- * repeatedly used to specify each assigned name of an enumeration type.
- * It takes as an argument a string which is the assigned name. The
- * string MUST NOT be empty and MUST NOT have any leading or trailing
- * whitespace characters. The use of Unicode control codes SHOULD be
- * avoided.
- *
- * The statement is optionally followed by a block of sub-statements that
- * holds detailed ENUM information.
- * All assigned names in an enumeration MUST be unique.
- *
- * The ENUM's sub-statements
- *
- * +--------------+---------+-------------+------------------+
- * | substatement | section | cardinality |data model mapping|
- * +--------------+---------+-------------+------------------+
- * | description | 7.19.3 | 0..1 | - string |
- * | reference | 7.19.4 | 0..1 | - string |
- * | status | 7.19.2 | 0..1 | - YangStatus |
- * | value | 9.6.4.2 | 0..1 | - int |
- * +--------------+---------+-------------+------------------+
- */
-
-/**
- * Represents the ENUM data type information.
- */
-public class YangEnum implements YangCommonInfo, Parsable, Comparable<YangEnum>, Serializable {
-
- private static final long serialVersionUID = 806201643L;
-
- /**
- * Named value for the ENUM.
- */
- private String namedValue;
-
- /**
- * Description of the ENUM value.
- */
- private String description;
-
- /**
- * Reference info of the ENUM value.
- */
- private String reference;
-
- /**
- * Status of the ENUM value.
- */
- private YangStatusType status;
-
- /**
- * Value of ENUM.
- */
- private int value;
-
- /**
- * Create a YANG ENUM.
- */
- public YangEnum() {
-
- }
-
- /**
- * Returns the named value.
- *
- * @return the named value
- */
- public String getNamedValue() {
- return namedValue;
- }
-
- /**
- * Sets the named value.
- *
- * @param namedValue the named value to set
- */
- public void setNamedValue(String namedValue) {
- this.namedValue = namedValue;
- }
-
- /**
- * Returns the description.
- *
- * @return the description
- */
- @Override
- public String getDescription() {
- return description;
- }
-
- /**
- * Sets the description.
- *
- * @param description set the description
- */
- @Override
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Returns the textual reference.
- *
- * @return the reference
- */
- @Override
- public String getReference() {
- return reference;
- }
-
- /**
- * Sets the textual reference.
- *
- * @param reference the reference to set
- */
- @Override
- public void setReference(String reference) {
- this.reference = reference;
- }
-
- /**
- * Returns the status.
- *
- * @return the status
- */
- @Override
- public YangStatusType getStatus() {
- return status;
- }
-
- /**
- * Sets the status.
- *
- * @param status the status to set
- */
- @Override
- public void setStatus(YangStatusType status) {
- this.status = status;
- }
-
- /**
- * Returns the value.
- *
- * @return the value
- */
- public int getValue() {
- return value;
- }
-
- /**
- * Sets the value.
- *
- * @param value the value to set
- */
- public void setValue(int value) {
- this.value = value;
- }
-
- /**
- * Returns the type of the data.
- *
- * @return ParsedDataType returns ENUM_DATA
- */
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.ENUM_DATA;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof YangEnum) {
- final YangEnum other = (YangEnum) obj;
- return Objects.equals(namedValue, other.namedValue);
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(namedValue);
- }
-
- /**
- * Validates the data on entering the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnEntry() throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-
- /**
- * Validates the data on exiting the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnExit() throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-
- @Override
- public int compareTo(YangEnum otherEnum) {
- if (namedValue.equals(otherEnum.getNamedValue())) {
- return 0;
- }
- return new Integer(value).compareTo(otherEnum.getValue());
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangEnumeration.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangEnumeration.java
deleted file mode 100644
index cf23464..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangEnumeration.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * 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;
-
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-/*
- * The enumeration built-in type represents values from a set of
- * assigned names.
- */
-
-/**
- * Represents the enumeration data type information.
- */
-public class YangEnumeration
- extends YangNode
- implements Parsable, CollisionDetector {
-
- private static final long serialVersionUID = 806201606L;
-
- // Enumeration info set.
- private SortedSet<YangEnum> enumSet;
-
- // Enumeration name.
- private String name;
-
- /**
- * Creates an enumeration object.
- */
- public YangEnumeration() {
- super(YangNodeType.ENUMERATION_NODE);
- setEnumSet(new TreeSet<YangEnum>());
- }
-
- /**
- * Returns the ENUM set.
- *
- * @return the ENUM set
- */
- public SortedSet<YangEnum> getEnumSet() {
- return enumSet;
- }
-
- /**
- * Sets the ENUM set.
- *
- * @param enumSet the ENUM set to set
- */
- private void setEnumSet(SortedSet<YangEnum> enumSet) {
- this.enumSet = enumSet;
- }
-
- /**
- * Adds ENUM information.
- *
- * @param enumInfo the ENUM information to be added
- * @throws DataModelException due to violation in data model rules
- */
- public void addEnumInfo(YangEnum enumInfo)
- throws DataModelException {
- if (!getEnumSet().add(enumInfo)) {
- throw new DataModelException("YANG ENUM already exists");
- }
- }
-
- /**
- * Returns enumeration name.
- *
- * @return the enumeration name
- */
- @Override
- public String getName() {
- return name;
- }
-
- /**
- * Sets the enumeration name.
- *
- * @param name enumeration name
- */
- @Override
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Returns the type of the data.
- *
- * @return returns ENUMERATION_DATA
- */
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.ENUMERATION_DATA;
- }
-
- /**
- * Validates the data on entering the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnEntry()
- throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-
- /**
- * Validates the data on exiting the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnExit()
- throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-
- @Override
- public void detectCollidingChild(String identifierName, YangConstructType dataType)
- throws DataModelException {
- /*
- Do nothing, since it is not part of the schema tree, it is only type of an existing node in schema tree.
- */
- }
-
- @Override
- public void detectSelfCollision(String identifierName, YangConstructType dataType)
- throws DataModelException {
- /*
- Do nothing, since it is not part of the schema tree, it is only type of an existing node in schema tree.
- */
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangExtension.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangExtension.java
deleted file mode 100644
index b22f6d1..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangExtension.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * 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;
-
-import java.io.Serializable;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-/*-
- * Reference RFC 6020.
- *
- * The "extension" statement allows the definition of new statements
- * within the YANG language. This new statement definition can be
- * imported and used by other modules.
- *
- * The statement's argument is an identifier that is the new keyword for
- * the extension and must be followed by a block of sub-statements that
- * holds detailed extension information. The purpose of the "extension"
- * statement is to define a keyword, so that it can be imported and used
- * by other modules.
- *
- * The extension can be used like a normal YANG statement, with the
- * statement name followed by an argument if one is defined by the
- * extension, and an optional block of sub-statements. The statement's
- * name is created by combining the prefix of the module in which the
- * extension was defined, a colon (":"), and the extension's keyword,
- * with no interleaving whitespace. The sub-statements of an extension
- * are defined by the extension, using some mechanism outside the scope
- * of this specification. Syntactically, the sub-statements MUST be YANG
- * statements, or also defined using "extension" statements.
- *
- * The extension's Sub-statements
- *
- * +--------------+---------+-------------+------------------+
- * | substatement | section | cardinality |data model mapping|
- * +--------------+---------+-------------+------------------+
- * | description | 7.19.3 | 0..1 | -string |
- * | reference | 7.19.4 | 0..1 | -string |
- * | status | 7.19.2 | 0..1 | -YangStatus |
- * | argument | 7.17.2 | 0..1 | -string |
- * +--------------+---------+-------------+------------------+
- */
-
-/**
- * Represents data model node to maintain information defined in YANG extension.
- */
-public class YangExtension
- implements YangCommonInfo, Serializable, Parsable {
-
- private static final long serialVersionUID = 806201605L;
-
- /**
- * Name of the extension.
- */
- private String name;
-
- /**
- * Name of the argument.
- */
- private String argumentName;
-
- /**
- * Description of extension.
- */
- private String description;
-
- /**
- * Reference of the extension.
- */
- private String reference;
-
- /**
- * Status of the extension.
- */
- private YangStatusType status = YangStatusType.CURRENT;
-
- /**
- * Returns the YANG name of extension.
- *
- * @return the name of extension as defined in YANG file
- */
- public String getName() {
- return name;
- }
-
- /**
- * Sets the YANG name of extension.
- *
- * @param name the name of extension as defined in YANG file
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Returns the YANG argument name of extension.
- *
- * @return the name of argument as defined in YANG file
- */
- public String getArgumentName() {
- return argumentName;
- }
-
- /**
- * Sets the YANG argument name of extension.
- *
- * @param argumentName the name of argument as defined in YANG file
- */
- public void setArgumentName(String argumentName) {
- this.argumentName = argumentName;
- }
-
- /**
- * Returns the description.
- *
- * @return the description
- */
- @Override
- public String getDescription() {
- return description;
- }
-
- /**
- * Sets the description.
- *
- * @param description set the description
- */
- @Override
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Returns the textual reference.
- *
- * @return the reference
- */
- @Override
- public String getReference() {
- return reference;
- }
-
- /**
- * Sets the textual reference.
- *
- * @param reference the reference to set
- */
- @Override
- public void setReference(String reference) {
- this.reference = reference;
- }
-
- /**
- * Returns the status.
- *
- * @return the status
- */
- @Override
- public YangStatusType getStatus() {
- return status;
- }
-
- /**
- * Sets the status.
- *
- * @param status the status to set
- */
- @Override
- public void setStatus(YangStatusType status) {
- this.status = status;
- }
-
- /**
- * Returns the type of the data.
- *
- * @return returns EXTENSION_DATA
- */
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.EXTENSION_DATA;
- }
-
- /**
- * Validates the data on entering the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnEntry()
- throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-
- /**
- * Validates the data on exiting the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnExit()
- throws DataModelException {
- // TODO : to be implemented
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangFeature.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangFeature.java
deleted file mode 100644
index f8f656b..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangFeature.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * 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;
-
-import java.io.Serializable;
-import java.util.LinkedList;
-import java.util.List;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-/*
- * Reference RFC 6020.
- *
- * The "feature" statement is used to define a mechanism by which
- * portions of the schema are marked as conditional. A feature name is
- * defined that can later be referenced using the "if-feature" statement.
- * Schema nodes tagged with a feature are ignored by the device unless
- * the device supports the given feature. This allows portions of the
- * YANG module to be conditional based on conditions on the device.
- * The model can represent the abilities of the device within the model,
- * giving a richer model that allows for differing device abilities and roles.
- *
- * The argument to the "feature" statement is the name of the new
- * feature, and follows the rules for identifiers. This name is used by the
- * "if-feature" statement to tie the schema nodes to the feature.
- *
- * The feature's Substatements
- *
- * +--------------+---------+-------------+------------------+
- * | substatement | section | cardinality |data model mapping|
- * +--------------+---------+-------------+------------------+
- * | description | 7.19.3 | 0..1 | -string |
- * | if-feature | 7.18.2 | 0..n | -YangIfFeature |
- * | reference | 7.19.4 | 0..1 | -string |
- * | status | 7.19.2 | 0..1 | -YangStatus |
- * +--------------+---------+-------------+------------------+
- */
-
-/**
- * Represents data model node to maintain information defined in YANG feature.
- */
-public class YangFeature implements YangCommonInfo, Parsable, YangIfFeatureHolder, Serializable {
-
- private static final long serialVersionUID = 806201635L;
-
- /**
- * Name of the feature.
- */
- private String name;
-
- /**
- * Description of feature.
- */
- private String description;
-
- /**
- * Reference of the feature.
- */
- private String reference;
-
- /**
- * Status of feature.
- */
- private YangStatusType statusType;
-
- /**
- * List of if-feature.
- */
- private List<YangIfFeature> ifFeatureList;
-
- @Override
- public String getDescription() {
- return description;
- }
-
- @Override
- public void setDescription(String description) {
- this.description = description;
- }
-
- @Override
- public String getReference() {
- return reference;
- }
-
- @Override
- public void setReference(String reference) {
- this.reference = reference;
- }
-
- @Override
- public YangStatusType getStatus() {
- return statusType;
- }
-
- @Override
- public void setStatus(YangStatusType status) {
- this.statusType = status;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.FEATURE_DATA;
- }
-
- @Override
- public void validateDataOnEntry() throws DataModelException {
- //TODO : To be implemented
- }
-
- @Override
- public void validateDataOnExit() throws DataModelException {
- //TODO : To be implemented
- }
-
- @Override
- public List<YangIfFeature> getIfFeatureList() {
- return ifFeatureList;
- }
-
- @Override
- public void addIfFeatureList(YangIfFeature ifFeature) {
- if (getIfFeatureList() == null) {
- setIfFeatureList(new LinkedList<>());
- }
- getIfFeatureList().add(ifFeature);
- }
-
- @Override
- public void setIfFeatureList(List<YangIfFeature> ifFeatureList) {
- this.ifFeatureList = ifFeatureList;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangFeatureHolder.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangFeatureHolder.java
deleted file mode 100644
index a3e15f2..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangFeatureHolder.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*Copyright 2016.year 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;
-
-import java.util.List;
-
-/**
- * Abstraction of feature entity. It is used to abstract the data holders of feature.
- */
-public interface YangFeatureHolder {
-
- /**
- * Returns the list of feature from data holder like container / list.
- *
- * @return the list of feature
- */
- List<YangFeature> getFeatureList();
-
- /**
- * Adds feature in feature list.
- *
- * @param feature the feature to be added
- */
- void addFeatureList(YangFeature feature);
-
- /**
- * Sets the list of feature.
- *
- * @param listOfFeature the list of feature to set
- */
- void setListOfFeature(List<YangFeature> listOfFeature);
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangGrouping.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangGrouping.java
deleted file mode 100644
index bf85835..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangGrouping.java
+++ /dev/null
@@ -1,324 +0,0 @@
-/*
- * 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;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
-
-/*-
- * Reference RFC 6020.
- *
- * The "grouping" statement is used to define a reusable block of nodes,
- * which may be used locally in the module, in modules that include it,
- * and by other modules that import from it. It takes one argument,
- * which is an identifier, followed by a block of sub-statements that
- * holds detailed grouping information.
- *
- * The "grouping" statement is not a data definition statement and, as
- * such, does not define any nodes in the schema tree.
- *
- * A grouping is like a "structure" or a "record" in conventional
- * programming languages.
- * Once a grouping is defined, it can be referenced in a "uses"
- * statement. A grouping MUST NOT reference itself,
- * neither directly nor indirectly through a chain of other groupings.
- *
- * If the grouping is defined at the top level of a YANG module or
- * submodule, the grouping's identifier MUST be unique within the
- * module.
- *
- * A grouping is more than just a mechanism for textual substitution,
- * but defines a collection of nodes. Identifiers appearing inside the
- * grouping are resolved relative to the scope in which the grouping is
- * defined, not where it is used. Prefix mappings, type names, grouping
- * names, and extension usage are evaluated in the hierarchy where the
- * "grouping" statement appears. For extensions, this means that
- * extensions are applied to the grouping node, not the uses node.
- *
- * The grouping's sub-statements
- *
- * +--------------+---------+-------------+------------------+
- * | substatement | section | cardinality |data model mapping|
- * +--------------+---------+-------------+------------------+
- * | anyxml | 7.10 | 0..n |-not supported |
- * | choice | 7.9 | 0..n |-child nodes |
- * | container | 7.5 | 0..n |-child nodes |
- * | description | 7.19.3 | 0..1 |-string |
- * | grouping | 7.11 | 0..n |-child nodes |
- * | leaf | 7.6 | 0..n |-YangLeaf |
- * | leaf-list | 7.7 | 0..n |-YangLeafList |
- * | list | 7.8 | 0..n |-child nodes |
- * | reference | 7.19.4 | 0..1 |-string |
- * | status | 7.19.2 | 0..1 |-YangStatus |
- * | typedef | 7.3 | 0..n |-child nodes |
- * | uses | 7.12 | 0..n |-child nodes |
- * +--------------+---------+-------------+------------------+
- */
-
-/**
- * Represents data model node to maintain information defined in YANG grouping.
- */
-public class YangGrouping
- extends YangNode
- implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector, YangTranslatorOperatorNode {
-
- private static final long serialVersionUID = 806201607L;
-
- /**
- * Name of the grouping.
- */
- private String name;
-
- /**
- * Description.
- */
- private String description;
-
- /**
- * List of leaves.
- */
- private List<YangLeaf> listOfLeaf;
-
- /**
- * List of leaf lists.
- */
- private List<YangLeafList> listOfLeafList;
-
- /**
- * Reference of the module.
- */
- private String reference;
-
- /**
- * Status of the node.
- */
- private YangStatusType status;
-
- /**
- * Creates the grouping node.
- */
- public YangGrouping() {
- super(YangNodeType.GROUPING_NODE);
- listOfLeaf = new LinkedList<YangLeaf>();
- listOfLeafList = new LinkedList<YangLeafList>();
- }
-
- /**
- * Returns YANG grouping name.
- *
- * @return YANG grouping name
- */
- @Override
- public String getName() {
- return name;
- }
-
- /**
- * Sets YANG grouping name.
- *
- * @param name YANG grouping name
- */
- @Override
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Returns the description.
- *
- * @return the description
- */
- @Override
- public String getDescription() {
- return description;
- }
-
- /**
- * Sets the description.
- *
- * @param description set the description
- */
- @Override
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Returns the list of leaves.
- *
- * @return the list of leaves
- */
- @Override
- public List<YangLeaf> getListOfLeaf() {
- return listOfLeaf;
- }
-
- /**
- * Sets the list of leaves.
- *
- * @param leafsList the list of leaf to set
- */
- @Override
- public void setListOfLeaf(List<YangLeaf> leafsList) {
- listOfLeaf = leafsList;
- }
-
- /**
- * Adds a leaf.
- *
- * @param leaf the leaf to be added
- */
- @Override
- public void addLeaf(YangLeaf leaf) {
- getListOfLeaf().add(leaf);
- }
-
- /**
- * Returns the list of leaf-list.
- *
- * @return the list of leaf-list
- */
- @Override
- public List<YangLeafList> getListOfLeafList() {
- return listOfLeafList;
- }
-
- /**
- * Sets the list of leaf-list.
- *
- * @param listOfLeafList the list of leaf-list to set
- */
- @Override
- public void setListOfLeafList(List<YangLeafList> listOfLeafList) {
- this.listOfLeafList = listOfLeafList;
- }
-
- /**
- * Adds a leaf-list.
- *
- * @param leafList the leaf-list to be added
- */
- @Override
- public void addLeafList(YangLeafList leafList) {
- getListOfLeafList().add(leafList);
- }
-
- /**
- * Returns the textual reference.
- *
- * @return the reference
- */
- @Override
- public String getReference() {
- return reference;
- }
-
- /**
- * Sets the textual reference.
- *
- * @param reference the reference to set
- */
- @Override
- public void setReference(String reference) {
- this.reference = reference;
- }
-
- /**
- * Returns the status.
- *
- * @return the status
- */
- @Override
- public YangStatusType getStatus() {
- return status;
- }
-
- /**
- * Sets the status.
- *
- * @param status the status to set
- */
- @Override
- public void setStatus(YangStatusType status) {
- this.status = status;
- }
-
- /**
- * Returns the type of the data.
- *
- * @return returns GROUPING_DATA
- */
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.GROUPING_DATA;
- }
-
- /**
- * Validates the data on entering the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnEntry()
- throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-
- /**
- * Validates the data on exiting the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnExit()
- throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-
- /*
- * Reference RFC6020
- *
- * Once a grouping is defined, it can be referenced in a "uses"
- * statement (see Section 7.12). A grouping MUST NOT reference itself,
- * neither directly nor indirectly through a chain of other groupings.
- *
- * If the grouping is defined at the top level of a YANG module or
- * submodule, the grouping's identifier MUST be unique within the
- * module.
- */
- @Override
- public void detectCollidingChild(String identifierName, YangConstructType dataType)
- throws DataModelException {
- // Asks helper to detect colliding child.
- detectCollidingChildUtil(identifierName, dataType, this);
- }
-
- @Override
- public void detectSelfCollision(String identifierName, YangConstructType dataType)
- throws DataModelException {
- if (getName().equals(identifierName)) {
- throw new DataModelException("YANG file error: Duplicate input identifier detected, same as grouping \"" +
- getName() + "\"");
- }
- }
- // TODO A grouping MUST NOT reference itself, neither directly nor indirectly through a chain of other groupings.
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangIdentity.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangIdentity.java
deleted file mode 100644
index 5e57012..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangIdentity.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * 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;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-import java.io.Serializable;
-
-/*-
- * Reference RFC 6020.
- *
- * The "identity" statement is used to define a new globally unique,
- * abstract, and untyped identity. Its only purpose is to denote its
- * name, semantics, and existence. An identity can either be defined
- * from scratch or derived from a base identity. The identity's
- * argument is an identifier that is the name of the identity. It is
- * followed by a block of substatements that holds detailed identity
- * information.
- *
- * The identity's Substatements
- *
- * +--------------+---------+-------------+-----------------------+
- * | substatement | section | cardinality | data model mapping |
- * +--------------+---------+-------------+-----------------------+
- * | base | 7.16.2 | 0..1 | -YangNodeIdentifier |
- * | description | 7.19.3 | 0..1 | -string |
- * | reference | 7.19.4 | 0..1 | -string |
- * | status | 7.19.2 | 0..1 | -YangStatus |
- * +--------------+---------+-------------+-----------------------+
- */
-
-/**
- * Represents data model node to maintain information defined in YANG identity.
- */
-public class YangIdentity extends YangNode implements YangCommonInfo, Parsable, Serializable {
-
- private static final long serialVersionUID = 806201691L;
-
- //Name of the identity.
- private String name;
-
- //Base node of identity.
- private YangBase baseNode;
-
- //Status of YANG identity.
- private YangStatusType status;
-
- //Description of YANG identity.
- private String description;
-
- //YANG reference of the identity.
- private String reference;
-
- //Creates a identity type of node.
- public YangIdentity() {
- super(YangNodeType.IDENTITY_NODE);
- }
-
- /**
- * Returns the name of identity.
- *
- * @return the identity name
- */
- public String getName() {
- return name;
- }
-
- /**
- * Sets the name of identity.
- *
- * @param name the identity name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- @Override
- public YangStatusType getStatus() {
- return status;
- }
-
- @Override
- public void setStatus(YangStatusType status) {
- this.status = status;
- }
-
- @Override
- public String getDescription() {
- return description;
- }
-
- @Override
- public void setDescription(String description) {
- this.description = description;
- }
-
- @Override
- public String getReference() {
- return reference;
- }
-
- @Override
- public void setReference(String reference) {
- this.reference = reference;
- }
-
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.IDENTITY_DATA;
- }
-
- @Override
- public void validateDataOnEntry() throws DataModelException {
- }
-
- @Override
- public void validateDataOnExit() throws DataModelException {
- }
-
- /**
- * Returns base node of identity.
- *
- * @return the base node of identity
- */
- public YangBase getBaseNode() {
- return baseNode;
- }
-
- /**
- * Sets the base node.
- *
- * @param baseNode the base node to set
- */
- public void setBaseNode(YangBase baseNode) {
- this.baseNode = baseNode;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangIdentityRef.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangIdentityRef.java
deleted file mode 100644
index 2019339..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangIdentityRef.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * 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;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.ResolvableStatus;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-import java.io.Serializable;
-
-/*-
- * Reference RFC 6020.
- *
- * The identityref type is used to reference an existing identity.
- *
- * The identityref's base Statement :
- * The "base" statement, which is a substatement to the "type"
- * statement, MUST be present if the type is "identityref". The
- * argument is the name of an identity, as defined by an "identity"
- * statement. If a prefix is present on the identity name, it refers to
- * an identity defined in the module that was imported with that prefix.
- * Otherwise, an identity with the matching name MUST be defined in the
- * current module or an included submodule.
- * Valid values for an identityref are any identities derived from the
- * identityref's base identity. On a particular server, the valid
- * values are further restricted to the set of identities defined in the
- * modules supported by the server.
- */
-
-/**
- * Represents data model node to maintain information defined in YANG identityref.
- */
-public class YangIdentityRef extends YangNode implements Parsable, Resolvable, Serializable {
-
- private static final long serialVersionUID = 806201692L;
-
- // Get referred identity parent information.
- private YangIdentity referredIdentity;
-
- // YANG node identifier.
- private YangNodeIdentifier baseIdentity;
-
- /**
- * Status of resolution. If completely resolved enum value is "RESOLVED",
- * if not enum value is "UNRESOLVED", in case reference of grouping/typedef/identityref/base
- * is added to uses/type/identityref/base but it's not resolved value of enum should be
- * "INTRA_FILE_RESOLVED".
- */
- private ResolvableStatus resolvableStatus;
-
- // Creates a specific identityref of node.
- public YangIdentityRef() {
- super(YangNodeType.IDENTITYREF_NODE);
- baseIdentity = new YangNodeIdentifier();
- resolvableStatus = ResolvableStatus.UNRESOLVED;
- }
-
- @Override
- public ResolvableStatus getResolvableStatus() {
- return resolvableStatus;
- }
-
- @Override
- public void setResolvableStatus(ResolvableStatus resolvableStatus) {
- this.resolvableStatus = resolvableStatus;
- }
-
- @Override
- public Object resolve() throws DataModelException {
-
- // Check if the derived info is present.
- YangIdentity identity = getReferredIdentity();
-
- if (identity == null) {
- throw new DataModelException("Linker Error: Identity information is missing.");
- }
-
- while (identity.getBaseNode() != null) {
- if (identity.getBaseNode().getResolvableStatus() != ResolvableStatus.RESOLVED) {
- setResolvableStatus(ResolvableStatus.INTRA_FILE_RESOLVED);
- return null;
- }
- identity = identity.getBaseNode().getReferredIdentity();
- }
- return null;
- }
-
- /**
- * Returns the YANG base node identifier.
- *
- * @return the YANG base node identifier
- */
- public YangNodeIdentifier getBaseIdentity() {
- return baseIdentity;
- }
-
- /**
- * Sets the YANG node identifier.
- *
- * @param baseIdentity the YANG node identifier to set
- */
- public void setBaseIdentity(YangNodeIdentifier baseIdentity) {
- this.baseIdentity = baseIdentity;
- }
-
- /**
- * Returns the name of identity.
- *
- * @return the identity name
- */
- @Override
- public String getName() {
- return baseIdentity.getName();
- }
-
- /**
- * Sets the name of identity.
- *
- * @param name the identity name to set
- */
- @Override
- public void setName(String name) {
- baseIdentity.setName(name);
- }
-
- /**
- * Sets node identifier.
- *
- * @param nodeIdentifier the node identifier
- */
- public void setNodeIdentifier(YangNodeIdentifier nodeIdentifier) {
- this.baseIdentity = nodeIdentifier;
- }
-
- /**
- * Returns prefix associated with base.
- *
- * @return prefix associated with base
- */
- public String getPrefix() {
- return baseIdentity.getPrefix();
- }
-
- /**
- * Sets prefix associated with base.
- *
- * @param prefix prefix associated with base
- */
- public void setPrefix(String prefix) {
- baseIdentity.setPrefix(prefix);
- }
-
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.IDENTITYREF_DATA;
- }
-
- @Override
- public void validateDataOnEntry() throws DataModelException {
- }
-
- @Override
- public void validateDataOnExit() throws DataModelException {
- }
-
- /**
- * Returns the parent identity node.
- *
- * @return the parent identity node
- */
- public YangIdentity getReferredIdentity() {
- return referredIdentity;
- }
-
- /**
- * Sets the parent identity node.
- *
- * @param referredIdentity the parent identity node to set
- */
- public void setReferredIdentity(YangIdentity referredIdentity) {
- this.referredIdentity = referredIdentity;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangIfFeature.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangIfFeature.java
deleted file mode 100644
index c2c8709..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangIfFeature.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * 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;
-
-import java.io.Serializable;
-import java.util.Iterator;
-import java.util.List;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.ResolvableStatus;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-/*
- * Reference RFC 6020.
- *
- * The "if-feature" statement makes its parent statement conditional.
- * The argument is the name of a feature, as defined by a "feature"
- * statement. The parent statement is implemented by servers that
- * support this feature. If a prefix is present on the feature name, it
- * refers to a feature defined in the module that was imported with that
- * prefix, or the local module if the prefix matches the local module's
- * prefix. Otherwise, a feature with the matching name MUST be defined
- * in the current module or an included submodule.
- *
- * Since submodules cannot include the parent module, any features in
- * the module that need to be exposed to submodules MUST be defined in a
- * submodule. Submodules can then include this submodule to find the
- * definition of the feature.
- */
-
-/**
- * Represents data model node to maintain information defined in YANG if-feature.
- */
-public class YangIfFeature implements Parsable, Resolvable, Serializable {
-
- private static final long serialVersionUID = 806201635L;
-
- /**
- * if-feature argument.
- */
- YangNodeIdentifier name;
-
- /**
- * Referred feature information.
- */
- YangFeature referredFeature;
-
- /**
- * Referred feature parent information.
- */
- YangNode referredFeatureHolder;
-
- /**
- * 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
- * "INTRA_FILE_RESOLVED".
- */
- private ResolvableStatus resolvableStatus;
-
- /**
- * Returns referred feature holder.
- *
- * @return referred feature holder
- */
- public YangNode getReferredFeatureHolder() {
- return referredFeatureHolder;
- }
-
- /**
- * Sets the referred feature holder.
- *
- * @param referredFeatureHolder referred feature holder
- */
- public void setReferredFeatureHolder(YangNode referredFeatureHolder) {
- this.referredFeatureHolder = referredFeatureHolder;
- }
-
- /**
- * Returns prefix associated with identifier.
- *
- * @return prefix associated with identifier
- */
- public String getPrefix() {
- return name.getPrefix();
- }
-
- /**
- * Sets prefix associated with identifier.
- *
- * @param prefix prefix associated with identifier
- */
- public void setPrefix(String prefix) {
- name.setPrefix(prefix);
- }
-
- /**
- * Returns referred feature associated with if-feature.
- *
- * @return referred feature associated with if-feature
- */
- public YangFeature getReferredFeature() {
- return referredFeature;
- }
-
- /**
- * Sets referred feature associated with if-feature.
- *
- * @param referredFeature referred feature associated with if-feature
- */
- public void setReferredFeature(YangFeature referredFeature) {
- this.referredFeature = referredFeature;
- }
-
- /**
- * Returns the YANG name of if-feature.
- *
- * @return the name of if-feature as defined in YANG file
- */
- public YangNodeIdentifier getName() {
- return name;
- }
-
- /**
- * Sets the YANG name of if-feature.
- *
- * @param name the name of if-feature as defined in YANG file
- */
- public void setName(YangNodeIdentifier name) {
- this.name = name;
- }
-
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.IF_FEATURE_DATA;
- }
-
- @Override
- public void validateDataOnEntry() throws DataModelException {
- // do nothing, no validation required for if-feature
- }
-
- @Override
- public void validateDataOnExit() throws DataModelException {
- // do nothing, no validation required for if-feature
- }
-
- @Override
- public ResolvableStatus getResolvableStatus() {
- return resolvableStatus;
- }
-
- @Override
- public void setResolvableStatus(ResolvableStatus resolvableStatus) {
- this.resolvableStatus = resolvableStatus;
- }
-
- @Override
- public Object resolve() throws DataModelException {
- YangFeature feature = getReferredFeature();
-
- // check whether feature has if-feature
- List<YangIfFeature> ifFeatureList = feature.getIfFeatureList();
- if (ifFeatureList != null && !ifFeatureList.isEmpty()) {
- Iterator<YangIfFeature> ifFeatureIterator = ifFeatureList.iterator();
- while (ifFeatureIterator.hasNext()) {
- YangIfFeature ifFeature = ifFeatureIterator.next();
- if (ifFeature.getResolvableStatus() != ResolvableStatus.RESOLVED) {
- setResolvableStatus(ResolvableStatus.INTRA_FILE_RESOLVED);
- return null;
- }
- }
- }
- return null;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangIfFeatureHolder.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangIfFeatureHolder.java
deleted file mode 100644
index 46c3233..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangIfFeatureHolder.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*Copyright 2016.year 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;
-
-import java.util.List;
-
-/**
- * Abstraction of if-feature entity. It is used to abstract the data holders of if-feature.
- */
-public interface YangIfFeatureHolder {
-
- /**
- * Returns the list of if-feature from data holder like container / list.
- *
- * @return the list of if-feature
- */
- List<YangIfFeature> getIfFeatureList();
-
- /**
- * Adds if-feature in if-feature list.
- *
- * @param ifFeature the if-feature to be added
- */
- void addIfFeatureList(YangIfFeature ifFeature);
-
- /**
- * Sets the list of if-feature.
- *
- * @param ifFeatureList the list of if-feature to set
- */
- void setIfFeatureList(List<YangIfFeature> ifFeatureList);
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangImport.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangImport.java
deleted file mode 100644
index f6405e1..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangImport.java
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * 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;
-
-import java.io.Serializable;
-import java.util.Date;
-import java.util.Set;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.findReferredNode;
-
-/*
- * Reference:RFC 6020.
- * The "import" statement makes definitions from one module available
- * inside another module or submodule. The argument is the name of the
- * module to import, and the statement is followed by a block of
- * sub statements that holds detailed import information.
- * When a module is imported, the importing module may:
- * o use any grouping and typedef defined at the top level in the
- * imported module or its submodules.
- *
- * o use any extension, feature, and identity defined in the imported
- * module or its submodules.
- *
- * o use any node in the imported module's schema tree in "must",
- * "path", and "when" statements, or as the target node in "augment"
- * and "deviation" statements.
- *
- * The mandatory "prefix" sub statement assigns a prefix for the imported
- * module that is scoped to the importing module or submodule. Multiple
- * "import" statements may be specified to import from different
- * modules.
- * When the optional "revision-date" sub-statement is present, any
- * typedef, grouping, extension, feature, and identity referenced by
- * definitions in the local module are taken from the specified revision
- * of the imported module. It is an error if the specified revision of
- * the imported module does not exist. If no "revision-date"
- * sub-statement is present, it is undefined from which revision of the
- * module they are taken.
- *
- * Multiple revisions of the same module MUST NOT be imported.
- *
- * The import's Substatements
- *
- * +---------------+---------+-------------+------------------+
- * | substatement | section | cardinality |data model mapping|
- * +---------------+---------+-------------+------------------+
- * | prefix | 7.1.4 | 1 | string |
- * | revision-date | 7.1.5.1 | 0..1 | Date |
- * +---------------+---------+-------------+------------------+
- */
-
-/**
- * Represents the information about the imported modules.
- */
-public class YangImport
- implements Parsable, LocationInfo, Serializable {
-
- private static final long serialVersionUID = 806201642L;
-
- /**
- * Name of the module that is being imported.
- */
- private String name;
-
- /**
- * Prefix used to identify the entities from the imported module.
- */
- private String prefixId;
-
- /**
- * Reference:RFC 6020.
- * <p>
- * The import's "revision-date" statement is used to specify the exact
- * version of the module to import. The "revision-date" statement MUST match
- * the most recent "revision" statement in the imported module. organization
- * which defined the YANG module.
- */
- private Date revision;
-
- /**
- * Reference to node which is imported.
- */
- private YangNode importedNode;
-
- // Error Line number.
- private transient int lineNumber;
-
- // Error character position.
- private transient int charPosition;
-
- /**
- * Creates a YANG import.
- */
- public YangImport() {
- }
-
- /**
- * Returns the imported module name.
- *
- * @return the module name
- */
- public String getModuleName() {
- return name;
- }
-
- /**
- * Sets module name.
- *
- * @param moduleName the module name to set
- */
- public void setModuleName(String moduleName) {
- name = moduleName;
- }
-
- /**
- * Returns the prefix used to identify the entities from the imported module.
- *
- * @return the prefix used to identify the entities from the imported
- * module
- */
- public String getPrefixId() {
- return prefixId;
- }
-
- /**
- * Sets prefix identifier.
- *
- * @param prefixId set the prefix identifier of the imported module
- */
- public void setPrefixId(String prefixId) {
- this.prefixId = prefixId;
- }
-
- /**
- * Returns the revision of the imported module.
- *
- * @return the revision of the imported module
- */
- public Date getRevision() {
- return revision;
- }
-
- /**
- * Sets the revision of the imported module.
- *
- * @param rev set the revision of the imported module
- */
- public void setRevision(Date rev) {
- revision = rev;
- }
-
- /**
- * Returns the type of the parsed data.
- *
- * @return returns IMPORT_DATA
- */
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.IMPORT_DATA;
- }
-
- /**
- * Validates the data on entering the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnEntry()
- throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
-
- }
-
- /**
- * Validates the data on exiting the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnExit()
- throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
-
- }
-
- /**
- * Returns imported node.
- *
- * @return imported node
- */
- public YangNode getImportedNode() {
- return importedNode;
- }
-
- /**
- * Sets imported node.
- *
- * @param importedNode imported node
- */
- public void setImportedNode(YangNode importedNode) {
- this.importedNode = importedNode;
- }
-
- @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) {
- charPosition = charPositionInLine;
- }
-
- /**
- * Adds reference to an import.
- *
- * @param yangNodeSet YANG file info set
- * @throws DataModelException a violation of data model rules
- */
- public void addReferenceToImport(Set<YangNode> yangNodeSet) throws DataModelException {
- String importedModuleName = getModuleName();
- Date importedModuleRevision = getRevision();
- YangNode moduleNode = null;
- /*
- * Find the imported module node for a given module name with a
- * specified revision if revision is not null.
- */
- if (importedModuleRevision != null) {
- String importedModuleNameWithRevision = importedModuleName + "@" + importedModuleRevision;
- moduleNode = findReferredNode(yangNodeSet, importedModuleNameWithRevision);
- }
-
- /*
- * Find the imported module node for a given module name without
- * revision if can't find with revision.
- */
- if (moduleNode == null) {
- moduleNode = findReferredNode(yangNodeSet, importedModuleName);
- }
-
- if (moduleNode != null) {
- if (moduleNode instanceof YangModule) {
- if (getRevision() == null) {
- setImportedNode(moduleNode);
- return;
- }
- // Match revision if import is with revision.
- if (((YangModule) moduleNode).getRevision().getRevDate().equals(importedModuleRevision)) {
- setImportedNode(moduleNode);
- return;
- }
- }
- }
-
- // Exception if there is no match.
- DataModelException exception = new DataModelException("YANG file error : Imported module "
- + importedModuleName + " with revision " + importedModuleRevision + " is not found.");
- exception.setLine(getLineNumber());
- exception.setCharPosition(getCharPosition());
- throw exception;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangInclude.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangInclude.java
deleted file mode 100644
index 48b796f..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangInclude.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * 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;
-
-import java.io.Serializable;
-import java.util.Date;
-import java.util.Set;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.findReferredNode;
-
-/*
- * Reference:RFC 6020.
- * The "include" statement is used to make content from a submodule
- * available to that submodule's parent module, or to another submodule
- * of that parent module. The argument is an identifier that is the
- * name of the submodule to include.
- * The includes's Substatements
- *
- * +---------------+---------+-------------+------------------+
- * | substatement | section | cardinality |data model mapping|
- * +---------------+---------+-------------+------------------+
- * | revision-date | 7.1.5.1 | 0..1 | string |
- * +---------------+---------+-------------+------------------+
- */
-
-/**
- * Represents the information about the included sub-modules.
- */
-public class YangInclude
- implements Parsable, LocationInfo, Serializable {
-
- private static final long serialVersionUID = 806201644L;
-
- /**
- * Name of the sub-module that is being included.
- */
- private String subModuleName;
-
- /**
- * The include's "revision-date" statement is used to specify the exact
- * version of the submodule to import.
- */
- private Date revision;
-
- /**
- * Reference to node which is included.
- */
- private YangNode includedNode;
-
- // Error Line number.
- private transient int lineNumber;
-
- // Error character position.
- private transient int charPosition;
-
- /**
- * Creates a YANG include.
- */
- public YangInclude() {
- }
-
- /**
- * Returns the name of included sub-module.
- *
- * @return the sub-module name
- */
- public String getSubModuleName() {
- return subModuleName;
- }
-
- /**
- * Sets the name of included sub-modules.
- *
- * @param subModuleName the sub-module name to set
- */
- public void setSubModuleName(String subModuleName) {
- this.subModuleName = subModuleName;
- }
-
- /**
- * Returns the revision.
- *
- * @return the revision
- */
- public Date getRevision() {
- return revision;
- }
-
- /**
- * Sets the revision.
- *
- * @param revision the revision to set
- */
- public void setRevision(Date revision) {
- this.revision = revision;
- }
-
- /**
- * Returns the type of parsed data.
- *
- * @return returns INCLUDE_DATA
- */
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.INCLUDE_DATA;
- }
-
- /**
- * Validates the data on entering the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnEntry()
- throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
-
- }
-
- /**
- * Validates the data on exiting the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnExit()
- throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
-
- }
-
- public YangNode getIncludedNode() {
- return includedNode;
- }
-
- public void setIncludedNode(YangNode includedNode) {
- this.includedNode = includedNode;
- }
-
- @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) {
- charPosition = charPositionInLine;
- }
-
- /**
- * Adds reference to an include.
- *
- * @param yangNodeSet YANG node set
- * @return YANG sub module node
- * @throws DataModelException a violation of data model rules
- */
- public YangSubModule addReferenceToInclude(Set<YangNode> yangNodeSet) throws DataModelException {
- String includedSubModuleName = getSubModuleName();
- Date includedSubModuleRevision = getRevision();
- YangNode subModuleNode = null;
-
- /*
- * Find the included sub-module node for a given module name with a
- * specified revision if revision is not null.
- */
- if (includedSubModuleRevision != null) {
- String includedSubModuleNameWithRevision = includedSubModuleName + "@" + includedSubModuleRevision;
- subModuleNode = findReferredNode(yangNodeSet, includedSubModuleNameWithRevision);
- }
-
- /*
- * Find the imported sub module node for a given module name without
- * revision if can't find with revision.
- */
- if (subModuleNode == null) {
- subModuleNode = findReferredNode(yangNodeSet, includedSubModuleName);
- }
-
- if (subModuleNode != null) {
- if (subModuleNode instanceof YangSubModule) {
- if (getRevision() == null) {
- setIncludedNode(subModuleNode);
- return (YangSubModule) subModuleNode;
- }
- // Match revision if inclusion is with revision.
- if (((YangSubModule) subModuleNode).getRevision().getRevDate().equals(includedSubModuleRevision)) {
- setIncludedNode(subModuleNode);
- return (YangSubModule) subModuleNode;
- }
- }
- }
- // Exception if there is no match.
- DataModelException exception = new DataModelException("YANG file error : Included sub module " +
- includedSubModuleName + "with a given revision is not found.");
- exception.setLine(getLineNumber());
- exception.setCharPosition(getCharPosition());
- throw exception;
- }
-
- /**
- * Reports an error when included sub-module doesn't meet condition that
- * "included sub-modules should belong module, as defined by the
- * "belongs-to" statement or sub-modules are only allowed to include other
- * sub-modules belonging to the same module.
- *
- * @throws DataModelException a violation in data model rule
- */
- public void reportIncludeError() throws DataModelException {
- DataModelException exception = new DataModelException("YANG file error : Included sub-module " +
- getSubModuleName() + "doesn't belongs to parent module also it doesn't belongs" +
- "to sub-module belonging to the same parent module.");
- exception.setLine(getLineNumber());
- exception.setCharPosition(getCharPosition());
- throw exception;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangInput.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangInput.java
deleted file mode 100644
index 272a6e2..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangInput.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * 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;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
-
-/*
- * Reference RFC 6020.
- *
- * The "input" statement, which is optional, is used to define input
- * parameters to the RPC operation. It does not take an argument. The
- * substatements to "input" define nodes under the RPC's input node.
- *
- * If a leaf in the input tree has a "mandatory" statement with the
- * value "true", the leaf MUST be present in a NETCONF RPC invocation.
- * Otherwise, the server MUST return a "missing-element" error.
- *
- * If a leaf in the input tree has a default value, the NETCONF server
- * MUST use this value in the same cases as described in Section 7.6.1.
- * In these cases, the server MUST operationally behave as if the leaf
- * was present in the NETCONF RPC invocation with the default value as
- * its value.
- *
- * If a "config" statement is present for any node in the input tree,
- * the "config" statement is ignored.
- *
- * If any node has a "when" statement that would evaluate to false, then
- * this node MUST NOT be present in the input tree.
- *
- * The input substatements
- *
- * +--------------+---------+-------------+------------------+
- * | substatement | section | cardinality |data model mapping|
- * +--------------+---------+-------------+------------------+
- * | anyxml | 7.10 | 0..n | -not supported |
- * | choice | 7.9 | 0..n | -child nodes |
- * | container | 7.5 | 0..n | -child nodes |
- * | grouping | 7.11 | 0..n | -child nodes |
- * | leaf | 7.6 | 0..n | -YangLeaf |
- * | leaf-list | 7.7 | 0..n | -YangLeafList |
- * | list | 7.8 | 0..n | -child nodes |
- * | typedef | 7.3 | 0..n | -child nodes |
- * | uses | 7.12 | 0..n | -child nodes |
- * +--------------+---------+-------------+------------------+
- */
-
-/**
- * Represents data model node to maintain information defined in YANG input.
- */
-public class YangInput
- extends YangNode
- implements YangLeavesHolder, Parsable, CollisionDetector, YangAugmentableNode, YangIsFilterContentNodes {
-
- private static final long serialVersionUID = 806201608L;
-
- /**
- * Name of the input.
- */
- private String name;
-
- /**
- * List of leaves contained.
- */
- private List<YangLeaf> listOfLeaf;
-
- /**
- * List of leaf-lists contained.
- */
- private List<YangLeafList> listOfLeafList;
-
- private List<YangAugmentedInfo> yangAugmentedInfo = new ArrayList<>();
-
- /**
- * Create a rpc input node.
- */
- public YangInput() {
- super(YangNodeType.INPUT_NODE);
- listOfLeaf = new LinkedList<>();
- listOfLeafList = new LinkedList<>();
- }
-
- @Override
- public void detectCollidingChild(String identifierName, YangConstructType dataType)
- throws DataModelException {
- // Detect colliding child.
- detectCollidingChildUtil(identifierName, dataType, this);
- }
-
- @Override
- public void detectSelfCollision(String identifierName, YangConstructType dataType)
- throws DataModelException {
- if (getName().equals(identifierName)) {
- throw new DataModelException("YANG file error: Duplicate input identifier detected, same as input \""
- + getName() + "\"");
- }
- }
-
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.INPUT_DATA;
- }
-
- @Override
- public void validateDataOnEntry()
- throws DataModelException {
- //TODO: implement the method.
- }
-
- @Override
- public void validateDataOnExit()
- throws DataModelException {
- //TODO: implement the method.
- }
-
- @Override
- public List<YangLeaf> getListOfLeaf() {
- return listOfLeaf;
- }
-
- @Override
- public void setListOfLeaf(List<YangLeaf> leafsList) {
- listOfLeaf = leafsList;
- }
-
- @Override
- public void addLeaf(YangLeaf leaf) {
- getListOfLeaf().add(leaf);
- }
-
- @Override
- public List<YangLeafList> getListOfLeafList() {
- return listOfLeafList;
- }
-
- @Override
- public void setListOfLeafList(List<YangLeafList> listOfLeafList) {
- this.listOfLeafList = listOfLeafList;
- }
-
- @Override
- public void addLeafList(YangLeafList leafList) {
- getListOfLeafList().add(leafList);
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public void setName(String name) {
- this.name = name;
- }
-
- @Override
- public void addAugmentation(YangAugmentedInfo augmentInfo) {
- yangAugmentedInfo.add(augmentInfo);
- }
-
- @Override
- public void removeAugmentation(YangAugmentedInfo augmentInfo) {
- yangAugmentedInfo.remove(augmentInfo);
- }
-
- @Override
- public List<YangAugmentedInfo> getAugmentedInfoList() {
- return yangAugmentedInfo;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangIsFilterContentNodes.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangIsFilterContentNodes.java
deleted file mode 100644
index 196305c..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangIsFilterContentNodes.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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;
-
-/**
- * Represent the YANG nodes which can contain is filter content match.
- */
-public interface YangIsFilterContentNodes {
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeaf.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeaf.java
deleted file mode 100644
index 3060fd4..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeaf.java
+++ /dev/null
@@ -1,423 +0,0 @@
-/*
- * 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;
-
-import java.io.Serializable;
-import java.util.LinkedList;
-import java.util.List;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-/*
- * Reference:RFC 6020.
- * The "leaf" statement is used to define a leaf node in the schema
- * tree. It takes one argument, which is an identifier, followed by a
- * block of sub-statements that holds detailed leaf information.
- *
- * A leaf node has a value, but no child nodes in the data tree.
- * Conceptually, the value in the data tree is always in the canonical
- * form.
- *
- * A leaf node exists in zero or one instances in the data tree.
- *
- * The "leaf" statement is used to define a scalar variable of a
- * particular built-in or derived type.
- *
- * The leaf's sub-statements
- *
- * +--------------+---------+-------------+------------------+
- * | substatement | section | cardinality |data model mapping|
- * +--------------+---------+-------------+------------------+
- * | config | 7.19.1 | 0..1 | - boolean |
- * | default | 7.6.4 | 0..1 | - string |
- * | description | 7.19.3 | 0..1 | - string |
- * | if-feature | 7.18.2 | 0..n | - YangIfFeature |
- * | mandatory | 7.6.5 | 0..1 | - boolean |
- * | must | 7.5.3 | 0..n | - YangMust |
- * | reference | 7.19.4 | 0..1 | - string |
- * | status | 7.19.2 | 0..1 | - YangStatus |
- * | type | 7.6.3 | 1 | - YangType |
- * | units | 7.3.3 | 0..1 | - String |
- * | when | 7.19.5 | 0..1 | - YangWhen |
- * +--------------+---------+-------------+------------------+
- */
-
-/**
- * Represents leaf data represented in YANG.
- */
-public class YangLeaf
- implements YangCommonInfo, Parsable, Cloneable, Serializable,
- YangMustHolder, YangIfFeatureHolder, YangWhenHolder, YangDataNode {
-
- private static final long serialVersionUID = 806201635L;
-
- /**
- * Name of leaf.
- */
- private String name;
-
- /**
- * If the leaf is a config parameter.
- */
- private Boolean isConfig;
-
- /**
- * description of leaf.
- */
- private String description;
-
- /**
- * If mandatory leaf.
- */
- private boolean isMandatory;
-
- /**
- * The textual reference to this leaf.
- */
- private String reference;
-
- /**
- * Status of leaf in YANG definition.
- */
- private YangStatusType status = YangStatusType.CURRENT;
-
- /**
- * Textual units info.
- */
- private String units;
-
- /**
- * Data type of the leaf.
- */
- private YangType<?> dataType;
-
- /**
- * Default value in string, needs to be converted to the target object,
- * based on the type.
- */
- private String defaultValueInString;
-
- /**
- * When data of the leaf.
- */
- private YangWhen when;
-
- /**
- * YANG Node in which the leaf is contained.
- */
- private transient YangLeavesHolder containedIn;
-
- /**
- * List of must statement constraints.
- */
- private List<YangMust> mustConstraintList;
-
- /**
- * List of if-feature.
- */
- private List<YangIfFeature> ifFeatureList;
-
- /**
- * Creates a YANG leaf.
- */
- public YangLeaf() {
- }
-
- /**
- * Returns the name of leaf.
- *
- * @return the leaf name
- */
- public String getName() {
- return name;
- }
-
- /**
- * Sets the name of leaf.
- *
- * @param leafName the leaf name to set
- */
- public void setLeafName(String leafName) {
- name = leafName;
- }
-
- /**
- * Returns the config flag.
- *
- * @return if config flag
- */
- public Boolean isConfig() {
- return isConfig;
- }
-
- /**
- * Sets the config flag.
- *
- * @param isCfg the flag value to set
- */
- public void setConfig(boolean isCfg) {
- isConfig = isCfg;
- }
-
- /**
- * Returns the when.
- *
- * @return the when
- */
- @Override
- public YangWhen getWhen() {
- return when;
- }
-
- /**
- * Sets the when.
- *
- * @param when the when to set
- */
- @Override
- public void setWhen(YangWhen when) {
- this.when = when;
- }
-
- /**
- * Returns the description.
- *
- * @return the description
- */
- @Override
- public String getDescription() {
- return description;
- }
-
- /**
- * Sets the description.
- *
- * @param description set the description
- */
- @Override
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Returns if the leaf is mandatory.
- *
- * @return if leaf is mandatory
- */
- public boolean isMandatory() {
- return isMandatory;
- }
-
- /**
- * Sets if the leaf is mandatory.
- *
- * @param isReq if the leaf is mandatory
- */
- public void setMandatory(boolean isReq) {
- isMandatory = isReq;
- }
-
- /**
- * Returns the textual reference.
- *
- * @return the reference
- */
- @Override
- public String getReference() {
- return reference;
- }
-
- /**
- * Sets the textual reference.
- *
- * @param reference the reference to set
- */
- @Override
- public void setReference(String reference) {
- this.reference = reference;
- }
-
- /**
- * Returns the status.
- *
- * @return the status
- */
- @Override
- public YangStatusType getStatus() {
- return status;
- }
-
- /**
- * Sets the status.
- *
- * @param status the status to set
- */
- @Override
- public void setStatus(YangStatusType status) {
- this.status = status;
- }
-
- /**
- * Returns the units.
- *
- * @return the units
- */
- public String getUnits() {
- return units;
- }
-
- /**
- * Sets the units.
- *
- * @param units the units to set
- */
- public void setUnits(String units) {
- this.units = units;
- }
-
- /**
- * Returns the default value.
- *
- * @return the default value
- */
- public String getDefaultValueInString() {
- return defaultValueInString;
- }
-
- /**
- * Sets the default value.
- *
- * @param defaultValueInString the default value
- */
- public void setDefaultValueInString(String defaultValueInString) {
- this.defaultValueInString = defaultValueInString;
- }
-
- /**
- * Returns the data type.
- *
- * @return the data type
- */
- public YangType<?> getDataType() {
- return dataType;
- }
-
- /**
- * Sets the data type.
- *
- * @param dataType the data type to set
- */
- public void setDataType(YangType<?> dataType) {
- this.dataType = dataType;
- }
-
- /**
- * Retrieves the YANG node in which the leaf is defined.
- *
- * @return the YANG node in which the leaf is defined
- */
- public YangLeavesHolder getContainedIn() {
- return containedIn;
- }
-
- /**
- * Assigns the YANG node in which the leaf is defined.
- *
- * @param containedIn the YANG node in which the leaf is defined
- */
- public void setContainedIn(YangLeavesHolder containedIn) {
- this.containedIn = containedIn;
- }
-
- @Override
- public YangLeaf clone()
- throws CloneNotSupportedException {
- return (YangLeaf) super.clone();
- }
-
- /**
- * Returns the type of the parsed data.
- *
- * @return returns LEAF_DATA
- */
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.LEAF_DATA;
- }
-
- /**
- * Validates the data on entering the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnEntry()
- throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
-
- }
-
- /**
- * Validates the data on exiting the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnExit()
- throws DataModelException {
- if (defaultValueInString != null && !defaultValueInString.isEmpty() && dataType != null) {
- dataType.isValidValue(defaultValueInString);
- }
- }
-
- @Override
- public List<YangMust> getListOfMust() {
- return mustConstraintList;
- }
-
- @Override
- public void setListOfMust(List<YangMust> mustConstraintList) {
- this.mustConstraintList = mustConstraintList;
- }
-
- @Override
- public void addMust(YangMust must) {
- if (getListOfMust() == null) {
- setListOfMust(new LinkedList<>());
- }
- getListOfMust().add(must);
- }
-
- @Override
- public List<YangIfFeature> getIfFeatureList() {
- return ifFeatureList;
- }
-
- @Override
- public void addIfFeatureList(YangIfFeature ifFeature) {
- if (getIfFeatureList() == null) {
- setIfFeatureList(new LinkedList<>());
- }
- getIfFeatureList().add(ifFeature);
- }
-
- @Override
- public void setIfFeatureList(List<YangIfFeature> ifFeatureList) {
- this.ifFeatureList = ifFeatureList;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeafList.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeafList.java
deleted file mode 100644
index cbb2038..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeafList.java
+++ /dev/null
@@ -1,441 +0,0 @@
-/*
- * 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;
-
-import java.io.Serializable;
-import java.util.LinkedList;
-import java.util.List;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-/*
- * Reference:RFC 6020.
- * Where the "leaf" statement is used to define a simple scalar variable
- * of a particular type, the "leaf-list" statement is used to define an
- * array of a particular type. The "leaf-list" statement takes one
- * argument, which is an identifier, followed by a block of
- * sub-statements that holds detailed leaf-list information.
- *
- * The values in a leaf-list MUST be unique.
- *
- * The leaf-list's sub-statements
- *
- * +--------------+---------+-------------+------------------+
- * | substatement | section | cardinality |data model mapping|
- * +--------------+---------+-------------+------------------+
- * | config | 7.19.1 | 0..1 | -boolean |
- * | description | 7.19.3 | 0..1 | -string |
- * | if-feature | 7.18.2 | 0..n | -YangIfFeature |
- * | max-elements | 7.7.4 | 0..1 | -int |
- * | min-elements | 7.7.3 | 0..1 | -int |
- * | must | 7.5.3 | 0..n | -YangMust |
- * | ordered-by | 7.7.5 | 0..1 | -TODO |
- * | reference | 7.19.4 | 0..1 | -string |
- * | status | 7.19.2 | 0..1 | -YangStatus |
- * | type | 7.4 | 1 | -YangType |
- * | units | 7.3.3 | 0..1 | -string |
- * | when | 7.19.5 | 0..1 | -YangWhen |
- * +--------------+---------+-------------+------------------+
- */
-
-/**
- * Represents leaf-list data represented in YANG.
- */
-public class YangLeafList
- implements YangCommonInfo, Parsable, Cloneable, Serializable,
- YangMustHolder, YangWhenHolder, YangIfFeatureHolder, YangDataNode {
-
- private static final long serialVersionUID = 806201637L;
-
- /**
- * Name of leaf-list.
- */
- private String name;
-
- /**
- * If the leaf-list is a config parameter.
- */
- private Boolean isConfig;
-
- /**
- * Description of leaf-list.
- */
- private String description;
-
- /**
- * Reference:RFC 6020.
- *
- * The "max-elements" statement, which is optional, takes as an argument a
- * positive integer or the string "unbounded", which puts a constraint on
- * valid list entries. A valid leaf-list or list always has at most
- * max-elements entries.
- *
- * If no "max-elements" statement is present, it defaults to "unbounded".
- */
- private YangMaxElement maxElement;
-
- /**
- * Reference:RFC 6020.
- *
- * The "min-elements" statement, which is optional, takes as an argument a
- * non-negative integer that puts a constraint on valid list entries. A
- * valid leaf-list or list MUST have at least min-elements entries.
- *
- * If no "min-elements" statement is present, it defaults to zero.
- *
- * The behavior of the constraint depends on the type of the leaf-list's or
- * list's closest ancestor node in the schema tree that is not a non-
- * presence container:
- *
- * o If this ancestor is a case node, the constraint is enforced if any
- * other node from the case exists.
- *
- * o Otherwise, it is enforced if the ancestor node exists.
- */
- private YangMinElement minElements;
-
- /**
- * The textual reference to this leaf-list.
- */
- private String reference;
-
- /**
- * Status of the leaf-list in the YANG definition.
- */
- private YangStatusType status = YangStatusType.CURRENT;
-
- /**
- * Textual units.
- */
- private String units;
-
- /**
- * Data type of leaf-list.
- */
- private YangType<?> dataType;
-
- /**
- * YANG Node in which the leaf is contained.
- */
- private transient YangLeavesHolder containedIn;
-
- /**
- * List of must statement constraints.
- */
- private List<YangMust> mustConstraintList;
-
- /**
- * When data of the leaf.
- */
- private YangWhen when;
-
- /**
- * List of if-feature.
- */
- private List<YangIfFeature> ifFeatureList;
-
- /**
- * Creates a YANG leaf-list.
- */
- public YangLeafList() {
- setMinElements(new YangMinElement());
- setMaxElements(new YangMaxElement());
- }
-
- /**
- * Returns the leaf-list name.
- *
- * @return the leaf-list name
- */
- public String getName() {
- return name;
- }
-
- /**
- * Sets the leaf-list name.
- *
- * @param leafListName the leaf-list name to set
- */
- public void setLeafName(String leafListName) {
- name = leafListName;
- }
-
- /**
- * Returns the config flag.
- *
- * @return the config flag
- */
- public Boolean isConfig() {
- return isConfig;
- }
-
- /**
- * Sets the config flag.
- *
- * @param isCfg the config flag
- */
- public void setConfig(boolean isCfg) {
- isConfig = isCfg;
- }
-
- /**
- * Returns the when.
- *
- * @return the when
- */
- @Override
- public YangWhen getWhen() {
- return when;
- }
-
- /**
- * Sets the when.
- *
- * @param when the when to set
- */
- @Override
- public void setWhen(YangWhen when) {
- this.when = when;
- }
-
- /**
- * Returns the description.
- *
- * @return the description
- */
- @Override
- public String getDescription() {
- return description;
- }
-
- /**
- * Sets the description.
- *
- * @param description set the description
- */
- @Override
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Returns the maximum elements number.
- *
- * @return the maximum elements number
- */
- public YangMaxElement getMaxElements() {
- return maxElement;
- }
-
- /**
- * Sets the maximum elements number.
- *
- * @param maxElement maximum elements number
- */
- public void setMaxElements(YangMaxElement maxElement) {
- this.maxElement = maxElement;
- }
-
- /**
- * Returns the minimum elements number.
- *
- * @return the minimum elements number
- */
- public YangMinElement getMinElements() {
- return minElements;
- }
-
- /**
- * Sets the minimum elements number.
- *
- * @param minElements the minimum elements number
- */
- public void setMinElements(YangMinElement minElements) {
- this.minElements = minElements;
- }
-
- /**
- * Returns the textual reference.
- *
- * @return the reference
- */
- @Override
- public String getReference() {
- return reference;
- }
-
- /**
- * Sets the textual reference.
- *
- * @param reference the reference to set
- */
- @Override
- public void setReference(String reference) {
- this.reference = reference;
- }
-
- /**
- * Returns the status.
- *
- * @return the status
- */
- @Override
- public YangStatusType getStatus() {
- return status;
- }
-
- /**
- * Sets the status.
- *
- * @param status the status to set
- */
- @Override
- public void setStatus(YangStatusType status) {
- this.status = status;
- }
-
- /**
- * Returns the units.
- *
- * @return the units
- */
- public String getUnits() {
- return units;
- }
-
- /**
- * Sets the units.
- *
- * @param units the units to set
- */
- public void setUnits(String units) {
- this.units = units;
- }
-
- /**
- * Returns the data type.
- *
- * @return the data type
- */
- public YangType<?> getDataType() {
- return dataType;
- }
-
- /**
- * Sets the data type.
- *
- * @param dataType the data type to set
- */
- public void setDataType(YangType<?> dataType) {
- this.dataType = dataType;
- }
-
- /**
- * Retrieves the YANG node in which the leaf is defined.
- *
- * @return the YANG node in which the leaf is defined
- */
- public YangLeavesHolder getContainedIn() {
- return containedIn;
- }
-
- /**
- * Assigns the YANG node in which the leaf is defined.
- *
- * @param containedIn the YANG node in which the leaf is defined
- */
- public void setContainedIn(YangLeavesHolder containedIn) {
- this.containedIn = containedIn;
- }
-
- @Override
- public YangLeafList clone()
- throws CloneNotSupportedException {
- return (YangLeafList) super.clone();
- }
-
- /**
- * Returns the type of the parsed data.
- *
- * @return returns LEAF_LIST_DATA
- */
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.LEAF_LIST_DATA;
- }
-
- /**
- * Validates the data on entering the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnEntry()
- throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
-
- }
-
- /**
- * Validates the data on exiting the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnExit()
- throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
-
- }
-
- @Override
- public List<YangIfFeature> getIfFeatureList() {
- return ifFeatureList;
- }
-
- @Override
- public void addIfFeatureList(YangIfFeature ifFeature) {
- if (getIfFeatureList() == null) {
- setIfFeatureList(new LinkedList<>());
- }
- getIfFeatureList().add(ifFeature);
- }
-
- @Override
- public void setIfFeatureList(List<YangIfFeature> ifFeatureList) {
- this.ifFeatureList = ifFeatureList;
- }
-
- @Override
- public List<YangMust> getListOfMust() {
- return mustConstraintList;
- }
-
- @Override
- public void setListOfMust(List<YangMust> mustConstraintList) {
- this.mustConstraintList = mustConstraintList;
- }
-
- @Override
- public void addMust(YangMust must) {
- if (getListOfMust() == null) {
- setListOfMust(new LinkedList<>());
- }
- getListOfMust().add(must);
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeafRef.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeafRef.java
deleted file mode 100644
index 104d701..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeafRef.java
+++ /dev/null
@@ -1,523 +0,0 @@
-/*
- * 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;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.ResolvableStatus;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-
-import java.io.Serializable;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.INTRA_FILE_RESOLVED;
-import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.RESOLVED;
-import static org.onosproject.yangutils.datamodel.utils.YangErrMsgConstants.DATA_MISSING_ERROR_TAG;
-import static org.onosproject.yangutils.datamodel.utils.YangErrMsgConstants.ERROR_PATH_LEAFREF_LEAF;
-import static org.onosproject.yangutils.datamodel.utils.YangErrMsgConstants.INSTANCE_REQUIRED_ERROR_APP_TAG;
-
-/*
- * Reference:RFC 6020.
- * The leafref type is used to reference a particular leaf instance in
- * the data tree. The "path" substatement (Section 9.9.2) selects a set
- * of leaf instances, and the leafref value space is the set of values
- * of these leaf instances.
- */
-
-/**
- * Represents the leafref information.
- *
- * @param <T> YANG leafref info
- */
-public class YangLeafRef<T> implements Parsable, Resolvable, Serializable, YangIfFeatureHolder,
- YangXPathResolver, YangAppErrorHolder, LocationInfo {
-
- private static final long serialVersionUID = 286201644L;
-
- /**
- * YANG data type.
- */
- private YangType effectiveDataType;
-
- /**
- * Referred leaf/leaf-list for the path specified in the leafref type.
- */
- private T referredLeafOrLeafList;
-
- /**
- * Path of the leafref.
- */
- private String path;
-
- /**
- * Leafref path type. Either absolute or relative path.
- */
- private YangPathArgType pathType;
-
- /**
- * List of atomic paths in absolute Path.
- */
- private List<YangAtomicPath> atomicPath;
-
- /**
- * YANG relative path.
- */
- private YangRelativePath relativePath;
-
- /**
- * Status of resolution. If completely resolved enum value is "RESOLVED",
- * if not enum value is "UNRESOLVED", in case reference of grouping/typedef/leafref
- * is added to uses/type/leafref but it's not resolved value of enum should be
- * "INTRA_FILE_RESOLVED".
- */
- private ResolvableStatus resolvableStatus;
-
- /**
- * Require instance status in leafref type.
- */
- private boolean requireInstance;
-
- /**
- * List of if-feature.
- */
- private List<YangIfFeature> ifFeatureList;
-
- /**
- * Parent node of the leafref's leaf.
- */
- private YangNode parentNodeOfLeafref;
-
- /**
- * Error line number.
- */
- private transient int lineNumber;
-
- /**
- * Error character position in number.
- */
- private transient int charPositionInLine;
-
- /**
- * Prefix in the nodes of the leafref path and its imported node name.
- */
- private Map<String, String> prefixAndItsImportedModule;
-
- /**
- * Returns the prefix in the leafref path and its imported node name.
- *
- * @return the list of leafref prefix and imported node name
- */
- public Map<String, String> getPrefixAndItsImportedModule() {
- return prefixAndItsImportedModule;
- }
-
- /**
- * Sets the prefix in the leafref path and its imported node name.
- *
- * @param prefixAndItsImportedModule the list of leafref prefix and imported node name
- */
- public void setPrefixAndItsImportedModule(Map<String, String> prefixAndItsImportedModule) {
- this.prefixAndItsImportedModule = prefixAndItsImportedModule;
- }
-
- /**
- * Returns the parent node from the leafref's leaf.
- *
- * @return parent node of the leafref
- */
- public YangNode getParentNodeOfLeafref() {
- return parentNodeOfLeafref;
- }
-
- /**
- * Sets the parent node from the leafref's leaf.
- *
- * @param parentNodeOfLeafref parent node of the leafref
- */
- public void setParentNodeOfLeafref(YangNode parentNodeOfLeafref) {
- this.parentNodeOfLeafref = parentNodeOfLeafref;
- }
- /**
- * YANG application error information.
- */
- private YangAppErrorInfo yangAppErrorInfo;
-
- /**
- * Creates a YANG leaf ref.
- */
- public YangLeafRef() {
- yangAppErrorInfo = new YangAppErrorInfo();
- yangAppErrorInfo.setErrorTag(DATA_MISSING_ERROR_TAG);
- yangAppErrorInfo.setErrorAppTag(INSTANCE_REQUIRED_ERROR_APP_TAG);
- yangAppErrorInfo.setErrorAppPath(ERROR_PATH_LEAFREF_LEAF);
- }
-
- /**
- * Returns the status of the require instance in leafref.
- *
- * @return status of the require instance
- */
- public boolean getRequireInstance() {
- return requireInstance;
- }
-
- /**
- * Sets the status of the require instance in leafref.
- *
- * @param requireInstance status of the require instance
- */
- public void setRequireInstance(boolean requireInstance) {
- this.requireInstance = requireInstance;
- }
-
- /**
- * Returns the type of data.
- *
- * @return the data type
- */
- public YangType getEffectiveDataType() {
- return effectiveDataType;
- }
-
- /**
- * Sets the type of data.
- *
- * @param effectiveDataType data type
- */
- public void setEffectiveDataType(YangType effectiveDataType) {
- this.effectiveDataType = effectiveDataType;
- }
-
- /**
- * Returns the path of the leafref.
- *
- * @return path of the leafref
- */
- public String getPath() {
- return path;
- }
-
- /**
- * Sets the path of the leafref.
- *
- * @param path leafref path
- */
- public void setPath(String path) {
- this.path = path;
- }
-
- /**
- * Returns the type of path in the leafref.
- *
- * @return type of path
- */
- public YangPathArgType getPathType() {
- return pathType;
- }
-
- /**
- * Sets the type of path in the leafref. It can be either absolute or relative type.
- *
- * @param pathType type of path
- */
- public void setPathType(YangPathArgType pathType) {
- this.pathType = pathType;
- }
-
- /**
- * Returns the list of atomic path.
- *
- * @return list of atomic path
- */
- public List<YangAtomicPath> getAtomicPath() {
- return atomicPath;
- }
-
- /**
- * Sets the list of atomic path.
- *
- * @param atomicPath list of atomic path.
- */
- public void setAtomicPath(List<YangAtomicPath> atomicPath) {
- this.atomicPath = atomicPath;
- }
-
- /**
- * Returns the object of relative path.
- *
- * @return object of relative path
- */
- public YangRelativePath getRelativePath() {
- return relativePath;
- }
-
- /**
- * Sets the object of relative path.
- *
- * @param relativePath object of relative path.
- */
- public void setRelativePath(YangRelativePath relativePath) {
- this.relativePath = relativePath;
- }
-
- /**
- * Returns the object of referred leaf/leaf-list.
- *
- * @return object of referred leaf/leaf-list
- */
- public T getReferredLeafOrLeafList() {
- return referredLeafOrLeafList;
- }
-
- /**
- * Sets the object of referred leaf/leaf-list.
- *
- * @param targetExtendedInfo object of referred leaf/leaf-list
- */
- public void setReferredLeafOrLeafList(T targetExtendedInfo) {
- this.referredLeafOrLeafList = targetExtendedInfo;
- }
-
- @Override
- public List<YangIfFeature> getIfFeatureList() {
- return ifFeatureList;
- }
-
- @Override
- public void addIfFeatureList(YangIfFeature ifFeature) {
- if (getIfFeatureList() == null) {
- setIfFeatureList(new LinkedList<>());
- }
- getIfFeatureList().add(ifFeature);
- }
-
- @Override
- public void setIfFeatureList(List<YangIfFeature> ifFeatureList) {
- this.ifFeatureList = ifFeatureList;
- }
-
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.LEAFREF_DATA;
- }
-
- @Override
- public void validateDataOnEntry() throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-
- @Override
- public void validateDataOnExit() throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-
- @Override
- public ResolvableStatus getResolvableStatus() {
- return resolvableStatus;
- }
-
- @Override
- public void setResolvableStatus(ResolvableStatus resolvableStatus) {
- this.resolvableStatus = resolvableStatus;
- }
-
- @Override
- public void setAppErrorInfo(YangAppErrorInfo yangAppErrorInfo) {
- this.yangAppErrorInfo = yangAppErrorInfo;
- }
-
- @Override
- public YangAppErrorInfo getAppErrorInfo() {
- return yangAppErrorInfo;
- }
-
- @Override
- public Object resolve() throws DataModelException {
-
- if (getReferredLeafOrLeafList() == null) {
- throw new DataModelException("Linker Error: The leafref does not refer to any leaf/leaf-list.");
- }
-
- // Initiate the resolution
- try {
- setResolvableStatus(getResolution());
- } catch (DataModelException e) {
- throw new DataModelException(e.getMessage());
- }
- return null;
- }
-
- /**
- * Returns the resolution status by getting the effective built-in type.
- *
- * @return status of resolution
- * @throws DataModelException a violation of data model rules
- */
- private ResolvableStatus getResolution() throws DataModelException {
-
- if (getReferredLeafOrLeafList() instanceof YangLeaf) {
- YangLeaf yangLeaf = ((YangLeaf) getReferredLeafOrLeafList());
- YangType baseType = yangLeaf.getDataType();
-
- if (baseType.getDataType() == YangDataTypes.LEAFREF) {
- YangLeafRef referredLeafRefInfo = (YangLeafRef) (yangLeaf.getDataType().getDataTypeExtendedInfo());
- /*
- * Check whether the referred typedef is resolved.
- */
- if (referredLeafRefInfo.getResolvableStatus() != INTRA_FILE_RESOLVED
- && referredLeafRefInfo.getResolvableStatus() != RESOLVED) {
- throw new DataModelException("Linker Error: Referred typedef is not resolved for type.");
- }
-
- /*
- * Check if the referred typedef is intra file resolved, if yes
- * sets current status also to intra file resolved .
- */
- if ((referredLeafRefInfo.getResolvableStatus() == INTRA_FILE_RESOLVED)) {
- return INTRA_FILE_RESOLVED;
- }
-
- // Add the if-feature list from referred leafref to current leafref.
- List<YangIfFeature> referredLeafIfFeatureListFromLeafref = referredLeafRefInfo.getIfFeatureList();
- if (referredLeafIfFeatureListFromLeafref != null && !referredLeafIfFeatureListFromLeafref.isEmpty()) {
- Iterator<YangIfFeature> referredLeafIfFeature = referredLeafIfFeatureListFromLeafref.iterator();
- while (referredLeafIfFeature.hasNext()) {
- YangIfFeature ifFeature = referredLeafIfFeature.next();
- addIfFeatureList(ifFeature);
- }
- }
- setEffectiveDataType(referredLeafRefInfo.getEffectiveDataType());
- } else if (baseType.getDataType() == YangDataTypes.DERIVED) {
- /*
- * Check whether the referred typedef is resolved.
- */
- if (baseType.getResolvableStatus() != INTRA_FILE_RESOLVED
- && baseType.getResolvableStatus() != RESOLVED) {
- throw new DataModelException("Linker Error: Referred typedef is not resolved for type.");
- }
- /*
- * Check if the referred typedef is intra file resolved, if yes
- * sets current status also to intra file resolved .
- */
- if ((baseType.getResolvableStatus() == INTRA_FILE_RESOLVED)) {
- return INTRA_FILE_RESOLVED;
- }
- setEffectiveDataType(baseType);
- } else {
- setEffectiveDataType(baseType);
- }
-
- // Add the if-feature list from referred leaf to current leafref.
- List<YangIfFeature> referredLeafIfFeatureList = yangLeaf.getIfFeatureList();
- if (referredLeafIfFeatureList != null && !referredLeafIfFeatureList.isEmpty()) {
- Iterator<YangIfFeature> referredLeafIfFeature = referredLeafIfFeatureList.iterator();
- while (referredLeafIfFeature.hasNext()) {
- YangIfFeature ifFeature = referredLeafIfFeature.next();
- addIfFeatureList(ifFeature);
- }
- }
- return RESOLVED;
- } else if (getReferredLeafOrLeafList() instanceof YangLeafList) {
- YangLeafList yangLeafList = ((YangLeafList) getReferredLeafOrLeafList());
- YangType baseType = yangLeafList.getDataType();
-
- if (baseType.getDataType() == YangDataTypes.LEAFREF) {
- YangLeafRef referredLeafRefInfo = (YangLeafRef) yangLeafList.getDataType().getDataTypeExtendedInfo();
- /*
- * Check whether the referred typedef is resolved.
- */
- if (referredLeafRefInfo.getResolvableStatus() != INTRA_FILE_RESOLVED
- && referredLeafRefInfo.getResolvableStatus() != RESOLVED) {
- throw new DataModelException("Linker Error: Referred typedef is not resolved for type.");
- }
- /*
- * Check if the referred typedef is intra file resolved, if yes
- * sets current status also to intra file resolved .
- */
- if ((referredLeafRefInfo.getResolvableStatus() == INTRA_FILE_RESOLVED)) {
- return INTRA_FILE_RESOLVED;
- }
- // Add the if-feature list from referred leafref to current leafref.
- List<YangIfFeature> referredLeafListIfFeatureListFromLeafref = referredLeafRefInfo.getIfFeatureList();
- if (referredLeafListIfFeatureListFromLeafref != null
- && !referredLeafListIfFeatureListFromLeafref.isEmpty()) {
- Iterator<YangIfFeature> referredLeafListIfFeature = referredLeafListIfFeatureListFromLeafref
- .iterator();
- while (referredLeafListIfFeature.hasNext()) {
- YangIfFeature ifFeature = referredLeafListIfFeature.next();
- addIfFeatureList(ifFeature);
- }
- }
- setEffectiveDataType(referredLeafRefInfo.getEffectiveDataType());
- } else if (baseType.getDataType() == YangDataTypes.DERIVED) {
- /*
- * Check whether the referred typedef is resolved.
- */
- if (baseType.getResolvableStatus() != INTRA_FILE_RESOLVED
- && baseType.getResolvableStatus() != RESOLVED) {
- throw new DataModelException("Linker Error: Referred typedef is not resolved for type.");
- }
- /*
- * Check if the referred typedef is intra file resolved, if yes
- * sets current status also to intra file resolved .
- */
- if ((baseType.getResolvableStatus() == INTRA_FILE_RESOLVED)) {
- return INTRA_FILE_RESOLVED;
- }
- setEffectiveDataType(baseType);
- } else {
- setEffectiveDataType(baseType);
- }
- // Add the if-feature list from referred leaf-list to current leafref.
- List<YangIfFeature> referredLeafListIfFeatureList = yangLeafList.getIfFeatureList();
- if (referredLeafListIfFeatureList != null && !referredLeafListIfFeatureList.isEmpty()) {
- Iterator<YangIfFeature> referredLeafListIfFeature = referredLeafListIfFeatureList.iterator();
- while (referredLeafListIfFeature.hasNext()) {
- YangIfFeature ifFeature = referredLeafListIfFeature.next();
- addIfFeatureList(ifFeature);
- }
- }
- return RESOLVED;
- } else {
- throw new DataModelException("Linker Error: The leafref must refer only to leaf/leaf-list.");
- }
- }
-
- @Override
- public int getLineNumber() {
- return lineNumber;
- }
-
- @Override
- public int getCharPosition() {
- return charPositionInLine;
- }
-
- @Override
- public void setLineNumber(int lineNumber) {
- this.lineNumber = lineNumber;
- }
-
- @Override
- public void setCharPosition(int charPositionInLine) {
- this.charPositionInLine = charPositionInLine;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeavesHolder.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeavesHolder.java
deleted file mode 100644
index a21ed34..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeavesHolder.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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;
-
-import java.util.List;
-
-/**
- * Abstraction of atomic configurable/status entity. It is used to abstract the
- * data holders of leaf or leaf list. Used in leaves parsing or attribute code
- * generation.
- */
-public interface YangLeavesHolder {
-
- /**
- * Returns the list of leaves from data holder like container / list.
- *
- * @return the list of leaves
- */
- List<YangLeaf> getListOfLeaf();
-
- /**
- * Sets the list of leaves.
- *
- * @param leafsList the list of leaf to set
- */
- void setListOfLeaf(List<YangLeaf> leafsList);
-
- /**
- * Adds leaf in data holder like container / list.
- *
- * @param leaf the leaf to be added
- */
- void addLeaf(YangLeaf leaf);
-
- /**
- * Returns the list of leaf-list from data holder like container / list.
- *
- * @return the list of leaf-list
- */
- List<YangLeafList> getListOfLeafList();
-
- /**
- * Sets the list of leaf-list.
- *
- * @param listOfLeafList the list of leaf-list to set
- */
- void setListOfLeafList(List<YangLeafList> listOfLeafList);
-
- /**
- * Adds leaf-list in data holder like container / list.
- *
- * @param leafList the leaf-list to be added
- */
- void addLeafList(YangLeafList leafList);
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLengthRestriction.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLengthRestriction.java
deleted file mode 100644
index 43780a6..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLengthRestriction.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * 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;
-
-import java.io.Serializable;
-
-/*-
- * Reference RFC 6020.
- *
- * Binary can be restricted with "length" statements alone.
- *
- */
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangUint64;
-
-/**
- * Represents the restriction for length data type.
- */
-public class YangLengthRestriction implements YangDesc, YangReference, Parsable, Serializable, YangAppErrorHolder {
-
- /*-
- * Reference RFC 6020.
- * The length Statement
- *
- * The "length" statement, which is an optional sub-statement to the
- * "type" statement, takes as an argument a length expression string.
- * It is used to restrict the built-in type "string", or types derived
- * from "string".
- * A "length" statement restricts the number of unicode characters in
- * the string.
- * A length range consists of an explicit value, or a lower bound, two
- * consecutive dots "..", and an upper bound. Multiple values or ranges
- * can be given, separated by "|". Length-restricting values MUST NOT
- * be negative. If multiple values or ranges are given, they all MUST
- * be disjoint and MUST be in ascending order. If a length restriction
- * is applied to an already length-restricted type, the new restriction
- * MUST be equal or more limiting, that is, raising the lower bounds,
- * reducing the upper bounds, removing explicit length values or ranges,
- * or splitting ranges into multiple ranges with intermediate gaps. A
- * length value is a non-negative integer, or one of the special values
- * "min" or "max". "min" and "max" mean the minimum and maximum length
- * accepted for the type being restricted, respectively. An
- * implementation is not required to support a length value larger than
- * 18446744073709551615.
- * The length's sub-statements
- *
- * +---------------+---------+-------------+-----------------+
- * | substatement | section | cardinality | mapped data type|
- * +---------------+---------+-------------+-----------------+
- * | description | 7.19.3 | 0..1 | string |
- * | error-app-tag | 7.5.4.2 | 0..1 | string |
- * | error-message | 7.5.4.1 | 0..1 | string |
- * | reference | 7.19.4 | 0..1 | string |
- * +---------------+---------+-------------+-----------------+
- */
-
- private static final long serialVersionUID = 806201645L;
-
- /**
- * Length restriction information.
- */
- private YangRangeRestriction<YangUint64> lengthRestriction;
-
- /**
- * Textual reference.
- */
- private String reference;
-
- /**
- * Textual description.
- */
- private String description;
-
- /**
- * YANG application error information.
- */
- private YangAppErrorInfo yangAppErrorInfo;
-
- /**
- * Creates a YANG length restriction object.
- */
- public YangLengthRestriction() {
- setLengthRestriction(new YangRangeRestriction<YangUint64>());
- }
-
- /**
- * Returns the length restriction on the string data.
- *
- * @return length restriction on the string data
- */
- public YangRangeRestriction<YangUint64> getLengthRestriction() {
- return lengthRestriction;
- }
-
- /**
- * Sets the length restriction on the string data.
- *
- * @param lengthRestriction length restriction on the string data
- */
- public void setLengthRestriction(YangRangeRestriction<YangUint64> lengthRestriction) {
- this.lengthRestriction = lengthRestriction;
- }
-
- /**
- * Returns the textual reference of the length restriction.
- *
- * @return textual reference of the length restriction
- */
- @Override
- public String getReference() {
- return reference;
- }
-
- /**
- * Sets the textual reference of the length restriction.
- *
- * @param ref textual reference of the length restriction
- */
- @Override
- public void setReference(String ref) {
- reference = ref;
- }
-
- /**
- * Returns the description of the length restriction.
- *
- * @return description of the length restriction
- */
- @Override
- public String getDescription() {
- return description;
- }
-
- /**
- * Sets the description of the length restriction.
- *
- * @param desc description of the length restriction
- */
- @Override
- public void setDescription(String desc) {
- description = desc;
-
- }
-
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.PATTERN_DATA;
- }
-
- @Override
- public void validateDataOnEntry() throws DataModelException {
- // TODO: implement the method.
- }
-
- @Override
- public void validateDataOnExit() throws DataModelException {
- // TODO: implement the method.
- }
-
- /**
- * Sets the application's error information.
- *
- * @param yangAppErrorInfo the application's error information
- */
- @Override
- public void setAppErrorInfo(YangAppErrorInfo yangAppErrorInfo) {
- this.yangAppErrorInfo = yangAppErrorInfo;
- }
-
- /**
- * Returns application's error information.
- *
- * @return application's error information
- */
- @Override
- public YangAppErrorInfo getAppErrorInfo() {
- return yangAppErrorInfo;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangList.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangList.java
deleted file mode 100644
index e2bd8b5..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangList.java
+++ /dev/null
@@ -1,767 +0,0 @@
-/*
- * 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;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
-
-/*
- * The "list" statement is used to define an interior data node in the
- * schema tree. A list node may exist in multiple instances in the data
- * tree. Each such instance is known as a list entry. The "list"
- * statement takes one argument, which is an identifier, followed by a
- * block of sub-statements that holds detailed list information.
- *
- * A list entry is uniquely identified by the values of the list's keys,
- * if defined.
- *
- * The list's sub-statements
- *
- * +--------------+---------+-------------+------------------+
- * | substatement | section | cardinality |data model mapping|
- * +--------------+---------+-------------+------------------+
- * | anyxml | 7.10 | 0..n |-not supported |
- * | choice | 7.9 | 0..n |-child nodes |
- * | config | 7.19.1 | 0..1 |-boolean |
- * | container | 7.5 | 0..n |-child nodes |
- * | description | 7.19.3 | 0..1 |-string |
- * | grouping | 7.11 | 0..n |-child nodes |
- * | if-feature | 7.18.2 | 0..n |-YangIfFeature |
- * | key | 7.8.2 | 0..1 |-String list |
- * | leaf | 7.6 | 0..n |-YangLeaf |
- * | leaf-list | 7.7 | 0..n |-YangLeafList |
- * | list | 7.8 | 0..n |-child nodes |
- * | max-elements | 7.7.4 | 0..1 |-int |
- * | min-elements | 7.7.3 | 0..1 |-int |
- * | must | 7.5.3 | 0..n |-YangMust |
- * | ordered-by | 7.7.5 | 0..1 |-TODO |
- * | reference | 7.19.4 | 0..1 |-string |
- * | status | 7.19.2 | 0..1 |-YangStatus |
- * | typedef | 7.3 | 0..n |-child nodes |
- * | unique | 7.8.3 | 0..n |-TODO |
- * | uses | 7.12 | 0..n |-child nodes |
- * | when | 7.19.5 | 0..1 |-YangWhen |
- * +--------------+---------+-------------+------------------+
- */
-
-/**
- * Represents list data represented in YANG.
- */
-public class YangList
- extends YangNode
- implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector,
- YangAugmentableNode, YangMustHolder, YangWhenHolder, YangIfFeatureHolder, YangDataNode,
- YangIsFilterContentNodes {
-
- private static final long serialVersionUID = 806201609L;
-
- /**
- * Name of the YANG list.
- */
- private String name;
-
- /**
- * If list maintains config data.
- */
- private Boolean isConfig;
-
- /**
- * Description of list.
- */
- private String description;
-
- /**
- * Reference RFC 6020.
- * <p>
- * The "key" statement, which MUST be present if the list represents
- * configuration, and MAY be present otherwise, takes as an argument a
- * string that specifies a space-separated list of leaf identifiers of this
- * list. A leaf identifier MUST NOT appear more than once in the key. Each
- * such leaf identifier MUST refer to a child leaf of the list. The leafs
- * can be defined directly in sub-statements to the list, or in groupings
- * used in the list.
- * <p>
- * The combined values of all the leafs specified in the key are used to
- * uniquely identify a list entry. All key leafs MUST be given values when a
- * list entry is created. Thus, any default values in the key leafs or their
- * types are ignored. It also implies that any mandatory statement in the
- * key leafs are ignored.
- * <p>
- * A leaf that is part of the key can be of any built-in or derived type,
- * except it MUST NOT be the built-in type "empty".
- * <p>
- * All key leafs in a list MUST have the same value for their "config" as
- * the list itself.
- * <p>
- * List of key leaf names.
- */
- private List<String> keyList;
-
- /**
- * Reference RFC 6020.
- * <p>
- * The "unique" statement is used to put constraints on valid list
- * entries. It takes as an argument a string that contains a space-
- * separated list of schema node identifiers, which MUST be given in the
- * descendant form. Each such schema node identifier MUST refer to a leaf.
- * <p>
- * If one of the referenced leafs represents configuration data, then
- * all of the referenced leafs MUST represent configuration data.
- * <p>
- * The "unique" constraint specifies that the combined values of all the
- * leaf instances specified in the argument string, including leafs with
- * default values, MUST be unique within all list entry instances in
- * which all referenced leafs exist.
- * <p>
- * List of unique leaf/leaf-list names
- */
- private List<String> uniqueList;
-
- /**
- * List of leaves.
- */
- private List<YangLeaf> listOfLeaf;
-
- /**
- * List of leaf-lists.
- */
- private List<YangLeafList> listOfLeafList;
-
- private List<YangAugmentedInfo> yangAugmentedInfo = new ArrayList<>();
-
- /**
- * Reference RFC 6020.
- * <p>
- * The "max-elements" statement, which is optional, takes as an argument a
- * positive integer or the string "unbounded", which puts a constraint on
- * valid list entries. A valid leaf-list or list always has at most
- * max-elements entries.
- * <p>
- * If no "max-elements" statement is present, it defaults to "unbounded".
- */
- private YangMaxElement maxElements;
-
- /**
- * Reference RFC 6020.
- * <p>
- * The "min-elements" statement, which is optional, takes as an argument a
- * non-negative integer that puts a constraint on valid list entries. A
- * valid leaf-list or list MUST have at least min-elements entries.
- * <p>
- * If no "min-elements" statement is present, it defaults to zero.
- * <p>
- * The behavior of the constraint depends on the type of the leaf-list's or
- * list's closest ancestor node in the schema tree that is not a non-
- * presence container:
- * <p>
- * o If this ancestor is a case node, the constraint is enforced if any
- * other node from the case exists.
- * <p>
- * o Otherwise, it is enforced if the ancestor node exists.
- */
- private YangMinElement minElements;
-
- /**
- * reference.
- */
- private String reference;
-
- /**
- * Status of the node.
- */
- private YangStatusType status = YangStatusType.CURRENT;
-
- /**
- * List of must statement constraints.
- */
- private List<YangMust> mustConstraintList;
-
- /**
- * When data of the node.
- */
- private YangWhen when;
-
- /**
- * List of if-feature.
- */
- private List<YangIfFeature> ifFeatureList;
-
- /**
- * Creates a YANG list object.
- */
- public YangList() {
- super(YangNodeType.LIST_NODE);
- listOfLeaf = new LinkedList<>();
- listOfLeafList = new LinkedList<>();
- }
-
- /**
- * Returns the when.
- *
- * @return the when
- */
- @Override
- public YangWhen getWhen() {
- return when;
- }
-
- /**
- * Sets the when.
- *
- * @param when the when to set
- */
- @Override
- public void setWhen(YangWhen when) {
- this.when = when;
- }
-
- /**
- * Returns the YANG list name.
- *
- * @return YANG list name
- */
- @Override
- public String getName() {
- return name;
- }
-
- /**
- * Sets the YANG list name.
- *
- * @param name YANG list name
- */
- @Override
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Returns the config flag.
- *
- * @return the isConfig
- */
- public Boolean isConfig() {
- return isConfig;
- }
-
- /**
- * Sets the config flag.
- *
- * @param isCfg the config flag
- */
- public void setConfig(boolean isCfg) {
- isConfig = isCfg;
- }
-
- /**
- * Returns the description.
- *
- * @return the description
- */
- @Override
- public String getDescription() {
- return description;
- }
-
- /**
- * Sets the description.
- *
- * @param description set the description
- */
- @Override
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Returns the list of unique field names.
- *
- * @return the list of unique field names
- */
- public List<String> getUniqueList() {
- return uniqueList;
- }
-
- /**
- * Sets the list of unique field names.
- *
- * @param uniqueList the list of unique field names
- */
- private void setUniqueList(List<String> uniqueList) {
- this.uniqueList = uniqueList;
- }
-
- /**
- * Returns the list of key field names.
- *
- * @return the list of key field names
- */
- public List<String> getKeyList() {
- return keyList;
- }
-
- /**
- * Sets the list of key field names.
- *
- * @param keyList the list of key field names
- */
- private void setKeyList(List<String> keyList) {
- this.keyList = keyList;
- }
-
- /**
- * Adds a key field name.
- *
- * @param key key field name.
- * @throws DataModelException a violation of data model rules
- */
- public void addKey(String key)
- throws DataModelException {
- if (getKeyList() == null) {
- setKeyList(new LinkedList<String>());
- }
-
- if (getKeyList().contains(key)) {
- throw new DataModelException("A leaf identifier must not appear more than once in the\n" +
- " key");
- }
-
- getKeyList().add(key);
- }
-
- /**
- * Adds a unique field name.
- *
- * @param unique unique field name.
- * @throws DataModelException a violation of data model rules
- */
- public void addUnique(String unique)
- throws DataModelException {
- if (getUniqueList() == null) {
- setUniqueList(new LinkedList<>());
- }
- if (getUniqueList().contains(unique)) {
- throw new DataModelException("A leaf identifier must not appear more than once in the\n" +
- " unique");
- }
- getUniqueList().add(unique);
- }
-
- /**
- * Returns the list of leaves.
- *
- * @return the list of leaves
- */
- @Override
- public List<YangLeaf> getListOfLeaf() {
- return listOfLeaf;
- }
-
- /**
- * Sets the list of leaves.
- *
- * @param leafsList the list of leaf to set
- */
- @Override
- public void setListOfLeaf(List<YangLeaf> leafsList) {
- listOfLeaf = leafsList;
- }
-
- /**
- * Adds a leaf.
- *
- * @param leaf the leaf to be added
- */
- @Override
- public void addLeaf(YangLeaf leaf) {
- if (getListOfLeaf() == null) {
- setListOfLeaf(new LinkedList<YangLeaf>());
- }
-
- getListOfLeaf().add(leaf);
- }
-
- /**
- * Returns the list of leaf-list.
- *
- * @return the list of leaf-list
- */
- @Override
- public List<YangLeafList> getListOfLeafList() {
- return listOfLeafList;
- }
-
- /**
- * Sets the list of leaf-list.
- *
- * @param listOfLeafList the list of leaf-list to set
- */
- @Override
- public void setListOfLeafList(List<YangLeafList> listOfLeafList) {
- this.listOfLeafList = listOfLeafList;
- }
-
- /**
- * Adds a leaf-list.
- *
- * @param leafList the leaf-list to be added
- */
- @Override
- public void addLeafList(YangLeafList leafList) {
- if (getListOfLeafList() == null) {
- setListOfLeafList(new LinkedList<YangLeafList>());
- }
-
- getListOfLeafList().add(leafList);
- }
-
- /**
- * Returns the max elements.
- *
- * @return the max elements
- */
- public YangMaxElement getMaxElements() {
- return maxElements;
- }
-
- /**
- * Sets the max elements.
- *
- * @param max the max elements
- */
- public void setMaxElements(YangMaxElement max) {
- this.maxElements = max;
- }
-
- /**
- * Returns the minimum elements.
- *
- * @return the minimum elements
- */
- public YangMinElement getMinElements() {
- return minElements;
- }
-
- /**
- * Sets the minimum elements.
- *
- * @param minElements the minimum elements
- */
- public void setMinElements(YangMinElement minElements) {
- this.minElements = minElements;
- }
-
- /**
- * Returns the textual reference.
- *
- * @return the reference
- */
- @Override
- public String getReference() {
- return reference;
- }
-
- /**
- * Sets the textual reference.
- *
- * @param reference the reference to set
- */
- @Override
- public void setReference(String reference) {
- this.reference = reference;
- }
-
- /**
- * Returns the status.
- *
- * @return the status
- */
- @Override
- public YangStatusType getStatus() {
- return status;
- }
-
- /**
- * Sets the status.
- *
- * @param status the status to set
- */
- @Override
- public void setStatus(YangStatusType status) {
- this.status = status;
- }
-
- /**
- * Returns the type of the parsed data.
- *
- * @return returns LIST_DATA
- */
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.LIST_DATA;
- }
-
- /**
- * Validates the data on entering the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnEntry()
- throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-
- /**
- * Validates the data on exiting the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnExit()
- throws DataModelException {
- List<String> keys = getKeyList();
- List<YangLeaf> leaves = getListOfLeaf();
- List<YangLeafList> leafLists = getListOfLeafList();
-
- setDefaultConfigValueToChild(leaves, leafLists);
- validateConfig(leaves, leafLists);
-
- /* A list must have atleast one key leaf if config is true */
- if (isConfig && (keys == null || leaves == null) && !isUsesPresentInList()
- && !isListPresentInGrouping()) {
- throw new DataModelException("A list must have atleast one key leaf if config is true;");
- } else if (keys != null) {
- validateKey(leaves, keys);
- }
- }
-
- /**
- * Sets the config's value to all leaf if leaf's config statement is not
- * specified.
- *
- * @param leaves list of leaf attributes of YANG list
- * @param leafLists list of leaf-list attributes of YANG list
- */
- private void setDefaultConfigValueToChild(List<YangLeaf> leaves, List<YangLeafList> leafLists) {
-
- /*
- * If "config" is not specified, the default is the same as the parent
- * schema node's "config" value.
- */
- if (leaves != null) {
- for (YangLeaf leaf : leaves) {
- if (leaf.isConfig() == null) {
- leaf.setConfig(isConfig);
- }
- }
- }
-
- /*
- * If "config" is not specified, the default is the same as the parent
- * schema node's "config" value.
- */
- if (leafLists != null) {
- for (YangLeafList leafList : leafLists) {
- if (leafList.isConfig() == null) {
- leafList.setConfig(isConfig);
- }
- }
- }
- }
-
- /**
- * Validates config statement of YANG list.
- *
- * @param leaves list of leaf attributes of YANG list
- * @param leafLists list of leaf-list attributes of YANG list
- * @throws DataModelException a violation of data model rules
- */
- private void validateConfig(List<YangLeaf> leaves, List<YangLeafList> leafLists)
- throws DataModelException {
-
- /*
- * If a node has "config" set to "false", no node underneath it can have
- * "config" set to "true".
- */
- if (!isConfig && leaves != null) {
- for (YangLeaf leaf : leaves) {
- if (leaf.isConfig()) {
- throw new DataModelException("If a list has \"config\" set to \"false\", no node underneath " +
- "it can have \"config\" set to \"true\".");
- }
- }
- }
-
- if (!isConfig && leafLists != null) {
- for (YangLeafList leafList : leafLists) {
- if (leafList.isConfig()) {
- throw new DataModelException("If a list has \"config\" set to \"false\", no node underneath " +
- "it can have \"config\" set to \"true\".");
- }
- }
- }
- }
-
- /**
- * Validates key statement of list.
- *
- * @param leaves list of leaf attributes of list
- * @param keys list of key attributes of list
- * @throws DataModelException a violation of data model rules
- */
- private void validateKey(List<YangLeaf> leaves, List<String> keys)
- throws DataModelException {
- boolean leafFound = false;
- List<YangLeaf> keyLeaves = new LinkedList<>();
-
- /*
- * 1. Leaf identifier must refer to a child leaf of the list 2. A leaf
- * that is part of the key must not be the built-in type "empty".
- */
- for (String key : keys) {
- if (leaves != null && !leaves.isEmpty()) {
- for (YangLeaf leaf : leaves) {
- if (key.equals(leaf.getName())) {
- if (leaf.getDataType().getDataType() == YangDataTypes.EMPTY) {
- throw new DataModelException(" A leaf that is part of the key must not be the built-in " +
- "type \"empty\".");
- }
- leafFound = true;
- keyLeaves.add(leaf);
- break;
- }
- }
- }
-
- if (!leafFound && !isUsesPresentInList() && !isListPresentInGrouping()) {
- throw new DataModelException("An identifier, in key, must refer to a child leaf of the list");
- }
- leafFound = false;
- }
-
- /*
- * All key leafs in a list MUST have the same value for their "config"
- * as the list itself.
- */
- for (YangLeaf keyLeaf : keyLeaves) {
- if (isConfig != keyLeaf.isConfig()) {
- throw new DataModelException("All key leafs in a list must have the same value for their" +
- " \"config\" as the list itself.");
- }
- }
- }
-
- @Override
- public void detectCollidingChild(String identifierName, YangConstructType dataType)
- throws DataModelException {
- // Asks helper to detect colliding child.
- detectCollidingChildUtil(identifierName, dataType, this);
- }
-
- @Override
- public void detectSelfCollision(String identifierName, YangConstructType dataType)
- throws DataModelException {
- if (getName().equals(identifierName)) {
- throw new DataModelException("YANG file error: Duplicate input identifier detected, same as list \"" +
- getName() + "\"");
- }
- }
-
- private boolean isUsesPresentInList() {
- YangNode node = getChild();
- while (node != null) {
- if (node instanceof YangUses) {
- return true;
- }
- node = node.getNextSibling();
- }
- return false;
- // TODO When grouping linking is done this method has to be modified.
- }
-
- private boolean isListPresentInGrouping() {
- YangNode node = getParent();
- while (node != null) {
- if (node instanceof YangGrouping) {
- return true;
- }
- node = node.getParent();
- }
- return false;
- // TODO When grouping linking is done this method has to be modified.
- }
-
- @Override
- public List<YangIfFeature> getIfFeatureList() {
- return ifFeatureList;
- }
-
- @Override
- public void addIfFeatureList(YangIfFeature ifFeature) {
- if (getIfFeatureList() == null) {
- setIfFeatureList(new LinkedList<>());
- }
- getIfFeatureList().add(ifFeature);
- }
-
- @Override
- public void setIfFeatureList(List<YangIfFeature> ifFeatureList) {
- this.ifFeatureList = ifFeatureList;
- }
-
- @Override
- public List<YangMust> getListOfMust() {
- return mustConstraintList;
- }
-
- @Override
- public void setListOfMust(List<YangMust> mustConstraintList) {
- this.mustConstraintList = mustConstraintList;
- }
-
- @Override
- public void addMust(YangMust must) {
- if (getListOfMust() == null) {
- setListOfMust(new LinkedList<>());
- }
- getListOfMust().add(must);
- }
-
- @Override
- public void addAugmentation(YangAugmentedInfo augmentInfo) {
- yangAugmentedInfo.add(augmentInfo);
- }
-
- @Override
- public void removeAugmentation(YangAugmentedInfo augmentInfo) {
- yangAugmentedInfo.remove(augmentInfo);
- }
-
- @Override
- public List<YangAugmentedInfo> getAugmentedInfoList() {
- return yangAugmentedInfo;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangMaxElement.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangMaxElement.java
deleted file mode 100644
index 6ec7f47..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangMaxElement.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * 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;
-
-import static org.onosproject.yangutils.datamodel.utils.YangErrMsgConstants.OPERATION_FAILED_ERROR_TAG;
-import static org.onosproject.yangutils.datamodel.utils.YangErrMsgConstants.TOO_MANY_ELEMENTS_ERROR_APP_TAG;
-
-import java.io.Serializable;
-
-/**
- * Represents max element data represented in YANG.
- */
-public class YangMaxElement implements YangAppErrorHolder, Serializable {
-
- private static final long serialVersionUID = 807201694L;
-
- /**
- * YANG application error information.
- */
- private YangAppErrorInfo yangAppErrorInfo;
-
- /**
- * Reference:RFC 6020.
- *
- * The "max-elements" statement, which is optional, takes as an argument a
- * positive integer or the string "unbounded", which puts a constraint on
- * valid list entries. A valid leaf-list or list always has at most
- * max-elements entries.
- *
- * If no "max-elements" statement is present, it defaults to "unbounded".
- */
- private int maxElement = Integer.MAX_VALUE;
-
- /**
- * Creates a YANG maximum element.
- */
- public YangMaxElement() {
- YangAppErrorInfo yangAppErrorInfo = new YangAppErrorInfo();
- yangAppErrorInfo.setErrorTag(OPERATION_FAILED_ERROR_TAG);
- yangAppErrorInfo.setErrorAppTag(TOO_MANY_ELEMENTS_ERROR_APP_TAG);
- }
-
- /**
- * Returns the maximum element value.
- *
- * @return the maximum element value
- */
- public int getMaxElement() {
- return maxElement;
- }
-
- /**
- * Sets the maximum element value.
- *
- * @param maxElement the maximum element value
- */
- public void setMaxElement(int maxElement) {
- this.maxElement = maxElement;
- }
-
- @Override
- public void setAppErrorInfo(YangAppErrorInfo yangAppErrorInfo) {
- this.yangAppErrorInfo = yangAppErrorInfo;
- }
-
- @Override
- public YangAppErrorInfo getAppErrorInfo() {
- return yangAppErrorInfo;
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangMinElement.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangMinElement.java
deleted file mode 100644
index 4eab3a8..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangMinElement.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * 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;
-
-import static org.onosproject.yangutils.datamodel.utils.YangErrMsgConstants.OPERATION_FAILED_ERROR_TAG;
-import static org.onosproject.yangutils.datamodel.utils.YangErrMsgConstants.TOO_FEW_ELEMENTS_ERROR_APP_TAG;
-
-import java.io.Serializable;
-
-/**
- * Represents minimum element data represented in YANG.
- */
-public class YangMinElement implements YangAppErrorHolder, Serializable {
-
- private static final long serialVersionUID = 807201695L;
-
- /**
- * YANG application error information.
- */
- private YangAppErrorInfo yangAppErrorInfo;
-
- /**
- * Reference:RFC 6020.
- *
- * The "min-elements" statement, which is optional, takes as an argument a
- * non-negative integer that puts a constraint on valid list entries. A
- * valid leaf-list or list MUST have at least min-elements entries.
- *
- * If no "min-elements" statement is present, it defaults to zero.
- *
- * The behavior of the constraint depends on the type of the leaf-list's or
- * list's closest ancestor node in the schema tree that is not a non-
- * presence container:
- *
- * If this ancestor is a case node, the constraint is enforced if any
- * other node from the case exists.
- *
- * Otherwise, it is enforced if the ancestor node exists.
- */
- private int minElement = 0;
-
- /**
- * Creates a YANG minimum element.
- */
- public YangMinElement() {
- YangAppErrorInfo yangAppErrorInfo = new YangAppErrorInfo();
- yangAppErrorInfo.setErrorTag(OPERATION_FAILED_ERROR_TAG);
- yangAppErrorInfo.setErrorAppTag(TOO_FEW_ELEMENTS_ERROR_APP_TAG);
- }
-
- /**
- * Returns the minimum element value.
- *
- * @return the minimum element value
- */
- public int getMinElement() {
- return minElement;
- }
-
- /**
- * Sets the minimum element value.
- *
- * @param minElement the minimum element value
- */
- public void setMinElement(int minElement) {
- this.minElement = minElement;
- }
-
- @Override
- public void setAppErrorInfo(YangAppErrorInfo yangAppErrorInfo) {
- this.yangAppErrorInfo = yangAppErrorInfo;
- }
-
- @Override
- public YangAppErrorInfo getAppErrorInfo() {
- return yangAppErrorInfo;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java
deleted file mode 100644
index c2df52f..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java
+++ /dev/null
@@ -1,763 +0,0 @@
-/*
- * 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;
-
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.linkInterFileReferences;
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.resolveLinkingForResolutionList;
-
-/*-
- * Reference:RFC 6020.
- * The "module" statement defines the module's name,
- * and groups all statements that belong to the module together. The "module"
- * statement's argument is the name of the module, followed by a block of
- * sub statements that hold detailed module information.
- * The module's sub statements
- *
- * +--------------+---------+-------------+-----------------------+
- * |sub statement | section | cardinality | data model mapping |
- * +--------------+---------+-------------+-----------------------+
- * | anyxml | 7.10 | 0..n | not supported |
- * | augment | 7.15 | 0..n | child nodes |
- * | choice | 7.9 | 0..n | child nodes |
- * | contact | 7.1.8 | 0..1 | string |
- * | container | 7.5 | 0..n | child nodes |
- * | description | 7.19.3 | 0..1 | string |
- * | deviation | 7.18.3 | 0..n | TODO |
- * | extension | 7.17 | 0..n | TODO |
- * | feature | 7.18.1 | 0..n | TODO |
- * | grouping | 7.11 | 0..n | child nodes |
- * | identity | 7.16 | 0..n | TODO |
- * | import | 7.1.5 | 0..n | list of import info |
- * | include | 7.1.6 | 0..n | list of include info |
- * | leaf | 7.6 | 0..n | list of leaf info |
- * | leaf-list | 7.7 | 0..n | list of leaf-list info|
- * | list | 7.8 | 0..n | child nodes |
- * | namespace | 7.1.3 | 1 | string/uri |
- * | notification | 7.14 | 0..n | TODO |
- * | organization | 7.1.7 | 0..1 | string |
- * | prefix | 7.1.4 | 1 | string |
- * | reference | 7.19.4 | 0..1 | string |
- * | revision | 7.1.9 | 0..n | revision |
- * | rpc | 7.13 | 0..n | TODO |
- * | typedef | 7.3 | 0..n | child nodes |
- * | uses | 7.12 | 0..n | child nodes |
- * | YANG-version | 7.1.2 | 0..1 | int |
- * +--------------+---------+-------------+-----------------------+
- */
-
-/**
- * Represents data model node to maintain information defined in YANG module.
- */
-public class YangModule
- extends YangNode
- implements YangLeavesHolder, YangDesc, YangReference, Parsable, CollisionDetector, YangReferenceResolver,
- RpcNotificationContainer, YangFeatureHolder, YangIsFilterContentNodes {
-
- private static final long serialVersionUID = 806201610L;
-
- /**
- * Name of the module.
- */
- private String name;
-
- /**
- * Reference:RFC 6020.
- * <p>
- * The "contact" statement provides contact information for the module. The
- * argument is a string that is used to specify contact information for the
- * person or persons to whom technical queries concerning this module should
- * be sent, such as their name, postal address, telephone number, and
- * electronic mail address.
- */
- private String contact;
-
- /**
- * Reference:RFC 6020.
- * <p>
- * The "description" statement takes as an argument a string that contains a
- * human-readable textual description of this definition. The text is
- * provided in a language (or languages) chosen by the module developer; for
- * the sake of interoperability.
- */
- private String description;
-
- /**
- * List of YANG modules imported.
- */
- private List<YangImport> importList;
-
- /**
- * List of YANG sub-modules included.
- */
- private List<YangInclude> includeList;
-
- /**
- * List of leaves at root level in the module.
- */
- private List<YangLeaf> listOfLeaf;
-
- /**
- * List of leaf-lists at root level in the module.
- */
- private List<YangLeafList> listOfLeafList;
-
- /**
- * List of feature at root level in the module.
- */
- private List<YangFeature> listOfFeature;
-
- /**
- * Name space of the module.
- */
- private YangNameSpace nameSpace;
-
- /**
- * Reference:RFC 6020.
- * <p>
- * The "organization" statement defines the party responsible for this
- * module. The argument is a string that is used to specify a textual
- * description of the organization(s) under whose auspices this module was
- * developed.
- */
- private String organization;
-
- /**
- * Prefix to refer to the objects in module.
- */
- private String prefix;
-
- /**
- * Reference of the module.
- */
- private String reference;
-
- /**
- * Revision info of the module.
- */
- private YangRevision revision;
-
- /**
- * YANG version.
- */
- private byte version;
-
- /*-
- * Reference RFC 6020.
- *
- * Nested typedefs and groupings.
- * Typedefs and groupings may appear nested under many YANG statements,
- * allowing these to be lexically scoped by the hierarchy under which
- * they appear. This allows types and groupings to be defined near
- * where they are used, rather than placing them at the top level of the
- * hierarchy. The close proximity increases readability.
- *
- * Scoping also allows types to be defined without concern for naming
- * conflicts between types in different submodules. Type names can be
- * specified without adding leading strings designed to prevent name
- * collisions within large modules.
- *
- * Finally, scoping allows the module author to keep types and groupings
- * private to their module or submodule, preventing their reuse. Since
- * only top-level types and groupings (i.e., those appearing as
- * sub-statements to a module or submodule statement) can be used outside
- * the module or submodule, the developer has more control over what
- * pieces of their module are presented to the outside world, supporting
- * the need to hide internal information and maintaining a boundary
- * between what is shared with the outside world and what is kept
- * private.
- *
- * Scoped definitions MUST NOT shadow definitions at a higher scope. A
- * type or grouping cannot be defined if a higher level in the schema
- * hierarchy has a definition with a matching identifier.
- *
- * A reference to an unprefixed type or grouping, or one which uses the
- * prefix of the current module, is resolved by locating the closest
- * matching "typedef" or "grouping" statement among the immediate
- * sub-statements of each ancestor statement.
- */
- private List<YangResolutionInfo> derivedTypeResolutionList;
-
- /**
- * Uses resolution list.
- */
- private List<YangResolutionInfo> usesResolutionList;
-
- /**
- * If-feature resolution list.
- */
- private List<YangResolutionInfo> ifFeatureResolutionList;
-
- /**
- * LeafRef resolution list.
- */
- private List<YangResolutionInfo> leafRefResolutionList;
-
- /**
- * Base resolution list.
- */
- private List<YangResolutionInfo> baseResolutionList;
-
- /**
- * IdentityRef resolution list.
- */
- private List<YangResolutionInfo> identityRefResolutionList;
-
- /**
- * Augment resolution list.
- */
- private List<YangResolutionInfo> augmentResolutionList;
-
- /**
- * Compiler annotation list.
- */
- private List<YangCompilerAnnotation> compilerAnnotationList;
-
- /**
- * Extension list.
- */
- private List<YangExtension> extensionList;
-
- /**
- * Creates a YANG node of module type.
- */
- public YangModule() {
-
- super(YangNodeType.MODULE_NODE);
- derivedTypeResolutionList = new LinkedList<>();
- augmentResolutionList = new LinkedList<>();
- usesResolutionList = new LinkedList<>();
- ifFeatureResolutionList = new LinkedList<>();
- leafRefResolutionList = new LinkedList<>();
- baseResolutionList = new LinkedList<>();
- identityRefResolutionList = new LinkedList<>();
- compilerAnnotationList = new LinkedList<>();
- importList = new LinkedList<>();
- includeList = new LinkedList<>();
- listOfLeaf = new LinkedList<>();
- listOfLeafList = new LinkedList<>();
- extensionList = new LinkedList<>();
- }
-
- /**
- * Returns name of the module.
- *
- * @return module name
- */
- @Override
- public String getName() {
- return name;
- }
-
- /**
- * Sets module name.
- *
- * @param moduleName module name
- */
- @Override
- public void setName(String moduleName) {
- name = moduleName;
- }
-
- /**
- * Returns the contact details of the module owner.
- *
- * @return the contact details of YANG owner
- */
- public String getContact() {
- return contact;
- }
-
- /**
- * Sets the contact details of the module owner.
- *
- * @param contact the contact details of YANG owner
- */
- public void setContact(String contact) {
- this.contact = contact;
- }
-
- /**
- * Returns the description of module.
- *
- * @return the description of YANG module
- */
- @Override
- public String getDescription() {
- return description;
- }
-
- /**
- * Sets the description of module.
- *
- * @param description set the description of YANG module
- */
- @Override
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Returns the list of imported modules.
- *
- * @return the list of imported modules
- */
- @Override
- public List<YangImport> getImportList() {
- return importList;
- }
-
- /**
- * Adds the imported module information to the import list.
- *
- * @param importedModule module being imported
- */
- @Override
- public void addToImportList(YangImport importedModule) {
- getImportList().add(importedModule);
- }
-
- @Override
- public void setImportList(List<YangImport> importList) {
- this.importList = importList;
- }
-
- /**
- * Returns the list of included sub modules.
- *
- * @return the included list of sub modules
- */
- @Override
- public List<YangInclude> getIncludeList() {
- return includeList;
- }
-
- /**
- * Adds the included sub module information to the include list.
- *
- * @param includeModule submodule being included
- */
- @Override
- public void addToIncludeList(YangInclude includeModule) {
- getIncludeList().add(includeModule);
- }
-
- @Override
- public void setIncludeList(List<YangInclude> includeList) {
- this.includeList = includeList;
- }
-
- /**
- * Returns the list of leaves in module.
- *
- * @return the list of leaves
- */
- @Override
- public List<YangLeaf> getListOfLeaf() {
- return listOfLeaf;
- }
-
- @Override
- public void setListOfLeaf(List<YangLeaf> leafsList) {
- listOfLeaf = leafsList;
- }
-
- /**
- * Adds a leaf in module.
- *
- * @param leaf the leaf to be added
- */
- @Override
- public void addLeaf(YangLeaf leaf) {
- getListOfLeaf().add(leaf);
- }
-
- /**
- * Returns the list of leaf-list from module.
- *
- * @return the list of leaf-list
- */
- @Override
- public List<YangLeafList> getListOfLeafList() {
- return listOfLeafList;
- }
-
- @Override
- public void setListOfLeafList(List<YangLeafList> listOfLeafList) {
- this.listOfLeafList = listOfLeafList;
- }
-
-
- /**
- * Adds a leaf-list in module.
- *
- * @param leafList the leaf-list to be added
- */
- @Override
- public void addLeafList(YangLeafList leafList) {
- getListOfLeafList().add(leafList);
- }
-
- @Override
- public List<YangFeature> getFeatureList() {
- return listOfFeature;
- }
-
- @Override
- public void addFeatureList(YangFeature feature) {
- if (getFeatureList() == null) {
- setListOfFeature(new LinkedList<>());
- }
- getFeatureList().add(feature);
- }
-
- @Override
- public void setListOfFeature(List<YangFeature> listOfFeature) {
- this.listOfFeature = listOfFeature;
- }
-
- /**
- * Returns the name space of module elements.
- *
- * @return the nameSpace
- */
- public YangNameSpace getNameSpace() {
- return nameSpace;
- }
-
- /**
- * Sets the name space of module elements.
- *
- * @param nameSpace the nameSpace to set
- */
- public void setNameSpace(YangNameSpace nameSpace) {
- this.nameSpace = nameSpace;
- }
-
- /**
- * Returns the modules organization.
- *
- * @return the organization
- */
- public String getOrganization() {
- return organization;
- }
-
- /**
- * Sets the modules organization.
- *
- * @param org the organization to set
- */
- public void setOrganization(String org) {
- organization = org;
- }
-
- /**
- * Returns the prefix.
- *
- * @return the prefix
- */
- @Override
- public String getPrefix() {
- return prefix;
- }
-
- /**
- * Sets the prefix.
- *
- * @param prefix the prefix to set
- */
- @Override
- public void setPrefix(String prefix) {
- this.prefix = prefix;
- }
-
- @Override
- public void resolveSelfFileLinking(ResolvableType type)
- throws DataModelException {
- // Get the list to be resolved.
- List<YangResolutionInfo> resolutionList = getUnresolvedResolutionList(type);
- // Resolve linking for a resolution list.
- resolveLinkingForResolutionList(resolutionList, this);
- }
-
- @Override
- public void resolveInterFileLinking(ResolvableType type)
- throws DataModelException {
- // Get the list to be resolved.
- List<YangResolutionInfo> resolutionList = getUnresolvedResolutionList(type);
- // Resolve linking for a resolution list.
- linkInterFileReferences(resolutionList, this);
- }
-
- /**
- * Returns the textual reference.
- *
- * @return the reference
- */
- @Override
- public String getReference() {
- return reference;
- }
-
- /**
- * Sets the textual reference.
- *
- * @param reference the reference to set
- */
- @Override
- public void setReference(String reference) {
- this.reference = reference;
- }
-
- /**
- * Returns the revision.
- *
- * @return the revision
- */
- public YangRevision getRevision() {
- return revision;
- }
-
- /**
- * Sets the revision.
- *
- * @param revision the revision to set
- */
- public void setRevision(YangRevision revision) {
- this.revision = revision;
- }
-
- /**
- * Returns the version.
- *
- * @return the version
- */
- public byte getVersion() {
- return version;
- }
-
- /**
- * Sets the version.
- *
- * @param version the version to set
- */
- public void setVersion(byte version) {
- this.version = version;
- }
-
- /**
- * Adds compiler annotation in compiler-annotation list.
- *
- * @param compilerAnnotation the compiler-annotation to be added
- */
- public void addCompilerAnnotation(YangCompilerAnnotation compilerAnnotation) {
- getCompilerAnnotationList().add(compilerAnnotation);
- }
-
- /**
- * Returns the compiler annotation list.
- *
- * @return the compiler annotation list
- */
- public List<YangCompilerAnnotation> getCompilerAnnotationList() {
- return compilerAnnotationList;
- }
-
- /**
- * Sets the compiler-annotation list.
- *
- * @param compilerAnnotationList the list of compiler-annotation
- */
- public void setCompilerAnnotationList(List<YangCompilerAnnotation> compilerAnnotationList) {
- this.compilerAnnotationList = compilerAnnotationList;
- }
-
- /**
- * Adds extension in extension list.
- *
- * @param extension the extension to be added
- */
- public void addExtension(YangExtension extension) {
- getExtensionList().add(extension);
- }
-
- /**
- * Returns the extension list.
- *
- * @return the extension list
- */
- public List<YangExtension> getExtensionList() {
- return extensionList;
- }
-
- /**
- * Sets the extension list.
- *
- * @param extensionList the list of extension
- */
- public void setExtensionList(List<YangExtension> extensionList) {
- this.extensionList = extensionList;
- }
-
- /**
- * Returns the type of the parsed data.
- *
- * @return returns MODULE_DATA
- */
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.MODULE_DATA;
- }
-
- /**
- * Validates the data on entering the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnEntry()
- throws DataModelException {
- /*
- * Module is root in the data model tree, hence there is no entry
- * validation
- */
- }
-
- /**
- * Validates the data on exiting the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnExit()
- throws DataModelException {
- /*
- * TODO: perform symbol linking for the imported or included YANG info.
- * TODO: perform symbol resolution for referred YANG entities.
- */
- }
-
- @Override
- public void detectCollidingChild(String identifierName, YangConstructType dataType)
- throws DataModelException {
- // Asks helper to detect colliding child.
- detectCollidingChildUtil(identifierName, dataType, this);
- }
-
- @Override
- public void detectSelfCollision(String identifierName, YangConstructType dataType)
- throws DataModelException {
- // Not required as module doesn't have any parent.
- }
-
- @Override
- public List<YangResolutionInfo> getUnresolvedResolutionList(ResolvableType type) {
- if (type == ResolvableType.YANG_DERIVED_DATA_TYPE) {
- return derivedTypeResolutionList;
- } else if (type == ResolvableType.YANG_USES) {
- return usesResolutionList;
- } else if (type == ResolvableType.YANG_AUGMENT) {
- return augmentResolutionList;
- } else if (type == ResolvableType.YANG_IF_FEATURE) {
- return ifFeatureResolutionList;
- } else if (type == ResolvableType.YANG_LEAFREF) {
- return leafRefResolutionList;
- } else if (type == ResolvableType.YANG_BASE) {
- return baseResolutionList;
- } else {
- return identityRefResolutionList;
- }
- }
-
- @Override
- public void addToResolutionList(YangResolutionInfo resolutionInfo,
- ResolvableType type) {
- if (type == ResolvableType.YANG_DERIVED_DATA_TYPE) {
- derivedTypeResolutionList.add(resolutionInfo);
- } else if (type == ResolvableType.YANG_USES) {
- usesResolutionList.add(resolutionInfo);
- } else if (type == ResolvableType.YANG_IF_FEATURE) {
- ifFeatureResolutionList.add(resolutionInfo);
- } else if (type == ResolvableType.YANG_LEAFREF) {
- leafRefResolutionList.add(resolutionInfo);
- } else if (type == ResolvableType.YANG_BASE) {
- baseResolutionList.add(resolutionInfo);
- } else if (type == ResolvableType.YANG_AUGMENT) {
- augmentResolutionList.add(resolutionInfo);
- } else if (type == ResolvableType.YANG_IDENTITYREF) {
- identityRefResolutionList.add(resolutionInfo);
- }
- }
-
- @Override
- public void setResolutionList(List<YangResolutionInfo> resolutionList,
- ResolvableType type) {
- if (type == ResolvableType.YANG_DERIVED_DATA_TYPE) {
- derivedTypeResolutionList = resolutionList;
- } else if (type == ResolvableType.YANG_USES) {
- usesResolutionList = resolutionList;
- } else if (type == ResolvableType.YANG_IF_FEATURE) {
- ifFeatureResolutionList.add((YangResolutionInfo) resolutionList);
- } else if (type == ResolvableType.YANG_LEAFREF) {
- leafRefResolutionList = resolutionList;
- } else if (type == ResolvableType.YANG_BASE) {
- baseResolutionList = resolutionList;
- } else if (type == ResolvableType.YANG_AUGMENT) {
- augmentResolutionList = resolutionList;
- } else if (type == ResolvableType.YANG_IDENTITYREF) {
- identityRefResolutionList = resolutionList;
- }
-
- }
-
- @Override
- public void addReferencesToImportList(Set<YangNode> yangNodeSet)
- throws DataModelException {
- Iterator<YangImport> importInfoIterator = getImportList().iterator();
- // Run through the imported list to add references.
- while (importInfoIterator.hasNext()) {
- YangImport yangImport = importInfoIterator.next();
- yangImport.addReferenceToImport(yangNodeSet);
- }
- }
-
- @Override
- public void addReferencesToIncludeList(Set<YangNode> yangNodeSet)
- throws DataModelException {
- Iterator<YangInclude> includeInfoIterator = getIncludeList().iterator();
- // Run through the included list to add references.
- while (includeInfoIterator.hasNext()) {
- YangInclude yangInclude = includeInfoIterator.next();
- YangSubModule subModule = null;
- subModule = yangInclude.addReferenceToInclude(yangNodeSet);
-
- // Check if the referred sub-modules parent is self
- if (!(subModule.getBelongsTo().getModuleNode() == this)) {
- yangInclude.reportIncludeError();
- }
- }
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangMust.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangMust.java
deleted file mode 100644
index 62f6c9e..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangMust.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * 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;
-
-import java.io.Serializable;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-import static org.onosproject.yangutils.datamodel.utils.YangErrMsgConstants.OPERATION_FAILED_ERROR_TAG;
-import static org.onosproject.yangutils.datamodel.utils.YangErrMsgConstants.MUST_VIOLATION_ERROR_APP_TAG;
-
-/*-
- * The "must" statement, which is optional, takes as an argument a string that
- * contains an XPath expression. It is used to formally declare a constraint
- * on valid data.
- *
- * When a datastore is validated, all "must" constraints are conceptually
- * evaluated once for each data node in the data tree, and for all leafs with
- * default values in use. If a data node does not exist in the data tree, and
- * it does not have a default value, its "must" statements are not evaluated.
- *
- * All such constraints MUST evaluate to true for the data to be valid.
- *
- * The must's sub-statements
- *
- * +---------------+---------+-------------+------------------+
- * | substatement | section | cardinality |data model mapping|
- * +---------------+---------+-------------+------------------+
- * | description | 7.19.3 | 0..1 | -string |
- * | error-app-tag | 7.5.4.2 | 0..1 | -not supported |
- * | error-message | 7.5.4.1 | 0..1 | -not supported |
- * | reference | 7.19.4 | 0..1 | -string |
- * +---------------+---------+-------------+------------------+
- */
-
-/**
- * Represents information defined in YANG must.
- */
-public class YangMust implements YangDesc, YangReference, Parsable, Serializable, YangAppErrorHolder {
-
- private static final long serialVersionUID = 806201646L;
-
- /**
- * Constraint info.
- */
- private String constraint;
-
- /**
- * Description string.
- */
- private String description;
-
- /**
- * Reference string.
- */
- private String reference;
-
- /**
- * YANG application error information.
- */
- private YangAppErrorInfo yangAppErrorInfo;
-
- /**
- * Creates a YANG must restriction.
- */
- public YangMust() {
- yangAppErrorInfo = new YangAppErrorInfo();
- yangAppErrorInfo.setErrorTag(OPERATION_FAILED_ERROR_TAG);
- yangAppErrorInfo.setErrorAppTag(MUST_VIOLATION_ERROR_APP_TAG);
- }
-
- /**
- * Returns the constraint.
- *
- * @return the constraint
- */
- public String getConstraint() {
- return constraint;
- }
-
- /**
- * Sets the constraint.
- *
- * @param constraint the constraint to set
- */
- public void setConstraint(String constraint) {
- this.constraint = constraint;
- }
-
- /**
- * Returns the description.
- *
- * @return the description
- */
- @Override
- public String getDescription() {
- return description;
- }
-
- /**
- * Sets the description.
- *
- * @param description set the description
- */
- @Override
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Returns the textual reference.
- *
- * @return the reference
- */
- @Override
- public String getReference() {
- return reference;
- }
-
- /**
- * Sets the textual reference.
- *
- * @param reference the reference to set
- */
- @Override
- public void setReference(String reference) {
- this.reference = reference;
- }
-
- /**
- * Returns the type of the parsed data.
- *
- * @return returns MUST_DATA
- */
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.MUST_DATA;
- }
-
- /**
- * Validates the data on entering the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnEntry() throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-
- /**
- * Validates the data on exiting the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnExit() throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-
- @Override
- public void setAppErrorInfo(YangAppErrorInfo yangAppErrorInfo) {
- this.yangAppErrorInfo = yangAppErrorInfo;
- }
-
- @Override
- public YangAppErrorInfo getAppErrorInfo() {
- return yangAppErrorInfo;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangMustHolder.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangMustHolder.java
deleted file mode 100644
index badd3d9..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangMustHolder.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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;
-
-import java.util.List;
-
-/**
- * Abstraction of must entity. It is used to abstract the data holders of must.
- */
-public interface YangMustHolder {
-
- /**
- * Returns the list of must from data holder like container / list.
- *
- * @return the list of must
- */
- List<YangMust> getListOfMust();
-
- /**
- * Sets the list of must.
- *
- * @param mustConstraintList the list of must to set
- */
- void setListOfMust(List<YangMust> mustConstraintList);
-
- /**
- * Adds must in data holder like container / list.
- *
- * @param must the must to be added
- */
- void addMust(YangMust must);
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNameSpace.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNameSpace.java
deleted file mode 100644
index 60f327f..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNameSpace.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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;
-
-import java.io.Serializable;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-/*
- * Reference:RFC 6020.
- * The "namespace" statement defines the XML namespace that all
- * identifiers defined by the module are qualified by, with the
- * exception of data node identifiers defined inside a grouping.
- * The argument to the "namespace" statement is the URI of the
- * namespace.
- */
-
-/**
- * Represents name space to be used for the XML data tree.
- */
-public class YangNameSpace implements Parsable, Serializable {
-
- private static final long serialVersionUID = 806201647L;
-
- private String uri;
-
- /**
- * Creats a YANG name space object.
- */
- public YangNameSpace() {
- }
-
- /**
- * Returns the name space URI.
- *
- * @return the URI
- */
- public String getUri() {
- return uri;
- }
-
- /**
- * Sets the name space URI.
- *
- * @param uri the URI to set
- */
- public void setUri(String uri) {
- this.uri = uri;
- }
-
- /**
- * Returns the type of the parsed data.
- *
- * @return returns NAMESPACE_DATA
- */
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.NAMESPACE_DATA;
- }
-
- /**
- * Validates the data on entering the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnEntry() throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-
- /**
- * Validates the data on exiting the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnExit() throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNode.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNode.java
deleted file mode 100644
index d501b0b..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNode.java
+++ /dev/null
@@ -1,478 +0,0 @@
-/*
- * 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;
-
-import java.io.Serializable;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-
-import static org.onosproject.yangutils.datamodel.TraversalType.CHILD;
-import static org.onosproject.yangutils.datamodel.TraversalType.PARENT;
-import static org.onosproject.yangutils.datamodel.TraversalType.SIBILING;
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.cloneLeaves;
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.updateClonedLeavesUnionEnumRef;
-
-/**
- * Represents base class of a node in data model tree.
- */
-public abstract class YangNode
- implements Cloneable, Serializable, YangDataNode, Comparable<YangNode> {
-
- private static final long serialVersionUID = 806201601L;
-
- /**
- * Type of node.
- */
- private YangNodeType nodeType;
-
- /**
- * Parent reference.
- */
- private YangNode parent;
-
- /**
- * First child reference.
- */
- private YangNode child;
-
- /**
- * Next sibling reference.
- */
- private YangNode nextSibling;
-
- /**
- * Previous sibling reference.
- */
- private YangNode previousSibling;
-
- /**
- * Priority of the node.
- */
- private int priority;
-
- /**
- * Flag if the node is for translation.
- */
- private boolean isToTranslate = true;
-
- /**
- * Returns the priority of the node.
- *
- * @return priority of the node
- */
- public int getPriority() {
- return priority;
- }
-
- /**
- * Sets the priority of the node.
- *
- * @param priority of the node
- */
- public void setPriority(int priority) {
- this.priority = priority;
- }
-
- /**
- * Returns the nodes name.
- *
- * @return nodes name
- */
- public abstract String getName();
-
- /**
- * Sets the nodes name.
- *
- * @param name nodes name
- */
- public abstract void setName(String name);
-
- /**
- * Creates a YANG node object.
- */
- @SuppressWarnings("unused")
- private YangNode() {
-
- }
-
- /**
- * Creates a specific type of node.
- *
- * @param type of YANG node
- */
- protected YangNode(YangNodeType type) {
- setNodeType(type);
- }
-
- /**
- * Returns the node type.
- *
- * @return node type
- */
- public YangNodeType getNodeType() {
- return nodeType;
- }
-
- /**
- * Sets the node type.
- *
- * @param nodeType type of node
- */
- private void setNodeType(YangNodeType nodeType) {
- this.nodeType = nodeType;
- }
-
- /**
- * Returns the parent of node.
- *
- * @return parent of node
- */
- public YangNode getParent() {
- return parent;
- }
-
- /**
- * Sets the parent of node.
- *
- * @param parent node
- */
- public void setParent(YangNode parent) {
- this.parent = parent;
- }
-
- /**
- * Returns the first child of node.
- *
- * @return first child of node
- */
- public YangNode getChild() {
- return child;
- }
-
- /**
- * Sets the first instance of a child node.
- *
- * @param child is only child to be set
- */
- public void setChild(YangNode child) {
- this.child = child;
- }
-
- /**
- * Returns the next sibling of node.
- *
- * @return next sibling of node
- */
- public YangNode getNextSibling() {
- return nextSibling;
- }
-
- /**
- * Sets the next sibling of node.
- *
- * @param sibling YANG node
- */
- public void setNextSibling(YangNode sibling) {
- nextSibling = sibling;
- }
-
- /**
- * Returns the previous sibling.
- *
- * @return previous sibling node
- */
- public YangNode getPreviousSibling() {
- return previousSibling;
- }
-
- /**
- * Sets the previous sibling.
- *
- * @param previousSibling points to predecessor sibling
- */
- public void setPreviousSibling(YangNode previousSibling) {
- this.previousSibling = previousSibling;
- }
-
- /**
- * Adds a child node, the children sibling list will be sorted based on node
- * type.
- *
- * @param newChild refers to a child to be added
- * @throws DataModelException due to violation in data model rules
- */
- public void addChild(YangNode newChild)
- throws DataModelException {
- if (newChild.getNodeType() == null) {
- throw new DataModelException("Abstract node cannot be inserted into a tree");
- }
-
- if (newChild.getParent() == null) {
- newChild.setParent(this);
- } else if (newChild.getParent() != this) {
- throw new DataModelException("Node is already part of a tree");
- }
-
- if (newChild.getChild() != null) {
- throw new DataModelException("Child to be added is not atomic, it already has a child");
- }
-
- if (newChild.getNextSibling() != null) {
- throw new DataModelException("Child to be added is not atomic, it already has a next sibling");
- }
-
- if (newChild.getPreviousSibling() != null) {
- throw new DataModelException("Child to be added is not atomic, it already has a previous sibling");
- }
-
- /* First child to be added */
- if (getChild() == null) {
- setChild(newChild);
- return;
- }
-
- YangNode curNode;
- curNode = getChild();
-
- /*
- * Get the predecessor child of new child
- */
- while (curNode.getNextSibling() != null) {
-
- curNode = curNode.getNextSibling();
- }
-
- /* If the new node needs to be the last child */
- if (curNode.getNextSibling() == null) {
- curNode.setNextSibling(newChild);
- newChild.setPreviousSibling(curNode);
- }
- }
-
- @Override
- public int compareTo(YangNode otherNode) {
- if (priority == otherNode.getPriority()) {
- return 1;
- }
- return ((Integer) otherNode.getPriority()).compareTo(priority);
- }
-
- /**
- * Clones the current node contents and create a new node.
- *
- * @param yangUses YANG uses
- * @return cloned node
- * @throws CloneNotSupportedException clone is not supported by the referred
- * node
- */
- public YangNode clone(YangUses yangUses)
- throws CloneNotSupportedException {
- YangNode clonedNode = (YangNode) super.clone();
- if (clonedNode instanceof YangLeavesHolder) {
- try {
- cloneLeaves((YangLeavesHolder) clonedNode, yangUses);
- } catch (DataModelException e) {
- throw new CloneNotSupportedException(e.getMessage());
- }
- }
-
- clonedNode.setParent(null);
- clonedNode.setChild(null);
- clonedNode.setNextSibling(null);
- clonedNode.setPreviousSibling(null);
- return clonedNode;
- }
-
- /**
- * Clones the subtree from the specified source node to the mentioned target
- * node. The source and target root node cloning is carried out by the
- * caller.
- *
- * @param srcRootNode source node for sub tree cloning
- * @param dstRootNode destination node where the sub tree needs to be cloned
- * @param yangUses YANG uses
- * @throws DataModelException data model error
- */
- public static void cloneSubTree(YangNode srcRootNode, YangNode dstRootNode, YangUses yangUses)
- throws DataModelException {
-
- YangNode nextNodeToClone = srcRootNode;
- TraversalType curTraversal;
-
- YangNode clonedTreeCurNode = dstRootNode;
- YangNode newNode = null;
-
- nextNodeToClone = nextNodeToClone.getChild();
- if (nextNodeToClone == null) {
- return;
- } else {
- /**
- * Root level cloning is taken care in the caller.
- */
- curTraversal = CHILD;
- }
-
- /**
- * Caller ensures the cloning of the root nodes
- */
- try {
- while (nextNodeToClone != srcRootNode) {
- if (nextNodeToClone == null) {
- throw new DataModelException("Internal error: Cloning failed, source tree null pointer reached");
- }
- if (curTraversal != PARENT) {
- newNode = nextNodeToClone.clone(yangUses);
- detectCollisionWhileCloning(clonedTreeCurNode, newNode, curTraversal);
- }
-
- if (curTraversal == CHILD) {
-
- /**
- * add the new node to the cloned tree.
- */
- clonedTreeCurNode.addChild(newNode);
-
- /**
- * update the cloned tree's traversal current node as the
- * new node.
- */
- clonedTreeCurNode = newNode;
- } else if (curTraversal == SIBILING) {
-
- clonedTreeCurNode.addNextSibling(newNode);
- clonedTreeCurNode = newNode;
- } else if (curTraversal == PARENT) {
- if (clonedTreeCurNode instanceof YangLeavesHolder) {
- updateClonedLeavesUnionEnumRef((YangLeavesHolder) clonedTreeCurNode);
- }
- clonedTreeCurNode = clonedTreeCurNode.getParent();
- }
-
- if (curTraversal != PARENT && nextNodeToClone.getChild() != null) {
- curTraversal = CHILD;
-
- /**
- * update the traversal's current node.
- */
- nextNodeToClone = nextNodeToClone.getChild();
-
- } else if (nextNodeToClone.getNextSibling() != null) {
-
- curTraversal = SIBILING;
-
- nextNodeToClone = nextNodeToClone.getNextSibling();
- } else {
- curTraversal = PARENT;
- nextNodeToClone = nextNodeToClone.getParent();
- }
- }
- } catch (CloneNotSupportedException e) {
- throw new DataModelException("Failed to clone the tree");
- }
-
- }
-
- /**
- * Detects collision when the grouping is deep copied to the uses's parent.
- *
- * @param currentNode parent/previous sibling node for the new node
- * @param newNode node which has to be added
- * @param addAs traversal type of the node
- * @throws DataModelException data model error
- */
- private static void detectCollisionWhileCloning(YangNode currentNode, YangNode newNode, TraversalType addAs)
- throws DataModelException {
- if (!(currentNode instanceof CollisionDetector)
- || !(newNode instanceof Parsable)) {
- throw new DataModelException("Node in data model tree does not support collision detection");
- }
-
- CollisionDetector collisionDetector = (CollisionDetector) currentNode;
- Parsable parsable = (Parsable) newNode;
- if (addAs == TraversalType.CHILD) {
- collisionDetector.detectCollidingChild(newNode.getName(), parsable.getYangConstructType());
- } else if (addAs == TraversalType.SIBILING) {
- currentNode = currentNode.getParent();
- if (!(currentNode instanceof CollisionDetector)) {
- throw new DataModelException("Node in data model tree does not support collision detection");
- }
- collisionDetector = (CollisionDetector) currentNode;
- collisionDetector.detectCollidingChild(newNode.getName(), parsable.getYangConstructType());
- } else {
- throw new DataModelException("Errored tree cloning");
- }
-
- }
-
- /**
- * /** Returns true if translation required.
- *
- * @return true if translation required
- */
- public boolean isToTranslate() {
- return isToTranslate;
- }
-
- /**
- * Sest true if translation required.
- *
- * @param toTranslate true if translation required.
- */
- public void setToTranslate(boolean toTranslate) {
- isToTranslate = toTranslate;
- }
-
- /**
- * Adds a new next sibling.
- *
- * @param newSibling new sibling to be added
- * @throws DataModelException data model error
- */
- private void addNextSibling(YangNode newSibling)
- throws DataModelException {
-
- if (newSibling.getNodeType() == null) {
- throw new DataModelException("Cloned abstract node cannot be inserted into a tree");
- }
-
- if (newSibling.getParent() == null) {
- /**
- * Since the siblings needs to have a common parent, set the parent
- * as the current node's parent
- */
- newSibling.setParent(getParent());
-
- } else {
- throw new DataModelException("Node is already part of a tree, and cannot be added as a sibling");
- }
-
- if (newSibling.getPreviousSibling() == null) {
- newSibling.setPreviousSibling(this);
- setNextSibling(newSibling);
- } else {
- throw new DataModelException("New sibling to be added is not atomic, it already has a previous sibling");
- }
-
- if (newSibling.getChild() != null) {
- throw new DataModelException("Sibling to be added is not atomic, it already has a child");
- }
-
- if (newSibling.getNextSibling() != null) {
- throw new DataModelException("Sibling to be added is not atomic, it already has a next sibling");
- }
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNodeIdentifier.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNodeIdentifier.java
deleted file mode 100644
index 8c0ff9f..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNodeIdentifier.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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;
-
-import java.io.Serializable;
-
-/**
- * Represents YANG node identifier which is a combination of prefix and name.
- */
-public class YangNodeIdentifier implements Serializable {
-
- private static final long serialVersionUID = 806201648L;
-
- // Name of the node.
- private String name;
-
- // Prefix of the node.
- private String prefix;
-
- /**
- * Creates an instance of YANG node identifier.
- */
- public YangNodeIdentifier() {
- }
-
- /**
- * Returns name of the node identifier.
- *
- * @return name of the node identifier
- */
- public String getName() {
- return name;
- }
-
- /**
- * Sets name of the node identifier.
- *
- * @param name name of the node identifier
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Returns prefix of the node identifier.
- *
- * @return name of the node identifier
- */
- public String getPrefix() {
- return prefix;
- }
-
- /**
- * Sets prefix of the node identifier.
- *
- * @param prefix prefix of the node identifier
- */
- public void setPrefix(String prefix) {
- this.prefix = prefix;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNodeType.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNodeType.java
deleted file mode 100644
index c6108c7..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNodeType.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * 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;
-
-/**
- * Represents node type in data model tree corresponding to YANG schema.
- */
-public enum YangNodeType {
- /**
- * Node contains module information.
- */
- MODULE_NODE,
-
- /**
- * Node contains sub module information.
- */
- SUB_MODULE_NODE,
-
- /**
- * Node contains "YANG's typedef" information.
- */
- TYPEDEF_NODE,
-
- /**
- * Node contains "YANG's type" information.
- */
- TYPE_NODE,
-
- /**
- * Node contains "YANG's choice" information.
- */
- CHOICE_NODE,
-
- /**
- * Node contains "YANG's case" information.
- */
- CASE_NODE,
-
- /**
- * Node contains "YANG's enumeration" information.
- */
- ENUMERATION_NODE,
-
- /**
- * Node contains grouping information.
- */
- GROUPING_NODE,
-
- /**
- * Node contains "YANG's uses" information.
- */
- USES_NODE,
-
- /**
- * Node contains augmentation information.
- */
- AUGMENT_NODE,
-
- /**
- * Node contains "YANG's container" information.
- */
- CONTAINER_NODE,
-
- /**
- * Node contains "YANG's notification" information.
- */
- NOTIFICATION_NODE,
-
- /**
- * Node contains "YANG's input" information.
- */
- INPUT_NODE,
-
- /**
- * Node contains "YANG's output" information.
- */
- OUTPUT_NODE,
-
- /**
- * Node contains "YANG's rpc" information.
- */
- RPC_NODE,
-
- /**
- * Node contains "YANG's union" information.
- */
- UNION_NODE,
-
- /**
- * Node contains "YANG's list" information.
- */
- LIST_NODE,
-
- /**
- * Identity node.
- */
- IDENTITY_NODE,
-
- /**
- * Identityref node.
- */
- IDENTITYREF_NODE
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNotification.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNotification.java
deleted file mode 100644
index 0484b0e..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNotification.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * 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;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
-
-/*
- * Reference RFC 6020.
- *
- * YANG allows the definition of notifications suitable for NETCONF.
- * YANG data definition statements are used to model the content of the
- * notification.
- *
- * The "notification" statement is used to define a NETCONF
- * notification. It takes one argument, which is an identifier,
- * followed by a block of substatements that holds detailed notification
- * information. The "notification" statement defines a notification
- * node in the schema tree.
- *
- * If a leaf in the notification tree has a "mandatory" statement with
- * the value "true", the leaf MUST be present in a NETCONF notification.
- *
- * If a leaf in the notification tree has a default value, the NETCONF
- * client MUST use this value in the same cases as described in
- * Section 7.6.1. In these cases, the client MUST operationally behave
- * as if the leaf was present in the NETCONF notification with the
- * default value as its value.
- *
- * If a "config" statement is present for any node in the notification
- * tree, the "config" statement is ignored.
- *
- * The notification's substatements
- *
- * +--------------+---------+-------------+------------------+
- * | substatement | section | cardinality |data model mapping|
- * +--------------+---------+-------------+------------------+
- * | anyxml | 7.10 | 0..n | -not supported |
- * | choice | 7.9 | 0..n | -child nodes |
- * | container | 7.5 | 0..n | -child nodes |
- * | description | 7.19.3 | 0..1 | -string |
- * | grouping | 7.11 | 0..n | -child nodes |
- * | if-feature | 7.18.2 | 0..n | -YangIfFeature |
- * | leaf | 7.6 | 0..n | -YangLeaf |
- * | leaf-list | 7.7 | 0..n | -YangLeafList |
- * | list | 7.8 | 0..n | -child nodes |
- * | reference | 7.19.4 | 0..1 | -string |
- * | status | 7.19.2 | 0..1 | -YangStatus |
- * | typedef | 7.3 | 0..n | -child nodes |
- * | uses | 7.12 | 0..n | -child nodes |
- * +--------------+---------+-------------+------------------+
- */
-
-/**
- * Represents data model node to maintain information defined in YANG notification.
- */
-public class YangNotification
- extends YangNode
- implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector,
- YangAugmentableNode, YangIfFeatureHolder {
-
- private static final long serialVersionUID = 806201611L;
-
- /**
- * Name of the notification.
- */
- private String name;
-
- /**
- * Description of notification.
- */
- private String description;
-
- /**
- * List of leaves contained.
- */
- private List<YangLeaf> listOfLeaf;
-
- /**
- * List of leaf-lists contained.
- */
- private List<YangLeafList> listOfLeafList;
-
- /**
- * Reference of the module.
- */
- private String reference;
-
- /**
- * Status of the node.
- */
- private YangStatusType status = YangStatusType.CURRENT;
-
- /**
- * List of if-feature.
- */
- private List<YangIfFeature> ifFeatureList;
-
- private List<YangAugmentedInfo> yangAugmentedInfo = new ArrayList<>();
-
- /**
- * Create a notification node.
- */
- public YangNotification() {
- super(YangNodeType.NOTIFICATION_NODE);
- listOfLeaf = new LinkedList<>();
- listOfLeafList = new LinkedList<>();
- }
-
- @Override
- public void detectCollidingChild(String identifierName, YangConstructType dataType)
- throws DataModelException {
- // Detect colliding child.
- detectCollidingChildUtil(identifierName, dataType, this);
- }
-
- @Override
- public void detectSelfCollision(String identifierName, YangConstructType dataType)
- throws DataModelException {
- if (getName().equals(identifierName)) {
- throw new DataModelException("YANG file error: Duplicate input identifier detected, same as notification \""
- + getName() + "\"");
- }
- }
-
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.NOTIFICATION_DATA;
- }
-
- @Override
- public void validateDataOnEntry()
- throws DataModelException {
- //TODO: implement the method.
- }
-
- @Override
- public void validateDataOnExit()
- throws DataModelException {
- //TODO: implement the method.
- }
-
- @Override
- public String getDescription() {
- return description;
- }
-
- @Override
- public void setDescription(String description) {
- this.description = description;
- }
-
- @Override
- public List<YangLeaf> getListOfLeaf() {
- return listOfLeaf;
- }
-
- @Override
- public void setListOfLeaf(List<YangLeaf> leafsList) {
- listOfLeaf = leafsList;
- }
-
- @Override
- public void addLeaf(YangLeaf leaf) {
- getListOfLeaf().add(leaf);
- }
-
- @Override
- public List<YangLeafList> getListOfLeafList() {
- return listOfLeafList;
- }
-
- @Override
- public void setListOfLeafList(List<YangLeafList> listOfLeafList) {
- this.listOfLeafList = listOfLeafList;
- }
-
- @Override
- public void addLeafList(YangLeafList leafList) {
- getListOfLeafList().add(leafList);
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public void setName(String name) {
- this.name = name;
- }
-
- @Override
- public String getReference() {
- return reference;
- }
-
- @Override
- public void setReference(String reference) {
- this.reference = reference;
- }
-
- @Override
- public YangStatusType getStatus() {
- return status;
- }
-
- @Override
- public void setStatus(YangStatusType status) {
- this.status = status;
- }
-
- @Override
- public List<YangIfFeature> getIfFeatureList() {
- return ifFeatureList;
- }
-
- @Override
- public void addIfFeatureList(YangIfFeature ifFeature) {
- if (getIfFeatureList() == null) {
- setIfFeatureList(new LinkedList<>());
- }
- getIfFeatureList().add(ifFeature);
- }
-
- @Override
- public void setIfFeatureList(List<YangIfFeature> ifFeatureList) {
- this.ifFeatureList = ifFeatureList;
- }
-
- @Override
- public void addAugmentation(YangAugmentedInfo augmentInfo) {
- yangAugmentedInfo.add(augmentInfo);
- }
-
- @Override
- public void removeAugmentation(YangAugmentedInfo augmentInfo) {
- yangAugmentedInfo.remove(augmentInfo);
- }
-
- @Override
- public List<YangAugmentedInfo> getAugmentedInfoList() {
- return yangAugmentedInfo;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangOutput.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangOutput.java
deleted file mode 100644
index 0e496bb..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangOutput.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * 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;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
-
-/*
- * Reference RFC 6020.
- *
- * The "output" statement, which is optional, is used to define output
- * parameters to the RPC operation. It does not take an argument. The
- * substatements to "output" define nodes under the RPC's output node.
- *
- * If a leaf in the output tree has a "mandatory" statement with the
- * value "true", the leaf MUST be present in a NETCONF RPC reply.
- *
- * If a leaf in the output tree has a default value, the NETCONF client
- * MUST use this value in the same cases as described in Section 7.6.1.
- * In these cases, the client MUST operationally behave as if the leaf
- * was present in the NETCONF RPC reply with the default value as its
- * value.
- *
- * If a "config" statement is present for any node in the output tree,
- * the "config" statement is ignored.
- *
- * If any node has a "when" statement that would evaluate to false, then
- * this node MUST NOT be present in the output tree.
- *
- * The output substatements
- *
- * +--------------+---------+-------------+------------------+
- * | substatement | section | cardinality |data model mapping|
- * +--------------+---------+-------------+------------------+
- * | anyxml | 7.10 | 0..n | -not supported |
- * | choice | 7.9 | 0..n | -child nodes |
- * | container | 7.5 | 0..n | -child nodes |
- * | grouping | 7.11 | 0..n | -child nodes |
- * | leaf | 7.6 | 0..n | -YangLeaf |
- * | leaf-list | 7.7 | 0..n | -YangLeafList |
- * | list | 7.8 | 0..n | -child nodes |
- * | typedef | 7.3 | 0..n | -child nodes |
- * | uses | 7.12 | 0..n | -child nodes |
- * +--------------+---------+-------------+------------------+
- */
-
-/**
- * Represents data model node to maintain information defined in YANG output.
- */
-public class YangOutput
- extends YangNode
- implements YangLeavesHolder, Parsable, CollisionDetector, YangAugmentableNode, YangIsFilterContentNodes {
-
- private static final long serialVersionUID = 806201612L;
-
- /**
- * Name of the output.
- */
- private String name;
-
- /**
- * List of leaves contained.
- */
- private List<YangLeaf> listOfLeaf;
-
- /**
- * List of leaf-lists contained.
- */
- private List<YangLeafList> listOfLeafList;
-
- private List<YangAugmentedInfo> yangAugmentedInfo = new ArrayList<>();
-
- /**
- * Create a rpc output node.
- */
- public YangOutput() {
- super(YangNodeType.OUTPUT_NODE);
- listOfLeaf = new LinkedList<>();
- listOfLeafList = new LinkedList<>();
- }
-
- @Override
- public void detectCollidingChild(String identifierName, YangConstructType dataType)
- throws DataModelException {
- // Detect colliding child.
- detectCollidingChildUtil(identifierName, dataType, this);
- }
-
- @Override
- public void detectSelfCollision(String identifierName, YangConstructType dataType)
- throws DataModelException {
- if (getName().equals(identifierName)) {
- throw new DataModelException("YANG file error: Duplicate identifier detected, same as output \""
- + getName() + "\"");
- }
- }
-
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.OUTPUT_DATA;
- }
-
- @Override
- public void validateDataOnEntry()
- throws DataModelException {
- //TODO: implement the method.
- }
-
- @Override
- public void validateDataOnExit()
- throws DataModelException {
- //TODO: implement the method.
- }
-
- @Override
- public List<YangLeaf> getListOfLeaf() {
- return listOfLeaf;
- }
-
- @Override
- public void addLeaf(YangLeaf leaf) {
- getListOfLeaf().add(leaf);
- }
-
- @Override
- public void setListOfLeaf(List<YangLeaf> leafsList) {
- listOfLeaf = leafsList;
- }
-
- @Override
- public List<YangLeafList> getListOfLeafList() {
- return listOfLeafList;
- }
-
- @Override
- public void setListOfLeafList(List<YangLeafList> listOfLeafList) {
- this.listOfLeafList = listOfLeafList;
- }
-
- @Override
- public void addLeafList(YangLeafList leafList) {
- getListOfLeafList().add(leafList);
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public void setName(String name) {
- this.name = name;
- }
-
- @Override
- public void addAugmentation(YangAugmentedInfo augmentInfo) {
- yangAugmentedInfo.add(augmentInfo);
- }
-
- @Override
- public void removeAugmentation(YangAugmentedInfo augmentInfo) {
- yangAugmentedInfo.remove(augmentInfo);
- }
-
- @Override
- public List<YangAugmentedInfo> getAugmentedInfoList() {
- return yangAugmentedInfo;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangPathArgType.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangPathArgType.java
deleted file mode 100644
index 26e1fb2..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangPathArgType.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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;
-
-/**
- * Represents path argument type in data model tree.
- */
-public enum YangPathArgType {
-
- /**
- * Absolute path.
- */
- ABSOLUTE_PATH,
-
- /**
- * Relative path.
- */
- RELATIVE_PATH
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangPathOperator.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangPathOperator.java
deleted file mode 100644
index 0594af8..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangPathOperator.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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;
-
-/**
- * Represents path-expr in data model tree.
- */
-public enum YangPathOperator {
-
- /**
- * Path expression contains equal-to.
- */
- EQUALTO
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangPathPredicate.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangPathPredicate.java
deleted file mode 100644
index cf45349..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangPathPredicate.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * 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;
-
-import java.io.Serializable;
-
-/**
- * Representation of data model node to maintain path predicate in YANG absolute-path or relative-path.
- */
-public class YangPathPredicate<T> implements Serializable {
-
- private static final long serialVersionUID = 806201689L;
-
- // YANG node identifier.
- private YangNodeIdentifier nodeIdentifier;
-
- // Left axis node will represent the nodeidentifier before equality sign in path predicate.
- private T leftAxisNode;
-
- // YANG path operator.
- private YangPathOperator pathOperator;
-
- // YANG relative path.
- private YangRelativePath rightRelativePath;
-
- // Right axis node will represent the nodeidentifier after equality sign in path predicate.
- private T rightAxisNode;
-
- /**
- * Returns the path expression operator.
- *
- * @return the path expression operator
- */
- public YangPathOperator getPathOperator() {
- return pathOperator;
- }
-
- /**
- * Sets the path expression operator.
- *
- * @param pathOperator Sets the path expression operator
- */
- public void setPathOperator(YangPathOperator pathOperator) {
- this.pathOperator = pathOperator;
- }
-
- /**
- * Returns the right relative path expression.
- *
- * @return the right relative path expression
- */
- public YangRelativePath getRightRelativePath() {
- return rightRelativePath;
- }
-
- /**
- * Sets the right relative path expression.
- *
- * @param rightRelativePath Sets the right relative path expression
- */
- public void setRightRelativePath(YangRelativePath rightRelativePath) {
- this.rightRelativePath = rightRelativePath;
- }
-
- /**
- * Returns the nodeidentifier.
- *
- * @return the nodeidentifier
- */
- public YangNodeIdentifier getNodeIdentifier() {
- return nodeIdentifier;
- }
-
- /**
- * Sets the YANG node identifier.
- *
- * @param nodeIdentifier Sets the node identifier
- *
- */
- public void setNodeIdentifier(YangNodeIdentifier nodeIdentifier) {
- this.nodeIdentifier = nodeIdentifier;
- }
-
- /**
- * Returns the left axis node.
- *
- * @return the left axis node
- */
- public T getLeftAxisNode() {
- return leftAxisNode;
- }
-
- /**
- * Sets the left axis node.
- *
- * @param leftAxisNode Sets the left axis node
- */
- public void setLeftAxisNode(T leftAxisNode) {
- this.leftAxisNode = leftAxisNode;
- }
-
- /**
- * Returns the right axis node.
- *
- * @return the right axis node
- */
- public T getRightAxisNode() {
- return rightAxisNode;
- }
-
- /**
- * Sets the right axis node.
- *
- * @param rightAxisNode Sets the right axis node
- */
- public void setRightAxisNode(T rightAxisNode) {
- this.rightAxisNode = rightAxisNode;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangPatternRestriction.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangPatternRestriction.java
deleted file mode 100644
index 9e5d8ef..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangPatternRestriction.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * 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;
-
-import java.io.Serializable;
-import java.util.LinkedList;
-import java.util.List;
-
-/*-
- * Reference RFC 6020.
- *
- * The pattern Statement
- *
- * The "pattern" statement, which is an optional sub-statement to the
- * "type" statement, takes as an argument a regular expression string.
- * It is used to restrict the built-in type "string", or types derived
- * from "string", to values that match the pattern.
- *
- * If the type has multiple "pattern" statements, the expressions are
- * ANDed together, i.e., all such expressions have to match.
- *
- * If a pattern restriction is applied to an already pattern-restricted
- * type, values must match all patterns in the base type, in addition to
- * the new patterns.
- * The pattern's sub-statements
- *
- * +---------------+---------+-------------+
- * | substatement | section | cardinality |
- * +---------------+---------+-------------+
- * | description | 7.19.3 | 0..1 |
- * | error-app-tag | 7.5.4.2 | 0..1 |
- * | error-message | 7.5.4.1 | 0..1 |
- * | reference | 7.19.4 | 0..1 |
- * +---------------+---------+-------------+
- */
-
-/**
- * Represents pattern restriction information. The regular expression restriction on string
- * data type.
- */
-public class YangPatternRestriction implements Serializable, YangAppErrorHolder {
-
- private static final long serialVersionUID = 806201649L;
-
- /**
- * Pattern restriction defined for the current type.
- */
- private List<String> patternList;
-
- /**
- * YANG application error information.
- */
- private YangAppErrorInfo yangAppErrorInfo;
-
- /**
- * Creates a YANG pattern restriction object.
- */
- public YangPatternRestriction() {
- setPatternList(new LinkedList<String>());
- }
-
- /**
- * Returns the pattern restriction defined for the current type.
- *
- * @return pattern restriction defined for the current type.
- */
- public List<String> getPatternList() {
- return patternList;
- }
-
- /**
- * Sets the pattern restriction defined for the current type.
- *
- * @param pattern pattern restriction defined for the current type..
- */
- private void setPatternList(List<String> pattern) {
- patternList = pattern;
- }
-
- /**
- * Adds a new pattern to the list of pattern restriction.
- *
- * @param newPattern pattern restriction.
- */
- public void addPattern(String newPattern) {
- getPatternList().add(newPattern);
- }
-
- @Override
- public void setAppErrorInfo(YangAppErrorInfo yangAppErrorInfo) {
- this.yangAppErrorInfo = yangAppErrorInfo;
- }
-
- @Override
- public YangAppErrorInfo getAppErrorInfo() {
- return yangAppErrorInfo;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRangeInterval.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRangeInterval.java
deleted file mode 100644
index 4ee9787..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRangeInterval.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*Copyright 2016.year 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;
-
-import java.io.Serializable;
-
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangBuiltInDataTypeInfo;
-
-/**
- * Represents single interval information of a range.
- *
- * @param <T> range type based on the data type
- */
-public class YangRangeInterval<T extends YangBuiltInDataTypeInfo<T>> implements Serializable {
-
- private static final long serialVersionUID = 806201650L;
-
- /**
- * Starting value of the range interval.
- */
- private T startValue;
-
- /**
- * Last value of the range interval.
- */
- private T endValue;
-
- /**
- * Creates YANG range interval object.
- */
- public YangRangeInterval() {
- }
-
- /**
- * Returns the starting value of the range interval.
- *
- * @return the starting value of the range interval
- */
- public T getStartValue() {
- return startValue;
- }
-
- /**
- * Sets the starting value of the range interval.
- *
- * @param startValue the starting value of the range interval
- */
- public void setStartValue(T startValue) {
- this.startValue = startValue;
- }
-
- /**
- * Returns the last value of the range interval.
- *
- * @return last value of the range interval
- */
- public T getEndValue() {
- return endValue;
- }
-
- /**
- * Sets the last value of the range interval.
- *
- * @param endValue last value of the range interval
- */
- public void setEndValue(T endValue) {
- this.endValue = endValue;
- }
-
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRangeRestriction.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRangeRestriction.java
deleted file mode 100644
index 29322e6..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRangeRestriction.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * 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;
-
-import java.io.Serializable;
-import java.util.LinkedList;
-import java.util.List;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangBuiltInDataTypeInfo;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-
-import static org.onosproject.yangutils.datamodel.BuiltInTypeObjectFactory.getDataObjectFromString;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/*-
- * Reference RFC 6020.
- *
- * The range Statement
- *
- * The "range" statement, which is an optional sub-statement to the
- * "type" statement, takes as an argument a range expression string. It
- * is used to restrict integer and decimal built-in types, or types
- * derived from those.
- *
- * A range consists of an explicit value, or a lower-inclusive bound,
- * two consecutive dots "..", and an upper-inclusive bound. Multiple
- * values or ranges can be given, separated by "|". If multiple values
- * or ranges are given, they all MUST be disjoint and MUST be in
- * ascending order. If a range restriction is applied to an already
- * range-restricted type, the new restriction MUST be equal or more
- * limiting, that is raising the lower bounds, reducing the upper
- * bounds, removing explicit values or ranges, or splitting ranges into
- * multiple ranges with intermediate gaps. Each explicit value and
- * range boundary value given in the range expression MUST match the
- * type being restricted, or be one of the special values "min" or
- * "max". "min" and "max" mean the minimum and maximum value accepted
- * for the type being restricted, respectively.
- */
-
-/**
- * Represents ascending range restriction information.
- *
- * @param <T> range type (data type)
- */
-public class YangRangeRestriction<T extends YangBuiltInDataTypeInfo<T>>
- implements YangDesc, YangReference, Parsable, Serializable, YangAppErrorHolder {
-
- private static final long serialVersionUID = 8062016051L;
-
- /**
- * Ascending list of range interval restriction. If the restriction is a
- * single value, the start and end length of the range is same.
- */
- private List<YangRangeInterval<T>> ascendingRangeIntervals;
-
- /**
- * Textual reference.
- */
- private String reference;
-
- /**
- * Textual description.
- */
- private String description;
-
- /**
- * YANG application error information.
- */
- private YangAppErrorInfo yangAppErrorInfo;
-
- /**
- * Creates YANG range restriction object.
- */
- public YangRangeRestriction() {
- }
-
- /**
- * Returns the list of range interval restriction in ascending order.
- *
- * @return list of range interval restriction in ascending order
- */
- public List<YangRangeInterval<T>> getAscendingRangeIntervals() {
- return ascendingRangeIntervals;
- }
-
- /**
- * Sets the list of range interval restriction in ascending order.
- *
- * @param rangeList list of range interval restriction in ascending order
- */
- private void setAscendingRangeIntervals(List<YangRangeInterval<T>> rangeList) {
- ascendingRangeIntervals = rangeList;
- }
-
- /**
- * Returns the minimum valid value as per the restriction.
- *
- * @return minimum restricted value
- * @throws DataModelException data model exception for minimum restriction
- */
- public T getMinRestrictedvalue() throws DataModelException {
- if (getAscendingRangeIntervals() == null) {
- throw new DataModelException("No range restriction info");
- }
- if (getAscendingRangeIntervals().isEmpty()) {
- throw new DataModelException("No range interval info");
- }
- return getAscendingRangeIntervals().get(0).getStartValue();
- }
-
- /**
- * Returns the maximum valid value as per the restriction.
- *
- * @return minimum maximum value
- * @throws DataModelException data model exception for maximum restriction
- */
- public T getMaxRestrictedvalue() throws DataModelException {
- if (getAscendingRangeIntervals() == null) {
- throw new DataModelException("No range restriction info");
- }
- if (getAscendingRangeIntervals().isEmpty()) {
- throw new DataModelException("No range interval info");
- }
- return getAscendingRangeIntervals()
- .get(getAscendingRangeIntervals().size() - 1).getEndValue();
- }
-
- /**
- * Adds new interval to extend its range in the last. i.e. newly added
- * interval needs to be bigger than the biggest interval in the list.
- *
- * @param newInterval restricted length interval
- * @throws DataModelException data model exception for range restriction
- */
- public void addRangeRestrictionInterval(YangRangeInterval<T> newInterval) throws DataModelException {
-
- checkNotNull(newInterval);
- checkNotNull(newInterval.getStartValue());
-
- if (getAscendingRangeIntervals() == null) {
- /*
- * First interval that is being added, and it must be the smallest
- * interval.
- */
- setAscendingRangeIntervals(new LinkedList<YangRangeInterval<T>>());
- getAscendingRangeIntervals().add(newInterval);
- return;
- }
-
- T curMaxvalue = getMaxRestrictedvalue();
-
- if (newInterval.getStartValue().compareTo(curMaxvalue) < 1) {
- throw new DataModelException(
- "New added range interval is lesser than the old interval(s)");
- }
-
- getAscendingRangeIntervals()
- .add(getAscendingRangeIntervals().size(), newInterval);
- }
-
- /**
- * 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
- * @throws DataModelException data model error
- */
- public boolean isValidValueString(String valueInString) 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.");
-
- }
-
- YangDataTypes type = getAscendingRangeIntervals().get(0).getStartValue().getYangType();
- YangBuiltInDataTypeInfo<?> value = getDataObjectFromString(valueInString, type);
-
- for (YangRangeInterval<T> interval : getAscendingRangeIntervals()) {
- int rangeStartCompareRes = interval.getStartValue().compareTo((T) value);
- int rangeEndCompareRes = interval.getEndValue().compareTo((T) value);
-
- if (rangeStartCompareRes <= 0 && rangeEndCompareRes >= 0) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * 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
- */
- @Override
- public String getReference() {
- return reference;
- }
-
- /**
- * Sets the textual reference of the length restriction.
- *
- * @param ref textual reference of the length restriction
- */
- @Override
- public void setReference(String ref) {
- reference = ref;
- }
-
- /**
- * Returns the description of the length restriction.
- *
- * @return description of the length restriction
- */
- @Override
- public String getDescription() {
- return description;
- }
-
- /**
- * Sets the description of the length restriction.
- *
- * @param desc description of the length restriction
- */
- @Override
- public void setDescription(String desc) {
- description = desc;
-
- }
-
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.RANGE_DATA;
- }
-
- @Override
- public void validateDataOnEntry() throws DataModelException {
- // TODO: implement the method.
- }
-
- @Override
- public void validateDataOnExit() throws DataModelException {
- // TODO: implement the method.
- }
-
- @Override
- public void setAppErrorInfo(YangAppErrorInfo yangAppErrorInfo) {
- this.yangAppErrorInfo = yangAppErrorInfo;
- }
-
- @Override
- public YangAppErrorInfo getAppErrorInfo() {
- return yangAppErrorInfo;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangReference.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangReference.java
deleted file mode 100644
index 44397a3..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangReference.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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 textual reference for a YANG entity. Abstracted to unify the
- * parsing and translator processing of reference.
- */
-public interface YangReference {
-
- /**
- * Returns the textual reference.
- *
- * @return the reference
- */
- String getReference();
-
- /**
- * Sets the textual reference.
- *
- * @param reference the reference to set
- */
- void setReference(String reference);
-
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangReferenceResolver.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangReferenceResolver.java
deleted file mode 100644
index 8be3242..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangReferenceResolver.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * 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;
-
-import java.util.List;
-import java.util.Set;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-
-/**
- * Abstraction of YANG dependency resolution information. Abstracted to obtain the
- * resolution information.
- */
-public interface YangReferenceResolver {
-
- /**
- * Returns unresolved resolution list.
- *
- * @param type resolvable type
- * @return list of resolution information objects
- */
- List<YangResolutionInfo> getUnresolvedResolutionList(ResolvableType type);
-
- /**
- * Adds to the resolution list.
- *
- * @param resolutionInfo resolution information
- * @param type resolvable type
- */
- void addToResolutionList(YangResolutionInfo resolutionInfo, ResolvableType type);
-
- /**
- * Creates resolution list.
- *
- * @param resolutionList resolution list
- * @param type resolvable type
- */
- void setResolutionList(List<YangResolutionInfo> resolutionList, ResolvableType type);
-
- /**
- * Returns unresolved imported list.
- *
- * @return unresolved imported list
- */
- List<YangImport> getImportList();
-
- /**
- * Adds to the import list.
- *
- * @param yangImport import to be added
- */
- void addToImportList(YangImport yangImport);
-
- /**
- * Create import list.
- *
- * @param importList import list
- */
- void setImportList(List<YangImport> importList);
-
- /**
- * Returns unresolved include list.
- *
- * @return unresolved include list
- */
- List<YangInclude> getIncludeList();
-
- /**
- * Adds to the include list.
- *
- * @param yangInclude include to be added
- */
- void addToIncludeList(YangInclude yangInclude);
-
- /**
- * Creates include list.
- *
- * @param includeList include list
- */
- void setIncludeList(List<YangInclude> includeList);
-
- /**
- * Returns prefix of resolution root node.
- *
- * @return prefix resolution root node prefix
- */
- String getPrefix();
-
- /**
- * Sets prefix of resolution list root node.
- *
- * @param prefix resolution root node prefix
- */
- void setPrefix(String prefix);
-
- /**
- * Resolves self file linking.
- *
- * @param type resolvable type
- * @throws DataModelException a violation in data model rule
- */
- void resolveSelfFileLinking(ResolvableType type)
- throws DataModelException;
-
- /**
- * Resolves inter file linking.
- *
- * @param type resolvable type
- * @throws DataModelException a violation in data model rule
- */
- void resolveInterFileLinking(ResolvableType type)
- throws DataModelException;
-
- /**
- * Adds references to include.
- *
- * @param yangNodeSet YANG node info set
- * @throws DataModelException a violation of data model rules
- */
- void addReferencesToIncludeList(Set<YangNode> yangNodeSet)
- throws DataModelException;
-
- /**
- * Adds references to import.
- *
- * @param yangNodeSet YANG node info set
- * @throws DataModelException a violation of data model rules
- */
- void addReferencesToImportList(Set<YangNode> yangNodeSet)
- throws DataModelException;
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRelativePath.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRelativePath.java
deleted file mode 100644
index a7af2a2..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRelativePath.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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;
-
-import java.io.Serializable;
-import java.util.List;
-
-/**
- * Representation of data model node to maintain relative path defined in YANG path-arg.
- */
-public class YangRelativePath implements Serializable {
-
- private static final long serialVersionUID = 806201690L;
-
- // Relative path ancestor node count the number of node exist between current node to parent node.
- private int ancestorNodeCount;
-
- // Absolute path expression.
- private List<YangAtomicPath> atomicPathList;
-
- /**
- * Returns the absolute path.
- *
- * @return the absolute path
- */
- public List<YangAtomicPath> getAtomicPathList() {
- return atomicPathList;
- }
-
- /**
- * Sets the absolute path.
- *
- * @param atomicPathList Sets the absolute path
- */
- public void setAtomicPathList(List<YangAtomicPath> atomicPathList) {
- this.atomicPathList = atomicPathList;
- }
-
- /**
- * Returns the relative path ancestor count.
- *
- * @return the relative path ancestor count
- */
- public int getAncestorNodeCount() {
- return ancestorNodeCount;
- }
-
- /**
- * Sets the relative path ancestor count.
- *
- * @param ancestorNodeCount Sets the relative path ancestor count
- */
- public void setAncestorNodeCount(int ancestorNodeCount) {
- this.ancestorNodeCount = ancestorNodeCount;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangResolutionInfo.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangResolutionInfo.java
deleted file mode 100644
index c63e832..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangResolutionInfo.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-
-/**
- * Abstraction of resolution object which will be resolved by linker.
- *
- * @param <T> type of resolution entity uses / type
- */
-public interface YangResolutionInfo<T> extends LocationInfo {
-
- /**
- * Resolves linking with all the ancestors node for a resolution info.
- *
- * @param dataModelRootNode module/sub-module node
- * @throws DataModelException DataModelException a violation of data model
- * rules
- */
- void resolveLinkingForResolutionInfo(YangReferenceResolver dataModelRootNode)
- throws DataModelException;
-
- /**
- * Retrieves information about the entity that needs to be resolved.
- *
- * @return information about the entity that needs to be resolved
- */
- YangEntityToResolveInfo<T> getEntityToResolveInfo();
-
- /**
- * Performs inter file linking of uses/type referring to typedef/grouping
- * of other YANG file.
- *
- * @param dataModelRootNode module/sub-module node
- * @throws DataModelException a violation in data model rule
- */
- void linkInterFile(YangReferenceResolver dataModelRootNode)
- throws DataModelException;
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRevision.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRevision.java
deleted file mode 100644
index 0a5342c..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRevision.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * 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;
-
-import java.io.Serializable;
-import java.util.Date;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-/*
- * Reference:RFC 6020.
- * The "revision" statement specifies the editorial revision history of
- * the module, including the initial revision. A series of revision
- * statements detail the changes in the module's definition. The
- * argument is a date string in the format "YYYY-MM-DD", followed by a
- * block of sub-statements that holds detailed revision information. A
- * module SHOULD have at least one initial "revision" statement. For
- * every published editorial change, a new one SHOULD be added in front
- * of the revisions sequence, so that all revisions are in reverse
- * chronological order.
- * The revision's sub-statement
- *
- * +--------------+---------+-------------+------------------+
- * | substatement | section | cardinality |data model mapping|
- * +--------------+---------+-------------+------------------+
- * | description | 7.19.3 | 0..1 |string |
- * | reference | 7.19.4 | 0..1 |sring |
- * +--------------+---------+-------------+------------------+
- */
-
-/**
- * Represents the information about the revision.
- */
-public class YangRevision implements YangDesc, YangReference, Parsable, Serializable {
-
- private static final long serialVersionUID = 8062016052L;
-
- /**
- * Revision date. Date string in the format "YYYY-MM-DD"
- */
- private Date revDate;
-
- /**
- * Description of revision.
- */
- private String description;
-
- /**
- * Textual reference for revision.
- */
- private String reference;
-
- /**
- * Creates a YANG revision object.
- */
- public YangRevision() {
- }
-
- /**
- * Returns the revision date.
- *
- * @return the revision date
- */
- public Date getRevDate() {
- return revDate;
- }
-
- /**
- * Sets the revision date.
- *
- * @param revDate the revision date to set
- */
- public void setRevDate(Date revDate) {
- this.revDate = revDate;
- }
-
- /**
- * Returns the description.
- *
- * @return the description
- */
- @Override
- public String getDescription() {
- return description;
- }
-
- /**
- * Sets the description.
- *
- * @param description set the description
- */
- @Override
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Returns the textual reference.
- *
- * @return the reference
- */
- @Override
- public String getReference() {
- return reference;
- }
-
- /**
- * Sets the textual reference.
- *
- * @param reference the reference to set
- */
- @Override
- public void setReference(String reference) {
- this.reference = reference;
- }
-
- /**
- * Returns the type of the parsed data.
- *
- * @return returns REVISION_DATA
- */
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.REVISION_DATA;
- }
-
- /**
- * Validates the data on entering the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnEntry() throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
-
- }
-
- /**
- * Validates the data on exiting the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnExit() throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
-
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRpc.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRpc.java
deleted file mode 100644
index 72060ad..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangRpc.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * 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;
-
-import java.util.LinkedList;
-import java.util.List;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
-
-/*
- * Reference RFC 6020.
- *
- * The "rpc" statement is used to define a NETCONF RPC operation. It
- * takes one argument, which is an identifier, followed by a block of
- * substatements that holds detailed rpc information. This argument is
- * the name of the RPC, and is used as the element name directly under
- * the <rpc> element, as designated by the substitution group
- * "rpcOperation" in [RFC4741].
- *
- * The "rpc" statement defines an rpc node in the schema tree. Under
- * the rpc node, a schema node with the name "input", and a schema node
- * with the name "output" are also defined. The nodes "input" and
- * "output" are defined in the module's namespace.
- *
- * The rpc substatements
- *
- * +--------------+---------+-------------+------------------+
- * | substatement | section | cardinality |data model mapping|
- * +--------------+---------+-------------+------------------+
- * | description | 7.19.3 | 0..1 | -string |
- * | grouping | 7.11 | 0..n | -child nodes |
- * | if-feature | 7.18.2 | 0..n | -YangIfFeature |
- * | input | 7.13.2 | 0..1 | -child nodes |
- * | output | 7.13.3 | 0..1 | -child nodes |
- * | reference | 7.19.4 | 0..1 | -string |
- * | status | 7.19.2 | 0..1 | -YangStatus |
- * | typedef | 7.3 | 0..n | -child nodes |
- * +--------------+---------+-------------+------------------+
- */
-
-/**
- * Represents data model node to maintain information defined in YANG rpc.
- */
-public class YangRpc extends YangNode implements YangCommonInfo, Parsable,
- CollisionDetector, YangIfFeatureHolder {
-
- private static final long serialVersionUID = 806201613L;
-
- /**
- * Name of the rpc.
- */
- private String name;
-
- /**
- * Description of rpc.
- */
- private String description;
-
- /**
- * Reference of the module.
- */
- private String reference;
-
- /**
- * Status of the node.
- */
- private YangStatusType status = YangStatusType.CURRENT;
-
- /**
- * List of if-feature.
- */
- private List<YangIfFeature> ifFeatureList;
-
- /**
- * Create a rpc node.
- */
- public YangRpc() {
- super(YangNodeType.RPC_NODE);
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public void setName(String name) {
- this.name = name;
- }
-
- @Override
- public void detectCollidingChild(String identifierName, YangConstructType dataType) throws DataModelException {
- // Detect colliding child.
- detectCollidingChildUtil(identifierName, dataType, this);
- }
-
- @Override
- public void detectSelfCollision(String identifierName, YangConstructType dataType) throws DataModelException {
- if (getName().equals(identifierName)) {
- throw new DataModelException("YANG file error: Duplicate input identifier detected, same as rpc \""
- + getName() + "\"");
- }
- }
-
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.RPC_DATA;
- }
-
- @Override
- public void validateDataOnEntry() throws DataModelException {
- //TODO: implement the method.
- }
-
- @Override
- public void validateDataOnExit() throws DataModelException {
- //TODO: implement the method.
- }
-
- @Override
- public String getDescription() {
- return description;
- }
-
- @Override
- public void setDescription(String description) {
- this.description = description;
- }
-
- @Override
- public String getReference() {
- return reference;
- }
-
- @Override
- public void setReference(String reference) {
- this.reference = reference;
- }
-
- @Override
- public YangStatusType getStatus() {
- return status;
- }
-
- @Override
- public void setStatus(YangStatusType status) {
- this.status = status;
- }
-
- @Override
- public List<YangIfFeature> getIfFeatureList() {
- return ifFeatureList;
- }
-
- @Override
- public void addIfFeatureList(YangIfFeature ifFeature) {
- if (getIfFeatureList() == null) {
- setIfFeatureList(new LinkedList<>());
- }
- getIfFeatureList().add(ifFeature);
- }
-
- @Override
- public void setIfFeatureList(List<YangIfFeature> ifFeatureList) {
- this.ifFeatureList = ifFeatureList;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangStatus.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangStatus.java
deleted file mode 100644
index 2b3c626..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangStatus.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*Copyright 2016.year 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 for status on a YANG entity. Abstracted to unify the parsing and
- * translator processing of status.
- */
-public interface YangStatus {
-
- /**
- * Returns the status.
- *
- * @return the status
- */
- YangStatusType getStatus();
-
- /**
- * Sets the status.
- *
- * @param status the status to set
- */
- void setStatus(YangStatusType status);
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangStatusType.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangStatusType.java
deleted file mode 100644
index d5ac982..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangStatusType.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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;
-
-/*
- * Reference:RFC 6020.
- * The "status" statement takes as an argument one of the strings
- * "current", "deprecated", or "obsolete". If no status is specified,
- * the default is "current".
- */
-
-/**
- * Represents the status of YANG entities.
- */
-public enum YangStatusType {
- /**
- * Reference:RFC 6020.
- *
- * "current" means that the definition is current and valid.
- */
- CURRENT,
-
- /**
- * Reference:RFC 6020.
- *
- * "deprecated" indicates an obsolete definition, but it
- * permits new/ continued implementation in order to foster interoperability
- * with older/existing implementations.
- */
- DEPRECATED,
-
- /**
- * Reference:RFC 6020.
- *
- * "obsolete" means the definition is obsolete and
- * SHOULD NOT be implemented and/or can be removed from implementations.
- */
- OBSOLETE
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangStringRestriction.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangStringRestriction.java
deleted file mode 100644
index dcd0f1d..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangStringRestriction.java
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * 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;
-
-import java.io.Serializable;
-import java.math.BigInteger;
-import java.util.ListIterator;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangUint64;
-
-/*-
- * Reference RFC 6020.
- *
- * A string can be restricted with the "length" and "pattern" statements.
- *
- */
-
-/**
- * Represents the restriction for string data type.
- */
-public class YangStringRestriction implements YangDesc, YangReference, Parsable, Serializable {
-
- /*-
- * Reference RFC 6020.
- * The length Statement
- *
- * The "length" statement, which is an optional sub-statement to the
- * "type" statement, takes as an argument a length expression string.
- * It is used to restrict the built-in type "string", or types derived
- * from "string".
- * A "length" statement restricts the number of unicode characters in
- * the string.
- * A length range consists of an explicit value, or a lower bound, two
- * consecutive dots "..", and an upper bound. Multiple values or ranges
- * can be given, separated by "|". Length-restricting values MUST NOT
- * be negative. If multiple values or ranges are given, they all MUST
- * be disjoint and MUST be in ascending order. If a length restriction
- * is applied to an already length-restricted type, the new restriction
- * MUST be equal or more limiting, that is, raising the lower bounds,
- * reducing the upper bounds, removing explicit length values or ranges,
- * or splitting ranges into multiple ranges with intermediate gaps. A
- * length value is a non-negative integer, or one of the special values
- * "min" or "max". "min" and "max" mean the minimum and maximum length
- * accepted for the type being restricted, respectively. An
- * implementation is not required to support a length value larger than
- * 18446744073709551615.
- * The length's sub-statements
- *
- * +---------------+---------+-------------+-----------------+
- * | substatement | section | cardinality | mapped data type|
- * +---------------+---------+-------------+-----------------+
- * | description | 7.19.3 | 0..1 | string |
- * | error-app-tag | 7.5.4.2 | 0..1 | string |
- * | error-message | 7.5.4.1 | 0..1 | string |
- * | reference | 7.19.4 | 0..1 | string |
- * +---------------+---------+-------------+-----------------+
- */
-
- private static final long serialVersionUID = 8062016053L;
-
- /**
- * Length restriction information.
- */
- private YangRangeRestriction<YangUint64> lengthRestriction;
-
- /**
- * Effective pattern restriction for the type.
- */
- private YangPatternRestriction patternRestriction;
-
- /**
- * Textual reference.
- */
- private String reference;
-
- /**
- * Textual description.
- */
- private String description;
-
- /**
- * Creates a YANG string restriction object.
- */
- public YangStringRestriction() {
- }
-
- /**
- * Returns the length restriction on the string data.
- *
- * @return length restriction on the string data
- */
- public YangRangeRestriction<YangUint64> getLengthRestriction() {
- return lengthRestriction;
- }
-
- /**
- * Sets the length restriction on the string data.
- *
- * @param lengthRestriction length restriction on the string data
- */
- public void setLengthRestriction(YangRangeRestriction<YangUint64> lengthRestriction) {
- this.lengthRestriction = lengthRestriction;
- }
-
- /**
- * Returns the pattern restriction for the type.
- *
- * @return pattern restriction for the type
- */
- public YangPatternRestriction getPatternRestriction() {
- return patternRestriction;
- }
-
- /**
- * Sets the pattern restriction for the type.
- *
- * @param patternRestriction pattern restriction for the type
- */
- public void setPatternRestriction(YangPatternRestriction patternRestriction) {
- this.patternRestriction = patternRestriction;
- }
-
- /**
- * Adds a new pattern restriction for the type.
- *
- * @param newPattern new pattern restriction for the type
- */
- public void addPattern(String newPattern) {
- if (getPatternRestriction() == null) {
- setPatternRestriction(new YangPatternRestriction());
- }
- getPatternRestriction().addPattern(newPattern);
- }
-
- /**
- * Returns the textual reference of the string restriction.
- *
- * @return textual reference of the string restriction
- */
- @Override
- public String getReference() {
- return reference;
- }
-
- /**
- * Sets the textual reference of the string restriction.
- *
- * @param ref textual reference of the string restriction
- */
- @Override
- public void setReference(String ref) {
- reference = ref;
- }
-
- /**
- * Returns the description of the string restriction.
- *
- * @return description of the string restriction
- */
- @Override
- public String getDescription() {
- return description;
- }
-
- /**
- * Sets the description of the string restriction.
- *
- * @param desc description of the string restriction
- */
- @Override
- public void setDescription(String desc) {
- description = desc;
-
- }
-
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.PATTERN_DATA;
- }
-
- /**
- * Validates if the given value is correct as per the length restriction.
- *
- * @param valueInString value
- * @return true, if the value is confirming to length restriction, false otherwise
- */
- public boolean isValidStringOnLengthRestriction(String valueInString) {
- if (lengthRestriction == null || lengthRestriction.getAscendingRangeIntervals() == null
- || lengthRestriction.getAscendingRangeIntervals().isEmpty()) {
- // Length restriction is optional
- return true;
- }
-
- ListIterator<YangRangeInterval<YangUint64>> rangeListIterator = lengthRestriction.getAscendingRangeIntervals()
- .listIterator();
- boolean isMatched = false;
- while (rangeListIterator.hasNext()) {
- YangRangeInterval rangeInterval = rangeListIterator.next();
- BigInteger startValue = ((YangUint64) rangeInterval.getStartValue()).getValue();
- BigInteger endValue = ((YangUint64) rangeInterval.getEndValue()).getValue();
- if ((valueInString.length() >= startValue.intValue()) &&
- (valueInString.length() <= endValue.intValue())) {
- isMatched = true;
- break;
- }
- }
-
- return isMatched;
- }
-
- /**
- * Validates if the given value is correct as per the pattern restriction.
- *
- * @param valueInString value
- * @return true, if the value is confirming to pattern restriction, false otherwise
- */
- public boolean isValidStringOnPatternRestriction(String valueInString) {
- if (patternRestriction == null
- || patternRestriction.getPatternList().isEmpty()) {
- // Pattern restriction is optional
- return true;
- }
-
- ListIterator<String> patternListIterator = patternRestriction.getPatternList().listIterator();
- boolean isMatched = false;
- while (patternListIterator.hasNext()) {
- if (valueInString.matches(patternListIterator.next())) {
- isMatched = true;
- break;
- }
- }
-
- return isMatched;
- }
-
- @Override
- public void validateDataOnEntry() throws DataModelException {
- // TODO: implement the method.
- }
-
- @Override
- public void validateDataOnExit() throws DataModelException {
- // TODO: implement the method.
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java
deleted file mode 100644
index a58eb7d..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java
+++ /dev/null
@@ -1,754 +0,0 @@
-/*
- * 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;
-
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.linkInterFileReferences;
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.resolveLinkingForResolutionList;
-
-/*
- * Reference RFC 6020.
- *
- * While the primary unit in YANG is a module, a YANG module can itself
- * be constructed out of several submodules. Submodules allow a module
- * designer to split a complex model into several pieces where all the
- * submodules contribute to a single namespace, which is defined by the
- * module that includes the submodules.
- *
- * The "submodule" statement defines the submodule's name, and groups
- * all statements that belong to the submodule together. The
- * "submodule" statement's argument is the name of the submodule,
- * followed by a block of sub-statements that hold detailed submodule
- * information.
- *
- * The submodule's sub-statements
- *
- * +--------------+---------+-------------+------------------+
- * | substatement | section | cardinality |data model mapping|
- * +--------------+---------+-------------+------------------+
- * | anyxml | 7.10 | 0..n | - not supported |
- * | augment | 7.15 | 0..n | - child nodes |
- * | belongs-to | 7.2.2 | 1 | - YangBelongsTo |
- * | choice | 7.9 | 0..n | - child nodes |
- * | contact | 7.1.8 | 0..1 | - string |
- * | container | 7.5 | 0..n | - child nodes |
- * | description | 7.19.3 | 0..1 | - string |
- * | deviation | 7.18.3 | 0..n | - TODO |
- * | extension | 7.17 | 0..n | - TODO |
- * | feature | 7.18.1 | 0..n | - YangFeature |
- * | grouping | 7.11 | 0..n | - child nodes |
- * | identity | 7.16 | 0..n | - TODO |
- * | import | 7.1.5 | 0..n | - YangImport |
- * | include | 7.1.6 | 0..n | - YangInclude |
- * | leaf | 7.6 | 0..n | - YangLeaf |
- * | leaf-list | 7.7 | 0..n | - YangLeafList |
- * | list | 7.8 | 0..n | - child nodes |
- * | notification | 7.14 | 0..n | - TODO |
- * | organization | 7.1.7 | 0..1 | - string |
- * | reference | 7.19.4 | 0..1 | - string |
- * | revision | 7.1.9 | 0..n | - string |
- * | rpc | 7.13 | 0..n | - TODO |
- * | typedef | 7.3 | 0..n | - child nodes |
- * | uses | 7.12 | 0..n | - child nodes |
- * | YANG-version | 7.1.2 | 0..1 | - int |
- * +--------------+---------+-------------+------------------+
- */
-
-/**
- * Represents data model node to maintain information defined in YANG sub-module.
- */
-public class YangSubModule
- extends YangNode
- implements YangLeavesHolder, YangDesc, YangReference, Parsable, CollisionDetector, YangReferenceResolver,
- RpcNotificationContainer, YangFeatureHolder, YangIsFilterContentNodes {
-
- private static final long serialVersionUID = 806201614L;
-
- /**
- * Name of sub module.
- */
- private String name;
-
- /**
- * Module to which it belongs to.
- */
- private YangBelongsTo belongsTo;
-
- /**
- * Reference RFC 6020.
- * <p>
- * The "contact" statement provides contact information for the module. The
- * argument is a string that is used to specify contact information for the
- * person or persons to whom technical queries concerning this module should
- * be sent, such as their name, postal address, telephone number, and
- * electronic mail address.
- */
- private String contact;
-
- /**
- * Description.
- */
- private String description;
-
- /**
- * List of YANG modules imported.
- */
- private List<YangImport> importList;
-
- /**
- * List of YANG sub-modules included.
- */
- private List<YangInclude> includeList;
-
- /**
- * List of leaves at root level in the sub-module.
- */
- private List<YangLeaf> listOfLeaf;
-
- /**
- * List of leaf-lists at root level in the sub-module.
- */
- private List<YangLeafList> listOfLeafList;
-
- /**
- * List of feature at root level in the module.
- */
- private List<YangFeature> listOfFeature;
-
- /**
- * Organization owner of the sub-module.
- */
- private String organization;
-
- /**
- * Reference of the sub-module.
- */
- private String reference;
-
- /**
- * Revision info of the sub-module.
- */
- private YangRevision revision;
-
- /**
- * YANG version.
- */
- private byte version;
-
- /**
- * Prefix of parent module.
- */
- private String prefix;
-
- /*-
- * Reference RFC 6020.
- *
- * Nested typedefs and groupings.
- * Typedefs and groupings may appear nested under many YANG statements,
- * allowing these to be lexically scoped by the hierarchy under which
- * they appear. This allows types and groupings to be defined near
- * where they are used, rather than placing them at the top level of the
- * hierarchy. The close proximity increases readability.
- *
- * Scoping also allows types to be defined without concern for naming
- * conflicts between types in different submodules. Type names can be
- * specified without adding leading strings designed to prevent name
- * collisions within large modules.
- *
- * Finally, scoping allows the module author to keep types and groupings
- * private to their module or submodule, preventing their reuse. Since
- * only top-level types and groupings (i.e., those appearing as
- * sub-statements to a module or submodule statement) can be used outside
- * the module or submodule, the developer has more control over what
- * pieces of their module are presented to the outside world, supporting
- * the need to hide internal information and maintaining a boundary
- * between what is shared with the outside world and what is kept
- * private.
- *
- * Scoped definitions MUST NOT shadow definitions at a higher scope. A
- * type or grouping cannot be defined if a higher level in the schema
- * hierarchy has a definition with a matching identifier.
- *
- * A reference to an unprefixed type or grouping, or one which uses the
- * prefix of the current module, is resolved by locating the closest
- * matching "typedef" or "grouping" statement among the immediate
- * sub-statements of each ancestor statement.
- */
- private List<YangResolutionInfo> derivedTypeResolutionList;
-
- /**
- * Uses resolution list.
- */
- private List<YangResolutionInfo> usesResolutionList;
-
- /**
- * If-feature resolution list.
- */
- private List<YangResolutionInfo> ifFeatureResolutionList;
-
- /**
- * LeafRef resolution list.
- */
- private List<YangResolutionInfo> leafRefResolutionList;
-
- /**
- * Base resolution list.
- */
- private List<YangResolutionInfo> baseResolutionList;
-
- /**
- * IdentityRef resolution list.
- */
- private List<YangResolutionInfo> identityRefResolutionList;
-
- /**
- * Compiler annotation list.
- */
- private List<YangCompilerAnnotation> compilerAnnotationList;
-
- /**
- * extension list.
- */
- private List<YangExtension> extensionList;
-
- /**
- * Augment resolution list.
- */
- private List<YangResolutionInfo> augmentResolutionList;
-
- /**
- * Creates a sub module node.
- */
- public YangSubModule() {
- super(YangNodeType.SUB_MODULE_NODE);
- derivedTypeResolutionList = new LinkedList<>();
- augmentResolutionList = new LinkedList<>();
- usesResolutionList = new LinkedList<>();
- ifFeatureResolutionList = new LinkedList<>();
- leafRefResolutionList = new LinkedList<>();
- baseResolutionList = new LinkedList<>();
- identityRefResolutionList = new LinkedList<>();
- compilerAnnotationList = new LinkedList<>();
- importList = new LinkedList<>();
- includeList = new LinkedList<>();
- listOfLeaf = new LinkedList<>();
- listOfLeafList = new LinkedList<>();
- extensionList = new LinkedList<>();
- }
-
- /**
- * Returns the YANG name of the sub module.
- *
- * @return YANG name of the sub module
- */
- @Override
- public String getName() {
- return name;
- }
-
- /**
- * Sets YANG name of the sub module.
- *
- * @param subModuleName YANG name of the sub module
- */
- @Override
- public void setName(String subModuleName) {
- name = subModuleName;
- }
-
- /**
- * Returns the module info.
- *
- * @return the belongs to info
- */
- public YangBelongsTo getBelongsTo() {
- return belongsTo;
- }
-
- /**
- * Sets the module info.
- *
- * @param belongsTo module info to set
- */
- public void setBelongsTo(YangBelongsTo belongsTo) {
- this.belongsTo = belongsTo;
- }
-
- /**
- * Returns the contact.
- *
- * @return the contact
- */
- public String getContact() {
- return contact;
- }
-
- /**
- * Sets the contact.
- *
- * @param contact the contact to set
- */
- public void setContact(String contact) {
- this.contact = contact;
- }
-
- /**
- * Returns the description.
- *
- * @return the description
- */
- @Override
- public String getDescription() {
- return description;
- }
-
- /**
- * Sets the description.
- *
- * @param description set the description
- */
- @Override
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Returns the list of imported modules.
- *
- * @return the list of imported modules
- */
- @Override
- public List<YangImport> getImportList() {
- return importList;
- }
-
- /**
- * Adds the imported module information to the import list.
- *
- * @param importedModule module being imported
- */
- @Override
- public void addToImportList(YangImport importedModule) {
- getImportList().add(importedModule);
- }
-
- @Override
- public void setImportList(List<YangImport> importList) {
- this.importList = importList;
- }
-
- /**
- * Returns the list of included sub modules.
- *
- * @return the included list of sub modules
- */
- @Override
- public List<YangInclude> getIncludeList() {
- return includeList;
- }
-
- /**
- * Returns the included sub module information to the include list.
- *
- * @param includeModule submodule being included
- */
- @Override
- public void addToIncludeList(YangInclude includeModule) {
- getIncludeList().add(includeModule);
- }
-
- @Override
- public void setIncludeList(List<YangInclude> includeList) {
- this.includeList = includeList;
- }
-
- @Override
- public String getPrefix() {
- return prefix;
- }
-
- @Override
- public void setPrefix(String prefix) {
- this.prefix = prefix;
- }
-
- @Override
- public void resolveSelfFileLinking(ResolvableType type)
- throws DataModelException {
- // Get the list to be resolved.
- List<YangResolutionInfo> resolutionList = getUnresolvedResolutionList(type);
- // Resolve linking for a resolution list.
- resolveLinkingForResolutionList(resolutionList, this);
- }
-
- @Override
- public void resolveInterFileLinking(ResolvableType type)
- throws DataModelException {
- // Get the list to be resolved.
- List<YangResolutionInfo> resolutionList = getUnresolvedResolutionList(type);
- // Resolve linking for a resolution list.
- linkInterFileReferences(resolutionList, this);
- }
-
- /**
- * Returns the list of leaves.
- *
- * @return the list of leaves
- */
- @Override
- public List<YangLeaf> getListOfLeaf() {
- return listOfLeaf;
- }
-
- @Override
- public void setListOfLeaf(List<YangLeaf> leafsList) {
- listOfLeaf = leafsList;
- }
-
- /**
- * Adds a leaf.
- *
- * @param leaf the leaf to be added
- */
- @Override
- public void addLeaf(YangLeaf leaf) {
- getListOfLeaf().add(leaf);
- }
-
- /**
- * Returns the list of leaf-list.
- *
- * @return the list of leaf-list
- */
- @Override
- public List<YangLeafList> getListOfLeafList() {
- return listOfLeafList;
- }
-
- @Override
- public void setListOfLeafList(List<YangLeafList> listOfLeafList) {
- this.listOfLeafList = listOfLeafList;
- }
-
- /**
- * Adds a leaf-list.
- *
- * @param leafList the leaf-list to be added
- */
- @Override
- public void addLeafList(YangLeafList leafList) {
- getListOfLeafList().add(leafList);
- }
-
- /**
- * Returns the sub-modules organization.
- *
- * @return the organization
- */
- public String getOrganization() {
- return organization;
- }
-
- /**
- * Sets the sub-modules organization.
- *
- * @param org the organization to set
- */
- public void setOrganization(String org) {
- organization = org;
- }
-
- /**
- * Returns the textual reference.
- *
- * @return the reference
- */
- @Override
- public String getReference() {
- return reference;
- }
-
- /**
- * Sets the textual reference.
- *
- * @param reference the reference to set
- */
- @Override
- public void setReference(String reference) {
- this.reference = reference;
- }
-
- /**
- * Returns the revision.
- *
- * @return the revision
- */
- public YangRevision getRevision() {
- return revision;
- }
-
- /**
- * Sets the revision.
- *
- * @param revision the revision to set
- */
- public void setRevision(YangRevision revision) {
- this.revision = revision;
- }
-
- /**
- * Returns the version.
- *
- * @return the version
- */
- public byte getVersion() {
- return version;
- }
-
- /**
- * Sets the version.
- *
- * @param version the version to set
- */
- public void setVersion(byte version) {
- this.version = version;
- }
-
- /**
- * Returns the type of the parsed data.
- *
- * @return returns SUB_MODULE_DATA
- */
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.SUB_MODULE_DATA;
- }
-
- /**
- * Validates the data on entering the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnEntry()
- throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-
- /**
- * Validates the data on exiting the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnExit()
- throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-
- @Override
- public void detectCollidingChild(String identifierName, YangConstructType dataType)
- throws DataModelException {
- // Asks helper to detect colliding child.
- detectCollidingChildUtil(identifierName, dataType, this);
- }
-
- @Override
- public void detectSelfCollision(String identifierName, YangConstructType dataType)
- throws DataModelException {
- // Not required as module doesn't have any parent.
- }
-
- @Override
- public List<YangResolutionInfo> getUnresolvedResolutionList(ResolvableType type) {
- if (type == ResolvableType.YANG_DERIVED_DATA_TYPE) {
- return derivedTypeResolutionList;
- } else if (type == ResolvableType.YANG_USES) {
- return usesResolutionList;
- } else if (type == ResolvableType.YANG_AUGMENT) {
- return augmentResolutionList;
- } else if (type == ResolvableType.YANG_IF_FEATURE) {
- return ifFeatureResolutionList;
- } else if (type == ResolvableType.YANG_LEAFREF) {
- return leafRefResolutionList;
- } else if (type == ResolvableType.YANG_BASE) {
- return baseResolutionList;
- } else {
- return identityRefResolutionList;
- }
- }
-
- @Override
- public void addToResolutionList(YangResolutionInfo resolutionInfo,
- ResolvableType type) {
- if (type == ResolvableType.YANG_DERIVED_DATA_TYPE) {
- derivedTypeResolutionList.add(resolutionInfo);
- } else if (type == ResolvableType.YANG_USES) {
- usesResolutionList.add(resolutionInfo);
- } else if (type == ResolvableType.YANG_IF_FEATURE) {
- ifFeatureResolutionList.add(resolutionInfo);
- } else if (type == ResolvableType.YANG_LEAFREF) {
- leafRefResolutionList.add(resolutionInfo);
- } else if (type == ResolvableType.YANG_BASE) {
- baseResolutionList.add(resolutionInfo);
- } else if (type == ResolvableType.YANG_AUGMENT) {
- augmentResolutionList.add(resolutionInfo);
- } else if (type == ResolvableType.YANG_IDENTITYREF) {
- identityRefResolutionList.add(resolutionInfo);
- }
- }
-
- @Override
- public void setResolutionList(List<YangResolutionInfo> resolutionList,
- ResolvableType type) {
- if (type == ResolvableType.YANG_DERIVED_DATA_TYPE) {
- derivedTypeResolutionList = resolutionList;
- } else if (type == ResolvableType.YANG_USES) {
- usesResolutionList = resolutionList;
- } else if (type == ResolvableType.YANG_IF_FEATURE) {
- ifFeatureResolutionList.add((YangResolutionInfo) resolutionList);
- } else if (type == ResolvableType.YANG_LEAFREF) {
- leafRefResolutionList = resolutionList;
- } else if (type == ResolvableType.YANG_BASE) {
- baseResolutionList = resolutionList;
- } else if (type == ResolvableType.YANG_AUGMENT) {
- augmentResolutionList = resolutionList;
- } else if (type == ResolvableType.YANG_IDENTITYREF) {
- identityRefResolutionList = resolutionList;
- }
-
- }
-
- /**
- * Links the sub-module with module.
- *
- * @param yangNodeSet YANG file information set
- * @throws DataModelException a violation in data model rule
- */
- public void linkWithModule(Set<YangNode> yangNodeSet)
- throws DataModelException {
- getBelongsTo().linkWithModule(yangNodeSet);
- }
-
- @Override
- public void addReferencesToIncludeList(Set<YangNode> yangNodeSet)
- throws DataModelException {
- Iterator<YangInclude> includeInfoIterator = getIncludeList().iterator();
- // Run through the included list to add references.
- while (includeInfoIterator.hasNext()) {
- YangInclude yangInclude = includeInfoIterator.next();
- YangSubModule subModule = null;
- subModule = yangInclude.addReferenceToInclude(yangNodeSet);
- // Check if the referred sub-modules parent is self
- if (!(subModule.getBelongsTo().getModuleNode() == getBelongsTo().getModuleNode())) {
- yangInclude.reportIncludeError();
- }
- }
- }
-
- @Override
- public void addReferencesToImportList(Set<YangNode> yangNodeSet)
- throws DataModelException {
- Iterator<YangImport> importInfoIterator = getImportList().iterator();
- // Run through the imported list to add references.
- while (importInfoIterator.hasNext()) {
- YangImport yangImport = importInfoIterator.next();
- yangImport.addReferenceToImport(yangNodeSet);
- }
- }
-
- @Override
- public List<YangFeature> getFeatureList() {
- return listOfFeature;
- }
-
- @Override
- public void addFeatureList(YangFeature feature) {
- if (getFeatureList() == null) {
- setListOfFeature(new LinkedList<>());
- }
- getFeatureList().add(feature);
- }
-
- @Override
- public void setListOfFeature(List<YangFeature> listOfFeature) {
- this.listOfFeature = listOfFeature;
- }
-
- /**
- * Adds compiler annotation in compiler annotation list.
- *
- * @param compilerAnnotation the compiler annotation to be added
- */
- public void addCompilerAnnotation(YangCompilerAnnotation compilerAnnotation) {
- getCompilerAnnotationList().add(compilerAnnotation);
- }
-
- /**
- * Returns the compiler annotation list.
- *
- * @return the compiler annotation list
- */
- public List<YangCompilerAnnotation> getCompilerAnnotationList() {
- return compilerAnnotationList;
- }
-
- /**
- * Sets the compiler annotation list.
- *
- * @param compilerAnnotationList the list of compiler annotation
- */
- public void setCompilerAnnotationList(List<YangCompilerAnnotation> compilerAnnotationList) {
- this.compilerAnnotationList = compilerAnnotationList;
- }
-
-
- /**
- * Adds extension in extension list.
- *
- * @param extension the extension to be added
- */
- public void addExtension(YangExtension extension) {
- getExtensionList().add(extension);
- }
-
- /**
- * Returns the extension list.
- *
- * @return the extension list
- */
- public List<YangExtension> getExtensionList() {
- return extensionList;
- }
-
- /**
- * Sets the extension list.
- *
- * @param extensionList the list of extension
- */
- public void setExtensionList(List<YangExtension> extensionList) {
- this.extensionList = extensionList;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangTranslatorOperatorNode.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangTranslatorOperatorNode.java
deleted file mode 100644
index 1c96c68..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangTranslatorOperatorNode.java
+++ /dev/null
@@ -1,25 +0,0 @@
-
-/*
- * 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 an entity which provides info about whether to translate module/submodule in manager and service
- * classes.
- */
-public interface YangTranslatorOperatorNode {
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangType.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangType.java
deleted file mode 100644
index ca442e6..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangType.java
+++ /dev/null
@@ -1,504 +0,0 @@
-/*
- * 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;
-
-import java.io.Serializable;
-import java.math.BigInteger;
-import java.util.Iterator;
-import java.util.ListIterator;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.DataModelUtils;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.ResolvableStatus;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.DataTypeException;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangUint64;
-
-import static org.onosproject.yangutils.datamodel.BuiltInTypeObjectFactory.getDataObjectFromString;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypeUtils.isOfRangeRestrictedType;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.DERIVED;
-
-/*
- * Reference:RFC 6020.
- * The "type" statement takes as an argument a string that is the name
- * of a YANG built-in type or a derived type, followed by an optional
- * block of sub-statements that are used to put further restrictions
- * on the type.
- *
- * The restrictions that can be applied depend on the type being restricted.
- * The type's sub-statements
- *
- * +------------------+---------+-------------+------------------------------------+
- * | substatement | section | cardinality | mapped data type |
- * +------------------+---------+-------------+------------------------------------+
- * | bit | 9.7.4 | 0..n | - YangBit used in YangBits |
- * | enum | 9.6.4 | 0..n | - YangEnum used in YangEnumeration |
- * | length | 9.4.4 | 0..1 | - used for string |
- * | path | 9.9.2 | 0..1 | - path for referred leaf/leaf-list |
- * | pattern | 9.4.6 | 0..n | - used for string |
- * | range | 9.2.4 | 0..1 | - used for integer data type |
- * | require-instance | 9.13.2 | 0..1 | - TODO instance-identifier |
- * | type | 7.4 | 0..n | - TODO union |
- * +------------------+---------+-------------+------------------------------------+
- */
-
-/**
- * Represents the data type information.
- *
- * @param <T> YANG data type info
- */
-public class YangType<T>
- implements Parsable, Resolvable, Serializable {
-
- private static final long serialVersionUID = 8062016054L;
-
- /**
- * YANG node identifier.
- */
- private YangNodeIdentifier nodeIdentifier;
-
- /**
- * YANG data type.
- */
- private YangDataTypes dataType;
-
- /**
- * Additional information about data type, example restriction info, named
- * values, etc. The extra information is based on the data type. Based on
- * the data type, the extended info can vary.
- */
- private T dataTypeExtendedInfo;
-
- /**
- * 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
- * "INTRA_FILE_RESOLVED".
- */
- private ResolvableStatus resolvableStatus;
-
- /**
- * Creates a YANG type object.
- */
- public YangType() {
-
- nodeIdentifier = new YangNodeIdentifier();
- resolvableStatus = ResolvableStatus.UNRESOLVED;
- }
-
- /**
- * Returns prefix associated with data type name.
- *
- * @return prefix associated with data type name
- */
- public String getPrefix() {
- return nodeIdentifier.getPrefix();
- }
-
- /**
- * Sets prefix associated with data type name.
- *
- * @param prefix prefix associated with data type name
- */
- public void setPrefix(String prefix) {
- nodeIdentifier.setPrefix(prefix);
- }
-
- /**
- * Returns the name of data type.
- *
- * @return the name of data type
- */
- public String getDataTypeName() {
- return nodeIdentifier.getName();
- }
-
- /**
- * Sets the name of the data type.
- *
- * @param typeName the name to set
- */
- public void setDataTypeName(String typeName) {
- nodeIdentifier.setName(typeName);
- }
-
- /**
- * Returns the type of data.
- *
- * @return the data type
- */
- public YangDataTypes getDataType() {
- return dataType;
- }
-
- /**
- * Sets the type of data.
- *
- * @param dataType data type
- */
- public void setDataType(YangDataTypes dataType) {
- this.dataType = dataType;
- }
-
- /**
- * Returns the data type meta data.
- *
- * @return the data type meta data
- */
- public T getDataTypeExtendedInfo() {
- return dataTypeExtendedInfo;
- }
-
- /**
- * Sets the data type meta data.
- *
- * @param dataTypeInfo the meta data to set
- */
- public void setDataTypeExtendedInfo(T dataTypeInfo) {
- this.dataTypeExtendedInfo = dataTypeInfo;
- }
-
- /**
- * Returns node identifier.
- *
- * @return node identifier
- */
- public YangNodeIdentifier getNodeIdentifier() {
- return nodeIdentifier;
- }
-
- /**
- * Sets node identifier.
- *
- * @param nodeIdentifier the node identifier
- */
- public void setNodeIdentifier(YangNodeIdentifier nodeIdentifier) {
- this.nodeIdentifier = nodeIdentifier;
- }
-
- /**
- * Resets the class attributes to its default value.
- */
- public void resetYangType() {
- nodeIdentifier = new YangNodeIdentifier();
- resolvableStatus = ResolvableStatus.UNRESOLVED;
- dataType = null;
- dataTypeExtendedInfo = null;
- }
-
- /**
- * Returns the type of the parsed data.
- *
- * @return returns TYPE_DATA
- */
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.TYPE_DATA;
- }
-
- /**
- * Validates the data on entering the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnEntry()
- throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-
- /**
- * Validates the data on exiting the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnExit()
- throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-
- @Override
- public ResolvableStatus getResolvableStatus() {
- return resolvableStatus;
- }
-
- @Override
- public void setResolvableStatus(ResolvableStatus resolvableStatus) {
- this.resolvableStatus = resolvableStatus;
- }
-
- @Override
- public Object resolve()
- throws DataModelException {
- /*
- * Check whether the data type is derived.
- */
- if (getDataType() != DERIVED) {
- throw new DataModelException("Linker Error: Resolve should only be called for derived data types.");
- }
-
- // Check if the derived info is present.
- YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) getDataTypeExtendedInfo();
- if (derivedInfo == null) {
- throw new DataModelException("Linker Error: Derived information is missing.");
- }
-
- // Initiate the resolution
- try {
- setResolvableStatus(derivedInfo.resolve());
- } catch (DataModelException e) {
- throw new DataModelException(e.getMessage());
- }
- return null;
- }
-
- /**
- * Validates the input data value against the permissible value for the
- * type as per the YANG file.
- *
- * @param value input data value
- * @throws DataModelException a violation of data model rules
- */
- void isValidValue(String value) throws DataModelException {
- switch (getDataType()) {
- case INT8:
- case INT16:
- case INT32:
- case INT64:
- case UINT8:
- case UINT16:
- case UINT32:
- case UINT64: {
- if (getDataTypeExtendedInfo() == null) {
- getDataObjectFromString(value, getDataType());
- } else {
- if (!((YangRangeRestriction) getDataTypeExtendedInfo()).isValidValueString(value)) {
- throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " +
- getDataType());
- }
- }
- break;
- }
- case DECIMAL64: {
- // Fraction-Digits and range needs to get it from yang
- YangDecimal64<YangRangeRestriction> decimal64 =
- (YangDecimal64<YangRangeRestriction>) getDataTypeExtendedInfo();
- validateDecimal64(value, decimal64.getFractionDigit(),
- decimal64.getRangeRestrictedExtendedInfo());
- break;
- }
- case STRING: {
- if (getDataTypeExtendedInfo() == null) {
- break;
- } else if (!(((YangStringRestriction) getDataTypeExtendedInfo()).isValidStringOnLengthRestriction(value)
- && ((YangStringRestriction) getDataTypeExtendedInfo())
- .isValidStringOnPatternRestriction(value))) {
- throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " +
- getDataType());
- }
- break;
- }
- case BOOLEAN:
- if (!(value.equals(DataModelUtils.TRUE) || value.equals(DataModelUtils.FALSE))) {
- throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " +
- getDataType());
- }
- break;
- case ENUMERATION: {
- Iterator<YangEnum> iterator = ((YangEnumeration) getDataTypeExtendedInfo()).getEnumSet().iterator();
- boolean isValidated = false;
- while (iterator.hasNext()) {
- YangEnum enumTemp = iterator.next();
- if (enumTemp.getNamedValue().equals(value)) {
- isValidated = true;
- break;
- }
- }
-
- if (!isValidated) {
- throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " +
- getDataType());
- }
- break;
- }
- case BITS: {
- YangBits bits = (YangBits) getDataTypeExtendedInfo();
- if (bits.fromString(value) == null) {
- throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " +
- getDataType());
- }
- break;
- }
- case BINARY: {
- if (!isValidBinary(value, (YangRangeRestriction) getDataTypeExtendedInfo())) {
- throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " +
- getDataType());
- }
- break;
- }
- case LEAFREF: {
- YangLeafRef<?> leafRef = (YangLeafRef<?>) getDataTypeExtendedInfo();
- leafRef.validateDataOnExit();
- break;
- }
- case IDENTITYREF: {
- // TODO TBD
- break;
- }
- case EMPTY: {
- if (value.length() > 0) {
- throw new DataTypeException("YANG file error : Input value \"" + value
- + "\" is not allowed for a data type " + getDataType());
- }
- break;
- }
- case UNION: {
- ListIterator<YangType<?>> listIterator = ((YangUnion) getDataTypeExtendedInfo()).getTypeList()
- .listIterator();
- boolean isValidated = false;
- while (listIterator.hasNext()) {
- YangType<?> type = (YangType<?>) listIterator.next();
- try {
- type.isValidValue(value);
- // If it is not thrown exception then validation is success
- isValidated = true;
- break;
- } catch (Exception e) {
- }
- }
-
- if (!isValidated) {
- throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " +
- getDataType());
- }
- break;
- }
- case INSTANCE_IDENTIFIER: {
- // TODO TBD
- break;
- }
- case DERIVED: {
- YangDataTypes dataType = ((YangDerivedInfo) getDataTypeExtendedInfo()).getEffectiveBuiltInType();
- if (isOfRangeRestrictedType(dataType)) {
- if (((YangDerivedInfo) getDataTypeExtendedInfo()).getResolvedExtendedInfo() == null) {
- getDataObjectFromString(value,
- ((YangDerivedInfo) getDataTypeExtendedInfo())
- .getEffectiveBuiltInType());
- } else {
- if (!((YangRangeRestriction) ((YangDerivedInfo) getDataTypeExtendedInfo())
- .getResolvedExtendedInfo()).isValidValueString(value)) {
- throw new DataTypeException("YANG file error : Input value \"" + value
- + "\" is not a valid " + dataType);
- }
- }
- } else if (dataType == YangDataTypes.STRING) {
- if (((YangDerivedInfo) getDataTypeExtendedInfo()).getResolvedExtendedInfo() != null) {
- YangStringRestriction stringRestriction =
- ((YangStringRestriction) ((YangDerivedInfo) getDataTypeExtendedInfo())
- .getResolvedExtendedInfo());
- if (!(stringRestriction.isValidStringOnLengthRestriction(value) &&
- stringRestriction.isValidStringOnPatternRestriction(value))) {
- throw new DataTypeException("YANG file error : Input value \"" + value
- + "\" is not a valid " + dataType);
- }
- }
- } else if (dataType == YangDataTypes.BITS) {
- YangBits bits = (YangBits) getDataTypeExtendedInfo();
- if (bits.fromString(value) == null) {
- throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " +
- dataType);
- }
- } else if (dataType == YangDataTypes.BINARY) {
- if (!isValidBinary(value, (YangRangeRestriction) ((YangDerivedInfo)
- getDataTypeExtendedInfo()).getResolvedExtendedInfo())) {
- throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " +
- dataType);
- }
- } else if (dataType == YangDataTypes.DECIMAL64) {
- YangDerivedInfo derivedInfo = (YangDerivedInfo) getDataTypeExtendedInfo();
- YangTypeDef typedef = (YangTypeDef) derivedInfo.getReferredTypeDef();
- YangType<YangDecimal64> decimal64Type =
- (YangType<YangDecimal64>) typedef.getTypeList().iterator().next();
- YangDecimal64<YangRangeRestriction> decimal64 = decimal64Type.getDataTypeExtendedInfo();
- // Fraction-Digits and range needs to get it from yang
- validateDecimal64(value, decimal64.getFractionDigit(),
- decimal64.getRangeRestrictedExtendedInfo());
- }
- break;
- }
- default: {
- throw new DataTypeException("YANG file error : Input value \"" + value + "\" received for " +
- "unsupported data type " + getDataType());
- }
- }
- }
-
-
- /**
- * Checks whether specific string is valid decimal64 value.
- *
- * @param value decimal64 value
- */
- private void validateDecimal64(String value, int fractionDigit, YangRangeRestriction rangeRestriction)
- throws DataModelException {
- YangDecimal64<YangRangeRestriction> decimal64 = YangDecimal64.fromString(value);
- decimal64.setFractionDigit(fractionDigit);
- decimal64.setRangeRestrictedExtendedInfo(rangeRestriction);
- decimal64.validateDecimal64();
- }
-
- /**
- * Checks whether specific string is valid binary.
- *
- * @param value binary value
- * @return true if validation success otherwise false
- */
- private boolean isValidBinary(String value, YangRangeRestriction lengthRestriction) {
- YangBinary binary = new YangBinary(value);
-
- // After decoding binary, its length should not be zero
- if (binary.getBinaryData().length == 0) {
- return false;
- }
-
- if (lengthRestriction == null || lengthRestriction.getAscendingRangeIntervals() == null
- || lengthRestriction.getAscendingRangeIntervals().isEmpty()) {
- // Length restriction is optional
- return true;
- }
-
- ListIterator<YangRangeInterval<YangUint64>> rangeListIterator = lengthRestriction.getAscendingRangeIntervals()
- .listIterator();
- boolean isMatched = false;
- while (rangeListIterator.hasNext()) {
- YangRangeInterval rangeInterval = rangeListIterator.next();
- BigInteger startValue = ((YangUint64) rangeInterval.getStartValue()).getValue();
- BigInteger endValue = ((YangUint64) rangeInterval.getEndValue()).getValue();
- // convert (encode) back and check length
- if ((binary.toString().length() >= startValue.intValue()) &&
- (binary.toString().length() <= endValue.intValue())) {
- isMatched = true;
- break;
- }
- }
-
- return isMatched;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangTypeDef.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangTypeDef.java
deleted file mode 100644
index 085a5c8..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangTypeDef.java
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- * 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;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
-
-/*-
- * Reference RFC 6020.
- *
- * The "typedef" statement defines a new type that may be used locally in the
- * module, in modules or submodules which include it, and by other modules that
- * import from it. The new type is called the "derived type", and the type from
- * which it was derived is called the "base type". All derived types can be
- * traced back to a YANG built-in type.
- *
- * The "typedef" statement's argument is an identifier that is the name of the
- * type to be defined, and MUST be followed by a block of sub-statements that
- * holds detailed typedef information.
- *
- * The name of the type MUST NOT be one of the YANG built-in types. If the
- * typedef is defined at the top level of a YANG module or submodule, the name
- * of the type to be defined MUST be unique within the module.
- * The typedef's sub-statements
- *
- * +--------------+---------+-------------+------------------+
- * | substatement | section | cardinality |data model mapping|
- * +--------------+---------+-------------+------------------+
- * | default | 7.3.4 | 0..1 |-string |
- * | description | 7.19.3 | 0..1 |-string |
- * | reference | 7.19.4 | 0..1 |-string |
- * | status | 7.19.2 | 0..1 |-YangStatus |
- * | type | 7.3.2 | 1 |-yangType |
- * | units | 7.3.3 | 0..1 |-string |
- * +--------------+---------+-------------+------------------+
- */
-
-/**
- * Represents data model node to maintain information defined in YANG typedef.
- */
-public class YangTypeDef extends YangNode implements YangCommonInfo, Parsable, YangTypeHolder, CollisionDetector,
- YangTranslatorOperatorNode {
-
- private static final long serialVersionUID = 806201615L;
-
- /**
- * Default value in string, needs to be converted to the target object,
- * based on the type.
- */
- private String defaultValueInString;
-
- /**
- * Description of new type.
- */
- private String description;
-
- /**
- * reference string.
- */
- private String reference;
-
- /**
- * Status of the data type.
- */
- private YangStatusType status;
-
- /**
- * Name of the typedef.
- */
- private String name;
-
- /**
- * Units of the data type.
- */
- private String units;
-
- /**
- * List of YANG type, for typedef it will have single type.
- * This is done to unify the code with union.
- */
- private List<YangType<?>> typeList;
-
- /**
- * Creates a typedef node.
- */
- public YangTypeDef() {
- super(YangNodeType.TYPEDEF_NODE);
- typeList = new LinkedList<>();
- }
-
- /**
- * Returns the default value.
- *
- * @return the default value
- */
- public String getDefaultValueInString() {
- return defaultValueInString;
- }
-
- /**
- * Sets the default value.
- *
- * @param defaultValueInString the default value
- */
- public void setDefaultValueInString(String defaultValueInString) {
- this.defaultValueInString = defaultValueInString;
- }
-
- /**
- * Returns the description.
- *
- * @return the description
- */
- @Override
- public String getDescription() {
- return description;
- }
-
- /**
- * Sets the description.
- *
- * @param description set the description
- */
- @Override
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Returns the textual reference.
- *
- * @return the reference
- */
- @Override
- public String getReference() {
- return reference;
- }
-
- /**
- * Sets the textual reference.
- *
- * @param reference the reference to set
- */
- @Override
- public void setReference(String reference) {
- this.reference = reference;
- }
-
- /**
- * Returns the status.
- *
- * @return the status
- */
- @Override
- public YangStatusType getStatus() {
- return status;
- }
-
- /**
- * Sets the status.
- *
- * @param status the status to set
- */
- @Override
- public void setStatus(YangStatusType status) {
- this.status = status;
- }
-
- /**
- * Returns the data type.
- *
- * @return the data type
- */
- public YangType<?> getTypeDefBaseType() {
- if (!getTypeList().isEmpty()) {
- return getTypeList().get(0);
- }
- return null;
- }
-
- /**
- * Sets the data type.
- *
- * @param dataType the data type
- */
- public void setDataType(YangType<?> dataType) {
- getTypeList().add(0, dataType);
- }
-
- /**
- * Returns the unit.
- *
- * @return the units
- */
- public String getUnits() {
- return units;
- }
-
- /**
- * Sets the unit.
- *
- * @param units the units to set
- */
- public void setUnits(String units) {
- this.units = units;
- }
-
- /**
- * Returns the type of the data.
- *
- * @return returns TYPEDEF_DATA
- */
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.TYPEDEF_DATA;
- }
-
- /**
- * Validates the data on entering the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnEntry() throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-
- /**
- * Validates the data on exiting the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnExit() throws DataModelException {
- if (defaultValueInString != null && !defaultValueInString.isEmpty() && getTypeDefBaseType() != null) {
- getTypeDefBaseType().isValidValue(defaultValueInString);
- }
- }
-
- /**
- * Returns the YANG name of the typedef.
- *
- * @return YANG name of the typedef
- */
- @Override
- public String getName() {
- return name;
- }
-
- /**
- * Sets YANG name of the typedef.
- *
- * @param name YANG name of the typedef
- */
- @Override
- public void setName(String name) {
- this.name = name;
- }
-
- @Override
- public List<YangType<?>> getTypeList() {
- return typeList;
- }
-
- @Override
- public void detectCollidingChild(String identifierName, YangConstructType dataType) throws DataModelException {
- // Asks helper to detect colliding child.
- detectCollidingChildUtil(identifierName, dataType, this);
- }
-
- @Override
- public void detectSelfCollision(String identifierName, YangConstructType dataType) throws DataModelException {
- if (getName().equals(identifierName)) {
- throw new DataModelException("YANG file error: Duplicate input identifier detected, same as typedef \""
- + getName() + "\"");
- }
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangTypeHolder.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangTypeHolder.java
deleted file mode 100644
index 284f86a..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangTypeHolder.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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;
-
-import java.util.List;
-
-/**
- * Represents the holder with type(s).
- */
-public interface YangTypeHolder {
-
- /**
- * Returns type list.
- *
- * @return type list
- */
- List<YangType<?>> getTypeList();
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangUnion.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangUnion.java
deleted file mode 100644
index f20d5cc..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangUnion.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * 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;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-
-/*
- * Reference RFC 6020.
- *
- * The union built-in type represents a value that corresponds to one of
- * its member types.
- *
- * When the type is "union", the "type" statement (Section 7.4) MUST be
- * present. It is used to repeatedly specify each member type of the
- * union. It takes as an argument a string that is the name of a member
- * type.
- *
- * A member type can be of any built-in or derived type, except it MUST
- * NOT be one of the built-in types "empty" or "leafref".
- *
- * When a string representing a union data type is validated, the string
- * is validated against each member type, in the order they are
- * specified in the "type" statement, until a match is found.
- *
- * Any default value or "units" property defined in the member types is
- * not inherited by the union type.
- */
-
-/**
- * Represents data model node to maintain information defined in YANG union.
- */
-public class YangUnion extends YangNode implements Parsable, YangTypeHolder {
-
- private static final long serialVersionUID = 806201616L;
-
- // List of YANG type.
- private List<YangType<?>> typeList;
-
- // Name of union.
- private String name;
-
- // Current child union number.
- private transient int childUnionNumber;
-
- /**
- * Creates a YANG union node.
- */
- public YangUnion() {
- super(YangNodeType.UNION_NODE);
- typeList = new LinkedList<>();
- childUnionNumber = 1;
- }
-
- @Override
- public List<YangType<?>> getTypeList() {
- return typeList;
- }
-
- /**
- * Sets the list of YANG type.
- *
- * @param typeList list of YANG type.
- */
- public void setTypeList(List<YangType<?>> typeList) {
- this.typeList = typeList;
- }
-
- /**
- * Returns running child union number.
- *
- * @return running child union number
- */
- public int getChildUnionNumber() {
- return childUnionNumber;
- }
-
- /**
- * Sets the running child union number.
- *
- * @param childUnionNumber running child union number
- */
- public void setChildUnionNumber(int childUnionNumber) {
- this.childUnionNumber = childUnionNumber;
- }
-
- /**
- * Adds YANG type to type list.
- *
- * @param yangType YANG type to be added to list
- * @throws DataModelException union member type must not be one of the
- * built-in types "empty" or "leafref"
- */
- public void addType(YangType<?> yangType) throws DataModelException {
- if (yangType.getDataType() == YangDataTypes.EMPTY || yangType.getDataType() == YangDataTypes.LEAFREF) {
- throw new DataModelException("Union member type must not be one of the built-in types \"empty\" or " +
- "\"leafref\"");
- }
- getTypeList().add(yangType);
- }
-
- /**
- * Returns union name.
- *
- * @return the union name
- */
- @Override
- public String getName() {
- return name;
- }
-
- /**
- * Sets the union name.
- *
- * @param name union name
- */
- @Override
- public void setName(String name) {
- this.name = name;
- }
-
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.UNION_DATA;
- }
-
- /**
- * Validates the data on entering the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnEntry() throws DataModelException {
- //TODO: implement the method.
- }
-
- /**
- * Validates the data on exiting the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnExit() throws DataModelException {
- //TODO: implement the method.
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangUses.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangUses.java
deleted file mode 100644
index 957000d..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangUses.java
+++ /dev/null
@@ -1,680 +0,0 @@
-/*
- * 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;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.ResolvableStatus;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-import static org.onosproject.yangutils.datamodel.TraversalType.CHILD;
-import static org.onosproject.yangutils.datamodel.TraversalType.PARENT;
-import static org.onosproject.yangutils.datamodel.TraversalType.ROOT;
-import static org.onosproject.yangutils.datamodel.TraversalType.SIBILING;
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.getParentNodeInGenCode;
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.resolveLeafrefUnderGroupingForLeaf;
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.resolveLeafrefUnderGroupingForLeafList;
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.updateClonedLeavesUnionEnumRef;
-
-/*-
- * Reference RFC 6020.
- *
- * The "uses" statement is used to reference a "grouping" definition. It takes
- * one argument, which is the name of the grouping.
- *
- * The effect of a "uses" reference to a grouping is that the nodes defined by
- * the grouping are copied into the current schema tree, and then updated
- * according to the "refine" and "augment" statements.
- *
- * The identifiers defined in the grouping are not bound to a namespace until
- * the contents of the grouping are added to the schema tree via a "uses"
- * statement that does not appear inside a "grouping" statement, at which point
- * they are bound to the namespace of the current module.
- *
- * The uses's sub-statements
- *
- * +--------------+---------+-------------+------------------+
- * | substatement | section | cardinality |data model mapping|
- * +--------------+---------+-------------+------------------+
- * | augment | 7.15 | 0..1 | -child nodes |
- * | description | 7.19.3 | 0..1 | -string |
- * | if-feature | 7.18.2 | 0..n | -YangIfFeature |
- * | refine | 7.12.2 | 0..1 | -TODO |
- * | reference | 7.19.4 | 0..1 | -string |
- * | status | 7.19.2 | 0..1 | -YangStatus |
- * | when | 7.19.5 | 0..1 | -YangWhen |
- * +--------------+---------+-------------+------------------+
- */
-
-/**
- * Represents data model node to maintain information defined in YANG uses.
- */
-public class YangUses
- extends YangNode
- implements YangCommonInfo, Parsable, Resolvable, CollisionDetector, YangWhenHolder,
- YangIfFeatureHolder, YangTranslatorOperatorNode {
-
- private static final long serialVersionUID = 806201617L;
-
- /**
- * YANG node identifier.
- */
- private YangNodeIdentifier nodeIdentifier;
-
- /**
- * Referred group.
- */
- private YangGrouping refGroup;
-
- /**
- * Description of YANG uses.
- */
- private String description;
-
- /**
- * YANG reference.
- */
- private String reference;
-
- /**
- * Status of YANG uses.
- */
- private YangStatusType status;
-
- /**
- * When data of the node.
- */
- private YangWhen when;
-
- /**
- * List of if-feature.
- */
- private List<YangIfFeature> ifFeatureList;
-
- /**
- * 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
- * "INTRA_FILE_RESOLVED".
- */
- private ResolvableStatus resolvableStatus;
-
- /**
- * Effective list of nodes of grouping that needs to replicated at YANG uses.
- */
- private List<YangNode> resolvedGroupingNodes;
-
- /**
- * Effective list of leaves of grouping that needs to replicated at YANG uses.
- */
- private List<List<YangLeaf>> resolvedGroupingLeaves;
-
- /**
- * Effective list of leaf lists of grouping that needs to replicated at YANG uses.
- */
- private List<List<YangLeafList>> resolvedGroupingLeafLists;
-
- /**
- * Effective list of leaf lists of grouping that needs to replicated at YANG uses.
- */
- private List<YangEntityToResolveInfoImpl> entityToResolveInfoList;
-
- /**
- * Current grouping depth for uses.
- */
- private int currentGroupingDepth;
-
- /**
- * Creates an YANG uses node.
- */
- public YangUses() {
- super(YangNodeType.USES_NODE);
- nodeIdentifier = new YangNodeIdentifier();
- resolvableStatus = ResolvableStatus.UNRESOLVED;
- resolvedGroupingNodes = new LinkedList<YangNode>();
- resolvedGroupingLeaves = new LinkedList<List<YangLeaf>>();
- resolvedGroupingLeafLists = new LinkedList<List<YangLeafList>>();
- }
-
- /**
- * Returns the list of entity to resolve.
- *
- * @return the list of entity to resolve
- */
- public List<YangEntityToResolveInfoImpl> getEntityToResolveInfoList() {
- return entityToResolveInfoList;
- }
-
- /**
- * Sets the list of entity to resolve.
- *
- * @param entityToResolveInfoList the list of entity to resolve
- */
- public void setEntityToResolveInfoList(List<YangEntityToResolveInfoImpl> entityToResolveInfoList) {
- this.entityToResolveInfoList = entityToResolveInfoList;
- }
-
- /**
- * Adds an entity to resolve in list.
- *
- * @param entityToResolve entity to resolved
- * @throws DataModelException a violation of data model rules
- */
- public void addEntityToResolve(YangEntityToResolveInfoImpl entityToResolve)
- throws DataModelException {
- if (getEntityToResolveInfoList() == null) {
- setEntityToResolveInfoList(new LinkedList<YangEntityToResolveInfoImpl>());
- }
- getEntityToResolveInfoList().add(entityToResolve);
- }
-
- /**
- * Returns the referred group.
- *
- * @return the referred group
- */
- public YangGrouping getRefGroup() {
- return refGroup;
- }
-
- /**
- * Sets the referred group.
- *
- * @param refGroup the referred group
- */
- public void setRefGroup(YangGrouping refGroup) {
- this.refGroup = refGroup;
- }
-
- /**
- * Returns the when.
- *
- * @return the when
- */
- @Override
- public YangWhen getWhen() {
- return when;
- }
-
- /**
- * Sets the when.
- *
- * @param when the when to set
- */
- @Override
- public void setWhen(YangWhen when) {
- this.when = when;
- }
-
- /**
- * Returns the description.
- *
- * @return the description
- */
- @Override
- public String getDescription() {
- return description;
- }
-
- /**
- * Sets the description.
- *
- * @param description set the description
- */
- @Override
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Returns the textual reference.
- *
- * @return the reference
- */
- @Override
- public String getReference() {
- return reference;
- }
-
- /**
- * Sets the textual reference.
- *
- * @param reference the reference to set
- */
- @Override
- public void setReference(String reference) {
- this.reference = reference;
- }
-
- /**
- * Returns the status.
- *
- * @return the status
- */
- @Override
- public YangStatusType getStatus() {
- return status;
- }
-
- /**
- * Sets the status.
- *
- * @param status the status to set
- */
- @Override
- public void setStatus(YangStatusType status) {
- this.status = status;
- }
-
- /**
- * Returns the type of the data.
- *
- * @return returns USES_DATA
- */
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.USES_DATA;
- }
-
- /**
- * Validates the data on entering the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnEntry()
- throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-
- /**
- * Validates the data on exiting the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnExit()
- throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-
- @Override
- public String getName() {
- return nodeIdentifier.getName();
- }
-
- @Override
- public void setName(String name) {
- nodeIdentifier.setName(name);
- }
-
- /**
- * Returns node identifier.
- *
- * @return node identifier
- */
- public YangNodeIdentifier getNodeIdentifier() {
- return nodeIdentifier;
- }
-
- /**
- * Sets node identifier.
- *
- * @param nodeIdentifier the node identifier
- */
- public void setNodeIdentifier(YangNodeIdentifier nodeIdentifier) {
- this.nodeIdentifier = nodeIdentifier;
- }
-
- /**
- * Returns prefix associated with uses.
- *
- * @return prefix associated with uses
- */
- public String getPrefix() {
- return nodeIdentifier.getPrefix();
- }
-
- /**
- * Get prefix associated with uses.
- *
- * @param prefix prefix associated with uses
- */
- public void setPrefix(String prefix) {
- nodeIdentifier.setPrefix(prefix);
- }
-
- @Override
- public Object resolve()
- throws DataModelException {
-
- YangGrouping referredGrouping = getRefGroup();
-
- if (referredGrouping == null) {
- throw new DataModelException("YANG uses linker error, cannot resolve uses");
- } else {
- /*
- * if referredGrouping has uses which is not resolved then set the status
- * as Intra file resolved and return
- */
- if (checkIsUnresolvedRecursiveUsesInGrouping(referredGrouping)) {
- return null;
- }
- }
-
- YangNode usesParentNode = getParentNodeInGenCode(this);
- if (!(usesParentNode instanceof YangLeavesHolder)
- || !(usesParentNode instanceof CollisionDetector)) {
- throw new DataModelException("YANG uses holder construct is wrong");
- }
-
- YangLeavesHolder usesParentLeavesHolder = (YangLeavesHolder) usesParentNode;
- if (referredGrouping.getListOfLeaf() != null) {
- for (YangLeaf leaf : referredGrouping.getListOfLeaf()) {
- YangLeaf clonedLeaf = null;
- try {
- ((CollisionDetector) usesParentLeavesHolder).detectCollidingChild(leaf.getName(),
- YangConstructType.LEAF_DATA);
- clonedLeaf = leaf.clone();
- if (getCurrentGroupingDepth() == 0) {
- YangEntityToResolveInfoImpl resolveInfo = resolveLeafrefUnderGroupingForLeaf(clonedLeaf,
- usesParentLeavesHolder, this);
- if (resolveInfo != null) {
- addEntityToResolve(resolveInfo);
- }
- }
- } catch (CloneNotSupportedException | DataModelException e) {
- throw new DataModelException(e.getMessage());
- }
-
- clonedLeaf.setContainedIn(usesParentLeavesHolder);
- usesParentLeavesHolder.addLeaf(clonedLeaf);
- }
- }
- if (referredGrouping.getListOfLeafList() != null) {
- for (YangLeafList leafList : referredGrouping.getListOfLeafList()) {
- YangLeafList clonedLeafList = null;
- try {
- ((CollisionDetector) usesParentLeavesHolder).detectCollidingChild(leafList.getName(),
- YangConstructType.LEAF_LIST_DATA);
- clonedLeafList = leafList.clone();
- if (getCurrentGroupingDepth() == 0) {
- YangEntityToResolveInfoImpl resolveInfo =
- resolveLeafrefUnderGroupingForLeafList(clonedLeafList, usesParentLeavesHolder);
- if (resolveInfo != null) {
- addEntityToResolve(resolveInfo);
- }
- }
- } catch (CloneNotSupportedException | DataModelException e) {
- throw new DataModelException(e.getMessage());
- }
-
- clonedLeafList.setContainedIn(usesParentLeavesHolder);
- usesParentLeavesHolder.addLeafList(clonedLeafList);
- }
- }
-
- try {
- YangNode.cloneSubTree(referredGrouping, usesParentNode, this);
- } catch (DataModelException e) {
- throw new DataModelException(e.getMessage());
- }
- updateClonedLeavesUnionEnumRef(usesParentLeavesHolder);
- return getEntityToResolveInfoList();
- }
-
- /**
- * Checks if referred grouping has uses which is not resolved then it set the
- * status of current uses as intra file resolved and returns true.
- *
- * @param referredGrouping referred grouping node of uses
- * @return true if referred grouping has unresolved uses
- */
- private boolean checkIsUnresolvedRecursiveUsesInGrouping(YangGrouping referredGrouping) {
-
- /**
- * Search the grouping node's children for presence of uses node.
- */
- TraversalType curTraversal = ROOT;
- YangNode curNode = referredGrouping.getChild();
- while (curNode != null) {
- if (curNode.getName().equals(referredGrouping.getName())) {
- // if we have traversed all the child nodes, then exit from loop
- return false;
- }
-
- // if child nodes has uses, then add it to resolution stack
- if (curNode instanceof YangUses) {
- if (((YangUses) curNode).getResolvableStatus() != ResolvableStatus.RESOLVED) {
- setResolvableStatus(ResolvableStatus.INTRA_FILE_RESOLVED);
- return true;
- }
- }
-
- // Traversing all the child nodes of grouping
- if (curTraversal != PARENT && curNode.getChild() != null) {
- curTraversal = CHILD;
- curNode = curNode.getChild();
- } else if (curNode.getNextSibling() != null) {
- curTraversal = SIBILING;
- curNode = curNode.getNextSibling();
- } else {
- curTraversal = PARENT;
- curNode = curNode.getParent();
- }
- }
- return false;
- }
-
- /**
- * Clone the resolved uses contained in grouping to the uses of grouping.
- *
- * @param usesInGrouping resolved uses in grouping
- * @param usesHolder holder of uses
- */
- private void addResolvedUsesInfoOfGrouping(YangUses usesInGrouping,
- YangLeavesHolder usesHolder) throws DataModelException {
- for (YangNode usesResolvedNode : usesInGrouping.getUsesResolvedNodeList()) {
- addNodeOfGrouping(usesResolvedNode);
- }
-
- for (List<YangLeaf> leavesList : usesInGrouping.getUsesResolvedLeavesList()) {
- addLeavesOfGrouping(cloneLeavesList(leavesList, usesHolder));
- }
-
- for (List<YangLeafList> listOfLeafLists : usesInGrouping.getUsesResolvedListOfLeafList()) {
- addListOfLeafListOfGrouping(
- cloneListOfLeafList(listOfLeafLists, usesHolder));
- }
- }
-
- /**
- * Clone the list of leaves and return the cloned list leaves.
- *
- * @param listOfLeaves list of leaves to be cloned
- * @param usesParentNode parent of the cloned location
- * @return cloned list of leaves
- * @throws DataModelException a violation in data model rule
- */
- private List<YangLeaf> cloneLeavesList(List<YangLeaf> listOfLeaves,
- YangLeavesHolder usesParentNode) throws DataModelException {
- if (listOfLeaves == null || listOfLeaves.size() == 0) {
- throw new DataModelException("No leaves to clone");
- }
-
- List<YangLeaf> newLeavesList = new LinkedList<YangLeaf>();
- for (YangLeaf leaf : listOfLeaves) {
- YangLeaf clonedLeaf;
- try {
- ((CollisionDetector) usesParentNode).detectCollidingChild(leaf.getName(),
- YangConstructType.LEAF_DATA);
- clonedLeaf = leaf.clone();
- } catch (CloneNotSupportedException | DataModelException e) {
- throw new DataModelException(e.getMessage());
- }
-
- clonedLeaf.setContainedIn(usesParentNode);
- newLeavesList.add(clonedLeaf);
- }
-
- return newLeavesList;
- }
-
- /**
- * Clone the list of leaf list.
- *
- * @param listOfLeafList list of leaf list that needs to be cloned
- * @param usesParentNode parent of uses
- * @return cloned list of leaf list
- */
- private List<YangLeafList> cloneListOfLeafList(List<YangLeafList> listOfLeafList,
- YangLeavesHolder usesParentNode) throws DataModelException {
- if (listOfLeafList == null || listOfLeafList.size() == 0) {
- throw new DataModelException("No leaf lists to clone");
- }
-
- List<YangLeafList> newListOfLeafList = new LinkedList<YangLeafList>();
- for (YangLeafList leafList : listOfLeafList) {
- YangLeafList clonedLeafList;
- try {
- ((CollisionDetector) usesParentNode).detectCollidingChild(leafList.getName(),
- YangConstructType.LEAF_LIST_DATA);
- clonedLeafList = leafList.clone();
- } catch (CloneNotSupportedException | DataModelException e) {
- throw new DataModelException(e.getMessage());
- }
-
- clonedLeafList.setContainedIn(usesParentNode);
- newListOfLeafList.add(clonedLeafList);
- }
-
- return newListOfLeafList;
- }
-
- @Override
- public ResolvableStatus getResolvableStatus() {
- return resolvableStatus;
- }
-
- @Override
- public void setResolvableStatus(ResolvableStatus resolvableStatus) {
- this.resolvableStatus = resolvableStatus;
- }
-
- @Override
- public void detectCollidingChild(String identifierName, YangConstructType dataType)
- throws DataModelException {
- detectCollidingChildUtil(identifierName, dataType, this);
- }
-
- @Override
- public void detectSelfCollision(String identifierName, YangConstructType dataType)
- throws DataModelException {
-
- if (getName().equals(identifierName)) {
- throw new DataModelException("YANG file error: Duplicate input identifier detected, same as uses \""
- + getName() + "\"");
- }
- }
-
- /**
- * Adds the node under grouping to the effective uses resolved info.
- *
- * @param nodeInGrouping node defined under grouping which needs to be copied in
- * the context of uses
- */
- public void addNodeOfGrouping(YangNode nodeInGrouping) {
- resolvedGroupingNodes.add(nodeInGrouping);
- }
-
- /**
- * Returns the effective list of nodes added due to uses linking.
- *
- * @return effective list of nodes added due to uses linking
- */
- public List<YangNode> getUsesResolvedNodeList() {
- return resolvedGroupingNodes;
- }
-
- /**
- * Adds the leaves under grouping to the effective uses resolved info.
- *
- * @param leavesInGrouping Leaves defined under grouping which needs to be copied in
- * the context of uses
- */
- public void addLeavesOfGrouping(List<YangLeaf> leavesInGrouping) {
- resolvedGroupingLeaves.add(leavesInGrouping);
- }
-
- /**
- * Returns the effective list of Leaves added due to uses linking.
- *
- * @return effective list of Leaves added due to uses linking
- */
- public List<List<YangLeaf>> getUsesResolvedLeavesList() {
- return resolvedGroupingLeaves;
- }
-
- /**
- * Adds the leaf-lists under grouping to the effective uses resolved info.
- *
- * @param leafListsInGrouping leaf-lists defined under grouping which needs to be copied in
- * the context of uses
- */
- public void addListOfLeafListOfGrouping(List<YangLeafList> leafListsInGrouping) {
- resolvedGroupingLeafLists.add(leafListsInGrouping);
- }
-
- /**
- * Returns the effective list of Leaves added due to uses linking.
- *
- * @return effective list of Leaves added due to uses linking
- */
- public List<List<YangLeafList>> getUsesResolvedListOfLeafList() {
- return resolvedGroupingLeafLists;
- }
-
- @Override
- public List<YangIfFeature> getIfFeatureList() {
- return ifFeatureList;
- }
-
- @Override
- public void addIfFeatureList(YangIfFeature ifFeature) {
- if (getIfFeatureList() == null) {
- setIfFeatureList(new LinkedList<>());
- }
- getIfFeatureList().add(ifFeature);
- }
-
- @Override
- public void setIfFeatureList(List<YangIfFeature> ifFeatureList) {
- this.ifFeatureList = ifFeatureList;
- }
-
- public void setCurrentGroupingDepth(int currentGroupingDepth) {
- this.currentGroupingDepth = currentGroupingDepth;
- }
-
- public int getCurrentGroupingDepth() {
- return currentGroupingDepth;
- }
-
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangWhen.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangWhen.java
deleted file mode 100644
index c508681..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangWhen.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * 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;
-
-import java.io.Serializable;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-/*
- * Reference RFC 6020.
- *
- * The "when" statement makes its parent data definition statement
- * conditional. The node defined by the parent data definition
- * statement is only valid when the condition specified by the "when"
- * statement is satisfied.
- *
- * The statement's argument is an XPath expression, which is used to formally
- * specify this condition. If the XPath expression conceptually evaluates to
- * "true" for a particular instance, then the node defined by the parent data
- * definition statement is valid; otherwise, it is not.
- *
- * The when's sub-statements
- *
- * +---------------+---------+-------------+------------------+
- * | substatement | section | cardinality |data model mapping|
- * +---------------+---------+-------------+------------------+
- * | description | 7.19.3 | 0..1 | -string |
- * | reference | 7.19.4 | 0..1 | -string |
- * +---------------+---------+-------------+------------------+
- */
-
-/**
- * Represents information defined in YANG when.
- */
-public class YangWhen implements YangDesc, YangReference, Parsable, Serializable {
-
- private static final long serialVersionUID = 806201646L;
-
- /**
- * When condition info.
- */
- private String condition;
-
- /**
- * Description string.
- */
- private String description;
-
- /**
- * Reference string.
- */
- private String reference;
-
- /**
- * Creates a YANG when restriction.
- */
- public YangWhen() {
- }
-
- /**
- * Returns the condition.
- *
- * @return the condition
- */
- public String getCondition() {
- return condition;
- }
-
- /**
- * Sets the condition.
- *
- * @param condition the condition to set
- */
- public void setCondition(String condition) {
- this.condition = condition;
- }
-
- /**
- * Returns the description.
- *
- * @return the description
- */
- @Override
- public String getDescription() {
- return description;
- }
-
- /**
- * Sets the description.
- *
- * @param description set the description
- */
- @Override
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Returns the textual reference.
- *
- * @return the reference
- */
- @Override
- public String getReference() {
- return reference;
- }
-
- /**
- * Sets the textual reference.
- *
- * @param reference the reference to set
- */
- @Override
- public void setReference(String reference) {
- this.reference = reference;
- }
-
- /**
- * Returns the type of the parsed data.
- *
- * @return returns WHEN_DATA
- */
- @Override
- public YangConstructType getYangConstructType() {
- return YangConstructType.WHEN_DATA;
- }
-
- /**
- * Validates the data on entering the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnEntry() throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-
- /**
- * Validates the data on exiting the corresponding parse tree node.
- *
- * @throws DataModelException a violation of data model rules
- */
- @Override
- public void validateDataOnExit() throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangWhenHolder.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangWhenHolder.java
deleted file mode 100644
index 1c7df4d..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangWhenHolder.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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 when entity. It is used to abstract the data holders of when.
- */
-public interface YangWhenHolder {
-
- /**
- * Returns the when.
- *
- * @return the when
- */
- YangWhen getWhen();
-
- /**
- * Sets the when.
- *
- * @param when the when to set
- */
- void setWhen(YangWhen when);
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangXPathResolver.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangXPathResolver.java
deleted file mode 100644
index db94660..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangXPathResolver.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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 an entity which can be resolved with x-path linker.
- */
-public interface YangXPathResolver {
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/exceptions/DataModelException.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/exceptions/DataModelException.java
deleted file mode 100644
index b1375a7..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/exceptions/DataModelException.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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.exceptions;
-
-/**
- * Represents base class for exceptions in data model operations.
- */
-public class DataModelException extends Exception {
-
- private static final long serialVersionUID = 201601270658L;
- private int lineNumber;
- private int charPositionInLine;
-
- /**
- * Creates a data model exception with message.
- *
- * @param message the detail of exception in string
- */
- public DataModelException(String message) {
- super(message);
- }
-
- /**
- * Creates exception from message and cause.
- *
- * @param message the detail of exception in string
- * @param cause underlying cause of the error
- */
- public DataModelException(final String message, final Throwable cause) {
- super(message, cause);
- }
-
- /**
- * Creates exception from cause.
- *
- * @param cause underlying cause of the error
- */
- public DataModelException(final Throwable cause) {
- super(cause);
- }
-
- /**
- * Returns line number of the exception.
- *
- * @return line number of the exception
- */
- public int getLineNumber() {
- return this.lineNumber;
- }
-
- /**
- * Returns position of the exception.
- *
- * @return position of the exception
- */
- public int getCharPositionInLine() {
- return this.charPositionInLine;
- }
-
- /**
- * Sets line number of YANG file.
- *
- * @param line line number of YANG file
- */
- public void setLine(int line) {
- this.lineNumber = line;
- }
-
- /**
- * Sets position of exception.
- *
- * @param charPosition position of exception
- */
- public void setCharPosition(int charPosition) {
- this.charPositionInLine = charPosition;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/exceptions/package-info.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/exceptions/package-info.java
deleted file mode 100644
index ec607f3..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/exceptions/package-info.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * 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.
- */
-/**
- * Custom data model exceptions.
- */
-package org.onosproject.yangutils.datamodel.exceptions;
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/JavaFileInfo.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/JavaFileInfo.java
deleted file mode 100644
index 8b2d49f..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/JavaFileInfo.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * 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.javadatamodel;
-
-import java.io.Serializable;
-
-/**
- * Represents cached java file handle, which supports the addition of member attributes and
- * methods.
- */
-public class JavaFileInfo implements Serializable {
-
- private static final long serialVersionUID = 806102633L;
-
- /**
- * The type(s) of java source file(s) to be generated when the cached file
- * handle is closed.
- */
- private transient int genFileTypes;
-
- /**
- * Name of the module.
- */
- private String javaName;
-
- /**
- * Java Package of the mapped java class.
- */
- private String pkg;
-
- /**
- * File generation directory path.
- */
- private String relativeFilePath;
-
- /**
- * File generation base directory path.
- */
- private String codeGenDirFilePath;
-
- /**
- * Plugin configuration for naming convention.
- */
- private transient YangPluginConfig pluginConfig;
-
- /**
- * Returns the types of files being generated corresponding to the YANG
- * definition.
- *
- * @return the types of files being generated corresponding to the YANG
- * definition
- */
- public int getGeneratedFileTypes() {
- return genFileTypes;
- }
-
- /**
- * Sets the types of files being generated corresponding to the YANG
- * definition.
- *
- * @param fileTypes the types of files being generated corresponding to the
- * YANG definition
- */
- public void setGeneratedFileTypes(int fileTypes) {
- genFileTypes = fileTypes;
- }
-
- /**
- * Adds the types of files being generated corresponding to the YANG
- * definition.
- *
- * @param fileTypes the types of files being generated corresponding to the
- * YANG definition
- */
- public void addGeneratedFileTypes(int fileTypes) {
- genFileTypes |= fileTypes;
- }
-
- /**
- * Returns the java name of the node.
- *
- * @return the java name of node
- */
- public String getJavaName() {
- return javaName;
- }
-
- /**
- * Sets the java name of the node.
- *
- * @param name the java name of node
- */
- public void setJavaName(String name) {
- javaName = name;
- }
-
- /**
- * Returns the mapped java package.
- *
- * @return the java package
- */
- public String getPackage() {
- return pkg;
- }
-
- /**
- * Sets the node's package.
- *
- * @param nodePackage node's package
- */
- public void setPackage(String nodePackage) {
- pkg = nodePackage;
- }
-
- /**
- * Sets directory package path for code generation.
- *
- * @param path directory package path for code generation
- */
- public void setPackageFilePath(String path) {
- relativeFilePath = path;
- }
-
- /**
- * Returns directory package path for code generation.
- *
- * @return directory package path for code generation
- */
- public String getPackageFilePath() {
- return relativeFilePath;
- }
-
- /**
- * Returns base directory package path for code generation.
- *
- * @return directory package path for code generation
- */
- public String getBaseCodeGenPath() {
- return codeGenDirFilePath;
- }
-
- /**
- * Sets base directory package path for code generation.
- *
- * @param path base directory path
- */
- public void setBaseCodeGenPath(String path) {
- codeGenDirFilePath = path;
- }
-
- /**
- * Returns plugin configurations.
- *
- * @return the pluginConfig
- */
- public YangPluginConfig getPluginConfig() {
- return pluginConfig;
- }
-
- /**
- * Sets plugin configurations.
- *
- * @param pluginConfig the pluginConfig to set
- */
- public void setPluginConfig(YangPluginConfig pluginConfig) {
- this.pluginConfig = pluginConfig;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/JavaQualifiedTypeInfo.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/JavaQualifiedTypeInfo.java
deleted file mode 100644
index 49208bc..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/JavaQualifiedTypeInfo.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.javadatamodel;
-
-import java.io.Serializable;
-
-/**
- * Represents the information about individual imports in the generated file.
- */
-public class JavaQualifiedTypeInfo
- implements Serializable {
-
- private static final long serialVersionUID = 806201634L;
-
- /**
- * Package location where the imported class/interface is defined.
- */
- protected String pkgInfo;
-
- /**
- * Class/interface being referenced.
- */
- protected String classInfo;
-
- /**
- * Returns class info.
- *
- * @return class info
- */
- public String getClassInfo() {
- return classInfo;
- }
-
- /**
- * Returns package info.
- *
- * @return package info
- */
- public String getPkgInfo() {
- return pkgInfo;
- }
-
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaAugment.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaAugment.java
deleted file mode 100644
index b1d7e44..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaAugment.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.javadatamodel;
-
-import org.onosproject.yangutils.datamodel.YangAugment;
-
-/**
- * Represents YANG java augment.
- */
-public class YangJavaAugment extends YangAugment {
-
- private static final long serialVersionUID = 208201601L;
-
- protected JavaFileInfo javaFileInfo;
-
- /**
- * Returns java file info.
- *
- * @return java file info
- */
- public JavaFileInfo getJavaFileInfo() {
- return javaFileInfo;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaCase.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaCase.java
deleted file mode 100644
index 356825f..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaCase.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.javadatamodel;
-
-import org.onosproject.yangutils.datamodel.YangCase;
-
-/**
- * Represents YANG java case.
- */
-public class YangJavaCase extends YangCase {
-
- private static final long serialVersionUID = 208201602L;
-
- protected JavaFileInfo javaFileInfo;
-
- /**
- * Returns java file info.
- *
- * @return java file info
- */
- public JavaFileInfo getJavaFileInfo() {
- return javaFileInfo;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaChoice.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaChoice.java
deleted file mode 100644
index 1b4412d..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaChoice.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.javadatamodel;
-
-import org.onosproject.yangutils.datamodel.YangChoice;
-
-/**
- * Represents YANG java choice.
- */
-public class YangJavaChoice extends YangChoice {
-
- private static final long serialVersionUID = 208201603L;
-
- protected JavaFileInfo javaFileInfo;
-
- /**
- * Returns java file info.
- *
- * @return java file info
- */
- public JavaFileInfo getJavaFileInfo() {
- return javaFileInfo;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaContainer.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaContainer.java
deleted file mode 100644
index 5b579cd..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaContainer.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.javadatamodel;
-
-import org.onosproject.yangutils.datamodel.YangContainer;
-
-/**
- * Represents YANG java container.
- */
-public class YangJavaContainer extends YangContainer {
-
- private static final long serialVersionUID = 208201604L;
-
- protected JavaFileInfo javaFileInfo;
-
- /**
- * Returns java file info.
- *
- * @return java file info
- */
- public JavaFileInfo getJavaFileInfo() {
- return javaFileInfo;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaEnumeration.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaEnumeration.java
deleted file mode 100644
index 2fbc9549b..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaEnumeration.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.javadatamodel;
-
-import org.onosproject.yangutils.datamodel.YangEnumeration;
-
-/**
- * Represents YANG java enumeration.
- */
-public class YangJavaEnumeration extends YangEnumeration {
-
- private static final long serialVersionUID = 208201605L;
-
- protected JavaFileInfo javaFileInfo;
-
- /**
- * Returns java file info.
- *
- * @return java file info
- */
- public JavaFileInfo getJavaFileInfo() {
- return javaFileInfo;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaGrouping.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaGrouping.java
deleted file mode 100644
index 78088cc..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaGrouping.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.javadatamodel;
-
-import org.onosproject.yangutils.datamodel.YangGrouping;
-
-/**
- * Represents YANG java grouping.
- */
-public class YangJavaGrouping extends YangGrouping {
-
- private static final long serialVersionUID = 208201606L;
-
- protected JavaFileInfo javaFileInfo;
-
- /**
- * Returns java file info.
- *
- * @return java file info
- */
- public JavaFileInfo getJavaFileInfo() {
- return javaFileInfo;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaIdentity.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaIdentity.java
deleted file mode 100644
index 3dc6fa3..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaIdentity.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.javadatamodel;
-
-import org.onosproject.yangutils.datamodel.YangIdentity;
-
-/**
- * Represents YANG java identity.
- */
-public class YangJavaIdentity extends YangIdentity {
-
- private static final long serialVersionUID = 208201616L;
-
- protected JavaFileInfo javaFileInfo;
-
- /**
- * Returns java file info.
- *
- * @return java file info
- */
- public JavaFileInfo getJavaFileInfo() {
- return javaFileInfo;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaInput.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaInput.java
deleted file mode 100644
index a4578cd..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaInput.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.javadatamodel;
-
-import org.onosproject.yangutils.datamodel.YangInput;
-
-/**
- * Represents YANG java input.
- */
-public class YangJavaInput extends YangInput {
-
- private static final long serialVersionUID = 208201607L;
-
- protected JavaFileInfo javaFileInfo;
-
- /**
- * Returns java file info.
- *
- * @return java file info
- */
- public JavaFileInfo getJavaFileInfo() {
- return javaFileInfo;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaLeaf.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaLeaf.java
deleted file mode 100644
index d580091..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaLeaf.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.javadatamodel;
-
-import org.onosproject.yangutils.datamodel.YangLeaf;
-
-/**
- * Represent YANG java leaf.
- */
-public class YangJavaLeaf extends YangLeaf {
-
- private static final long serialVersionUID = 208201617L;
-
- protected JavaQualifiedTypeInfo javaQualifiedTypeInfo;
-
- /**
- * Returns java qualified type info.
- *
- * @return java qualified type info
- */
- public JavaQualifiedTypeInfo getJavaQualifiedTypeInfo() {
- return javaQualifiedTypeInfo;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaLeafList.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaLeafList.java
deleted file mode 100644
index 01867da..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaLeafList.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.javadatamodel;
-
-import org.onosproject.yangutils.datamodel.YangLeafList;
-
-/**
- * Represents YANG java leaf list.
- */
-public class YangJavaLeafList extends YangLeafList {
-
- private static final long serialVersionUID = 208201618L;
-
- protected JavaQualifiedTypeInfo javaQualifiedTypeInfo;
-
- /**
- * Returns java qualified type info.
- *
- * @return java qualified type info
- */
- public JavaQualifiedTypeInfo getJavaQualifiedTypeInfo() {
- return javaQualifiedTypeInfo;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaList.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaList.java
deleted file mode 100644
index 499f89f..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaList.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.javadatamodel;
-
-import org.onosproject.yangutils.datamodel.YangList;
-
-/**
- * Represent YANG java list.
- */
-public class YangJavaList extends YangList {
-
- private static final long serialVersionUID = 208201608L;
-
- /**
- * Contains the information of the java file being generated.
- */
- protected JavaFileInfo javaFileInfo;
-
- /**
- * Returns java file info.
- *
- * @return java file info
- */
- public JavaFileInfo getJavaFileInfo() {
- return javaFileInfo;
- }
-
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaModule.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaModule.java
deleted file mode 100644
index 46915db..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaModule.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.javadatamodel;
-
-import org.onosproject.yangutils.datamodel.YangModule;
-
-/**
- * Represents YANG java module.
- */
-public class YangJavaModule extends YangModule {
-
- private static final long serialVersionUID = 208201609L;
-
- protected JavaFileInfo javaFileInfo;
-
- /**
- * Returns java file info.
- *
- * @return java file info
- */
- public JavaFileInfo getJavaFileInfo() {
- return javaFileInfo;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaNotification.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaNotification.java
deleted file mode 100644
index 653f37b..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaNotification.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.javadatamodel;
-
-import org.onosproject.yangutils.datamodel.YangNotification;
-
-/**
- * Represents YANG java notification.
- */
-public class YangJavaNotification extends YangNotification {
-
- private static final long serialVersionUID = 208201610L;
-
- protected JavaFileInfo javaFileInfo;
-
- /**
- * Returns java file info.
- *
- * @return java file info
- */
- public JavaFileInfo getJavaFileInfo() {
- return javaFileInfo;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaOutput.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaOutput.java
deleted file mode 100644
index 08fe3bd..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaOutput.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.javadatamodel;
-
-import org.onosproject.yangutils.datamodel.YangOutput;
-
-/**
- * Represents YANG java output.
- */
-public class YangJavaOutput extends YangOutput {
-
- private static final long serialVersionUID = 208201611L;
-
- protected JavaFileInfo javaFileInfo;
-
- /**
- * Returns java file info.
- *
- * @return java file info
- */
- public JavaFileInfo getJavaFileInfo() {
- return javaFileInfo;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaRpc.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaRpc.java
deleted file mode 100644
index 382f36c..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaRpc.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.javadatamodel;
-
-import org.onosproject.yangutils.datamodel.YangRpc;
-
-/**
- * Represents YANG java rpc.
- */
-public class YangJavaRpc extends YangRpc {
-
- private static final long serialVersionUID = 208201612L;
-
- protected JavaFileInfo javaFileInfo;
-
- /**
- * Returns java file info.
- *
- * @return java file info
- */
- public JavaFileInfo getJavaFileInfo() {
- return javaFileInfo;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaSubModule.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaSubModule.java
deleted file mode 100644
index 34d90c4..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaSubModule.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.javadatamodel;
-
-import org.onosproject.yangutils.datamodel.YangSubModule;
-
-/**
- * Represents YANG java submodule.
- */
-public class YangJavaSubModule extends YangSubModule {
-
- private static final long serialVersionUID = 208201612L;
-
- protected JavaFileInfo javaFileInfo;
-
- /**
- * Returns java file info.
- *
- * @return java file info
- */
- public JavaFileInfo getJavaFileInfo() {
- return javaFileInfo;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaType.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaType.java
deleted file mode 100644
index 3fd2fb6..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaType.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.javadatamodel;
-
-import org.onosproject.yangutils.datamodel.YangType;
-
-/**
- * Represents YANG java type.
- */
-public class YangJavaType extends YangType {
-
- protected JavaQualifiedTypeInfo javaQualifiedTypeInfo;
-
- /**
- * Returns java qualified type info.
- *
- * @return java qualified type info
- */
- public JavaQualifiedTypeInfo getJavaQualifiedTypeInfo() {
- return javaQualifiedTypeInfo;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaTypeDef.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaTypeDef.java
deleted file mode 100644
index 345d53b..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaTypeDef.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.javadatamodel;
-
-import org.onosproject.yangutils.datamodel.YangTypeDef;
-
-/**
- * Represents YANG java typedef.
- */
-public class YangJavaTypeDef extends YangTypeDef {
-
- private static final long serialVersionUID = 208201613L;
-
- protected JavaFileInfo javaFileInfo;
-
- /**
- * Returns java file info.
- *
- * @return java file info
- */
- public JavaFileInfo getJavaFileInfo() {
- return javaFileInfo;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaUnion.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaUnion.java
deleted file mode 100644
index 1111d48..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaUnion.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.javadatamodel;
-
-import org.onosproject.yangutils.datamodel.YangUnion;
-
-/**
- * Represent YANG java union.
- */
-public class YangJavaUnion extends YangUnion {
-
- private static final long serialVersionUID = 208201614L;
- protected JavaFileInfo javaFileInfo;
-
- /**
- * Returns java file info.
- *
- * @return java file info
- */
- public JavaFileInfo getJavaFileInfo() {
- return javaFileInfo;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaUses.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaUses.java
deleted file mode 100644
index 1e1e363..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaUses.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.javadatamodel;
-
-import org.onosproject.yangutils.datamodel.YangUses;
-
-/**
- * Represent YANG java uses.
- */
-public class YangJavaUses extends YangUses {
-
- private static final long serialVersionUID = 208201615L;
-
- protected JavaFileInfo javaFileInfo;
-
- /**
- * Returns java file info.
- *
- * @return java file info
- */
- public JavaFileInfo getJavaFileInfo() {
- return javaFileInfo;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangPluginConfig.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangPluginConfig.java
deleted file mode 100644
index 353d025..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangPluginConfig.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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.javadatamodel;
-
-/**
- * Representation of plugin configurations required for YANG utils.
- */
-public final class YangPluginConfig {
-
- /**
- * Contains the code generation directory.
- */
- private String codeGenDir;
-
- /**
- * Contains information of naming conflicts that can be resolved.
- */
- private YangToJavaNamingConflictUtil conflictResolver;
-
- /**
- * Java code generation is for sbi.
- */
- private String codeGenerateForsbi;
-
- /**
- * Creates an object for YANG plugin config.
- */
- public YangPluginConfig() {
- }
-
- /**
- * Returns the string for code generation.
- *
- * @return returns the string for code generation.
- */
- public String getCodeGenerateForsbi() {
- return codeGenerateForsbi;
- }
-
- /**
- * Sets the string sbi or nbi for code generation.
- *
- * @param codeGenerateForsbi generation is for sbi
- */
- public void setCodeGenerateForsbi(String codeGenerateForsbi) {
- this.codeGenerateForsbi = codeGenerateForsbi;
- }
-
- /**
- * Sets the path of the java code where it has to be generated.
- *
- * @param codeGenDir path of the directory
- */
- public void setCodeGenDir(String codeGenDir) {
- this.codeGenDir = codeGenDir;
- }
-
- /**
- * Returns the code generation directory path.
- *
- * @return code generation directory
- */
- public String getCodeGenDir() {
- return codeGenDir;
- }
-
- /**
- * Sets the object.
- *
- * @param conflictResolver object of the class
- */
- public void setConflictResolver(YangToJavaNamingConflictUtil conflictResolver) {
- this.conflictResolver = conflictResolver;
- }
-
- /**
- * Returns the object.
- *
- * @return object of the class
- */
- public YangToJavaNamingConflictUtil getConflictResolver() {
- return conflictResolver;
- }
-
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangToJavaNamingConflictUtil.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangToJavaNamingConflictUtil.java
deleted file mode 100644
index 3bfd360..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangToJavaNamingConflictUtil.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * 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.javadatamodel;
-
-/**
- * Representation of YANG to java naming conflict resolver util.
- */
-public final class YangToJavaNamingConflictUtil {
-
- /**
- * Contains the replacement value for a period.
- */
- private static String replacementForPeriodInIdentifier;
-
- /**
- * Contains the replacement value for an underscore.
- */
- private static String replacementForUnderscoreInIdentifier;
-
- /**
- * Contains the replacement value for a hyphen.
- */
- private static String replacementForHyphenInIdentifier;
-
- /**
- * Contains the prefix value for adding with the identifier.
- */
- private static String prefixForIdentifier;
-
- /**
- * Creates an object for YANG to java naming conflict util.
- */
- public YangToJavaNamingConflictUtil() {
- }
-
- /**
- * Sets the replacement value for a period.
- *
- * @param periodReplacement replacement value for period
- */
- public void setReplacementForPeriod(String periodReplacement) {
- replacementForPeriodInIdentifier = periodReplacement;
- }
-
- /**
- * Returns the replaced period value.
- *
- * @return replaced period
- */
- public String getReplacementForPeriod() {
- return replacementForPeriodInIdentifier;
- }
-
- /**
- * Sets the replacement value for a hyphen.
- *
- * @param hyphenReplacement replacement value for hyphen
- */
- public void setReplacementForHyphen(String hyphenReplacement) {
- replacementForHyphenInIdentifier = hyphenReplacement;
- }
-
- /**
- * Returns the replaced hyphen value.
- *
- * @return replaced hyphen
- */
- public String getReplacementForHyphen() {
- return replacementForHyphenInIdentifier;
- }
-
- /**
- * Sets the replacement value for an underscore.
- *
- * @param underscoreReplacement replacement value for underscore
- */
- public void setReplacementForUnderscore(String underscoreReplacement) {
- replacementForUnderscoreInIdentifier = underscoreReplacement;
- }
-
- /**
- * Returns the replaced underscore value.
- *
- * @return replaced underscore
- */
- public String getReplacementForUnderscore() {
- return replacementForUnderscoreInIdentifier;
- }
-
- /**
- * Sets the prefix value for adding with the identifier.
- *
- * @param prefix prefix for identifier
- */
- public void setPrefixForIdentifier(String prefix) {
- prefixForIdentifier = prefix;
- }
-
- /**
- * Returns the prefix for identifier.
- *
- * @return prefix for identifier
- */
- public String getPrefixForIdentifier() {
- return prefixForIdentifier;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/package-info.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/package-info.java
deleted file mode 100644
index 273febd..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Representation of YANG java data model.
- */
-package org.onosproject.yangutils.datamodel.javadatamodel;
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/package-info.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/package-info.java
deleted file mode 100644
index d8e8901..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Maintains application's schema information.
- */
-package org.onosproject.yangutils.datamodel;
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/DataModelUtils.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/DataModelUtils.java
deleted file mode 100644
index 1da8a1a..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/DataModelUtils.java
+++ /dev/null
@@ -1,595 +0,0 @@
-/*
- * 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.utils;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-
-import org.onosproject.yangutils.datamodel.CollisionDetector;
-import org.onosproject.yangutils.datamodel.ResolvableType;
-import org.onosproject.yangutils.datamodel.YangAtomicPath;
-import org.onosproject.yangutils.datamodel.YangAugment;
-import org.onosproject.yangutils.datamodel.YangBase;
-import org.onosproject.yangutils.datamodel.YangEntityToResolveInfoImpl;
-import org.onosproject.yangutils.datamodel.YangEnumeration;
-import org.onosproject.yangutils.datamodel.YangIdentityRef;
-import org.onosproject.yangutils.datamodel.YangIfFeature;
-import org.onosproject.yangutils.datamodel.YangImport;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangLeafList;
-import org.onosproject.yangutils.datamodel.YangLeafRef;
-import org.onosproject.yangutils.datamodel.YangLeavesHolder;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangReferenceResolver;
-import org.onosproject.yangutils.datamodel.YangResolutionInfo;
-import org.onosproject.yangutils.datamodel.YangRpc;
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.datamodel.YangUnion;
-import org.onosproject.yangutils.datamodel.YangUses;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-
-/**
- * Represents utilities for data model tree.
- */
-public final class DataModelUtils {
- public static final String TRUE = "true";
- public static final String FALSE = "false";
- private static final String SLASH = File.separator;
-
- /**
- * Creates a new data model tree utility.
- */
- private DataModelUtils() {
- }
-
- /**
- * Detects the colliding identifier name in a given YANG node and its child.
- *
- * @param identifierName name for which collision detection is to be checked
- * @param dataType type of YANG node asking for detecting collision
- * @param node instance of calling node
- * @throws DataModelException a violation of data model rules
- */
- public static void detectCollidingChildUtil(String identifierName, YangConstructType dataType, YangNode node)
- throws DataModelException {
- if (dataType == YangConstructType.USES_DATA || dataType == YangConstructType.GROUPING_DATA) {
- detectCollidingForUsesGrouping(identifierName, dataType, node);
- } else {
- if (node instanceof YangLeavesHolder) {
- YangLeavesHolder leavesHolder = (YangLeavesHolder) node;
- detectCollidingLeaf(leavesHolder.getListOfLeaf(), identifierName);
- detectCollidingLeafList(leavesHolder.getListOfLeafList(), identifierName);
- }
- node = node.getChild();
- while (node != null) {
- Parsable parsable = (Parsable) node;
- if (node instanceof CollisionDetector
- && parsable.getYangConstructType() != YangConstructType.USES_DATA
- && parsable.getYangConstructType() != YangConstructType.GROUPING_DATA) {
- ((CollisionDetector) node).detectSelfCollision(identifierName, dataType);
- }
- node = node.getNextSibling();
- }
- }
- }
-
- /**
- * Detects colliding of uses and grouping only with uses and grouping respectively.
- *
- * @param identifierName name for which collision detection is to be checked
- * @param dataType type of YANG node asking for detecting collision
- * @param node node instance of calling node
- * @throws DataModelException a violation of data model rules
- */
- private static void detectCollidingForUsesGrouping(String identifierName, YangConstructType dataType, YangNode node)
- throws DataModelException {
-
- node = node.getChild();
- while (node != null) {
- Parsable parsable = (Parsable) node;
- if (node instanceof CollisionDetector
- && parsable.getYangConstructType() == dataType) {
- ((CollisionDetector) node).detectSelfCollision(identifierName, dataType);
- }
- node = node.getNextSibling();
- }
- }
-
- /**
- * Detects the colliding identifier name in a given leaf node.
- *
- * @param listOfLeaf List of leaves to detect collision
- * @param identifierName name for which collision detection is to be checked
- * @throws DataModelException a violation of data model rules
- */
- private static void detectCollidingLeaf(List<YangLeaf> listOfLeaf, String identifierName)
- throws DataModelException {
-
- if (listOfLeaf == null) {
- return;
- }
- for (YangLeaf leaf : listOfLeaf) {
- if (leaf.getName().equals(identifierName)) {
- throw new DataModelException("YANG file error: Duplicate input identifier detected, same as leaf \""
- + leaf.getName() + "\"");
- }
- }
- }
-
- /**
- * Detects the colliding identifier name in a given leaf-list node.
- *
- * @param listOfLeafList list of leaf-lists to detect collision
- * @param identifierName name for which collision detection is to be checked
- * @throws DataModelException a violation of data model rules
- */
- private static void detectCollidingLeafList(List<YangLeafList> listOfLeafList, String identifierName)
- throws DataModelException {
-
- if (listOfLeafList == null) {
- return;
- }
- for (YangLeafList leafList : listOfLeafList) {
- if (leafList.getName().equals(identifierName)) {
- throw new DataModelException("YANG file error: Duplicate input identifier detected, same as leaf " +
- "list \"" + leafList.getName() + "\"");
- }
- }
- }
-
- /**
- * Add a resolution information.
- *
- * @param resolutionInfo information about the YANG construct which has to be resolved
- * @throws DataModelException a violation of data model rules
- */
- public static void addResolutionInfo(YangResolutionInfo resolutionInfo)
- throws DataModelException {
-
- /* get the module node to add maintain the list of nested reference */
- YangNode curNode = resolutionInfo.getEntityToResolveInfo()
- .getHolderOfEntityToResolve();
- while (!(curNode instanceof YangReferenceResolver)) {
- curNode = curNode.getParent();
- if (curNode == null) {
- throw new DataModelException("Internal datamodel error: Datamodel tree is not correct");
- }
- }
- YangReferenceResolver resolutionNode = (YangReferenceResolver) curNode;
-
- if (resolutionInfo.getEntityToResolveInfo()
- .getEntityToResolve() instanceof YangType) {
- resolutionNode.addToResolutionList(resolutionInfo,
- ResolvableType.YANG_DERIVED_DATA_TYPE);
- } else if (resolutionInfo.getEntityToResolveInfo()
- .getEntityToResolve() instanceof YangUses) {
- resolutionNode.addToResolutionList(resolutionInfo,
- ResolvableType.YANG_USES);
- } else if (resolutionInfo.getEntityToResolveInfo()
- .getEntityToResolve() instanceof YangAugment) {
- resolutionNode.addToResolutionList(resolutionInfo,
- ResolvableType.YANG_AUGMENT);
- } else if (resolutionInfo.getEntityToResolveInfo()
- .getEntityToResolve() instanceof YangIfFeature) {
- resolutionNode.addToResolutionList(resolutionInfo,
- ResolvableType.YANG_IF_FEATURE);
- } else if (resolutionInfo.getEntityToResolveInfo()
- .getEntityToResolve() instanceof YangLeafRef) {
- resolutionNode.addToResolutionList(resolutionInfo,
- ResolvableType.YANG_LEAFREF);
- } else if (resolutionInfo.getEntityToResolveInfo().getEntityToResolve() instanceof YangBase) {
- resolutionNode.addToResolutionList(resolutionInfo, ResolvableType.YANG_BASE);
- } else if (resolutionInfo.getEntityToResolveInfo().getEntityToResolve() instanceof YangIdentityRef) {
- resolutionNode.addToResolutionList(resolutionInfo, ResolvableType.YANG_IDENTITYREF);
- }
- }
-
- /**
- * Resolve linking for a resolution list.
- *
- * @param resolutionList resolution list for which linking to be done
- * @param dataModelRootNode module/sub-module node
- * @throws DataModelException a violation of data model rules
- */
- public static void resolveLinkingForResolutionList(List<YangResolutionInfo> resolutionList,
- YangReferenceResolver dataModelRootNode)
- throws DataModelException {
-
- for (YangResolutionInfo resolutionInfo : resolutionList) {
- resolutionInfo.resolveLinkingForResolutionInfo(dataModelRootNode);
- }
- }
-
- /**
- * Links type/uses referring to typedef/uses of inter YANG file.
- *
- * @param resolutionList resolution list for which linking to be done
- * @param dataModelRootNode module/sub-module node
- * @throws DataModelException a violation of data model rules
- */
- public static void linkInterFileReferences(List<YangResolutionInfo> resolutionList,
- YangReferenceResolver dataModelRootNode)
- throws DataModelException {
- /*
- * Run through the resolution list, find type/uses referring to inter
- * file typedef/grouping, ask for linking.
- */
- for (YangResolutionInfo resolutionInfo : resolutionList) {
- resolutionInfo.linkInterFile(dataModelRootNode);
- }
- }
-
- /**
- * Checks if there is any rpc defined in the module or sub-module.
- *
- * @param rootNode root node of the data model
- * @return status of rpc's existence
- */
- public static boolean isRpcChildNodePresent(YangNode rootNode) {
- YangNode childNode = rootNode.getChild();
- while (childNode != null) {
- if (childNode instanceof YangRpc) {
- return true;
- }
- childNode = childNode.getNextSibling();
- }
- return false;
- }
-
- /**
- * Returns referred node in a given set.
- *
- * @param yangNodeSet YANG node set
- * @param refNodeName name of the node which is referred
- * @return referred node's reference
- */
- public static YangNode findReferredNode(Set<YangNode> yangNodeSet, String refNodeName) {
- /*
- * Run through the YANG files to see which YANG file matches the
- * referred node name.
- */
- for (YangNode yangNode : yangNodeSet) {
- if (yangNode.getName().equals(refNodeName)) {
- return yangNode;
- }
- }
- return null;
- }
-
- /**
- * Returns the contained data model parent node.
- *
- * @param currentNode current node which parent contained node is required
- * @return parent node in which the current node is an attribute
- */
- public static YangNode getParentNodeInGenCode(YangNode currentNode) {
-
- /*
- * TODO: recursive parent lookup to support choice/augment/uses. TODO:
- * need to check if this needs to be updated for
- * choice/case/augment/grouping
- */
- return currentNode.getParent();
- }
-
- /**
- * Returns de-serializes YANG data-model nodes.
- *
- * @param serializedFileInfo serialized File Info
- * @return de-serializes YANG data-model nodes
- * @throws IOException when fails do IO operations
- */
- public static YangNode deSerializeDataModel(String serializedFileInfo) throws IOException {
-
- YangNode node;
- try {
- FileInputStream fileInputStream = new FileInputStream(serializedFileInfo);
- ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream);
- node = (YangNode) objectInputStream.readObject();
- objectInputStream.close();
- fileInputStream.close();
- } catch (IOException | ClassNotFoundException e) {
- throw new IOException(serializedFileInfo + " not found.");
- }
-
- return node;
- }
-
- /**
- * Clones the list of leaves and list of leaf list in the leaves holder.
- *
- * @param leavesHolder YANG node potentially containing leaves or leaf lists
- * @param yangUses instance of YANG uses
- * @throws CloneNotSupportedException clone is not supported
- * @throws DataModelException data model error
- */
- public static void cloneLeaves(YangLeavesHolder leavesHolder, YangUses yangUses)
- throws CloneNotSupportedException, DataModelException {
- List<YangLeaf> currentListOfLeaves = leavesHolder.getListOfLeaf();
- if (currentListOfLeaves != null) {
- List<YangLeaf> clonedLeavesList = new LinkedList<>();
- for (YangLeaf leaf : currentListOfLeaves) {
- YangLeaf clonedLeaf = leaf.clone();
- if (yangUses.getCurrentGroupingDepth() == 0) {
- YangEntityToResolveInfoImpl resolveInfo =
- resolveLeafrefUnderGroupingForLeaf(clonedLeaf, leavesHolder, yangUses);
- if (resolveInfo != null) {
- yangUses.addEntityToResolve(resolveInfo);
- }
- }
- clonedLeaf.setContainedIn(leavesHolder);
- clonedLeavesList.add(clonedLeaf);
- }
- leavesHolder.setListOfLeaf(clonedLeavesList);
- }
-
- List<YangLeafList> currentListOfLeafList = leavesHolder.getListOfLeafList();
- if (currentListOfLeafList != null) {
- List<YangLeafList> clonedListOfLeafList = new LinkedList<>();
- for (YangLeafList leafList : currentListOfLeafList) {
- YangLeafList clonedLeafList = leafList.clone();
- if (yangUses.getCurrentGroupingDepth() == 0) {
- YangEntityToResolveInfoImpl resolveInfo =
- resolveLeafrefUnderGroupingForLeafList(clonedLeafList, leavesHolder);
- if (resolveInfo != null) {
- yangUses.addEntityToResolve(resolveInfo);
- }
- }
- clonedLeafList.setContainedIn(leavesHolder);
- clonedListOfLeafList.add(clonedLeafList);
- }
- leavesHolder.setListOfLeafList(clonedListOfLeafList);
- }
- }
-
- /**
- * Resolves leafref in leaf, which are under grouping by adding it to the resolution list.
- *
- * @param clonedLeaf cloned leaf in uses from grouping
- * @param leafParentHolder holder of the leaf from uses
- * @param yangUses YANG uses
- * @return entity of leafref which has to be resolved
- * @throws DataModelException data model error
- */
- public static YangEntityToResolveInfoImpl resolveLeafrefUnderGroupingForLeaf(YangLeaf clonedLeaf,
- YangLeavesHolder leafParentHolder,
- YangUses yangUses) throws
- DataModelException {
- if (clonedLeaf.getDataType().getDataTypeExtendedInfo() instanceof YangLeafRef) {
- YangLeafRef leafrefForCloning = (YangLeafRef) clonedLeaf.getDataType().getDataTypeExtendedInfo();
- // Conversion of prefixes in absolute path while cloning them.
- convertThePrefixesDuringChange(leafrefForCloning, yangUses);
- leafrefForCloning.setParentNodeOfLeafref((YangNode) leafParentHolder);
- YangEntityToResolveInfoImpl yangEntityToResolveInfo = new YangEntityToResolveInfoImpl();
- yangEntityToResolveInfo.setEntityToResolve(leafrefForCloning);
- yangEntityToResolveInfo.setHolderOfEntityToResolve((YangNode) leafParentHolder);
- yangEntityToResolveInfo.setLineNumber(leafrefForCloning.getLineNumber());
- yangEntityToResolveInfo.setCharPosition(leafrefForCloning.getCharPosition());
- return yangEntityToResolveInfo;
- }
- return null;
- }
-
- /**
- * Converts the prefixes in all the nodes of the leafref with respect to the uses node.
- *
- * @param leafrefForCloning leafref that is to be cloned
- * @param yangUses instance of YANG uses where cloning is done
- * @throws DataModelException data model error
- */
- private static void convertThePrefixesDuringChange(YangLeafRef leafrefForCloning, YangUses yangUses) throws
- DataModelException {
- List<YangAtomicPath> atomicPathList = leafrefForCloning.getAtomicPath();
- if (atomicPathList != null && !atomicPathList.isEmpty()) {
- Iterator<YangAtomicPath> atomicPathIterator = atomicPathList.listIterator();
- while (atomicPathIterator.hasNext()) {
- YangAtomicPath atomicPath = atomicPathIterator.next();
- Map<String, String> prefixesAndItsImportNameNode = leafrefForCloning.getPrefixAndItsImportedModule();
- String prefixInPath = atomicPath.getNodeIdentifier().getPrefix();
- String importedNodeName = prefixesAndItsImportNameNode.get(prefixInPath);
- assignCurrentLeafedWithNewPrefixes(importedNodeName, atomicPath, yangUses);
- }
- }
- }
-
- /**
- * Assigns leafref with new prefixes while cloning.
- *
- * @param importedNodeName imported node name from grouping
- * @param atomicPath atomic path in leafref
- * @param node instance of YANG uses where cloning is done
- * @throws DataModelException data model error
- */
- private static void assignCurrentLeafedWithNewPrefixes(String importedNodeName, YangAtomicPath atomicPath,
- YangNode node) throws DataModelException {
- while (!(node instanceof YangReferenceResolver)) {
- node = node.getParent();
- if (node == null) {
- throw new DataModelException("Internal datamodel error: Datamodel tree is not correct");
- }
- }
- if (node instanceof YangModule) {
- List<YangImport> importInUsesList = ((YangModule) node).getImportList();
- if (importInUsesList != null && !importInUsesList.isEmpty()) {
- Iterator<YangImport> importInUsesListIterator = importInUsesList.listIterator();
- while (importInUsesListIterator.hasNext()) {
- YangImport importInUsesNode = importInUsesListIterator.next();
- if (importInUsesNode.getModuleName().equals(importedNodeName)) {
- atomicPath.getNodeIdentifier().setPrefix(importInUsesNode.getPrefixId());
- }
- }
- }
- }
- }
-
- /**
- * Resolves leafref in leaf-list, which are under grouping by adding it to the resolution list.
- *
- * @param clonedLeafList cloned leaf-list in uses from grouping
- * @param leafListParentHolder holder of the leaf-list from uses
- * @return entity of leafref which has to be resolved
- * @throws DataModelException data model error
- */
- public static YangEntityToResolveInfoImpl resolveLeafrefUnderGroupingForLeafList(YangLeafList clonedLeafList,
- YangLeavesHolder
- leafListParentHolder)
- throws DataModelException {
- if (clonedLeafList.getDataType().getDataTypeExtendedInfo() instanceof YangLeafRef) {
- YangLeafRef leafrefForCloning = (YangLeafRef) clonedLeafList.getDataType().getDataTypeExtendedInfo();
- leafrefForCloning.setParentNodeOfLeafref((YangNode) leafListParentHolder);
- YangEntityToResolveInfoImpl yangEntityToResolveInfo = new YangEntityToResolveInfoImpl();
- yangEntityToResolveInfo.setEntityToResolve(leafrefForCloning);
- yangEntityToResolveInfo.setHolderOfEntityToResolve((YangNode) leafListParentHolder);
- yangEntityToResolveInfo.setLineNumber(leafrefForCloning.getLineNumber());
- yangEntityToResolveInfo.setCharPosition(leafrefForCloning.getCharPosition());
- return yangEntityToResolveInfo;
- }
- return null;
- }
-
- /**
- * Clones the union or enum leaves. If there is any cloned leaves whose type is union/enum then the corresponding
- * type info needs to be updated to the cloned new type node.
- *
- * @param leavesHolder cloned leaves holder, for whom the leaves reference needs to be updated
- * @throws DataModelException when fails to do data model operations
- */
- public static void updateClonedLeavesUnionEnumRef(YangLeavesHolder leavesHolder) throws DataModelException {
- List<YangLeaf> currentListOfLeaves = leavesHolder.getListOfLeaf();
- if (currentListOfLeaves != null) {
- for (YangLeaf leaf : currentListOfLeaves) {
- if (leaf.getDataType().getDataType() == YangDataTypes.ENUMERATION
- || leaf.getDataType().getDataType() == YangDataTypes.UNION) {
- try {
- updateClonedTypeRef(leaf.getDataType(), leavesHolder);
- } catch (DataModelException e) {
- throw e;
- }
- }
- }
-
- }
-
- List<YangLeafList> currentListOfLeafList = leavesHolder.getListOfLeafList();
- if (currentListOfLeafList != null) {
- for (YangLeafList leafList : currentListOfLeafList) {
- if (leafList.getDataType().getDataType() == YangDataTypes.ENUMERATION
- || leafList.getDataType().getDataType() == YangDataTypes.UNION) {
- try {
- updateClonedTypeRef(leafList.getDataType(), leavesHolder);
- } catch (DataModelException e) {
- throw e;
- }
- }
- }
- }
- }
-
- /**
- * Updates the types extended info pointer to point to the cloned type node.
- *
- * @param dataType data type, whose extended info needs to be pointed to the cloned type
- * @param leavesHolder the leaves holder having the cloned type
- */
- private static void updateClonedTypeRef(YangType dataType, YangLeavesHolder leavesHolder)
- throws DataModelException {
- if (!(leavesHolder instanceof YangNode)) {
- throw new DataModelException("Data model error: cloned leaves holder is not a node");
- }
- YangNode potentialTypeNode = ((YangNode) leavesHolder).getChild();
- while (potentialTypeNode != null) {
- String dataTypeName = null;
- if (dataType.getDataType() == YangDataTypes.ENUMERATION) {
- YangEnumeration enumNode = (YangEnumeration) dataType.getDataTypeExtendedInfo();
- dataTypeName = enumNode.getName();
- } else if (dataType.getDataType() == YangDataTypes.UNION) {
- YangUnion unionNode = (YangUnion) dataType.getDataTypeExtendedInfo();
- dataTypeName = unionNode.getName();
- }
- if (potentialTypeNode.getName().contentEquals(dataTypeName)) {
- dataType.setDataTypeExtendedInfo(potentialTypeNode);
- return;
- }
- potentialTypeNode = potentialTypeNode.getNextSibling();
- }
-
- throw new DataModelException("Data model error: cloned leaves type is not found");
- }
-
- /**
- * Parses jar file and returns list of serialized file names.
- *
- * @param jarFile jar file to be parsed
- * @param directory directory where to search
- * @return list of serialized files
- * @throws IOException when fails to do IO operations
- */
- public static List<YangNode> parseJarFile(String jarFile, String directory)
- throws IOException {
-
- List<YangNode> nodes = new ArrayList<>();
- JarFile jar = new JarFile(jarFile);
- Enumeration<?> enumEntries = jar.entries();
-
- while (enumEntries.hasMoreElements()) {
- JarEntry file = (JarEntry) enumEntries.nextElement();
- if (file.getName().endsWith(".ser")) {
-
- if (file.getName().contains(SLASH)) {
- String[] strArray = file.getName().split(SLASH);
- String tempPath = "";
- for (int i = 0; i < strArray.length - 1; i++) {
- tempPath = SLASH + tempPath + SLASH + strArray[i];
- }
- File dir = new File(directory + tempPath);
- dir.mkdirs();
- }
- File serializedFile = new File(directory + SLASH + file.getName());
- if (file.isDirectory()) {
- serializedFile.mkdirs();
- continue;
- }
- InputStream inputStream = jar.getInputStream(file);
-
- FileOutputStream fileOutputStream = new FileOutputStream(serializedFile);
- while (inputStream.available() > 0) {
- fileOutputStream.write(inputStream.read());
- }
- fileOutputStream.close();
- inputStream.close();
- nodes.add(deSerializeDataModel(serializedFile.toString()));
- }
- }
- jar.close();
- return nodes;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/FractionDigits.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/FractionDigits.java
deleted file mode 100644
index f5c644a..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/FractionDigits.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * 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.utils;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-
-import java.math.BigDecimal;
-import java.util.ArrayList;
-
-/**
- * The "fraction-digits" statement, which is a substatement to the
- * "type" statement, MUST be present if the type is "decimal64". It
- * takes as an argument an integer between 1 and 18, inclusively. It
- * controls the size of the minimum difference between values of a
- * decimal64 type, by restricting the value space to numbers that are
- * expressible as "i x 10^-n" where n is the fraction-digits argument.
- *
- * +----------------+-----------------------+----------------------+
- * | fraction-digit | min | max |
- * +----------------+-----------------------+----------------------+
- * | 1 | -922337203685477580.8 | 922337203685477580.7 |
- * | 2 | -92233720368547758.08 | 92233720368547758.07 |
- * | 3 | -9223372036854775.808 | 9223372036854775.807 |
- * | 4 | -922337203685477.5808 | 922337203685477.5807 |
- * | 5 | -92233720368547.75808 | 92233720368547.75807 |
- * | 6 | -9223372036854.775808 | 9223372036854.775807 |
- * | 7 | -922337203685.4775808 | 922337203685.4775807 |
- * | 8 | -92233720368.54775808 | 92233720368.54775807 |
- * | 9 | -9223372036.854775808 | 9223372036.854775807 |
- * | 10 | -922337203.6854775808 | 922337203.6854775807 |
- * | 11 | -92233720.36854775808 | 92233720.36854775807 |
- * | 12 | -9223372.036854775808 | 9223372.036854775807 |
- * | 13 | -922337.2036854775808 | 922337.2036854775807 |
- * | 14 | -92233.72036854775808 | 92233.72036854775807 |
- * | 15 | -9223.372036854775808 | 9223.372036854775807 |
- * | 16 | -922.3372036854775808 | 922.3372036854775807 |
- * | 17 | -92.23372036854775808 | 92.23372036854775807 |
- * | 18 | -9.223372036854775808 | 9.223372036854775807 |
- * +----------------+-----------------------+----------------------+
- */
-
-/**
- * Represents the decimal64 value range based on fraction-digits.
- */
-public final class FractionDigits {
-
- public static class Range {
- private double min;
- private double max;
-
- /**
- * Creates an instance of range.
- *
- * @param min minimum value of decimal64
- * @param max maximum value of decimal64
- */
- protected Range(double min, double max) {
- this.min = min;
- this.max = max;
- }
-
- /**
- * Retrieve minimum value range.
- *
- * @return minimum value range
- */
- public double getMin() {
- return min;
- }
-
- /**
- * Retrieve maximum value range.
- *
- * @return maximum value range
- */
- public double getMax() {
- return max;
- }
- }
-
- private static ArrayList<Range> decimal64ValueRange = null;
-
- /**
- * Creates a fraction-digits instance.
- */
- private FractionDigits() {
- }
-
- /**
- * Generates decimal64 value range based on fraction-digits.
- *
- * @return decimal64 value range by fraction-digits as index
- */
- public static ArrayList<Range> getDecimal64ValueRange() {
- if (decimal64ValueRange == null) {
- decimal64ValueRange = new ArrayList<>();
- decimal64ValueRange.add(new Range(-922337203685477580.8, 922337203685477580.7)); // fraction-digit: 1
- decimal64ValueRange.add(new Range(-92233720368547758.08, 92233720368547758.07)); // fraction-digit: 2
- decimal64ValueRange.add(new Range(-9223372036854775.808, 9223372036854775.807)); // fraction-digit: 3
- decimal64ValueRange.add(new Range(-922337203685477.5808, 922337203685477.5807)); // fraction-digit: 4
- decimal64ValueRange.add(new Range(-92233720368547.75808, 92233720368547.75807)); // fraction-digit: 5
- decimal64ValueRange.add(new Range(-9223372036854.775808, 9223372036854.775807)); // fraction-digit: 6
- decimal64ValueRange.add(new Range(-922337203685.4775808, 922337203685.4775807)); // fraction-digit: 7
- decimal64ValueRange.add(new Range(-92233720368.54775808, 92233720368.54775807)); // fraction-digit: 8
- decimal64ValueRange.add(new Range(-9223372036.854775808, 9223372036.854775807)); // fraction-digit: 9
- decimal64ValueRange.add(new Range(-922337203.6854775808, 922337203.6854775807)); // fraction-digit: 10
- decimal64ValueRange.add(new Range(-92233720.36854775808, 92233720.36854775807)); // fraction-digit: 11
- decimal64ValueRange.add(new Range(-9223372.036854775808, 9223372.036854775807)); // fraction-digit: 12
- decimal64ValueRange.add(new Range(-922337.2036854775808, 922337.2036854775807)); // fraction-digit: 13
- decimal64ValueRange.add(new Range(-92233.72036854775808, 92233.72036854775807)); // fraction-digit: 14
- decimal64ValueRange.add(new Range(-9223.372036854775808, 9223.372036854775807)); // fraction-digit: 15
- decimal64ValueRange.add(new Range(-922.3372036854775808, 922.3372036854775807)); // fraction-digit: 16
- decimal64ValueRange.add(new Range(-92.23372036854775808, 92.23372036854775807)); // fraction-digit: 17
- decimal64ValueRange.add(new Range(-9.223372036854775808, 9.223372036854775807)); // fraction-digit: 18
- }
- return decimal64ValueRange;
- }
-
- /**
- * Retrieve range based on fraction-digits.
- *
- * @param fractionDigit fraction-digits
- * @return range
- * @throws DataModelException a violation of data model rules
- */
- public static Range getRange(int fractionDigit) throws DataModelException {
- if (!((fractionDigit >= 1) && (fractionDigit <= 18))) {
- throw new DataModelException("YANG file error : given fraction-digit is not in its range (1..18).");
- }
-
- return getDecimal64ValueRange().get(fractionDigit - 1);
- }
-
- /**
- * Checks whether specific decimal64 value is in correct range based fraction-digit.
- *
- * @param value decimal64 value
- * @param fractionDigit fraction-digits
- * @return true when it is in correct range otherwise false
- */
- public static boolean isValueInDecimal64Range(BigDecimal value, int fractionDigit) {
- // Fraction-digits should be in correct its own range.
- if (!((fractionDigit >= 1) && (fractionDigit <= 18))) {
- return false;
- }
-
- // ArrayList index starts from 0.
- FractionDigits.Range range = FractionDigits.getDecimal64ValueRange().get(fractionDigit - 1);
- if ((value.doubleValue() >= range.getMin()) && (value.doubleValue() <= range.getMax())) {
- return true;
- }
- return false;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/GeneratedLanguage.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/GeneratedLanguage.java
deleted file mode 100644
index 37d2161..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/GeneratedLanguage.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.utils;
-
-/**
- * Represents the target language in which the YANG information is modeled.
- */
-public enum GeneratedLanguage {
- /**
- * Target language is java.
- */
- JAVA_GENERATION
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/Parsable.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/Parsable.java
deleted file mode 100644
index eb32bc8..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/Parsable.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.utils;
-
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-
-/**
- * Abstraction of an entity which process the data of lexer's parse tree.
- */
-public interface Parsable {
-
- /**
- * Returns the type of YANG construct data.
- *
- * @return the type of YANG construct data.
- */
- YangConstructType getYangConstructType();
-
- /**
- * Checks if the node is valid as per YANG grammar's syntax and semantics.
- * This validation will be performed on entering the node in traversal
- *
- * @throws DataModelException if there is any violation of the YANG rules
- * in parsed data, corresponding exception should be thrown
- */
- void validateDataOnEntry() throws DataModelException;
-
- /**
- * Checks if the node is valid as per YANG grammar's syntax and semantics.
- * This validation will be performed on exiting the node in traversal
- *
- * @throws DataModelException if there is any violation of the YANG rules
- * in parsed data, corresponding exception should be thrown
- */
- void validateDataOnExit() throws DataModelException;
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/ResolvableStatus.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/ResolvableStatus.java
deleted file mode 100644
index d31f67b..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/ResolvableStatus.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.utils;
-
-/**
- * Represents the status of resolvable entity.
- */
-public enum ResolvableStatus {
-
- /**
- * Identifies that resolvable entity is unresolved.
- */
- UNRESOLVED,
-
- /**
- * Identifies that resolvable entity's reference is linked.
- */
- LINKED,
-
- /**
- * Identifies that resolvable entity is IntraFile resolved (i.e. complete
- * linking with in the intra file).
- */
- INTRA_FILE_RESOLVED,
-
- /**
- * Identifies that resolvable entity is resolved.
- */
- RESOLVED,
-
- /**
- * Identifies that resolvable entity is inter file linked (i.e. complete
- * linking with external files).
- */
- INTER_FILE_LINKED,
-
- /**
- * Identifies that resolvable entity is referred node is not defined.
- */
- UNDEFINED
-
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/RestrictionResolver.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/RestrictionResolver.java
deleted file mode 100644
index 7a44d1f..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/RestrictionResolver.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * 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.utils;
-
-import java.util.regex.Pattern;
-import org.onosproject.yangutils.datamodel.YangRangeInterval;
-import org.onosproject.yangutils.datamodel.YangRangeRestriction;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangBuiltInDataTypeInfo;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-
-import static org.onosproject.yangutils.datamodel.BuiltInTypeObjectFactory.getDataObjectFromString;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.LENGTH_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.RANGE_DATA;
-
-/**
- * Represents restriction resolver which provide common utility used by parser
- * and during linking for restriction resolution.
- */
-public final class RestrictionResolver {
-
- private static final String PIPE = "|";
- private static final String ADD = "+";
- private static final String EMPTY_STRING = "";
- private static final String INTERVAL = "..";
- private static final int MAX_RANGE_BOUNDARY = 2;
- private static final int MIN_RANGE_BOUNDARY = 1;
- private static final String MIN_KEYWORD = "min";
- private static final String MAX_KEYWORD = "max";
-
- /**
- * Creates a restriction resolver.
- */
- private RestrictionResolver() {
- }
-
- /**
- * Processes the range restriction for parser and linker.
- *
- * @param refRangeRestriction range restriction of referred typedef
- * @param lineNumber error line number
- * @param charPositionInLine error character position in line
- * @param hasReferredRestriction whether has referred restriction
- * @param curRangeString caller type's range string
- * @param effectiveType effective type, when called from linker
- * @return YANG range restriction
- * @throws DataModelException a violation in data model rule
- */
- public static YangRangeRestriction processRangeRestriction(YangRangeRestriction refRangeRestriction,
- int lineNumber, int charPositionInLine,
- boolean hasReferredRestriction,
- String curRangeString, YangDataTypes effectiveType)
- throws DataModelException {
- YangBuiltInDataTypeInfo<?> startValue;
- YangBuiltInDataTypeInfo<?> endValue;
- YangRangeRestriction rangeRestriction = new YangRangeRestriction();
-
- String rangeArgument = removeQuotesAndHandleConcat(curRangeString);
- 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(INTERVAL));
-
- if (rangeBoundary.length > MAX_RANGE_BOUNDARY) {
- DataModelException dataModelException = new DataModelException("YANG file error : " +
- YangConstructType.getYangConstructType(RANGE_DATA) + " " + rangeArgument +
- " is not valid.");
- dataModelException.setLine(lineNumber);
- dataModelException.setCharPosition(charPositionInLine);
- throw dataModelException;
- }
-
- if (rangeBoundary.length == MIN_RANGE_BOUNDARY) {
- startInterval = rangeBoundary[0].trim();
- endInterval = rangeBoundary[0].trim();
- } else {
- startInterval = rangeBoundary[0].trim();
- endInterval = rangeBoundary[1].trim();
- }
-
- try {
- if (hasReferredRestriction && startInterval.equals(MIN_KEYWORD)
- && refRangeRestriction.getMinRestrictedvalue() != null) {
- startValue = refRangeRestriction.getMinRestrictedvalue();
- } else if (hasReferredRestriction && startInterval.equals(MAX_KEYWORD)
- && refRangeRestriction.getMaxRestrictedvalue() != null) {
- startValue = refRangeRestriction.getMaxRestrictedvalue();
- } else {
- startValue = getDataObjectFromString(startInterval, effectiveType);
- }
- if (hasReferredRestriction && endInterval.equals(MIN_KEYWORD)
- && refRangeRestriction.getMinRestrictedvalue() != null) {
- endValue = refRangeRestriction.getMinRestrictedvalue();
- } else if (hasReferredRestriction && endInterval.equals(MAX_KEYWORD)
- && refRangeRestriction.getMaxRestrictedvalue() != null) {
- endValue = refRangeRestriction.getMaxRestrictedvalue();
- } else {
- endValue = getDataObjectFromString(endInterval, effectiveType);
- }
- } catch (Exception e) {
- DataModelException dataModelException = new DataModelException(e.getMessage());
- dataModelException.setLine(lineNumber);
- dataModelException.setCharPosition(charPositionInLine);
- throw dataModelException;
- }
-
- rangeInterval.setStartValue(startValue);
- rangeInterval.setEndValue(endValue);
-
- try {
- rangeRestriction.addRangeRestrictionInterval(rangeInterval);
- } catch (DataModelException dataModelException) {
- dataModelException.setLine(lineNumber);
- dataModelException.setCharPosition(charPositionInLine);
- throw dataModelException;
- }
- }
- return rangeRestriction;
- }
-
- /**
- * Processes the length restriction for parser and linker.
- *
- * @param refLengthRestriction length restriction of referred typedef
- * @param lineNumber error line number
- * @param charPositionInLine error character position in line
- * @param hasReferredRestriction whether has referred restriction
- * @param curLengthString caller type's length string
- * @return YANG range restriction
- * @throws DataModelException a violation in data model rule
- */
- public static YangRangeRestriction processLengthRestriction(YangRangeRestriction refLengthRestriction,
- int lineNumber, int charPositionInLine,
- boolean hasReferredRestriction,
- String curLengthString) throws DataModelException {
-
- YangBuiltInDataTypeInfo<?> startValue;
- YangBuiltInDataTypeInfo<?> endValue;
- YangRangeRestriction lengthRestriction = new YangRangeRestriction<>();
-
- String rangeArgument = removeQuotesAndHandleConcat(curLengthString);
- 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(INTERVAL));
-
- if (rangeBoundary.length > MAX_RANGE_BOUNDARY) {
- DataModelException dataModelException = new DataModelException("YANG file error : " +
- YangConstructType.getYangConstructType(LENGTH_DATA) + " " + rangeArgument +
- " is not valid.");
- dataModelException.setLine(lineNumber);
- dataModelException.setCharPosition(charPositionInLine);
- throw dataModelException;
- }
-
- if (rangeBoundary.length == MIN_RANGE_BOUNDARY) {
- startInterval = rangeBoundary[0].trim();
- endInterval = rangeBoundary[0].trim();
- } else {
- startInterval = rangeBoundary[0].trim();
- endInterval = rangeBoundary[1].trim();
- }
-
- try {
- if (hasReferredRestriction && startInterval.equals(MIN_KEYWORD)
- && refLengthRestriction.getMinRestrictedvalue() != null) {
- startValue = refLengthRestriction.getMinRestrictedvalue();
- } else if (hasReferredRestriction && startInterval.equals(MAX_KEYWORD)
- && refLengthRestriction.getMaxRestrictedvalue() != null) {
- startValue = refLengthRestriction.getMaxRestrictedvalue();
- } else {
- startValue = getDataObjectFromString(startInterval, YangDataTypes.UINT64);
- }
- if (hasReferredRestriction && endInterval.equals(MIN_KEYWORD)
- && refLengthRestriction.getMinRestrictedvalue() != null) {
- endValue = refLengthRestriction.getMinRestrictedvalue();
- } else if (hasReferredRestriction && endInterval.equals(MAX_KEYWORD)
- && refLengthRestriction.getMaxRestrictedvalue() != null) {
- endValue = refLengthRestriction.getMaxRestrictedvalue();
- } else {
- endValue = getDataObjectFromString(endInterval, YangDataTypes.UINT64);
- }
- } catch (Exception e) {
- DataModelException dataModelException = new DataModelException(e.getMessage());
- dataModelException.setLine(lineNumber);
- dataModelException.setCharPosition(charPositionInLine);
- throw dataModelException;
- }
-
- rangeInterval.setStartValue(startValue);
- rangeInterval.setEndValue(endValue);
-
- try {
- lengthRestriction.addRangeRestrictionInterval(rangeInterval);
- } catch (DataModelException dataModelException) {
- dataModelException.setLine(lineNumber);
- dataModelException.setCharPosition(charPositionInLine);
- throw dataModelException;
- }
- }
- return lengthRestriction;
- }
-
- /**
- * Removes doubles quotes and concatenates if string has plus symbol.
- *
- * @param yangStringData string from yang file
- * @return concatenated string after removing double quotes
- */
- private static String removeQuotesAndHandleConcat(String yangStringData) {
-
- yangStringData = yangStringData.replace("\"", EMPTY_STRING);
- String[] tmpData = yangStringData.split(Pattern.quote(ADD));
- StringBuilder builder = new StringBuilder();
- for (String yangString : tmpData) {
- builder.append(yangString);
- }
- return builder.toString();
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/YangConstructType.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/YangConstructType.java
deleted file mode 100644
index fc0fbd7..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/YangConstructType.java
+++ /dev/null
@@ -1,574 +0,0 @@
-/*
- * 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.utils;
-
-/**
- * Represents ENUM to represent the type of data in parse tree.
- */
-public enum YangConstructType {
- /**
- * Identifies the module parsed data.
- */
- MODULE_DATA,
-
- /**
- * Identifies the sub module parsed data.
- */
- SUB_MODULE_DATA,
-
- /**
- * Identifies the typedef parsed data.
- */
- TYPEDEF_DATA,
-
- /**
- * Identifies the type parsed data.
- */
- TYPE_DATA,
-
- /**
- * Identifies the choice parsed data.
- */
- CHOICE_DATA,
-
- /**
- * Identifies the case parsed data.
- */
- CASE_DATA,
-
- /**
- * Identifies the YANG enumeration parsed data.
- */
- ENUMERATION_DATA,
-
- /**
- * Identifies the grouping parsed data.
- */
- GROUPING_DATA,
-
- /**
- * Identifies the uses parsed data.
- */
- USES_DATA,
-
- /**
- * Identifies the augment parsed data.
- */
- AUGMENT_DATA,
-
- /**
- * Identifies the container parsed data.
- */
- CONTAINER_DATA,
-
- /**
- * Identifies the YANG list parsed data.
- */
- LIST_DATA,
-
- /**
- * Identifies the YANG belongs-to parsed data.
- */
- BELONGS_TO_DATA,
-
- /**
- * Identifies the YANG bit parsed data.
- */
- BIT_DATA,
-
- /**
- * Identifies the YANG bits parsed data.
- */
- BITS_DATA,
-
- /**
- * Identifies the YANG decimal64 parsed data.
- */
- DECIMAL64_DATA,
-
- /**
- * Identifies the YANG fraction-digits parsed data.
- */
- FRACTION_DIGITS_DATA,
-
- /**
- * Identifies the YANG enum parsed data.
- */
- ENUM_DATA,
-
- /**
- * Identifies the YANG import parsed data.
- */
- IMPORT_DATA,
-
- /**
- * Identifies the YANG include parsed data.
- */
- INCLUDE_DATA,
-
- /**
- * Identifies the YANG leaf parsed data.
- */
- LEAF_DATA,
-
- /**
- * Identifies the YANG leaf list parsed data.
- */
- LEAF_LIST_DATA,
-
- /**
- * Identifies the YANG must parsed data.
- */
- MUST_DATA,
-
- /**
- * Identifies the YANG revision parsed data.
- */
- REVISION_DATA,
-
- /**
- * Identifies the YANG revision date parsed data.
- */
- REVISION_DATE_DATA,
-
- /**
- * Identifies the YANG namespace parsed data.
- */
- NAMESPACE_DATA,
-
- /**
- * Identifies the YANG contact parsed data.
- */
- CONTACT_DATA,
-
- /**
- * Identifies the YANG config parsed data.
- */
- CONFIG_DATA,
-
- /**
- * Identifies the YANG description parsed data.
- */
- DESCRIPTION_DATA,
-
- /**
- * Identifies the YANG key parsed data.
- */
- KEY_DATA,
-
- /**
- * Identifies the YANG mandatory parsed data.
- */
- MANDATORY_DATA,
-
- /**
- * Identifies the YANG max element parsed data.
- */
- MAX_ELEMENT_DATA,
-
- /**
- * Identifies the YANG min element parsed data.
- */
- MIN_ELEMENT_DATA,
-
- /**
- * Identifies the YANG presence element parsed data.
- */
- PRESENCE_DATA,
-
- /**
- * Identifies the YANG reference element parsed data.
- */
- REFERENCE_DATA,
-
- /**
- * Identifies the YANG status element parsed data.
- */
- STATUS_DATA,
-
- /**
- * Identifies the YANG units element parsed data.
- */
- UNITS_DATA,
-
- /**
- * Identifies the YANG version element parsed data.
- */
- VERSION_DATA,
-
- /**
- * Identifies the YANG base element parsed data.
- */
- YANGBASE_DATA,
-
- /**
- * Identifies the YANG prefix element parsed data.
- */
- PREFIX_DATA,
-
- /**
- * Identifies the YANG default element parsed data.
- */
- DEFAULT_DATA,
-
- /**
- * Identifies the YANG value element parsed data.
- */
- VALUE_DATA,
-
- /**
- * Identifies the YANG organization parsed data.
- */
- ORGANIZATION_DATA,
-
- /**
- * Identifies the YANG position element parsed data.
- */
- POSITION_DATA,
-
- /**
- * Identifies the YANG data definition statements.
- */
- DATA_DEF_DATA,
-
- /**
- * Identifies the YANG union element parsed data.
- */
- UNION_DATA,
-
- /**
- * Identifies the YANG notification element parsed data.
- */
- NOTIFICATION_DATA,
-
- /**
- * Identifies the YANG when element parsed data.
- */
- WHEN_DATA,
-
- /**
- * Identifies the YANG input element parsed data.
- */
- INPUT_DATA,
-
- /**
- * Identifies the YANG output element parsed data.
- */
- OUTPUT_DATA,
-
- /**
- * Identifies the YANG rpc element parsed data.
- */
- RPC_DATA,
-
- /**
- * Identifies the YANG short case element parsed data.
- */
- SHORT_CASE_DATA,
-
- /**
- * Identifies the derived data type.
- */
- DERIVED,
-
- /**
- * Identifies the YANG range element parsed data.
- */
- RANGE_DATA,
-
- /**
- * Identifies the YANG length element parsed data.
- */
- LENGTH_DATA,
-
- /**
- * Identifies the YANG pattern element parsed data.
- */
- PATTERN_DATA,
-
- /**
- * Identifies the YANG extension element parsed data.
- */
- EXTENSION_DATA,
-
- /**
- * Identifies the YANG identity element parsed data.
- */
- IDENTITY_DATA,
-
- /**
- * Identifies the YANG base element parsed data.
- */
- BASE_DATA,
-
- /**
- * Identifies the YANG feature element parsed data.
- */
- FEATURE_DATA,
-
- /**
- * Identifies the YANG if-feature element parsed data.
- */
- IF_FEATURE_DATA,
-
- /**
- * Identifies the YANG path element parsed data.
- */
- PATH_DATA,
-
- /**
- * Identifies the YANG require-instance element parsed data.
- */
- REQUIRE_INSTANCE_DATA,
-
- /**
- * Identifies the YANG ordered-by element parsed data.
- */
- ORDERED_BY_DATA,
-
- /**
- * Identifies the YANG error-message element parsed data.
- */
- ERROR_MESSAGE_DATA,
-
- /**
- * Identifies the YANG error-app-tag element parsed data.
- */
- ERROR_APP_TAG_DATA,
-
- /**
- * Identifies the YANG unique element parsed data.
- */
- UNIQUE_DATA,
-
- /**
- * Identifies the YANG refine element parsed data.
- */
- REFINE_DATA,
-
- /**
- * Identifies the YANG leafref element parsed data.
- */
- LEAFREF_DATA,
-
- /**
- * Identifies the YANG identityref element parsed data.
- */
- IDENTITYREF_DATA,
-
- /**
- * Identifies the YANG instance identifier element parsed data.
- */
- INSTANCE_IDENTIFIER_DATA,
-
- /**
- * Identifies the YANG deviation element parsed data.
- */
- DEVIATION_DATA,
-
- /**
- * Identifies the YANG anyxml element parsed data.
- */
- ANYXML_DATA,
-
- /**
- * Identifies the YANG compiler annotation element parsed data.
- */
- COMPILER_ANNOTATION_DATA,
-
- /**
- * Identifies the YANG app data structure element parsed data.
- */
- APP_DATA_STRUCTURE,
-
- /**
- * Identifies the YANG app extended element parsed data.
- */
- APP_EXTENDED_NAME_DATA,
-
- /**
- * Identifies the YANG argument element parsed data.
- */
- ARGUMENT_DATA;
-
- /**
- * Returns the YANG construct keyword corresponding to enum values.
- *
- * @param yangConstructType enum value for parsable data type.
- * @return YANG construct keyword.
- */
- public static String getYangConstructType(YangConstructType yangConstructType) {
-
- switch (yangConstructType) {
- case MODULE_DATA:
- return "module";
- case SUB_MODULE_DATA:
- return "submodule";
- case TYPEDEF_DATA:
- return "typedef";
- case TYPE_DATA:
- return "type";
- case CHOICE_DATA:
- return "choice";
- case CASE_DATA:
- return "case";
- case ENUMERATION_DATA:
- return "enumeration";
- case GROUPING_DATA:
- return "grouping";
- case USES_DATA:
- return "uses";
- case AUGMENT_DATA:
- return "augment";
- case CONTAINER_DATA:
- return "container";
- case LIST_DATA:
- return "list";
- case BELONGS_TO_DATA:
- return "belongs-to";
- case BIT_DATA:
- return "bit";
- case BITS_DATA:
- return "bits";
- case DECIMAL64_DATA:
- return "decimal64";
- case FRACTION_DIGITS_DATA:
- return "fraction-digits";
- case ENUM_DATA:
- return "enum";
- case IMPORT_DATA:
- return "import";
- case INCLUDE_DATA:
- return "include";
- case LEAF_DATA:
- return "leaf";
- case LEAF_LIST_DATA:
- return "leaf-list";
- case MUST_DATA:
- return "must";
- case REVISION_DATA:
- return "revision";
- case REVISION_DATE_DATA:
- return "revision-date";
- case NAMESPACE_DATA:
- return "namespace";
- case CONTACT_DATA:
- return "contact";
- case CONFIG_DATA:
- return "config";
- case DESCRIPTION_DATA:
- return "description";
- case KEY_DATA:
- return "key";
- case MANDATORY_DATA:
- return "mandatory";
- case MAX_ELEMENT_DATA:
- return "max-elements";
- case MIN_ELEMENT_DATA:
- return "min-elements";
- case PRESENCE_DATA:
- return "presence";
- case REFERENCE_DATA:
- return "reference";
- case STATUS_DATA:
- return "status";
- case UNITS_DATA:
- return "units";
- case VERSION_DATA:
- return "version";
- case YANGBASE_DATA:
- return "yangbase";
- case PREFIX_DATA:
- return "prefix";
- case ORGANIZATION_DATA:
- return "organization";
- case VALUE_DATA:
- return "value";
- case POSITION_DATA:
- return "position";
- case DEFAULT_DATA:
- return "default";
- case DATA_DEF_DATA:
- return "data-def-substatements";
- case WHEN_DATA:
- return "when";
- case INPUT_DATA:
- return "input";
- case OUTPUT_DATA:
- return "ouput";
- case RPC_DATA:
- return "rpc";
- case SHORT_CASE_DATA:
- return "short-case";
- case DERIVED:
- return "derived";
- case NOTIFICATION_DATA:
- return "notification";
- case UNION_DATA:
- return "union";
- case RANGE_DATA:
- return "range";
- case LENGTH_DATA:
- return "length";
- case PATTERN_DATA:
- return "pattern";
- case EXTENSION_DATA:
- return "extension";
- case IDENTITY_DATA:
- return "identity";
- case BASE_DATA:
- return "base";
- case FEATURE_DATA:
- return "feature";
- case IF_FEATURE_DATA:
- return "if-feature";
- case PATH_DATA:
- return "path";
- case REQUIRE_INSTANCE_DATA:
- return "require-instance";
- case ORDERED_BY_DATA:
- return "ordered-by";
- case ERROR_MESSAGE_DATA:
- return "error-message";
- case ERROR_APP_TAG_DATA:
- return "error-app-tag";
- case UNIQUE_DATA:
- return "unique";
- case REFINE_DATA:
- return "refine";
- case LEAFREF_DATA:
- return "leafref";
- case IDENTITYREF_DATA:
- return "identityref";
- case INSTANCE_IDENTIFIER_DATA:
- return "instance-identifier";
- case DEVIATION_DATA:
- return "deviation";
- case ANYXML_DATA:
- return "anyxml";
- case COMPILER_ANNOTATION_DATA:
- return "compiler-annotation";
- case APP_DATA_STRUCTURE:
- return "app-data-structure";
- case APP_EXTENDED_NAME_DATA:
- return "app-extended-name";
- case ARGUMENT_DATA:
- return "argument";
- default:
- return "yang";
- }
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/YangErrMsgConstants.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/YangErrMsgConstants.java
deleted file mode 100644
index 4468d9b..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/YangErrMsgConstants.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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.utils;
-
-/**
- * Represents default YANG error message types.
- */
-public final class YangErrMsgConstants {
-
- /**
- * Static attribute for operation failed error tag.
- */
- public static final String OPERATION_FAILED_ERROR_TAG = "operation-failed";
-
- /**
- * Static attribute for data missing error tag.
- */
- public static final String DATA_MISSING_ERROR_TAG = "data-missing";
-
- /**
- * Static attribute for bad attribute error tag.
- */
- public static final String BAD_ATTRIBUTE_ERROR_TAG = "bad-attribute";
-
- /**
- * Static attribute for data not unique error app tag.
- */
- public static final String DATA_NOT_UNIQUE_ERROR_APP_TAG = "data-not-unique";
-
- /**
- * Static attribute for too many elements error app tag.
- */
- public static final String TOO_MANY_ELEMENTS_ERROR_APP_TAG = "too-many-elements";
-
- /**
- * Static attribute for too few elements error app tag.
- */
- public static final String TOO_FEW_ELEMENTS_ERROR_APP_TAG = "too-few-elements";
-
- /**
- * Static attribute for must violation error app tag.
- */
- public static final String MUST_VIOLATION_ERROR_APP_TAG = "must-violation";
-
- /**
- * Static attribute for instance required error app tag.
- */
- public static final String INSTANCE_REQUIRED_ERROR_APP_TAG = "instance-required";
-
- /**
- * Static attribute for missing choice error app tag.
- */
- public static final String MISSING_CHOICE_ERROR_APP_TAG = "missing-choice";
-
- /**
- * Static attribute for missing instance error app tag.
- */
- public static final String MISSING_INSTANCE_ERROR_APP_TAG = "missing-instance";
-
- /**
- * TODO: Static attribute for error path to the instance-identifier leaf.
- */
- public static final String ERROR_PATH_INSTANCE_IDENTIFIER_LEAF = "Path to the instance-identifier leaf.";
-
- /**
- * Static attribute for error path to the missing choice.
- */
- public static final String ERROR_PATH_MISSING_CHOICE = "Path to the element with the missing choice.";
-
- /**
- * Static attribute for error path to the leafref leaf.
- */
- public static final String ERROR_PATH_LEAFREF_LEAF = "Path to the leafref leaf.";
-
- /**
- * Creates an instance of yang error message constants.
- */
- private YangErrMsgConstants() {
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/DataTypeException.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/DataTypeException.java
deleted file mode 100644
index 8c24d6c..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/DataTypeException.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2016 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.utils.builtindatatype;
-
-/**
- * Base class for exceptions in data type.
- */
-public class DataTypeException extends RuntimeException {
-
- private static final long serialVersionUID = 20160211L;
-
- /**
- * Create a new data type exception.
- */
- public DataTypeException() {
- super();
- }
-
- /**
- * Creates a new data type exception with given message.
- *
- * @param message the detail of exception in string
- */
- public DataTypeException(String message) {
- super(message);
- }
-
- /**
- * Creates a new data type exception from given message and cause.
- *
- * @param message the detail of exception in string
- * @param cause underlying cause of the error
- */
- public DataTypeException(final String message, final Throwable cause) {
- super(message, cause);
- }
-
- /**
- * Creates a new data type exception from cause.
- *
- * @param cause underlying cause of the error
- */
- public DataTypeException(final Throwable cause) {
- super(cause);
- }
-
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangBuiltInDataTypeInfo.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangBuiltInDataTypeInfo.java
deleted file mode 100644
index 20c3260..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangBuiltInDataTypeInfo.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2016 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.utils.builtindatatype;
-
-/**
- * Represents the list of utility functions to be supported by YANG built in
- * data type implementations.
- *
- * @param <T> The target data type
- */
-public interface YangBuiltInDataTypeInfo<T> extends Comparable<T> {
-
- /**
- * Returns the YANG built in type.
- *
- * @return the YANG built in type
- */
- YangDataTypes getYangType();
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangDataTypeUtils.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangDataTypeUtils.java
deleted file mode 100644
index 738a999..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangDataTypeUtils.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.utils.builtindatatype;
-
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.INT16;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.INT32;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.INT64;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.INT8;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.UINT16;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.UINT32;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.UINT64;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.UINT8;
-
-/**
- * Represents YANG data type utilities.
- */
-public final class YangDataTypeUtils {
-
- /**
- * Restricts creation of YANG data type utils instance.
- */
- private YangDataTypeUtils() {
- }
-
- /**
- * Returns whether the data type is of range restricted type.
- *
- * @param dataType data type to be checked
- * @return true, if data type can have range restrictions, false otherwise
- */
- public static boolean isOfRangeRestrictedType(YangDataTypes dataType) {
- return dataType == INT8
- || dataType == INT16
- || dataType == INT32
- || dataType == INT64
- || dataType == UINT8
- || dataType == UINT16
- || dataType == UINT32
- || dataType == UINT64;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangDataTypes.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangDataTypes.java
deleted file mode 100644
index 3506c56..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangDataTypes.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * 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.utils.builtindatatype;
-
-/**
- * Represents ENUM to identify the YANG data type.
- */
-public enum YangDataTypes {
- /**
- * Reference:RFC 6020.
- *
- * int8 represents integer values between -128 and 127, inclusively.
- */
- INT8("int8"),
-
- /**
- * Reference:RFC 6020.
- *
- * int16 represents integer values between -32768 and 32767, inclusively.
- */
- INT16("int16"),
-
- /**
- * Reference:RFC 6020.
- *
- * int32 represents integer values between -2147483648 and 2147483647,
- * inclusively.
- */
- INT32("int32"),
-
- /**
- * Reference:RFC 6020.
- *
- * int64 represents integer values between -9223372036854775808 and
- * 9223372036854775807, inclusively.
- */
- INT64("int64"),
-
- /**
- * Reference:RFC 6020.
- *
- * uint8 represents integer values between 0 and 255, inclusively.
- */
- UINT8("uint8"),
-
- /**
- * Reference:RFC 6020.
- *
- * uint16 represents integer values between 0 and 65535, inclusively.
- */
- UINT16("uint16"),
-
- /**
- * Reference:RFC 6020.
- *
- * uint32 represents integer values between 0 and 4294967295, inclusively.
- */
- UINT32("uint32"),
-
- /**
- * Reference:RFC 6020.
- *
- * uint64 represents integer values between 0 and 18446744073709551615,
- * inclusively.
- */
- UINT64("uint64"),
-
- /**
- * Reference:RFC 6020.
- *
- * The decimal64 type represents a subset of the real numbers, which can be
- * represented by decimal numerals. The value space of decimal64 is the set
- * of numbers that can be obtained by multiplying a 64-bit signed integer by
- * a negative power of ten, i.e., expressible as "i x 10^-n" where i is an
- * integer64 and n is an integer between 1 and 18, inclusively.
- */
- DECIMAL64("decimal64"), // TODO: need to implement in type.
-
- /**
- * Reference:RFC 6020.
- *
- * The string built-in type represents human-readable strings in YANG. Legal
- * characters are tab, carriage return, line feed, and the legal characters
- * of Unicode and ISO/IEC 10646
- */
- STRING("string"),
-
- /**
- * Reference:RFC 6020.
- *
- * The boolean built-in type represents a boolean value.
- */
- BOOLEAN("boolean"),
-
- /**
- * Reference:RFC 6020.
- *
- * The enumeration built-in type represents values from a set of assigned
- * names.
- */
- ENUMERATION("enumeration"),
-
- /**
- * Reference:RFC 6020.
- *
- * The bits built-in type represents a bit set. That is, a bits value is a
- * set of flags identified by small integer position numbers starting at 0.
- * Each bit number has an assigned name.
- */
- BITS("bits"),
-
- /**
- * Reference:RFC 6020.
- *
- * The binary built-in type represents any binary data, i.e., a sequence of
- * octets.
- */
- BINARY("binary"),
-
- /**
- * Reference:RFC 6020.
- *
- * The leafref type is used to reference a particular leaf instance in the
- * data tree. The "path" sub-statement (Section 9.9.2) selects a set of leaf
- * instances, and the leafref value space is the set of values of these leaf
- * instances.
- *
- * If the leaf with the leafref type represents configuration data, the leaf
- * it refers to MUST also represent configuration. Such a leaf puts a
- * constraint on valid data. All leafref nodes MUST reference existing leaf
- * instances or leafs with default values in use for the data to be valid.
- *
- * There MUST NOT be any circular chains of leafrefs.
- *
- * If the leaf that the leafref refers to is conditional based on one or
- * more features, then the leaf with the leafref type MUST also be
- * conditional based on at least the same set of features.
- */
- LEAFREF("leafref"),
-
- /**
- * Reference:RFC 6020.
- *
- * The identityref type is used to reference an existing identity.
- */
- IDENTITYREF("identityref"),
-
- /**
- * Reference:RFC 6020.
- *
- * The empty built-in type represents a leaf that does not have any value,
- * it conveys information by its presence or absence.
- *
- * An empty type cannot have a default value.
- */
- EMPTY("empty"),
-
- /**
- * Reference:RFC 6020.
- *
- * The union built-in type represents a value that corresponds to one of its
- * member types.
- *
- * When the type is "union", the "type" statement MUST be present. It is
- * used to repeatedly specify each member type of the union. It takes as an
- * argument a string that is the name of a member type.
- *
- * A member type can be of any built-in or derived type, except it MUST NOT
- * be one of the built-in types "empty" or "leafref".
- *
- * When a string representing a union data type is validated, the string is
- * validated against each member type, in the order they are specified in
- * the "type" statement, until a match is found.
- *
- * Any default value or "units" property defined in the member types is not
- * inherited by the union type.
- */
- UNION("union"),
-
- /**
- * Reference:RFC 6020.
- *
- * The instance-identifier built-in type is used to uniquely identify a
- * particular instance node in the data tree.
- *
- * The syntax for an instance-identifier is a subset of the XPath
- * abbreviated syntax, formally defined by the rule "instance-identifier".
- * It is used to uniquely identify a node in the data tree. Predicates are
- * used only for specifying the values for the key nodes for list entries, a
- * value of a leaf-list entry, or a positional index for a list without
- * keys. For identifying list entries with keys, each predicate consists of
- * one equality test per key, and each key MUST have a corresponding
- * predicate.
- *
- * If the leaf with the instance-identifier type represents configuration
- * data, and the "require-instance" property is "true", the node it refers
- * to MUST also represent configuration. Such a leaf puts a constraint on
- * valid data. All such leaf nodes MUST reference existing nodes or leaf
- * nodes with their default value in use for the data to be valid.
- */
- INSTANCE_IDENTIFIER("instance-identifier"),
-
- /**
- * Derived data type.
- */
- DERIVED("derived");
-
- /**
- * Defined type from the enum value.
- */
- private String definedType;
-
- /**
- * Constructs type value from enum.
- *
- * @param definedType value of enum
- */
- YangDataTypes(String definedType) {
- this.definedType = definedType;
- }
-
- /**
- * Returns YANG data type for corresponding type name.
- *
- * @param name type name from YANG file.
- * @return YANG data type for corresponding type name.
- */
- public static YangDataTypes getType(String name) {
- name = name.replace("\"", "");
- for (YangDataTypes yangDataType : values()) {
- if (yangDataType.definedType.toLowerCase().equals(name)) {
- return yangDataType;
- }
- }
- return YangDataTypes.DERIVED;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangInt16.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangInt16.java
deleted file mode 100644
index 9124356..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangInt16.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * 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.utils.builtindatatype;
-
-import java.io.Serializable;
-
-/**
- * Handles the YANG's int16 data type processing.
- *
- * int16 represents integer values between -32768 and 32767, inclusively.
- */
-public class YangInt16 implements YangBuiltInDataTypeInfo<YangInt16>, Serializable {
-
- private static final long serialVersionUID = 8006201667L;
-
- /**
- * YANG's min keyword.
- */
- private static final String MIN_KEYWORD = "min";
-
- /**
- * YANG's max keyword.
- */
- private static final String MAX_KEYWORD = "max";
-
- /**
- * Valid minimum value of YANG's int16.
- */
- public static final short MIN_VALUE = -32768;
-
- /**
- * Valid maximum value of YANG's int16.
- */
- public static final short MAX_VALUE = 32767;
-
- /**
- * The value of YANG's int16.
- */
- private final short value;
-
- /**
- * Creates an object with the value initialized with value represented in
- * string.
- *
- * @param valueInString value of the object in string
- */
- public YangInt16(String valueInString) {
-
- if (valueInString.matches(MIN_KEYWORD)) {
- value = MIN_VALUE;
- } else if (valueInString.matches(MAX_KEYWORD)) {
- value = MAX_VALUE;
- } else {
- try {
- value = Short.parseShort(valueInString);
- } catch (Exception e) {
- throw new DataTypeException("YANG file error : Input value \"" + valueInString + "\" is not a valid " +
- "int16.");
- }
- }
- }
-
- /**
- * Returns YANG's int16 value.
- *
- * @return value of YANG's int16
- */
- public short getValue() {
- return value;
- }
-
- @Override
- public int compareTo(YangInt16 anotherYangInt16) {
- return Short.compare(value, anotherYangInt16.value);
- }
-
- @Override
- public YangDataTypes getYangType() {
- return YangDataTypes.INT16;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangInt32.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangInt32.java
deleted file mode 100644
index f8a3275..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangInt32.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * 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.utils.builtindatatype;
-
-import java.io.Serializable;
-
-/**
- * Handles the YANG's int32 data type processing.
- *
- * int32 represents integer values between -2147483648 and 2147483647, inclusively.
- */
-public class YangInt32 implements YangBuiltInDataTypeInfo<YangInt32>, Serializable {
-
- private static final long serialVersionUID = 8006201666L;
-
- /**
- * YANG's min keyword.
- */
- private static final String MIN_KEYWORD = "min";
-
- /**
- * YANG's max keyword.
- */
- private static final String MAX_KEYWORD = "max";
-
- /**
- * Valid minimum value of YANG's int32.
- */
- public static final int MIN_VALUE = -2147483648;
-
- /**
- * Valid maximum value of YANG's int32.
- */
- public static final int MAX_VALUE = 2147483647;
-
- /**
- * The value of YANG's int32.
- */
- private final int value;
-
- /**
- * Creates an object with the value initialized with value represented in
- * string.
- *
- * @param valueInString value of the object in string
- */
- public YangInt32(String valueInString) {
-
- if (valueInString.matches(MIN_KEYWORD)) {
- value = MIN_VALUE;
- } else if (valueInString.matches(MAX_KEYWORD)) {
- value = MAX_VALUE;
- } else {
- try {
- value = Integer.parseInt(valueInString);
- } catch (Exception e) {
- throw new DataTypeException("YANG file error : Input value \"" + valueInString + "\" is not a valid " +
- "int32.");
- }
- }
- }
-
- /**
- * Returns YANG's int32 value.
- *
- * @return value of YANG's int32
- */
- public int getValue() {
- return value;
- }
-
- @Override
- public int compareTo(YangInt32 anotherYangInt32) {
- return Integer.compare(value, anotherYangInt32.value);
- }
-
- @Override
- public YangDataTypes getYangType() {
- return YangDataTypes.INT32;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangInt64.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangInt64.java
deleted file mode 100644
index 26e9237..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangInt64.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * 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.utils.builtindatatype;
-
-import java.io.Serializable;
-
-/**
- * Handles the YANG's int8 data type processing.
- *
- * int8 represents integer values between -9223372036854775808 and 9223372036854775807, inclusively.
- */
-public class YangInt64 implements YangBuiltInDataTypeInfo<YangInt64>, Serializable {
-
- private static final long serialVersionUID = 8006201665L;
-
- /**
- * YANG's min keyword.
- */
- private static final String MIN_KEYWORD = "min";
-
- /**
- * YANG's max keyword.
- */
- private static final String MAX_KEYWORD = "max";
-
- /**
- * Valid minimum value of YANG's int64.
- */
- public static final Long MIN_VALUE = 0x8000000000000000L;
-
- /**
- * Valid maximum value of YANG's int64.
- */
- public static final long MAX_VALUE = 0x7fffffffffffffffL;
-
- /**
- * The value of YANG's int64.
- */
- private final long value;
-
- /**
- * Creates an object with the value initialized with value represented in
- * string.
- *
- * @param valueInString value of the object in string
- */
- public YangInt64(String valueInString) {
-
- if (valueInString.matches(MIN_KEYWORD)) {
- value = MIN_VALUE;
- } else if (valueInString.matches(MAX_KEYWORD)) {
- value = MAX_VALUE;
- } else {
- try {
- value = Long.parseLong(valueInString);
- } catch (Exception e) {
- throw new DataTypeException("YANG file error : Input value \"" + valueInString + "\" is not a valid " +
- "int64.");
- }
- }
- }
-
- /**
- * Returns YANG's int64 value.
- *
- * @return value of YANG's int64
- */
- public long getValue() {
- return value;
- }
-
- @Override
- public int compareTo(YangInt64 anotherYangInt64) {
- return Long.compare(value, anotherYangInt64.value);
- }
-
- @Override
- public YangDataTypes getYangType() {
- return YangDataTypes.INT64;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangInt8.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangInt8.java
deleted file mode 100644
index 455e343..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangInt8.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * 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.utils.builtindatatype;
-
-import java.io.Serializable;
-
-/**
- * Handles the YANG's int8 data type processing.
- *
- * int8 represents integer values between -128 and 127, inclusively.
- */
-public class YangInt8 implements YangBuiltInDataTypeInfo<YangInt8>, Serializable {
-
- private static final long serialVersionUID = 8006201664L;
-
- /**
- * YANG's min keyword.
- */
- private static final String MIN_KEYWORD = "min";
-
- /**
- * YANG's max keyword.
- */
- private static final String MAX_KEYWORD = "max";
-
- /**
- * Valid minimum value of YANG's int8.
- */
- public static final byte MIN_VALUE = -128;
-
- /**
- * Valid maximum value of YANG's int8.
- */
- public static final byte MAX_VALUE = 127;
-
- /**
- * The value of YANG's int8.
- */
- private final byte value;
-
- /**
- * Creates an object with the value initialized with value represented in
- * string.
- *
- * @param valueInString value of the object in string
- */
- public YangInt8(String valueInString) {
-
- if (valueInString.matches(MIN_KEYWORD)) {
- value = MIN_VALUE;
- } else if (valueInString.matches(MAX_KEYWORD)) {
- value = MAX_VALUE;
- } else {
- try {
- value = Byte.parseByte(valueInString);
- } catch (Exception e) {
- throw new DataTypeException("YANG file error : Input value \"" + valueInString + "\" is not a valid " +
- "int8.");
- }
- }
- }
-
- /**
- * Returns YANG's int8 value.
- *
- * @return value of YANG's int8
- */
- public byte getValue() {
- return value;
- }
-
- @Override
- public int compareTo(YangInt8 anotherYangInt8) {
- return Byte.compare(value, anotherYangInt8.value);
- }
-
- @Override
- public YangDataTypes getYangType() {
- return YangDataTypes.INT8;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangUint16.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangUint16.java
deleted file mode 100644
index 310f9d6..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangUint16.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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.utils.builtindatatype;
-
-import java.io.Serializable;
-
-/**
- * Handles the YANG's Uint16 data type processing.
- *
- * Uint16 represents integer values between 0 and 65535, inclusively.
- */
-public class YangUint16 implements YangBuiltInDataTypeInfo<YangUint16>, Serializable {
-
- private static final long serialVersionUID = 8006201663L;
-
- /**
- * YANG's min keyword.
- */
- private static final String MIN_KEYWORD = "min";
-
- /**
- * YANG's max keyword.
- */
- private static final String MAX_KEYWORD = "max";
-
- /**
- * Valid minimum value of YANG's Uint16.
- */
- public static final int MIN_VALUE = 0;
-
- /**
- * Valid maximum value of YANG's Uint16.
- */
- public static final int MAX_VALUE = 65535;
-
- /**
- * Value of the object.
- */
- private int value;
-
- /**
- * Creates an object with the value initialized with value represented in
- * string.
- *
- * @param valueInString value of the object in string
- */
- public YangUint16(String valueInString) {
-
- if (valueInString.matches(MIN_KEYWORD)) {
- value = MIN_VALUE;
- } else if (valueInString.matches(MAX_KEYWORD)) {
- value = MAX_VALUE;
- } else {
- try {
- value = Integer.parseInt(valueInString);
- } catch (Exception e) {
- throw new DataTypeException("YANG file error : Input value \"" + valueInString + "\" is not a valid " +
- "uint16.");
- }
- }
-
- if (value < MIN_VALUE) {
- throw new DataTypeException("YANG file error : " + valueInString + " is lesser than minimum value "
- + MIN_VALUE + ".");
- } else if (value > MAX_VALUE) {
- throw new DataTypeException("YANG file error : " + valueInString + " is greater than maximum value "
- + MAX_VALUE + ".");
- }
- }
-
- /**
- * Returns YANG's uint16 value.
- *
- * @return value of YANG's uint16
- */
- public int getValue() {
- return value;
- }
-
- @Override
- public int compareTo(YangUint16 another) {
- return Integer.compare(value, another.value);
- }
-
- @Override
- public YangDataTypes getYangType() {
- return YangDataTypes.UINT16;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangUint32.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangUint32.java
deleted file mode 100644
index 287d284..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangUint32.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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.utils.builtindatatype;
-
-import java.io.Serializable;
-
-/**
- * Handles the YANG's Uint32 data type processing.
- *
- * Uint32 represents integer values between 0 and 4294967295, inclusively.
- */
-public class YangUint32 implements YangBuiltInDataTypeInfo<YangUint32>, Serializable {
-
- private static final long serialVersionUID = 8006201662L;
-
- private static final String MIN_KEYWORD = "min";
- private static final String MAX_KEYWORD = "max";
-
- /**
- * Valid minimum value of YANG's Uint32.
- */
- public static final long MIN_VALUE = 0;
-
- /**
- * Valid maximum value of YANG's Uint32.
- */
- public static final long MAX_VALUE = 4294967295L;
-
- /**
- * Value of the object.
- */
- private long value;
-
- /**
- * Creates an object with the value initialized with value represented in
- * string.
- *
- * @param valueInString value of the object in string
- */
- public YangUint32(String valueInString) {
-
- if (valueInString.matches(MIN_KEYWORD)) {
- value = MIN_VALUE;
- } else if (valueInString.matches(MAX_KEYWORD)) {
- value = MAX_VALUE;
- } else {
- try {
- value = Long.parseLong(valueInString);
- } catch (Exception e) {
- throw new DataTypeException("YANG file error : Input value \"" + valueInString + "\" is not a valid " +
- "uint32.");
- }
- }
-
- if (value < MIN_VALUE) {
- throw new DataTypeException("YANG file error : " + valueInString + " is lesser than minimum value "
- + MIN_VALUE + ".");
- } else if (value > MAX_VALUE) {
- throw new DataTypeException("YANG file error : " + valueInString + " is greater than maximum value "
- + MAX_VALUE + ".");
- }
- }
-
- /**
- * Returns YANG's uint32 value.
- *
- * @return value of YANG's uint32
- */
- public long getValue() {
- return value;
- }
-
- @Override
- public int compareTo(YangUint32 another) {
- return Long.compare(value, another.value);
- }
-
- @Override
- public YangDataTypes getYangType() {
- return YangDataTypes.UINT32;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangUint64.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangUint64.java
deleted file mode 100644
index 16576c9..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangUint64.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * 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.utils.builtindatatype;
-
-import java.io.Serializable;
-import java.math.BigInteger;
-
-/**
- * Handles the YANG's Uint16 data type processing.
- *
- * Uint64 represents integer values between 0 and 18446744073709551615, inclusively.
- */
-public class YangUint64 implements YangBuiltInDataTypeInfo<YangUint64>, Serializable {
-
- private static final long serialVersionUID = 8006201661L;
-
- /**
- * YANG's min keyword.
- */
- private static final String MIN_KEYWORD = "min";
-
- /**
- * YANG's max keyword.
- */
- private static final String MAX_KEYWORD = "max";
-
- /**
- * Valid minimum value of YANG's Uint64.
- */
- public static final BigInteger MIN_VALUE = BigInteger.valueOf(0);
-
- /**
- * Valid maximum value of YANG's Uint64.
- */
- public static final BigInteger MAX_VALUE = new BigInteger("18446744073709551615");
-
- /**
- * Value of the object.
- */
- private BigInteger value;
-
- /**
- * Creates an object with the value initialized with value represented in
- * string.
- *
- * @param valueInString value of the object in string
- */
- public YangUint64(String valueInString) {
-
- if (valueInString.matches(MIN_KEYWORD)) {
- value = MIN_VALUE;
- } else if (valueInString.matches(MAX_KEYWORD)) {
- value = MAX_VALUE;
- } else {
- try {
- value = new BigInteger(valueInString);
- } catch (Exception e) {
- throw new DataTypeException("YANG file error : Input value \"" + valueInString + "\" is not a valid " +
- "uint64.");
- }
- }
-
- if (value.compareTo(MIN_VALUE) < 0) {
- throw new DataTypeException("YANG file error : " + valueInString + " is lesser than minimum value "
- + MIN_VALUE + ".");
- } else if (value.compareTo(MAX_VALUE) > 0) {
- throw new DataTypeException("YANG file error : " + valueInString + " is greater than maximum value "
- + MAX_VALUE + ".");
- }
- }
-
- /**
- * Returns YANG's uint64 value.
- *
- * @return value of YANG's uint64
- */
- public BigInteger getValue() {
- return value;
- }
-
- @Override
- public int compareTo(YangUint64 another) {
- return value.compareTo(another.value);
- }
-
- @Override
- public YangDataTypes getYangType() {
- return YangDataTypes.UINT64;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangUint8.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangUint8.java
deleted file mode 100644
index f2f4604..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangUint8.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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.utils.builtindatatype;
-
-import java.io.Serializable;
-
-/**
- * Handles the YANG's Uint8 data type processing.
- *
- * Uint8 represents integer values between 0 and 255, inclusively.
- */
-public class YangUint8 implements YangBuiltInDataTypeInfo<YangUint8>, Serializable {
-
- private static final long serialVersionUID = 8006201660L;
-
- /**
- * YANG's min keyword.
- */
- private static final String MIN_KEYWORD = "min";
-
- /**
- * YANG's max keyword.
- */
- private static final String MAX_KEYWORD = "max";
-
- /**
- * Valid minimum value of YANG's Uint8.
- */
- public static final short MIN_VALUE = 0;
-
- /**
- * Valid maximum value of YANG's Uint8.
- */
- public static final short MAX_VALUE = 255;
-
- /**
- * Value of the object.
- */
- private short value;
-
- /**
- * Creates an object with the value initialized with value represented in
- * string.
- *
- * @param valueInString value of the object in string
- */
- public YangUint8(String valueInString) {
-
- if (valueInString.matches(MIN_KEYWORD)) {
- value = MIN_VALUE;
- } else if (valueInString.matches(MAX_KEYWORD)) {
- value = MAX_VALUE;
- } else {
- try {
- value = Short.parseShort(valueInString);
- } catch (Exception e) {
- throw new DataTypeException("YANG file error : Input value \"" + valueInString + "\" is not a valid " +
- "uint8.");
- }
- }
-
- if (value < MIN_VALUE) {
- throw new DataTypeException("YANG file error : " + valueInString + " is lesser than minimum value "
- + MIN_VALUE + ".");
- } else if (value > MAX_VALUE) {
- throw new DataTypeException("YANG file error : " + valueInString + " is greater than maximum value "
- + MAX_VALUE + ".");
- }
- }
-
- /**
- * Returns YANG's uint8 value.
- *
- * @return value of YANG's uint8
- */
- public short getValue() {
- return value;
- }
-
- @Override
- public int compareTo(YangUint8 another) {
- return Short.compare(value, another.value);
- }
-
- @Override
- public YangDataTypes getYangType() {
- return YangDataTypes.UINT8;
- }
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/package-info.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/package-info.java
deleted file mode 100644
index d1ceae5..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*-
- * Copyright 2016 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.
- */
-
-/**
- * Utilities for YANG built in data types.
- */
-package org.onosproject.yangutils.datamodel.utils.builtindatatype;
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/package-info.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/package-info.java
deleted file mode 100644
index 5d2a683..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Utilities for checking data model tree collisions.
- */
-package org.onosproject.yangutils.datamodel.utils;
\ No newline at end of file
diff --git a/utils/yangutils/plugin/pom.xml b/utils/yangutils/plugin/pom.xml
deleted file mode 100644
index 41cabfa..0000000
--- a/utils/yangutils/plugin/pom.xml
+++ /dev/null
@@ -1,238 +0,0 @@
-<!--
- ~ 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.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-yangutils</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>yangutils-maven-plugin</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <name>onos-yang-utils-plugin</name>
- <packaging>maven-plugin</packaging>
-
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>yangutils-datamodel</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-core</artifactId>
- <version>3.3.9</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-plugin-api</artifactId>
- <version>3.3.9</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-annotations</artifactId>
- <version>3.4</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-scr-plugin</artifactId>
- <version>1.21.0</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-artifact</artifactId>
- <version>3.3.9</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-project</artifactId>
- <version>3.0-alpha-2</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-model</artifactId>
- <version>3.3.9</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.12</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.sonatype.plexus</groupId>
- <artifactId>plexus-build-api</artifactId>
- <version>0.0.7</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>2.4</version>
- </dependency>
-
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-all</artifactId>
- <version>1.3</version>
- </dependency>
-
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onlab-junit</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.antlr</groupId>
- <artifactId>antlr4-runtime</artifactId>
- <version>4.5.3</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>1.10</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.antlr</groupId>
- <artifactId>antlr4-maven-plugin</artifactId>
- <version>4.5</version>
- <executions>
- <execution>
- <phase>generate-sources</phase>
- <goals>
- <goal>antlr4</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <sourceDirectory>src/main/resources</sourceDirectory>
- <outputDirectory>target/generated-sources/org/onosproject/yangutils/parser/antlrgencode
- </outputDirectory>
- <visitor>false</visitor>
- <listener>true</listener>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-clean-plugin</artifactId>
- <version>3.0.0</version>
- <executions>
- <execution>
- <id>Deleting auto-generated listener interfaces</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>clean</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <excludeDefaultDirectories>true</excludeDefaultDirectories>
- <filesets>
- <fileset>
- <directory>target</directory>
- <followSymlinks>false</followSymlinks>
- <useDefaultExcludes>true</useDefaultExcludes>
- <excludes>
- <exclude>
- **/generated-sources/org/onosproject/yangutils/parser/antlrgencode/GeneratedYangLexer.java
- </exclude>
- <exclude>
- **/generated-sources/org/onosproject/yangutils/parser/antlrgencode/GeneratedYang.tokens
- </exclude>
- <exclude>
- **/generated-sources/org/onosproject/yangutils/parser/antlrgencode/GeneratedYangParser.java
- </exclude>
- <exclude>
- **/generated-sources/org/onosproject/yangutils/parser/antlrgencode/GeneratedYangLexer.tokens
- </exclude>
- <exclude>
- **/generated-sources/org/onosproject/yangutils/parser/antlrgencode/YangLexer.java
- </exclude>
- <exclude>
- **/generated-sources/org/onosproject/yangutils/parser/antlrgencode/YangLexer.tokens
- </exclude>
- </excludes>
- </fileset>
- </filesets>
- <verbose>false</verbose>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>1.10</version>
- <executions>
- <execution>
- <id>add-source</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>target/generated-sources/org/onosproject/yangutils/parser/antlrgencode</source>
- <sourceDirectory>
- target/generated-sources/org/onosproject/yangutils/parser/antlrgencode
- </sourceDirectory>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Export-Package>
- org.onosproject.yangutils.parser.*
- </Export-Package>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-plugin-plugin</artifactId>
- <version>3.4</version>
- <configuration>
- <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
- </configuration>
- <executions>
- <execution>
- <phase>generate-sources</phase>
- <goals>
- <goal>descriptor</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/YangLinker.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/YangLinker.java
deleted file mode 100644
index 5f029f2..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/YangLinker.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.linker;
-
-import java.util.Set;
-import org.onosproject.yangutils.datamodel.YangNode;
-
-/**
- * Abstraction of entity which provides linking service of YANG files.
- */
-public interface YangLinker {
-
- /**
- * Resolve the import and include dependencies for a given resolution
- * information.
- *
- * @param yangNodeSet set of all dependent YANG nodes
- */
- void resolveDependencies(Set<YangNode> yangNodeSet);
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/YangLinkingPhase.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/YangLinkingPhase.java
deleted file mode 100644
index 23020df..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/YangLinkingPhase.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.linker;
-
-/**
- * Represents the phase of YANG file reference linking.
- */
-public enum YangLinkingPhase {
-
- /**
- * Linking the reference within the files.
- */
- INTRA_FILE,
-
- /**
- * Linking the reference across the files.
- */
- INTER_FILE
-
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/exceptions/LinkerException.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/exceptions/LinkerException.java
deleted file mode 100644
index 755b5b4..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/exceptions/LinkerException.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * 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.linker.exceptions;
-
-/**
- * Represents base class for exceptions in linker operations.
- */
-public class LinkerException extends RuntimeException {
-
- private static final long serialVersionUID = 20160211L;
- private int lineNumber;
- private int charPositionInLine;
- private String fileName;
-
- /**
- * Creates a new linker exception.
- */
- public LinkerException() {
- super();
- }
-
- /**
- * Creates a new linker exception with given message.
- *
- * @param message the detail of exception in string
- */
- public LinkerException(String message) {
- super(message);
- }
-
- /**
- * Creates a new linker exception from given message and cause.
- *
- * @param message the detail of exception in string
- * @param cause underlying cause of the error
- */
- public LinkerException(final String message, final Throwable cause) {
- super(message, cause);
- }
-
- /**
- * Creates a new linker exception from cause.
- *
- * @param cause underlying cause of the error
- */
- public LinkerException(final Throwable cause) {
- super(cause);
- }
-
- /**
- * Returns line number of the exception.
- *
- * @return line number of the exception
- */
- public int getLineNumber() {
- return this.lineNumber;
- }
-
- /**
- * Returns YANG file name of the exception.
- *
- * @return YANG file name of the exception
- */
- public String getFileName() {
- return this.fileName;
- }
-
- /**
- * Returns position of the exception.
- *
- * @return position of the exception
- */
- public int getCharPositionInLine() {
- return this.charPositionInLine;
- }
-
- /**
- * Sets line number of YANG file.
- *
- * @param line line number of YANG file
- */
- public void setLine(int line) {
- this.lineNumber = line;
- }
-
- /**
- * Sets position of exception.
- *
- * @param charPosition position of exception
- */
- public void setCharPosition(int charPosition) {
- this.charPositionInLine = charPosition;
- }
-
- /**
- * Sets file name in parser exception.
- *
- * @param fileName YANG file name
- */
- public void setFileName(String fileName) {
- this.fileName = fileName;
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/exceptions/package-info.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/exceptions/package-info.java
deleted file mode 100644
index 42cf3a2..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/exceptions/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Custom linker exceptions.
- */
-package org.onosproject.yangutils.linker.exceptions;
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/impl/PrefixResolverType.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/impl/PrefixResolverType.java
deleted file mode 100644
index 469f8cb..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/impl/PrefixResolverType.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.linker.impl;
-
-/**
- * Enum for prefix resolver type when augment has come in path.
- */
-enum PrefixResolverType {
-
- /**
- * When prefix changes from inter file to intra file.
- */
- INTER_TO_INTRA,
-
- /**
- * When prefix changes from intra file to inter file.
- */
- INTRA_TO_INTER,
-
- /**
- * When prefix changes from one inter file to other inter file.
- */
- INTER_TO_INTER,
-
- /**
- * When no prefix change occurs.
- */
- NO_PREFIX_CHANGE_FOR_INTRA,
-
- /**
- * When no prefix change occurs.
- */
- NO_PREFIX_CHANGE_FOR_INTER
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/impl/YangLinkerManager.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/impl/YangLinkerManager.java
deleted file mode 100644
index 754801b..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/impl/YangLinkerManager.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * 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.linker.impl;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-import org.onosproject.yangutils.datamodel.ResolvableType;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangReferenceResolver;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.linker.YangLinker;
-import org.onosproject.yangutils.linker.exceptions.LinkerException;
-
-import static org.onosproject.yangutils.linker.impl.YangLinkerUtils.updateFilePriority;
-import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE;
-
-/**
- * Representation of entity which provides linking service of YANG files.
- */
-public class YangLinkerManager
- implements YangLinker {
-
- /*
- * Set of all the YANG nodes, corresponding to the YANG files parsed by
- * parser.
- */
- Set<YangNode> yangNodeSet = new HashSet<>();
-
- /**
- * Returns set of YANG node.
- *
- * @return set of YANG node
- */
- public Set<YangNode> getYangNodeSet() {
- return yangNodeSet;
- }
-
- /**
- * Creates YANG nodes set.
- *
- * @param yangNodeSet YANG node information set
- */
- public void createYangNodeSet(Set<YangNode> yangNodeSet) {
- getYangNodeSet().addAll(yangNodeSet);
- }
-
- @Override
- public void resolveDependencies(Set<YangNode> yangNodeSet) {
-
- // Create YANG node set.
- createYangNodeSet(yangNodeSet);
-
- // Carry out linking of sub module with module.
- linkSubModulesToParentModule(yangNodeSet);
-
- // Add references to import list.
- addRefToYangFilesImportList(yangNodeSet);
-
- // Add reference to include list.
- addRefToYangFilesIncludeList(yangNodeSet);
-
- // Update the priority for all the files.
- updateFilePriority(yangNodeSet);
-
- // TODO check for circular import/include.
-
- // Carry out inter-file linking.
- processInterFileLinking(yangNodeSet);
- }
-
- /**
- * Resolves sub-module linking by linking sub module with parent module.
- *
- * @param yangNodeSet set of YANG files info
- * @throws LinkerException fails to link sub-module to parent module
- */
- public void linkSubModulesToParentModule(Set<YangNode> yangNodeSet)
- throws LinkerException {
- for (YangNode yangNode : yangNodeSet) {
- if (yangNode instanceof YangSubModule) {
- try {
- ((YangSubModule) yangNode).linkWithModule(getYangNodeSet());
- } catch (DataModelException e) {
- String errorInfo = "YANG file error: " + yangNode.getName() + " at line: "
- + e.getLineNumber() + " at position: " + e.getCharPositionInLine() + NEW_LINE
- + e.getMessage();
- throw new LinkerException(errorInfo);
- // TODO add file path in exception message in util manager.
- }
- }
- }
- }
-
- /**
- * Adds imported node information to the import list.
- *
- * @param yangNodeSet set of YANG files info
- * @throws LinkerException fails to find imported module
- */
- public void addRefToYangFilesImportList(Set<YangNode> yangNodeSet) throws LinkerException {
- for (YangNode yangNode : yangNodeSet) {
- if (yangNode instanceof YangReferenceResolver) {
- try {
- ((YangReferenceResolver) yangNode).addReferencesToImportList(getYangNodeSet());
- } catch (DataModelException e) {
- String errorInfo = "Error in file: " + yangNode.getName() + " at line: "
- + e.getLineNumber() + " at position: " + e.getCharPositionInLine() + NEW_LINE
- + e.getMessage();
- throw new LinkerException(errorInfo);
- // TODO add file path in exception message in util manager.
- }
- }
- }
- }
-
- /**
- * Adds included node information to the include list.
- *
- * @param yangNodeSet set of YANG files info
- * @throws LinkerException fails to find included sub-module
- */
- public void addRefToYangFilesIncludeList(Set<YangNode> yangNodeSet) throws LinkerException {
- for (YangNode yangNode : yangNodeSet) {
- if (yangNode instanceof YangReferenceResolver) {
- try {
- ((YangReferenceResolver) yangNode).addReferencesToIncludeList(getYangNodeSet());
- } catch (DataModelException e) {
- String errorInfo = "Error in file: " + yangNode.getName() + " at line: "
- + e.getLineNumber() + " at position: " + e.getCharPositionInLine() + NEW_LINE
- + e.getMessage();
- throw new LinkerException(errorInfo);
- // TODO add file path in exception message in util manager.
- }
- }
- }
- }
-
- /**
- * Processes inter file linking for type and uses.
- *
- * @param yangNodeSet set of YANG files info
- * @throws LinkerException a violation in linker execution
- */
- public void processInterFileLinking(Set<YangNode> yangNodeSet)
- throws LinkerException {
- List<YangNode> yangNodeSortedList = new LinkedList<>();
- yangNodeSortedList.addAll(yangNodeSet);
- Collections.sort(yangNodeSortedList);
- for (YangNode yangNode : yangNodeSortedList) {
- try {
- ((YangReferenceResolver) yangNode)
- .resolveInterFileLinking(ResolvableType.YANG_IF_FEATURE);
- ((YangReferenceResolver) yangNode)
- .resolveInterFileLinking(ResolvableType.YANG_USES);
- ((YangReferenceResolver) yangNode)
- .resolveInterFileLinking(ResolvableType.YANG_AUGMENT);
- ((YangReferenceResolver) yangNode)
- .resolveInterFileLinking(ResolvableType.YANG_DERIVED_DATA_TYPE);
- ((YangReferenceResolver) yangNode)
- .resolveInterFileLinking(ResolvableType.YANG_BASE);
- ((YangReferenceResolver) yangNode)
- .resolveInterFileLinking(ResolvableType.YANG_IDENTITYREF);
- ((YangReferenceResolver) yangNode)
- .resolveInterFileLinking(ResolvableType.YANG_LEAFREF);
- } catch (DataModelException e) {
- String errorInfo = "Error in file: " + yangNode.getName() + " at line: "
- + e.getLineNumber() + " at position: " + e.getCharPositionInLine() + NEW_LINE + e.getMessage();
- throw new LinkerException(errorInfo);
- // TODO add file path in exception message in util manager.
- }
- }
- }
-
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/impl/YangLinkerUtils.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/impl/YangLinkerUtils.java
deleted file mode 100644
index c9fedd8..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/impl/YangLinkerUtils.java
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- * 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.linker.impl;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.regex.Pattern;
-
-import org.onosproject.yangutils.datamodel.YangAtomicPath;
-import org.onosproject.yangutils.datamodel.YangAugment;
-import org.onosproject.yangutils.datamodel.YangAugmentableNode;
-import org.onosproject.yangutils.datamodel.YangAugmentedInfo;
-import org.onosproject.yangutils.datamodel.YangCase;
-import org.onosproject.yangutils.datamodel.YangChoice;
-import org.onosproject.yangutils.datamodel.YangImport;
-import org.onosproject.yangutils.datamodel.YangInclude;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangLeafList;
-import org.onosproject.yangutils.datamodel.YangLeafRef;
-import org.onosproject.yangutils.datamodel.YangLeavesHolder;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeIdentifier;
-import org.onosproject.yangutils.datamodel.YangReferenceResolver;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-import org.onosproject.yangutils.linker.exceptions.LinkerException;
-
-import static org.onosproject.yangutils.utils.UtilConstants.COLON;
-import static org.onosproject.yangutils.utils.UtilConstants.EMPTY_STRING;
-
-/**
- * Represent utilities for YANG linker.
- */
-public final class YangLinkerUtils {
-
- private static final int IDENTIFIER_LENGTH = 64;
- private static final Pattern IDENTIFIER_PATTERN = Pattern.compile("[a-zA-Z_][a-zA-Z0-9_.-]*");
- private static final String XML = "xml";
-
- private YangLinkerUtils() {
- }
-
- /**
- * Detects collision between target nodes leaf/leaf-list or child node with augmented leaf/leaf-list or child node.
- *
- * @param targetNode target node
- * @param augment augment node
- */
- private static void detectCollision(YangNode targetNode, YangAugment augment) {
- YangNode targetNodesChild = targetNode.getChild();
- YangNode augmentsChild = augment.getChild();
- YangNode parent = targetNode;
- if (targetNode instanceof YangAugment) {
- parent = targetNode.getParent();
- } else {
- while (parent.getParent() != null) {
- parent = parent.getParent();
- }
- }
- if (targetNode instanceof YangChoice) {
- //Do nothing
- } else {
- detectCollisionInLeaveHolders(targetNode, augment);
- while (augmentsChild != null) {
- detectCollisionInChildNodes(targetNodesChild, augmentsChild, targetNode.getName(), parent.getName());
- augmentsChild = augmentsChild.getNextSibling();
- }
- }
- }
-
- /*Detects collision between leaves/leaf-lists*/
- private static void detectCollisionInLeaveHolders(YangNode targetNode, YangAugment augment) {
- YangLeavesHolder targetNodesLeavesHolder = (YangLeavesHolder) targetNode;
- YangNode parent = targetNode;
- if (targetNode instanceof YangAugment) {
- parent = targetNode.getParent();
- } else {
- while (parent.getParent() != null) {
- parent = parent.getParent();
- }
- }
- if (augment.getListOfLeaf() != null && augment.getListOfLeaf().size() != 0
- && targetNodesLeavesHolder.getListOfLeaf() != null) {
- for (YangLeaf leaf : augment.getListOfLeaf()) {
- for (YangLeaf targetLeaf : targetNodesLeavesHolder.getListOfLeaf()) {
- if (targetLeaf.getName().equals(leaf.getName())) {
- throw new LinkerException("target node " + targetNode.getName()
- + " contains augmented leaf " + leaf.getName() + " in module "
- + parent.getName());
- }
- }
- }
- } else if (augment.getListOfLeafList() != null
- && augment.getListOfLeafList().size() != 0
- && augment.getListOfLeafList() != null) {
- for (YangLeafList leafList : augment.getListOfLeafList()) {
- for (YangLeafList targetLeafList : targetNodesLeavesHolder.getListOfLeafList()) {
- if (targetLeafList.getName().equals(leafList.getName())) {
- throw new LinkerException("target node " + targetNode.getName()
- + " contains augmented leaf-list" + leafList.getName() + " in module "
- + parent.getName());
- }
- }
- }
- }
- }
-
- /*Detects collision for child nodes.*/
- private static void detectCollisionInChildNodes(YangNode targetNodesChild, YangNode augmentsChild, String
- targetName, String parentName) {
- while (augmentsChild != null) {
- while (targetNodesChild != null) {
- if (targetNodesChild.getName().equals(augmentsChild.getName())) {
- throw new LinkerException("target node " + targetName
- + " contains augmented child node" + augmentsChild.getName() + " in module "
- + parentName);
- }
- targetNodesChild = targetNodesChild.getNextSibling();
- }
- augmentsChild = augmentsChild.getNextSibling();
- }
- }
-
- /**
- * Detects collision between target nodes and its all leaf/leaf-list or child node with augmented leaf/leaf-list or
- * child node.
- *
- * @param targetNode target node
- * @param augment augment node
- */
- static void detectCollisionForAugmentedNode(YangNode targetNode, YangAugment augment) {
- // Detect collision for target node and augment node.
- detectCollision(targetNode, augment);
- List<YangAugmentedInfo> yangAugmentedInfo = ((YangAugmentableNode) targetNode).getAugmentedInfoList();
- // Detect collision for target augment node and current augment node.
- for (YangAugmentedInfo info : yangAugmentedInfo) {
- detectCollision((YangAugment) info, augment);
- }
- }
-
- /**
- * Returns list of path names that are needed from augment.
- *
- * @param augment instance of YANG augment
- * @param remainingAncestors ancestor count to move in augment path
- * @return list of path names needed in leafref
- */
- static List<String> getPathWithAugment(YangAugment augment, int remainingAncestors) {
- List<String> listOfPathName = new ArrayList<>();
- for (YangAtomicPath atomicPath : augment.getTargetNode()) {
- if (atomicPath.getNodeIdentifier().getPrefix() != null && !atomicPath.getNodeIdentifier().getPrefix()
- .equals(EMPTY_STRING)) {
- listOfPathName.add(atomicPath.getNodeIdentifier().getPrefix() + ":" +
- atomicPath.getNodeIdentifier().getName());
- } else {
- listOfPathName.add(atomicPath.getNodeIdentifier().getName());
- }
- }
-
-
- for (int countOfAncestor = 0; countOfAncestor < remainingAncestors; countOfAncestor++) {
- listOfPathName.remove(listOfPathName.size() - 1);
- }
- return listOfPathName;
- }
-
- /**
- * Skips the invalid nodes which cannot have data from YANG.
- *
- * @param currentParent current parent node reference
- * @param leafref instance of YANG leafref
- * @return parent node which can hold data
- * @throws LinkerException a violation of linker rules
- */
- static YangNode skipInvalidDataNodes(YangNode currentParent, YangLeafRef leafref) throws LinkerException {
- while (currentParent instanceof YangChoice || currentParent instanceof YangCase) {
- if (currentParent.getParent() == null) {
- throw new LinkerException("YANG file error: The target node, in the leafref path " +
- leafref.getPath() + ", is invalid.");
- }
- currentParent = currentParent.getParent();
- }
- return currentParent;
- }
-
- /**
- * Checks and return valid node identifier.
- *
- * @param nodeIdentifierString string from yang file
- * @param yangConstruct yang construct for creating error message
- * @return valid node identifier
- */
- static YangNodeIdentifier getValidNodeIdentifier(String nodeIdentifierString,
- YangConstructType yangConstruct) {
- String[] tmpData = nodeIdentifierString.split(Pattern.quote(COLON));
- if (tmpData.length == 1) {
- YangNodeIdentifier nodeIdentifier = new YangNodeIdentifier();
- nodeIdentifier.setName(getValidIdentifier(tmpData[0], yangConstruct));
- return nodeIdentifier;
- } else if (tmpData.length == 2) {
- YangNodeIdentifier nodeIdentifier = new YangNodeIdentifier();
- nodeIdentifier.setPrefix(getValidIdentifier(tmpData[0], yangConstruct));
- nodeIdentifier.setName(getValidIdentifier(tmpData[1], yangConstruct));
- return nodeIdentifier;
- } else {
- throw new LinkerException("YANG file error : " +
- YangConstructType.getYangConstructType(yangConstruct) + " name " + nodeIdentifierString +
- " is not valid.");
- }
- }
-
- /**
- * Validates identifier and returns concatenated string if string contains plus symbol.
- *
- * @param identifier string from yang file
- * @param yangConstruct yang construct for creating error message=
- * @return concatenated string after removing double quotes
- */
- public static String getValidIdentifier(String identifier, YangConstructType yangConstruct) {
-
- if (identifier.length() > IDENTIFIER_LENGTH) {
- throw new LinkerException("YANG file error : " +
- YangConstructType.getYangConstructType(yangConstruct) + " name " + identifier + " is " +
- "greater than 64 characters.");
- } else if (!IDENTIFIER_PATTERN.matcher(identifier).matches()) {
- throw new LinkerException("YANG file error : " +
- YangConstructType.getYangConstructType(yangConstruct) + " name " + identifier + " is not " +
- "valid.");
- } else if (identifier.toLowerCase().startsWith(XML)) {
- throw new LinkerException("YANG file error : " +
- YangConstructType.getYangConstructType(yangConstruct) + " identifier " + identifier +
- " must not start with (('X'|'x') ('M'|'m') ('L'|'l')).");
- } else {
- return identifier;
- }
- }
-
- /**
- * Updates the priority for all the input files.
- *
- * @param yangNodeSet set of YANG files info
- */
- public static void updateFilePriority(Set<YangNode> yangNodeSet) {
- for (YangNode yangNode : yangNodeSet) {
- updateFilePriorityOfNode(yangNode);
- }
- }
-
- /**
- * Updates priority of the node.
- *
- * @param yangNode YANG node information
- */
- private static void updateFilePriorityOfNode(YangNode yangNode) {
- int curNodePriority = yangNode.getPriority();
- if (yangNode instanceof YangReferenceResolver) {
- List<YangImport> yangImportList = ((YangReferenceResolver) yangNode).getImportList();
- Iterator<YangImport> importInfoIterator = yangImportList.iterator();
- // Run through the imported list to update priority.
- while (importInfoIterator.hasNext()) {
- YangImport yangImport = importInfoIterator.next();
- YangNode importedNode = yangImport.getImportedNode();
- if (curNodePriority >= importedNode.getPriority()) {
- importedNode.setPriority(curNodePriority + 1);
- updateFilePriorityOfNode(importedNode);
- }
- }
-
- List<YangInclude> yangIncludeList = ((YangReferenceResolver) yangNode).getIncludeList();
- Iterator<YangInclude> includeInfoIterator = yangIncludeList.iterator();
- // Run through the imported list to update priority.
- while (includeInfoIterator.hasNext()) {
- YangInclude yangInclude = includeInfoIterator.next();
- YangNode includedNode = yangInclude.getIncludedNode();
- if (curNodePriority >= includedNode.getPriority()) {
- includedNode.setPriority(curNodePriority + 1);
- updateFilePriorityOfNode(includedNode);
- }
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/impl/YangResolutionInfoImpl.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/impl/YangResolutionInfoImpl.java
deleted file mode 100644
index 0cd359b..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/impl/YangResolutionInfoImpl.java
+++ /dev/null
@@ -1,1789 +0,0 @@
-/*
- * 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.linker.impl;
-
-import java.io.Serializable;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Stack;
-
-import org.onosproject.yangutils.datamodel.Resolvable;
-import org.onosproject.yangutils.datamodel.ResolvableType;
-import org.onosproject.yangutils.datamodel.TraversalType;
-import org.onosproject.yangutils.datamodel.YangAtomicPath;
-import org.onosproject.yangutils.datamodel.YangAugment;
-import org.onosproject.yangutils.datamodel.YangAugmentableNode;
-import org.onosproject.yangutils.datamodel.YangBase;
-import org.onosproject.yangutils.datamodel.YangDerivedInfo;
-import org.onosproject.yangutils.datamodel.YangEntityToResolveInfo;
-import org.onosproject.yangutils.datamodel.YangEntityToResolveInfoImpl;
-import org.onosproject.yangutils.datamodel.YangFeature;
-import org.onosproject.yangutils.datamodel.YangFeatureHolder;
-import org.onosproject.yangutils.datamodel.YangGrouping;
-import org.onosproject.yangutils.datamodel.YangIdentity;
-import org.onosproject.yangutils.datamodel.YangIdentityRef;
-import org.onosproject.yangutils.datamodel.YangIfFeature;
-import org.onosproject.yangutils.datamodel.YangImport;
-import org.onosproject.yangutils.datamodel.YangInclude;
-import org.onosproject.yangutils.datamodel.YangInput;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangLeafList;
-import org.onosproject.yangutils.datamodel.YangLeafRef;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeIdentifier;
-import org.onosproject.yangutils.datamodel.YangOutput;
-import org.onosproject.yangutils.datamodel.YangPathArgType;
-import org.onosproject.yangutils.datamodel.YangReferenceResolver;
-import org.onosproject.yangutils.datamodel.YangRelativePath;
-import org.onosproject.yangutils.datamodel.YangResolutionInfo;
-import org.onosproject.yangutils.datamodel.YangRpc;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.datamodel.YangTypeDef;
-import org.onosproject.yangutils.datamodel.YangUses;
-import org.onosproject.yangutils.datamodel.YangXPathResolver;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.ResolvableStatus;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.linker.YangLinkingPhase;
-import org.onosproject.yangutils.linker.exceptions.LinkerException;
-
-import static org.onosproject.yangutils.datamodel.TraversalType.CHILD;
-import static org.onosproject.yangutils.datamodel.TraversalType.PARENT;
-import static org.onosproject.yangutils.datamodel.TraversalType.ROOT;
-import static org.onosproject.yangutils.datamodel.TraversalType.SIBILING;
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.addResolutionInfo;
-import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.INTER_FILE_LINKED;
-import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.INTRA_FILE_RESOLVED;
-import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.LINKED;
-import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.RESOLVED;
-import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.UNDEFINED;
-import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.UNRESOLVED;
-import static org.onosproject.yangutils.linker.YangLinkingPhase.INTER_FILE;
-import static org.onosproject.yangutils.linker.YangLinkingPhase.INTRA_FILE;
-import static org.onosproject.yangutils.linker.impl.YangLinkerUtils.detectCollisionForAugmentedNode;
-import static org.onosproject.yangutils.linker.impl.YangLinkerUtils.getPathWithAugment;
-import static org.onosproject.yangutils.linker.impl.YangLinkerUtils.getValidNodeIdentifier;
-import static org.onosproject.yangutils.linker.impl.YangLinkerUtils.skipInvalidDataNodes;
-import static org.onosproject.yangutils.utils.UtilConstants.BASE_LINKER_ERROR;
-import static org.onosproject.yangutils.utils.UtilConstants.EMPTY_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.FEATURE_LINKER_ERROR;
-import static org.onosproject.yangutils.utils.UtilConstants.GROUPING_LINKER_ERROR;
-import static org.onosproject.yangutils.utils.UtilConstants.IDENTITYREF;
-import static org.onosproject.yangutils.utils.UtilConstants.IDENTITYREF_LINKER_ERROR;
-import static org.onosproject.yangutils.utils.UtilConstants.INPUT;
-import static org.onosproject.yangutils.utils.UtilConstants.LEAFREF;
-import static org.onosproject.yangutils.utils.UtilConstants.LEAFREF_LINKER_ERROR;
-import static org.onosproject.yangutils.utils.UtilConstants.OUTPUT;
-import static org.onosproject.yangutils.utils.UtilConstants.SLASH_FOR_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.TYPEDEF_LINKER_ERROR;
-
-/**
- * Represents implementation of resolution object which will be resolved by
- * linker.
- *
- * @param <T> type of resolution entity uses / type
- */
-public class YangResolutionInfoImpl<T>
- implements YangResolutionInfo<T>, Serializable {
-
- private static final long serialVersionUID = 806201658L;
-
- /**
- * Information about the entity that needs to be resolved.
- */
- private YangEntityToResolveInfoImpl<T> entityToResolveInfo;
-
- /**
- * Error line number.
- */
- private transient int lineNumber;
-
- /**
- * Error character position in number.
- */
- private transient int charPosition;
-
- /**
- * Current module/sub-module reference, will be used in inter-file/
- * inter-jar scenario to get the import/include list.
- */
- private transient YangReferenceResolver curReferenceResolver;
-
- /**
- * Stack for type/uses is maintained for hierarchical references, this is
- * used during resolution.
- */
- private Stack<YangEntityToResolveInfoImpl<T>> partialResolvedStack;
-
- /**
- * It is private to ensure the overloaded method be invoked to create an
- * object.
- */
- @SuppressWarnings("unused")
- private YangResolutionInfoImpl() {
- }
-
- /**
- * 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 charPositionInLine error character position in line
- */
- public YangResolutionInfoImpl(T dataNode, YangNode holderNode, int lineNumber, int charPositionInLine) {
- setEntityToResolveInfo(new YangEntityToResolveInfoImpl<>());
- getEntityToResolveInfo().setEntityToResolve(dataNode);
- getEntityToResolveInfo().setHolderOfEntityToResolve(holderNode);
- this.setLineNumber(lineNumber);
- this.setCharPosition(charPositionInLine);
- setPartialResolvedStack(new Stack<>());
- }
-
- @Override
- public void resolveLinkingForResolutionInfo(YangReferenceResolver dataModelRootNode)
- throws DataModelException {
-
- setCurReferenceResolver(dataModelRootNode);
- /**
- * Current node to resolve, it can be a YANG type, YANG uses or YANG if-feature or
- * YANG leafref or YANG base or YANG identityref.
- */
- T entityToResolve = getEntityToResolveInfo().getEntityToResolve();
-
- // Check if linking is already done
- if (entityToResolve instanceof Resolvable) {
- Resolvable resolvable = (Resolvable) entityToResolve;
- if (resolvable.getResolvableStatus() == RESOLVED) {
- /**
- * entity is already resolved, so nothing to do
- */
- return;
- }
- } else {
- throw new DataModelException("Data Model Exception: Entity to resolved is other than " +
- "type/uses/if-feature/leafref/base/identityref");
- }
- // Push the initial entity to resolve in stack.
- addInPartialResolvedStack(getEntityToResolveInfo());
-
- linkAndResolvePartialResolvedStack();
-
- addDerivedRefTypeToRefTypeResolutionList();
- }
-
- /**
- * Resolves linking with ancestors.
- *
- * @throws DataModelException a violation of data model rules
- */
- private void linkAndResolvePartialResolvedStack()
- throws DataModelException {
-
- while (getPartialResolvedStack().size() != 0) {
- /**
- * Current node to resolve, it can be a YANG type or YANG uses or
- * YANG if-feature or YANG leafref or YANG base or YANG identityref.
- */
- T entityToResolve = getCurrentEntityToResolveFromStack();
- // Check if linking is already done
- if (entityToResolve instanceof Resolvable) {
-
- Resolvable resolvable = (Resolvable) entityToResolve;
- switch (resolvable.getResolvableStatus()) {
- case RESOLVED: {
- /*
- * If the entity is already resolved in the stack, then pop
- * it and continue with the remaining stack elements to
- * resolve
- */
- getPartialResolvedStack().pop();
- break;
- }
-
- case LINKED: {
- /*
- * If the top of the stack is already linked then resolve
- * the references and pop the entity and continue with
- * remaining stack elements to resolve.
- */
- resolveTopOfStack(INTRA_FILE);
- getPartialResolvedStack().pop();
- break;
- }
-
- case INTRA_FILE_RESOLVED: {
- /*
- * Pop the top of the stack.
- */
- getPartialResolvedStack().pop();
- break;
- }
-
- case UNRESOLVED: {
- linkTopOfStackReferenceUpdateStack();
-
- if (resolvable.getResolvableStatus() == UNRESOLVED) {
- // If current entity is still not resolved, then
- // linking/resolution has failed.
- String errorInfo;
- if (resolvable instanceof YangType) {
- errorInfo = TYPEDEF_LINKER_ERROR;
- } else if (resolvable instanceof YangUses) {
- errorInfo = GROUPING_LINKER_ERROR;
- } else if (resolvable instanceof YangIfFeature) {
- errorInfo = FEATURE_LINKER_ERROR;
- } else if (resolvable instanceof YangBase) {
- errorInfo = BASE_LINKER_ERROR;
- } else if (resolvable instanceof YangIdentityRef) {
- errorInfo = IDENTITYREF_LINKER_ERROR;
- } else {
- errorInfo = LEAFREF_LINKER_ERROR;
- }
- DataModelException dataModelException =
- new DataModelException(errorInfo);
- dataModelException.setLine(getLineNumber());
- dataModelException.setCharPosition(getCharPosition());
- throw dataModelException;
- }
- break;
- }
- default: {
- throw new DataModelException("Data Model Exception: Unsupported, linker state");
- }
-
- }
-
- } else {
- throw new DataModelException(
- "Data Model Exception: Entity to resolved is other than type/uses/if-feature" +
- "/leafref/base/identityref");
- }
- }
-
- }
-
- /**
- * Adds the leafref/identityref type to the type, which has derived type referring to
- * typedef with leafref/identityref type.
- */
- private void addDerivedRefTypeToRefTypeResolutionList() throws DataModelException {
-
- YangNode potentialAncestorWithReferredNode = getEntityToResolveInfo().getHolderOfEntityToResolve();
-
- // If holder is typedef return.
- if (potentialAncestorWithReferredNode instanceof YangTypeDef) {
- return;
- }
-
- // If entity is not type return.
- if (!(getEntityToResolveInfo().getEntityToResolve() instanceof YangType)) {
- return;
- }
-
- YangType yangType = (YangType) getEntityToResolveInfo().getEntityToResolve();
-
- // If type is not resolved return.
- if (yangType.getResolvableStatus() != RESOLVED) {
- return;
- }
-
- YangDerivedInfo derivedInfo = (YangDerivedInfo) yangType.getDataTypeExtendedInfo();
-
- /*
- * If the derived types referred type is not leafref/identityref return
- */
- if ((derivedInfo.getEffectiveBuiltInType() != YangDataTypes.LEAFREF) &&
- (derivedInfo.getEffectiveBuiltInType() != YangDataTypes.IDENTITYREF)) {
- return;
- }
-
- T extendedInfo = (T) derivedInfo.getReferredTypeDef().getTypeDefBaseType().getDataTypeExtendedInfo();
-
- while (extendedInfo instanceof YangDerivedInfo) {
- YangDerivedInfo derivedInfoFromTypedef = (YangDerivedInfo) extendedInfo;
- extendedInfo = (T) derivedInfoFromTypedef.getReferredTypeDef().getTypeDefBaseType()
- .getDataTypeExtendedInfo();
- }
-
- /*
- * Backup the derived types leafref/identityref info, delete all the info in current type,
- * but for resolution status as resolved. Copy the backed up leafref/identityref to types extended info,
- * create a leafref/identityref resolution info using the current resolution info and
- * add to leafref/identityref resolution list.
- */
- if (derivedInfo.getEffectiveBuiltInType() == YangDataTypes.LEAFREF) {
- YangLeafRef leafRefInTypeDef = (YangLeafRef) extendedInfo;
- yangType.resetYangType();
-
- yangType.setResolvableStatus(RESOLVED);
- yangType.setDataType(YangDataTypes.LEAFREF);
- yangType.setDataTypeName(LEAFREF);
- yangType.setDataTypeExtendedInfo(leafRefInTypeDef);
- leafRefInTypeDef.setResolvableStatus(UNRESOLVED);
- leafRefInTypeDef.setParentNodeOfLeafref(potentialAncestorWithReferredNode);
-
- // Add resolution information to the list.
- YangResolutionInfoImpl resolutionInfoImpl = new YangResolutionInfoImpl<>(leafRefInTypeDef,
- potentialAncestorWithReferredNode,
- getLineNumber(), getCharPosition());
- getCurReferenceResolver().addToResolutionList(resolutionInfoImpl,
- ResolvableType.YANG_LEAFREF);
- getCurReferenceResolver().resolveSelfFileLinking(ResolvableType.YANG_LEAFREF);
-
- } else if (derivedInfo.getEffectiveBuiltInType() == YangDataTypes.IDENTITYREF) {
-
- YangIdentityRef identityRefInTypeDef = (YangIdentityRef) extendedInfo;
- yangType.resetYangType();
-
- yangType.setResolvableStatus(RESOLVED);
- yangType.setDataType(YangDataTypes.IDENTITYREF);
- yangType.setDataTypeName(IDENTITYREF);
- yangType.setDataTypeExtendedInfo(identityRefInTypeDef);
- identityRefInTypeDef.setResolvableStatus(UNRESOLVED);
-
- // Add resolution information to the list.
- YangResolutionInfoImpl resolutionInfoImpl = new YangResolutionInfoImpl<>(identityRefInTypeDef,
- potentialAncestorWithReferredNode, getLineNumber(), getCharPosition());
- getCurReferenceResolver().addToResolutionList(resolutionInfoImpl,
- ResolvableType.YANG_IDENTITYREF);
- getCurReferenceResolver().resolveSelfFileLinking(ResolvableType.YANG_IDENTITYREF);
- }
- }
-
- /**
- * Resolves the current entity in the stack.
- */
- private void resolveTopOfStack(YangLinkingPhase linkingPhase)
- throws DataModelException {
- List<T> entityToResolve = (List<T>) ((Resolvable) getCurrentEntityToResolveFromStack()).resolve();
- if (entityToResolve != null && !entityToResolve.isEmpty()) {
- Iterator<T> entityToResolveIterator = entityToResolve.listIterator();
- while (entityToResolveIterator.hasNext()) {
- addUnresolvedEntitiesToStack(entityToResolveIterator.next());
- }
- }
- if (((Resolvable) getCurrentEntityToResolveFromStack()).getResolvableStatus() != INTRA_FILE_RESOLVED
- && ((Resolvable) getCurrentEntityToResolveFromStack()).getResolvableStatus() != UNDEFINED) {
- // Sets the resolution status in inside the type/uses/if-feature/leafref.
- ((Resolvable) getCurrentEntityToResolveFromStack()).setResolvableStatus(RESOLVED);
- }
- }
-
- /**
- * Adds the unresolved entities to the resolution list.
- *
- * @param entityToResolve entity to resolve
- * @throws DataModelException a violation of data model rules
- */
- private void addUnresolvedEntitiesToStack(T entityToResolve) throws DataModelException {
- if (entityToResolve instanceof YangEntityToResolveInfoImpl) {
- YangEntityToResolveInfoImpl entityToResolveInfo = (YangEntityToResolveInfoImpl) entityToResolve;
- if (entityToResolveInfo.getEntityToResolve() instanceof YangLeafRef) {
- YangLeafRef leafref = (YangLeafRef) entityToResolveInfo.getEntityToResolve();
- YangNode parentNodeOfLeafref = entityToResolveInfo.getHolderOfEntityToResolve();
- leafref.setParentNodeOfLeafref(parentNodeOfLeafref);
- if (leafref.getResolvableStatus() == UNRESOLVED) {
- leafref.setResolvableStatus(INTRA_FILE_RESOLVED);
- }
- // Add resolution information to the list.
- YangResolutionInfoImpl resolutionInfoImpl = new YangResolutionInfoImpl<YangLeafRef>(leafref,
- parentNodeOfLeafref, entityToResolveInfo.getLineNumber(),
- entityToResolveInfo.getCharPosition());
- addResolutionInfo(resolutionInfoImpl);
- }
- }
- }
-
- /**
- * Resolves linking for a node child and siblings.
- *
- * @throws DataModelException data model error
- */
- private void linkTopOfStackReferenceUpdateStack()
- throws DataModelException {
-
- if (getCurrentEntityToResolveFromStack() instanceof YangLeafRef) {
- ((Resolvable) getCurrentEntityToResolveFromStack()).setResolvableStatus(INTRA_FILE_RESOLVED);
- return;
- }
- /*
- * Check if self file reference is there, this will not check for the
- * scenario when prefix is not present and type/uses is present in
- * sub-module from include list.
- */
- if (!isCandidateForSelfFileReference()) {
- ((Resolvable) getCurrentEntityToResolveFromStack()).setResolvableStatus(INTRA_FILE_RESOLVED);
- return;
- }
-
- /**
- * Try to resolve the top of the stack and update partial resolved stack
- * if there is recursive references
- */
- YangNode potentialAncestorWithReferredNode = getPartialResolvedStack().peek()
- .getHolderOfEntityToResolve();
-
- if (getCurrentEntityToResolveFromStack() instanceof YangIfFeature) {
- resolveSelfFileLinkingForIfFeature(potentialAncestorWithReferredNode);
- return;
- } else if ((getCurrentEntityToResolveFromStack() instanceof YangIdentityRef) ||
- (getCurrentEntityToResolveFromStack() instanceof YangBase)) {
- resolveSelfFileLinkingForBaseAndIdentityref();
- return;
- } else {
-
- /**
- * Traverse up in the ancestor tree to check if the referred node is
- * defined
- */
- while (potentialAncestorWithReferredNode != null) {
-
- /**
- * Check for the referred node defined in a ancestor scope
- */
- YangNode potentialReferredNode = potentialAncestorWithReferredNode.getChild();
- if (isReferredNodeInSiblingListProcessed(potentialReferredNode)) {
- return;
- }
-
- potentialAncestorWithReferredNode = potentialAncestorWithReferredNode.getParent();
- }
- }
-
- /*
- * In case prefix is not present it's a candidate for inter-file
- * resolution via include list.
- */
- if (getRefPrefix() == null) {
- ((Resolvable) getCurrentEntityToResolveFromStack()).setResolvableStatus(INTRA_FILE_RESOLVED);
- }
- }
-
- /**
- * Resolves self file linking for base/identityref.
- *
- * @throws DataModelException a violation of data model rules
- */
- private void resolveSelfFileLinkingForBaseAndIdentityref()
- throws DataModelException {
-
- boolean referredIdentityFound = false;
- String nodeName = null;
-
- if (getCurrentEntityToResolveFromStack() instanceof YangIdentityRef) {
- nodeName = ((YangIdentityRef) getCurrentEntityToResolveFromStack()).getName();
- }
-
- if (getCurrentEntityToResolveFromStack() instanceof YangBase) {
- nodeName = ((YangBase) getCurrentEntityToResolveFromStack()).getBaseIdentifier().getName();
- }
-
- if (getCurReferenceResolver() instanceof YangModule) {
- YangModule rootNode = (YangModule) getCurReferenceResolver();
- // Sends list of nodes for finding the target identity.
- referredIdentityFound = isIdentityReferenceFound(nodeName, rootNode);
- } else if (getCurReferenceResolver() instanceof YangSubModule) {
- YangSubModule rootNode = (YangSubModule) getCurReferenceResolver();
- // Sends list of nodes for finding the target identity.
- referredIdentityFound = isIdentityReferenceFound(nodeName, rootNode);
- }
-
- if (referredIdentityFound) {
- return;
- }
-
- /*
- * In case prefix is not present it's a candidate for inter-file resolution via include list.
- */
- if (getRefPrefix() == null) {
- ((Resolvable) getCurrentEntityToResolveFromStack()).setResolvableStatus(INTRA_FILE_RESOLVED);
- }
- }
-
- /**
- * Returns the root parent with respect to the ancestor count from leafref.
- *
- * @param ancestorCount count of node where parent node can be reached
- * @param currentParent current parent node
- * @return root node
- * @throws DataModelException a violation of data model rules
- */
- private YangNode getRootNodeWithAncestorCount(int ancestorCount, YangNode currentParent)
- throws DataModelException {
-
- int currentParentCount = 1;
- while (currentParentCount < ancestorCount) {
- if (currentParent.getParent() == null) {
- throw new DataModelException("YANG file error: The target node of leafref is invalid.");
- }
- currentParent = currentParent.getParent();
- currentParentCount = currentParentCount + 1;
- }
- return currentParent;
- }
-
- /**
- * Resolves self file linking for if-feature.
- *
- * @param potentialAncestorWithReferredNode if-feature holder node
- * @throws DataModelException DataModelException a violation of data model
- * rules
- */
- private void resolveSelfFileLinkingForIfFeature(YangNode potentialAncestorWithReferredNode)
- throws DataModelException {
-
- YangFeatureHolder featureHolder = getFeatureHolder(potentialAncestorWithReferredNode);
- YangNode potentialReferredNode = (YangNode) featureHolder;
- if (isReferredNode(potentialReferredNode)) {
-
- // Adds reference link of entity to the node under resolution.
- addReferredEntityLink(potentialReferredNode, LINKED);
-
- /**
- * resolve the reference and update the partial resolution stack
- * with any further recursive references
- */
- addUnresolvedRecursiveReferenceToStack(potentialReferredNode);
- return;
- }
-
- /*
- * In case prefix is not present it's a candidate for inter-file
- * resolution via include list.
- */
- if (getRefPrefix() == null) {
- ((Resolvable) getCurrentEntityToResolveFromStack()).setResolvableStatus(INTRA_FILE_RESOLVED);
- }
- }
-
- /**
- * Returns the status of the referred identity found for base/identityref.
- *
- * @param nodeName the name of the base nodeidentifier/identityref nodeidentifier
- * @param ancestorWithTheReferredNode the parent node of base/identityref
- * @return status of referred base/identityref
- * @throws DataModelException a violation of data model rules
- */
- private boolean isIdentityReferenceFound(String nodeName, YangNode ancestorWithTheReferredNode)
- throws DataModelException {
-
- // When child is not present return.
- if (ancestorWithTheReferredNode.getChild() == null) {
- return false;
- }
-
- ancestorWithTheReferredNode = ancestorWithTheReferredNode.getChild();
-
- // Checks all the siblings under the node and returns the matched node.
- YangNode nodeFound = isReferredNodeInSiblingProcessedForIdentity(ancestorWithTheReferredNode, nodeName);
-
- if (nodeFound != null) {
- // Adds reference link of entity to the node under resolution.
- addReferredEntityLink(nodeFound, LINKED);
-
- /**
- * resolve the reference and update the partial resolution stack with any further recursive references
- */
- addUnresolvedRecursiveReferenceToStack(nodeFound);
- return true;
- }
-
- return false;
- }
-
- /**
- * Adds the unresolved constructs to stack which has to be resolved for leafref.
- *
- * @param yangleafOrLeafList YANG leaf or leaf list which holds the type
- * @param ancestorWithTheReferredNode holder of the YANG leaf or leaf list
- */
- private void addUnResolvedLeafRefTypeToStack(T yangleafOrLeafList, YangNode ancestorWithTheReferredNode) {
-
- YangType referredTypeInLeafOrLeafList;
- if (yangleafOrLeafList instanceof YangLeaf) {
- YangLeaf leaf = (YangLeaf) yangleafOrLeafList;
- referredTypeInLeafOrLeafList = leaf.getDataType();
- if (referredTypeInLeafOrLeafList.getDataType() == YangDataTypes.LEAFREF) {
- YangEntityToResolveInfoImpl<YangLeafRef<?>> unResolvedEntityInfo = new YangEntityToResolveInfoImpl<>();
- unResolvedEntityInfo.setEntityToResolve((YangLeafRef<?>) leaf.getDataType().getDataTypeExtendedInfo());
- unResolvedEntityInfo.setHolderOfEntityToResolve(ancestorWithTheReferredNode);
- addInPartialResolvedStack((YangEntityToResolveInfoImpl<T>) unResolvedEntityInfo);
- } else if (referredTypeInLeafOrLeafList.getDataType() == YangDataTypes.DERIVED) {
- YangEntityToResolveInfoImpl<YangType<?>> unResolvedEntityInfo = new YangEntityToResolveInfoImpl<>();
- unResolvedEntityInfo.setEntityToResolve(referredTypeInLeafOrLeafList);
- unResolvedEntityInfo.setHolderOfEntityToResolve(ancestorWithTheReferredNode);
- addInPartialResolvedStack((YangEntityToResolveInfoImpl<T>) unResolvedEntityInfo);
- }
- } else {
- YangLeafList leafList = (YangLeafList) yangleafOrLeafList;
- referredTypeInLeafOrLeafList = leafList.getDataType();
- if (referredTypeInLeafOrLeafList.getDataType() == YangDataTypes.LEAFREF) {
- YangEntityToResolveInfoImpl<YangLeafRef<?>> unResolvedEntityInfo = new YangEntityToResolveInfoImpl<>();
- unResolvedEntityInfo
- .setEntityToResolve((YangLeafRef<?>) leafList.getDataType().getDataTypeExtendedInfo());
- unResolvedEntityInfo.setHolderOfEntityToResolve(ancestorWithTheReferredNode);
- addInPartialResolvedStack((YangEntityToResolveInfoImpl<T>) unResolvedEntityInfo);
- } else if (referredTypeInLeafOrLeafList.getDataType() == YangDataTypes.DERIVED) {
- YangEntityToResolveInfoImpl<YangType<?>> unResolvedEntityInfo = new YangEntityToResolveInfoImpl<>();
- unResolvedEntityInfo.setEntityToResolve(referredTypeInLeafOrLeafList);
- unResolvedEntityInfo.setHolderOfEntityToResolve(ancestorWithTheReferredNode);
- addInPartialResolvedStack((YangEntityToResolveInfoImpl<T>) unResolvedEntityInfo);
- }
- }
- }
-
- /**
- * Returns feature holder(module/sub-module node) .
- *
- * @param potentialAncestorWithReferredNode if-feature holder node
- */
- private YangFeatureHolder getFeatureHolder(YangNode potentialAncestorWithReferredNode) {
- while (potentialAncestorWithReferredNode != null) {
- if (potentialAncestorWithReferredNode instanceof YangFeatureHolder) {
- return (YangFeatureHolder) potentialAncestorWithReferredNode;
- }
- potentialAncestorWithReferredNode = potentialAncestorWithReferredNode.getParent();
- }
- return null;
- }
-
- /**
- * Checks if the reference in self file or in external file.
- *
- * @return true if self file reference, false otherwise
- * @throws DataModelException a violation of data model rules
- */
- private boolean isCandidateForSelfFileReference()
- throws DataModelException {
- String prefix = getRefPrefix();
- return prefix == null || prefix.contentEquals(getCurReferenceResolver().getPrefix());
- }
-
- /**
- * Checks for the referred parent node for the leafref path.
- *
- * @param potentialReferredNode potential referred node
- * @return the reffered parent node of leaf/leaf-list
- * @throws DataModelException data model errors
- */
- private YangNode isReferredNodeInSiblingProcessedForLeafref(YangNode potentialReferredNode, String referredNodeName)
- throws DataModelException {
-
- while (potentialReferredNode != null) {
- if (potentialReferredNode instanceof YangInput) {
- if (referredNodeName.equalsIgnoreCase(INPUT)) {
- return potentialReferredNode;
- }
- } else if (potentialReferredNode instanceof YangOutput) {
- if (referredNodeName.equalsIgnoreCase(OUTPUT)) {
- return potentialReferredNode;
- }
- }
- // Check if the potential referred node is the actual referred node
- if (isReferredNodeForLeafref(potentialReferredNode, referredNodeName)) {
- if (potentialReferredNode instanceof YangGrouping || potentialReferredNode instanceof YangTypeDef) {
- if (potentialReferredNode.getParent() instanceof YangRpc) {
- potentialReferredNode = potentialReferredNode.getNextSibling();
- } else {
- throw new DataModelException("YANG file error: The target node of leafref is invalid.");
- }
- }
- return potentialReferredNode;
- }
- potentialReferredNode = potentialReferredNode.getNextSibling();
- }
- return null;
- }
-
- /**
- * Checks for the referred parent node for the base/identity.
- *
- * @param potentialReferredNode potential referred node
- * @return the reffered parent node of base/identity.
- * @throws DataModelException data model errors
- */
- private YangNode isReferredNodeInSiblingProcessedForIdentity(YangNode potentialReferredNode,
- String referredNodeName) throws DataModelException {
-
- while (potentialReferredNode != null) {
- if (potentialReferredNode instanceof YangIdentity) {
- // Check if the potential referred node is the actual referred node
- if (isReferredNodeForIdentity(potentialReferredNode, referredNodeName)) {
- return potentialReferredNode;
- }
- }
- potentialReferredNode = potentialReferredNode.getNextSibling();
- }
- return null;
- }
-
- /**
- * Checks if the current reference node name and the name in the path are equal.
- *
- * @param currentReferredNode the node where the reference is pointed
- * @param nameOfNodeinPath name of the node in the path
- * @return status of the match between the name
- * @throws DataModelException a violation of data model rules
- */
- private boolean isReferredNodeForLeafref(YangNode currentReferredNode, String nameOfNodeinPath)
- throws DataModelException {
-
- if (getCurrentEntityToResolveFromStack() instanceof YangLeafRef) {
- /*
- * Check if name of node name matches with the current reference
- * node.
- */
- return currentReferredNode.getName().contentEquals(nameOfNodeinPath);
- } else {
- throw new DataModelException("Data Model Exception: Entity to resolved is other than leafref");
- }
- }
-
- /**
- * Checks if the current reference node name and the name in the base/identityref base are equal.
- *
- * @param currentReferredNode the node where the reference is pointed
- * @param nameOfIdentityRefBase name of the base in the base/identityref base
- * @return status of the match between the name
- * @throws DataModelException a violation of data model rules
- */
- private boolean isReferredNodeForIdentity(YangNode currentReferredNode, String nameOfIdentityRefBase)
- throws DataModelException {
-
- if ((getCurrentEntityToResolveFromStack() instanceof YangIdentityRef) ||
- (getCurrentEntityToResolveFromStack() instanceof YangBase)) {
- /*
- * Check if name of node name matches with the current reference node.
- */
- return currentReferredNode.getName().contentEquals(nameOfIdentityRefBase);
- } else {
- throw new DataModelException("Data Model Exception: Entity to resolved is other than identityref");
- }
- }
-
- /**
- * Checks for the referred node defined in a ancestor scope.
- *
- * @param potentialReferredNode potential referred node
- * @return status of resolution and updating the partial resolved stack with
- * the any recursive references
- * @throws DataModelException a violation of data model rules
- */
- private boolean isReferredNodeInSiblingListProcessed(YangNode potentialReferredNode)
- throws DataModelException {
- while (potentialReferredNode != null) {
-
- // Check if the potential referred node is the actual referred node
- if (isReferredNode(potentialReferredNode)) {
-
- // Adds reference link of entity to the node under resolution.
- addReferredEntityLink(potentialReferredNode, LINKED);
-
- /**
- * resolve the reference and update the partial resolution stack
- * with any further recursive references
- */
- addUnresolvedRecursiveReferenceToStack(potentialReferredNode);
-
- /*
- * return true, since the reference is linked and any recursive
- * unresolved references is added to the stack
- */
- return true;
- }
-
- potentialReferredNode = potentialReferredNode.getNextSibling();
- }
- return false;
- }
-
- /**
- * Checks if the potential referred node is the actual referred node.
- *
- * @param potentialReferredNode typedef/grouping node
- * @return true if node is of resolve type otherwise false
- * @throws DataModelException a violation of data model rules
- */
- private boolean isReferredNode(YangNode potentialReferredNode)
- throws DataModelException {
- if (getCurrentEntityToResolveFromStack() instanceof YangType) {
- if (potentialReferredNode instanceof YangTypeDef) {
- /*
- * Check if name of node name matches with the entity being
- * resolved
- */
- return isNodeNameSameAsResolutionInfoName(potentialReferredNode);
- }
- } else if (getCurrentEntityToResolveFromStack() instanceof YangUses) {
- if (potentialReferredNode instanceof YangGrouping) {
- /*
- * Check if name of node name matches with the entity being
- * resolved
- */
- return isNodeNameSameAsResolutionInfoName(potentialReferredNode);
- }
- } else if (getCurrentEntityToResolveFromStack() instanceof YangIfFeature) {
- if (potentialReferredNode instanceof YangFeatureHolder) {
- /*
- * Check if name of node name matches with the entity being
- * resolved
- */
- return isNodeNameSameAsResolutionInfoName(potentialReferredNode);
- }
- } else if ((getCurrentEntityToResolveFromStack() instanceof YangBase) ||
- (getCurrentEntityToResolveFromStack() instanceof YangIdentityRef)) {
- if (potentialReferredNode instanceof YangIdentity) {
- /*
- * Check if name of node name matches with the entity being
- * resolved
- */
- return isNodeNameSameAsResolutionInfoName(potentialReferredNode);
- }
- } else {
- throw new DataModelException("Data Model Exception: Entity to resolved is other than type/" +
- "uses/base/identityref");
- }
- return false;
- }
-
- /**
- * Checks if node name is same as name in resolution info, i.e. name of
- * typedef/grouping is same as name of type/uses.
- *
- * @param node typedef/grouping node
- * @return true if node name is same as name in resolution info, otherwise
- * false
- * @throws DataModelException a violation of data model rules
- */
-
- private boolean isNodeNameSameAsResolutionInfoName(YangNode node)
- throws DataModelException {
- if (getCurrentEntityToResolveFromStack() instanceof YangType) {
- if (node.getName().contentEquals(
- ((YangType<?>) getCurrentEntityToResolveFromStack())
- .getDataTypeName())) {
- return true;
- }
- } else if (getCurrentEntityToResolveFromStack() instanceof YangUses) {
- if (node.getName().contentEquals(
- ((YangUses) getCurrentEntityToResolveFromStack()).getName())) {
- return true;
- }
- } else if (getCurrentEntityToResolveFromStack() instanceof YangIfFeature) {
- return isFeatureDefinedInNode(node);
- } else if (getCurrentEntityToResolveFromStack() instanceof YangBase) {
- if (node.getName().contentEquals(
- ((YangBase) getCurrentEntityToResolveFromStack()).getBaseIdentifier().getName())) {
- return true;
- }
- } else if (getCurrentEntityToResolveFromStack() instanceof YangIdentityRef) {
- if (node.getName().contentEquals(
- ((YangIdentityRef) getCurrentEntityToResolveFromStack()).getName())) {
- return true;
- }
- } else {
- throw new DataModelException("Data Model Exception: Entity to resolved is other than type/uses");
- }
- return false;
- }
-
- private boolean isFeatureDefinedInNode(YangNode node) throws DataModelException {
- YangNodeIdentifier ifFeature = ((YangIfFeature) getCurrentEntityToResolveFromStack()).getName();
- List<YangFeature> featureList = ((YangFeatureHolder) node).getFeatureList();
- if (featureList != null && !featureList.isEmpty()) {
- Iterator<YangFeature> iterator = featureList.iterator();
- while (iterator.hasNext()) {
- YangFeature feature = iterator.next();
- if (ifFeature.getName().equals(feature.getName())) {
- ((YangIfFeature) getCurrentEntityToResolveFromStack()).setReferredFeature(feature);
- ((YangIfFeature) getCurrentEntityToResolveFromStack()).setReferredFeatureHolder(node);
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * Adds reference of grouping/typedef in uses/type.
- *
- * @param referredNode grouping/typedef node being referred
- * @param linkedStatus linked status if success.
- * @throws DataModelException a violation of data model rules
- */
- private void addReferredEntityLink(YangNode referredNode, ResolvableStatus linkedStatus)
- throws DataModelException {
- if (getCurrentEntityToResolveFromStack() instanceof YangType) {
- YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) ((YangType<?>) getCurrentEntityToResolveFromStack())
- .getDataTypeExtendedInfo();
- derivedInfo.setReferredTypeDef((YangTypeDef) referredNode);
- } else if (getCurrentEntityToResolveFromStack() instanceof YangUses) {
- ((YangUses) getCurrentEntityToResolveFromStack())
- .setRefGroup((YangGrouping) referredNode);
- } else if (getCurrentEntityToResolveFromStack() instanceof YangIfFeature) {
- // do nothing , referred node is already set
- } else if (getCurrentEntityToResolveFromStack() instanceof YangLeafRef) {
- // do nothing , referred node is already set
- } else if (getCurrentEntityToResolveFromStack() instanceof YangBase) {
- ((YangBase) getCurrentEntityToResolveFromStack()).setReferredIdentity((YangIdentity) referredNode);
- } else if (getCurrentEntityToResolveFromStack() instanceof YangIdentityRef) {
- ((YangIdentityRef) getCurrentEntityToResolveFromStack()).setReferredIdentity((YangIdentity) referredNode);
- } else {
- throw new DataModelException("Data Model Exception: Entity to resolved is other than type" +
- "/uses/base/identityref");
- }
-
- // Sets the resolution status in inside the type/uses.
- ((Resolvable) getCurrentEntityToResolveFromStack()).setResolvableStatus(linkedStatus);
- }
-
- /**
- * Checks if type/grouping has further reference to typedef/ unresolved
- * uses. Add it to the partial resolve stack and return the status of
- * addition to stack.
- *
- * @param referredNode grouping/typedef node
- * @throws DataModelException a violation of data model rules
- */
- private void addUnresolvedRecursiveReferenceToStack(YangNode referredNode)
- throws DataModelException {
- if (getCurrentEntityToResolveFromStack() instanceof YangType) {
- /*
- * Checks if typedef type is derived
- */
- if (((YangTypeDef) referredNode).getTypeDefBaseType().getDataType() == YangDataTypes.DERIVED) {
-
- YangEntityToResolveInfoImpl<YangType<?>> unResolvedEntityInfo = new YangEntityToResolveInfoImpl<>();
- unResolvedEntityInfo.setEntityToResolve(((YangTypeDef) referredNode)
- .getTypeDefBaseType());
- unResolvedEntityInfo.setHolderOfEntityToResolve(referredNode);
- addInPartialResolvedStack((YangEntityToResolveInfoImpl<T>) unResolvedEntityInfo);
- }
-
- } else if (getCurrentEntityToResolveFromStack() instanceof YangUses) {
- /*
- * Search if the grouping has any un resolved uses child, if so
- * return true, else return false.
- */
- addUnResolvedUsesToStack(referredNode);
- } else if (getCurrentEntityToResolveFromStack() instanceof YangIfFeature) {
- addUnResolvedIfFeatureToStack(referredNode);
- } else if (getCurrentEntityToResolveFromStack() instanceof YangLeafRef) {
- // do nothing , referred node is already set
- throw new DataModelException("Data Model Exception: Entity to resolved is other than type/uses");
- } else if ((getCurrentEntityToResolveFromStack() instanceof YangBase) ||
- (getCurrentEntityToResolveFromStack() instanceof YangIdentityRef)) {
- /*
- * Search if the identity has any un resolved base, if so return true, else return false.
- */
- addUnResolvedBaseToStack(referredNode);
- } else {
- throw new DataModelException("Data Model Exception: Entity to resolved is other than type/uses/" +
- "base/identityref");
- }
- }
-
- /**
- * Returns if there is any unresolved uses in grouping.
- *
- * @param node grouping/typedef node
- */
- private void addUnResolvedUsesToStack(YangNode node) {
-
- /**
- * Search the grouping node's children for presence of uses node.
- */
- TraversalType curTraversal = ROOT;
- YangNode curNode = node.getChild();
- while (curNode != null) {
- if (curNode.getName().equals(node.getName())) {
- // if we have traversed all the child nodes, then exit from loop
- return;
- }
-
- // if child nodes has uses, then add it to resolution stack
- if (curNode instanceof YangUses) {
- YangEntityToResolveInfoImpl<YangUses> unResolvedEntityInfo = new YangEntityToResolveInfoImpl<>();
- unResolvedEntityInfo.setEntityToResolve((YangUses) curNode);
- unResolvedEntityInfo.setHolderOfEntityToResolve(node);
- addInPartialResolvedStack((YangEntityToResolveInfoImpl<T>) unResolvedEntityInfo);
- }
-
- // Traversing all the child nodes of grouping
- if (curTraversal != PARENT && curNode.getChild() != null) {
- curTraversal = CHILD;
- curNode = curNode.getChild();
- } else if (curNode.getNextSibling() != null) {
- curTraversal = SIBILING;
- curNode = curNode.getNextSibling();
- } else {
- curTraversal = PARENT;
- curNode = curNode.getParent();
- }
- }
- }
-
- /**
- * Returns if there is any unresolved if-feature in feature.
- *
- * @param node module/submodule node
- */
- private void addUnResolvedIfFeatureToStack(YangNode node) {
- YangFeature refFeature = ((YangIfFeature) getCurrentEntityToResolveFromStack()).getReferredFeature();
- List<YangIfFeature> ifFeatureList = refFeature.getIfFeatureList();
- if (ifFeatureList != null && !ifFeatureList.isEmpty()) {
- Iterator<YangIfFeature> ifFeatureIterator = ifFeatureList.iterator();
- while (ifFeatureIterator.hasNext()) {
- YangIfFeature ifFeature = ifFeatureIterator.next();
- YangEntityToResolveInfo<YangIfFeature> unResolvedEntityInfo = new YangEntityToResolveInfoImpl<>();
- unResolvedEntityInfo.setEntityToResolve(ifFeature);
- unResolvedEntityInfo.setHolderOfEntityToResolve(node);
- addInPartialResolvedStack((YangEntityToResolveInfoImpl<T>) unResolvedEntityInfo);
- }
- }
- }
-
- /**
- * Returns if there is any unresolved base in identity.
- *
- * @param node module/submodule node
- */
- private void addUnResolvedBaseToStack(YangNode node) {
-
- YangIdentity curNode = (YangIdentity) node;
- if (curNode.getBaseNode() != null) {
- if (curNode.getBaseNode().getResolvableStatus() != RESOLVED) {
- YangEntityToResolveInfoImpl<YangBase> unResolvedEntityInfo = new YangEntityToResolveInfoImpl<>();
- unResolvedEntityInfo.setEntityToResolve(curNode.getBaseNode());
- unResolvedEntityInfo.setHolderOfEntityToResolve(node);
- addInPartialResolvedStack((YangEntityToResolveInfoImpl<T>) unResolvedEntityInfo);
-
- }
- }
- }
-
-
- /**
- * Returns stack of YANG type with partially resolved YANG construct
- * hierarchy.
- *
- * @return partial resolved YANG construct stack
- */
- private Stack<YangEntityToResolveInfoImpl<T>> getPartialResolvedStack() {
- return partialResolvedStack;
- }
-
- /**
- * Sets stack of YANG type with partially resolved YANG construct hierarchy.
- *
- * @param partialResolvedStack partial resolved YANG construct stack
- */
- private void setPartialResolvedStack(Stack<YangEntityToResolveInfoImpl<T>> partialResolvedStack) {
- this.partialResolvedStack = partialResolvedStack;
- }
-
- /**
- * Sets stack of YANG type with partially resolved YANG construct hierarchy.
- *
- * @param partialResolvedInfo partial resolved YANG construct stack
- */
- private void addInPartialResolvedStack(YangEntityToResolveInfoImpl<T> partialResolvedInfo) {
- getPartialResolvedStack().push(partialResolvedInfo);
- }
-
- /**
- * Retrieves the next entity in the stack that needs to be resolved. It is
- * assumed that the caller ensures that the stack is not empty.
- *
- * @return next entity in the stack that needs to be resolved
- */
- private T getCurrentEntityToResolveFromStack() {
- return getPartialResolvedStack().peek().getEntityToResolve();
- }
-
- @Override
- public YangEntityToResolveInfoImpl<T> getEntityToResolveInfo() {
- return entityToResolveInfo;
- }
-
- /**
- * Sets information about the entity that needs to be resolved.
- *
- * @param entityToResolveInfo information about the entity that needs to be
- * resolved
- */
- private void setEntityToResolveInfo(YangEntityToResolveInfoImpl<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;
- }
-
- /**
- * Returns current module/sub-module reference, will be used in inter-file/
- * inter-jar scenario to get the import/include list.
- *
- * @return current module/sub-module reference
- */
- private YangReferenceResolver getCurReferenceResolver() {
- return curReferenceResolver;
- }
-
- /**
- * Sets current module/sub-module reference, will be used in inter-file/
- * inter-jar scenario to get the import/include list.
- *
- * @param curReferenceResolver current module/sub-module reference
- */
- private void setCurReferenceResolver(YangReferenceResolver curReferenceResolver) {
- this.curReferenceResolver = curReferenceResolver;
- }
-
- @Override
- public void linkInterFile(YangReferenceResolver dataModelRootNode)
- throws DataModelException {
-
- setCurReferenceResolver(dataModelRootNode);
-
- // Current node to resolve, it can be a YANG type or YANG uses.
- T entityToResolve = getEntityToResolveInfo().getEntityToResolve();
-
- // Check if linking is already done
- if (entityToResolve instanceof Resolvable) {
- Resolvable resolvable = (Resolvable) entityToResolve;
- if (resolvable.getResolvableStatus() == RESOLVED) {
- return;
- }
- } else {
- throw new DataModelException("Data Model Exception: Entity to resolved is not Resolvable");
- }
-
- if (entityToResolve instanceof YangXPathResolver && !(entityToResolve instanceof YangLeafRef)) {
- //Process x-path linking.
- processXPathLinking(entityToResolve, dataModelRootNode);
-
- } else {
-
- // Push the initial entity to resolve in stack.
- addInPartialResolvedStack(getEntityToResolveInfo());
-
- // Inter file linking and resolution.
- linkInterFileAndResolve();
-
- addDerivedRefTypeToRefTypeResolutionList();
- }
- }
-
- /**
- * Process x-path linking for augment and leaf-ref.
- *
- * @param entityToResolve entity to resolve
- * @param root root node
- */
- private void processXPathLinking(T entityToResolve,
- YangReferenceResolver root) {
-
- YangXpathLinker<T> xPathLinker = new YangXpathLinker<T>();
-
- if (entityToResolve instanceof YangAugment) {
- YangNode targetNode;
- YangAugment augment = (YangAugment) entityToResolve;
- targetNode = xPathLinker.processAugmentXpathLinking(augment.getTargetNode(),
- (YangNode) root);
- if (targetNode != null) {
- if (targetNode instanceof YangAugmentableNode) {
- detectCollisionForAugmentedNode(targetNode, augment);
- ((YangAugmentableNode) targetNode).addAugmentation(augment);
- augment.setAugmentedNode(targetNode);
- Resolvable resolvable = (Resolvable) entityToResolve;
- resolvable.setResolvableStatus(RESOLVED);
- } else {
- throw new LinkerException("Invalid target node type " + targetNode.getNodeType() + " for "
- + augment.getName());
- }
- } else {
- throw new LinkerException("Failed to link " + augment.getName());
- }
- } else if (entityToResolve instanceof YangLeafRef) {
- YangLeafRef leafRef = (YangLeafRef) entityToResolve;
- Object target = xPathLinker.processLeafRefXpathLinking(leafRef.getAtomicPath(),
- (YangNode) root, leafRef);
- if (target != null) {
- YangLeaf leaf = null;
- YangLeafList leafList = null;
- leafRef.setReferredLeafOrLeafList(target);
- if (target instanceof YangLeaf) {
- leaf = (YangLeaf) target;
- leafRef.setResolvableStatus(INTER_FILE_LINKED);
- addUnResolvedLeafRefTypeToStack((T) leaf, getEntityToResolveInfo().getHolderOfEntityToResolve());
- } else {
- leafList = (YangLeafList) target;
- leafRef.setResolvableStatus(INTER_FILE_LINKED);
- addUnResolvedLeafRefTypeToStack((T) leafList,
- getEntityToResolveInfo().getHolderOfEntityToResolve());
- }
- //TODO: add logic for leaf-ref for path predicates.
- } else {
- LinkerException linkerException = new LinkerException("YANG file error: Unable to find base " +
- "leaf/leaf-list for given leafref path "
- + leafRef.getPath());
- linkerException.setCharPosition(leafRef.getCharPosition());
- linkerException.setLine(leafRef.getLineNumber());
- throw linkerException;
- }
- }
- }
-
- /**
- * Returns the referenced prefix of entity under resolution.
- *
- * @return referenced prefix of entity under resolution
- * @throws DataModelException a violation in data model rule
- */
- private String getRefPrefix()
- throws DataModelException {
- String refPrefix;
- if (getCurrentEntityToResolveFromStack() instanceof YangType) {
- refPrefix = ((YangType<?>) getCurrentEntityToResolveFromStack()).getPrefix();
- } else if (getCurrentEntityToResolveFromStack() instanceof YangUses) {
- refPrefix = ((YangUses) getCurrentEntityToResolveFromStack()).getPrefix();
- } else if (getCurrentEntityToResolveFromStack() instanceof YangIfFeature) {
- refPrefix = ((YangIfFeature) getCurrentEntityToResolveFromStack()).getPrefix();
- } else if (getCurrentEntityToResolveFromStack() instanceof YangBase) {
- refPrefix = ((YangBase) getCurrentEntityToResolveFromStack()).getBaseIdentifier().getPrefix();
- } else if (getCurrentEntityToResolveFromStack() instanceof YangIdentityRef) {
- refPrefix = ((YangIdentityRef) getCurrentEntityToResolveFromStack()).getPrefix();
- } else {
- throw new DataModelException("Data Model Exception: Entity to resolved is other than " +
- "type/uses/base/identityref");
- }
- return refPrefix;
- }
-
- /**
- * Performs inter file linking and resolution.
- *
- * @throws DataModelException a violation in data model rule
- */
- private void linkInterFileAndResolve()
- throws DataModelException {
-
- while (getPartialResolvedStack().size() != 0) {
-
- // Current node to resolve, it can be a YANG type or YANG uses.
- T entityToResolve = getCurrentEntityToResolveFromStack();
- // Check if linking is already done
- if (entityToResolve instanceof Resolvable) {
-
- Resolvable resolvable = (Resolvable) entityToResolve;
- switch (resolvable.getResolvableStatus()) {
- case RESOLVED: {
- /*
- * If the entity is already resolved in the stack, then pop
- * it and continue with the remaining stack elements to
- * resolve
- */
- getPartialResolvedStack().pop();
- break;
- }
-
- case INTER_FILE_LINKED: {
- /*
- * If the top of the stack is already linked then resolve
- * the references and pop the entity and continue with
- * remaining stack elements to resolve
- */
- resolveTopOfStack(INTER_FILE);
- getPartialResolvedStack().pop();
- break;
- }
-
- case INTRA_FILE_RESOLVED: {
- /*
- * If the top of the stack is intra file resolved then check
- * if top of stack is linked, if not link it using
- * import/include list and push the linked referred entity
- * to the stack, otherwise only push it to the stack.
- */
- linkInterFileTopOfStackRefUpdateStack();
- break;
- }
-
- case UNDEFINED: {
- /*
- * In case of if-feature resolution, if referred "feature" is not
- * defined then the resolvable status will be undefined.
- */
- getPartialResolvedStack().pop();
- break;
- }
-
- default: {
- throw new DataModelException("Data Model Exception: Unsupported, linker state");
- }
-
- }
-
- } else {
- throw new DataModelException("Data Model Exception: Entity to resolved is other than type/uses");
- }
-
- }
-
- }
-
- /**
- * Links the top of the stack if it's inter-file and update stack.
- *
- * @throws DataModelException data model error
- */
- private void linkInterFileTopOfStackRefUpdateStack()
- throws DataModelException {
-
- if (getCurrentEntityToResolveFromStack() instanceof YangLeafRef) {
- // When leafref path comes with relative path, it will be converted to absolute path.
- setAbsolutePathFromRelativePathInLeafref(getCurrentEntityToResolveFromStack());
- processXPathLinking(getCurrentEntityToResolveFromStack(), getCurReferenceResolver());
- return;
- }
- /*
- * Obtain the referred node of top of stack entity under resolution
- */
- T referredNode = getRefNode();
-
- /*
- * Check for null for scenario when it's not linked and inter-file
- * linking is required.
- */
- if (referredNode == null) {
-
- /*
- * Check if prefix is null or not, to identify whether to search in
- * import list or include list.
- */
- if (getRefPrefix() != null && !getRefPrefix().contentEquals(getCurReferenceResolver().getPrefix())) {
- if (resolveWithImport()) {
- return;
- }
- } else {
- if (resolveWithInclude()) {
- return;
- }
- }
-
- if (getCurrentEntityToResolveFromStack() instanceof YangIfFeature) {
- ((YangIfFeature) getCurrentEntityToResolveFromStack()).setResolvableStatus(UNDEFINED);
- return;
- }
- // If current entity is still not resolved, then
- // linking/resolution has failed.
- String errorInfo;
- if (getCurrentEntityToResolveFromStack() instanceof YangType) {
- errorInfo = TYPEDEF_LINKER_ERROR;
- } else if (getCurrentEntityToResolveFromStack() instanceof YangUses) {
- errorInfo = GROUPING_LINKER_ERROR;
- } else if (getCurrentEntityToResolveFromStack() instanceof YangIfFeature) {
- errorInfo = FEATURE_LINKER_ERROR;
- } else if (getCurrentEntityToResolveFromStack() instanceof YangBase) {
- errorInfo = BASE_LINKER_ERROR;
- } else if (getCurrentEntityToResolveFromStack() instanceof YangIdentityRef) {
- errorInfo = IDENTITYREF_LINKER_ERROR;
- } else {
- errorInfo = LEAFREF_LINKER_ERROR;
- }
- DataModelException dataModelException = new DataModelException(errorInfo);
- dataModelException.setLine(getLineNumber());
- dataModelException.setCharPosition(getCharPosition());
- throw dataModelException;
- } else {
- ((Resolvable) getCurrentEntityToResolveFromStack()).setResolvableStatus(INTER_FILE_LINKED);
- addUnresolvedRecursiveReferenceToStack((YangNode) referredNode);
- }
- }
-
- /**
- * Sets the leafref with absolute path from the relative path.
- *
- * @param resolutionInfo information about the YANG construct which has to be resolved
- * @throws DataModelException a violation of data model rules
- */
- public void setAbsolutePathFromRelativePathInLeafref(T resolutionInfo) throws DataModelException {
- if (resolutionInfo instanceof YangLeafRef) {
-
- YangNode parentOfLeafref = ((YangLeafRef) resolutionInfo).getParentNodeOfLeafref();
- YangLeafRef leafref = (YangLeafRef) resolutionInfo;
-
- // Checks if the leafref has relative path in it.
- if (leafref.getPathType() == YangPathArgType.RELATIVE_PATH) {
- YangRelativePath relativePath = leafref.getRelativePath();
- List<YangAtomicPath> absoluteInRelative = relativePath.getAtomicPathList();
- int numberOfAncestors = relativePath.getAncestorNodeCount();
-
- // Gets the root node from the ancestor count.
- T nodeOrAugmentList = getRootNodeWithAncestorCountForLeafref(numberOfAncestors, parentOfLeafref,
- leafref);
- if (nodeOrAugmentList instanceof YangNode) {
- String pathNameToBePrefixed = EMPTY_STRING;
- YangNode rootNode = (YangNode) nodeOrAugmentList;
- // Forms a new absolute path from the relative path
- while (!(rootNode instanceof YangReferenceResolver)) {
- pathNameToBePrefixed = rootNode.getName() + SLASH_FOR_STRING + pathNameToBePrefixed;
- rootNode = rootNode.getParent();
- if (rootNode == null) {
- throw new DataModelException("Internal datamodel error: Datamodel tree is not correct");
- }
- }
- fillAbsolutePathValuesInLeafref(leafref, pathNameToBePrefixed, absoluteInRelative);
- } else {
- List<String> listOfAugment = (List<String>) nodeOrAugmentList;
- Iterator<String> listOfAugmentIterator = listOfAugment.listIterator();
- String augment = EMPTY_STRING;
- while (listOfAugmentIterator.hasNext()) {
- augment = augment + SLASH_FOR_STRING + listOfAugmentIterator.next();
- }
- fillAbsolutePathValuesInLeafref(leafref, augment, absoluteInRelative);
- }
- }
- }
- }
-
- /**
- * Fills the absolute path values in the leafref from relative path.
- *
- * @param leafref instance of YANG leafref
- * @param pathNameToBePrefixed path name which has to be prefixed to relative path
- * @param atomicPathsInRelative atomic paths in relative
- * @throws DataModelException a violation of data model rules
- */
- private void fillAbsolutePathValuesInLeafref(YangLeafRef leafref, String pathNameToBePrefixed,
- List<YangAtomicPath> atomicPathsInRelative) throws DataModelException {
-
- leafref.setPathType(YangPathArgType.ABSOLUTE_PATH);
- String[] pathName = new String[0];
- if (pathNameToBePrefixed != EMPTY_STRING && pathNameToBePrefixed != null) {
- pathName = pathNameToBePrefixed.split(SLASH_FOR_STRING);
- }
- List<YangAtomicPath> finalListForAbsolute = new LinkedList<>();
- for (String value : pathName) {
- if (value != null && !value.isEmpty() && value != EMPTY_STRING) {
- YangNodeIdentifier nodeIdentifier = getValidNodeIdentifier(value, YangConstructType.PATH_DATA);
- YangAtomicPath atomicPath = new YangAtomicPath();
- atomicPath.setNodeIdentifier(nodeIdentifier);
- finalListForAbsolute.add(atomicPath);
- }
- }
- if (atomicPathsInRelative != null && !atomicPathsInRelative.isEmpty()) {
- Iterator<YangAtomicPath> atomicPathIterator = atomicPathsInRelative.listIterator();
- while (atomicPathIterator.hasNext()) {
- YangAtomicPath yangAtomicPath = atomicPathIterator.next();
- finalListForAbsolute.add(yangAtomicPath);
- }
- leafref.setAtomicPath(finalListForAbsolute);
- } else {
- DataModelException dataModelException = new DataModelException("YANG file error: The target node, in the " +
- "leafref path " + leafref.getPath() + ", is invalid.");
- dataModelException.setCharPosition(leafref.getCharPosition());
- dataModelException.setLine(leafref.getLineNumber());
- throw dataModelException;
- }
- }
-
- /**
- * Returns the root parent with respect to the ancestor count from leafref.
- *
- * @param ancestorCount count of node where parent node can be reached
- * @param currentParent current parent node
- * @param leafref instance of YANG leafref
- * @return node where the ancestor count stops or augment path name list
- * @throws DataModelException a violation of data model rules
- */
- private T getRootNodeWithAncestorCountForLeafref(int ancestorCount, YangNode currentParent, YangLeafRef leafref)
- throws DataModelException {
-
- int currentParentCount = 1;
- currentParent = skipInvalidDataNodes(currentParent, leafref);
- if (currentParent instanceof YangAugment) {
- YangAugment augment = (YangAugment) currentParent;
- List<String> valueInAugment = getPathWithAugment(augment, ancestorCount - currentParentCount);
- return (T) valueInAugment;
- } else {
- while (currentParentCount < ancestorCount) {
- YangNode currentSkippedParent = skipInvalidDataNodes(currentParent, leafref);
- if (currentSkippedParent == currentParent) {
- if (currentParent.getParent() == null) {
- throw new DataModelException("YANG file error: The target node, in the leafref path "
- + leafref.getPath() + ", is invalid.");
- }
- currentParent = currentParent.getParent();
- } else {
- currentParent = currentSkippedParent;
- continue;
- }
- currentParentCount = currentParentCount + 1;
- if (currentParent instanceof YangAugment) {
- YangAugment augment = (YangAugment) currentParent;
- List<String> valueInAugment = getPathWithAugment(augment, ancestorCount - currentParentCount);
- return (T) valueInAugment;
- }
- }
- }
- return (T) currentParent;
- }
-
- /**
- * Finds and resolves with include list.
- *
- * @return true if resolved, false otherwise
- * @throws DataModelException a violation in data model rule
- */
- private boolean resolveWithInclude()
- throws DataModelException {
- /*
- * Run through all the nodes in include list and search for referred
- * typedef/grouping at the root level.
- */
- for (YangInclude yangInclude : getCurReferenceResolver().getIncludeList()) {
- YangNode linkedNode = null;
- if (getCurrentEntityToResolveFromStack() instanceof YangType) {
- linkedNode = findRefTypedef(yangInclude.getIncludedNode());
- } else if (getCurrentEntityToResolveFromStack() instanceof YangUses) {
- linkedNode = findRefGrouping(yangInclude.getIncludedNode());
- } else if (getCurrentEntityToResolveFromStack() instanceof YangIfFeature) {
- linkedNode = findRefFeature(yangInclude.getIncludedNode());
- } else if (getCurrentEntityToResolveFromStack() instanceof YangBase) {
- linkedNode = findRefIdentity(yangInclude.getIncludedNode());
- } else if (getCurrentEntityToResolveFromStack() instanceof YangIdentityRef) {
- linkedNode = findRefIdentityRef(yangInclude.getIncludedNode());
- }
-
- if (linkedNode != null) {
- // Add the link to external entity.
- addReferredEntityLink(linkedNode, INTER_FILE_LINKED);
-
- // Add the type/uses of referred typedef/grouping to the stack.
- addUnresolvedRecursiveReferenceToStack(linkedNode);
- return true;
- }
- }
- // If referred node can't be found return false.
- return false;
- }
-
- /**
- * Finds and resolves with import list.
- *
- * @return true if resolved, false otherwise
- * @throws DataModelException a violation in data model rule
- */
- private boolean resolveWithImport()
- throws DataModelException {
- /*
- * Run through import list to find the referred typedef/grouping.
- */
- for (YangImport yangImport : getCurReferenceResolver().getImportList()) {
- /*
- * Match the prefix attached to entity under resolution with the
- * imported/included module/sub-module's prefix. If found, search
- * for the referred typedef/grouping at the root level.
- */
- if (yangImport.getPrefixId().contentEquals(getRefPrefix())) {
- YangNode linkedNode = null;
- if (getCurrentEntityToResolveFromStack() instanceof YangType) {
- linkedNode = findRefTypedef(yangImport.getImportedNode());
- } else if (getCurrentEntityToResolveFromStack() instanceof YangUses) {
- linkedNode = findRefGrouping(yangImport.getImportedNode());
- } else if (getCurrentEntityToResolveFromStack() instanceof YangIfFeature) {
- linkedNode = findRefFeature(yangImport.getImportedNode());
- } else if (getCurrentEntityToResolveFromStack() instanceof YangBase) {
- linkedNode = findRefIdentity(yangImport.getImportedNode());
- } else if (getCurrentEntityToResolveFromStack() instanceof YangIdentityRef) {
- linkedNode = findRefIdentityRef(yangImport.getImportedNode());
- }
- if (linkedNode != null) {
- // Add the link to external entity.
- addReferredEntityLink(linkedNode, INTER_FILE_LINKED);
-
- // Add the type/uses of referred typedef/grouping to the
- // stack.
- addUnresolvedRecursiveReferenceToStack(linkedNode);
- return true;
- }
- /*
- * If referred node can't be found at root level break for loop,
- * and return false.
- */
- break;
- }
- }
- // If referred node can't be found return false.
- return false;
- }
-
- /**
- * Returns referred typedef/grouping node.
- *
- * @return referred typedef/grouping node
- * @throws DataModelException a violation in data model rule
- */
- private T getRefNode()
- throws DataModelException {
- if (getCurrentEntityToResolveFromStack() instanceof YangType) {
- YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) ((YangType<?>) getCurrentEntityToResolveFromStack())
- .getDataTypeExtendedInfo();
- return (T) derivedInfo.getReferredTypeDef();
- } else if (getCurrentEntityToResolveFromStack() instanceof YangUses) {
- return (T) ((YangUses) getCurrentEntityToResolveFromStack()).getRefGroup();
- } else if (getCurrentEntityToResolveFromStack() instanceof YangIfFeature) {
- return (T) ((YangIfFeature) getCurrentEntityToResolveFromStack()).getReferredFeatureHolder();
- } else if (getCurrentEntityToResolveFromStack() instanceof YangLeafRef) {
- return (T) ((YangLeafRef) getCurrentEntityToResolveFromStack()).getReferredLeafOrLeafList();
- } else if (getCurrentEntityToResolveFromStack() instanceof YangBase) {
- return (T) ((YangBase) getCurrentEntityToResolveFromStack()).getReferredIdentity();
- } else if (getCurrentEntityToResolveFromStack() instanceof YangIdentityRef) {
- return (T) ((YangIdentityRef) getCurrentEntityToResolveFromStack()).getReferredIdentity();
- } else {
- throw new DataModelException("Data Model Exception: Entity to resolved is other than type" +
- "/uses/base/identityref");
- }
- }
-
- /**
- * Finds the referred grouping node at the root level of imported/included node.
- *
- * @param refNode module/sub-module node
- * @return referred grouping
- */
- private YangNode findRefGrouping(YangNode refNode) {
- YangNode tmpNode = refNode.getChild();
- while (tmpNode != null) {
- if (tmpNode instanceof YangGrouping) {
- if (tmpNode.getName()
- .equals(((YangUses) getCurrentEntityToResolveFromStack()).getName())) {
- return tmpNode;
- }
- }
- tmpNode = tmpNode.getNextSibling();
- }
- return null;
- }
-
- /**
- * Finds the referred feature node at the root level of imported/included node.
- *
- * @param refNode module/sub-module node
- * @return referred feature
- */
- private YangNode findRefFeature(YangNode refNode) {
- YangNodeIdentifier ifFeature = ((YangIfFeature) getCurrentEntityToResolveFromStack()).getName();
- List<YangFeature> featureList = ((YangFeatureHolder) refNode).getFeatureList();
-
- if (featureList != null && !featureList.isEmpty()) {
- Iterator<YangFeature> iterator = featureList.iterator();
- while (iterator.hasNext()) {
- YangFeature feature = iterator.next();
- if (ifFeature.getName().equals(feature.getName())) {
- ((YangIfFeature) getCurrentEntityToResolveFromStack()).setReferredFeature(feature);
- return refNode;
- }
- }
- }
- return null;
- }
-
- /**
- * Finds the referred typedef node at the root level of imported/included node.
- *
- * @param refNode module/sub-module node
- * @return referred typedef
- */
- private YangNode findRefTypedef(YangNode refNode) {
- YangNode tmpNode = refNode.getChild();
- while (tmpNode != null) {
- if (tmpNode instanceof YangTypeDef) {
- if (tmpNode.getName()
- .equals(((YangType) getCurrentEntityToResolveFromStack()).getDataTypeName())) {
- return tmpNode;
- }
- }
- tmpNode = tmpNode.getNextSibling();
- }
- return null;
- }
-
- /**
- * Finds the referred identity node at the root level of imported/included node.
- *
- * @param refNode module/sub-module node
- * @return referred identity
- */
- private YangNode findRefIdentity(YangNode refNode) {
- YangNode tmpNode = refNode.getChild();
- while (tmpNode != null) {
- if (tmpNode instanceof YangIdentity) {
- if (tmpNode.getName()
- .equals(((YangBase) getCurrentEntityToResolveFromStack()).getBaseIdentifier().getName())) {
- return tmpNode;
- }
- }
- tmpNode = tmpNode.getNextSibling();
- }
- return null;
- }
-
- /**
- * Finds the referred identity node at the root level of imported/included node.
- *
- * @param refNode module/sub-module node
- * @return referred identity
- */
- private YangNode findRefIdentityRef(YangNode refNode) {
- YangNode tmpNode = refNode.getChild();
- while (tmpNode != null) {
- if (tmpNode instanceof YangIdentity) {
- if (tmpNode.getName()
- .equals(((YangIdentityRef) getCurrentEntityToResolveFromStack())
- .getBaseIdentity().getName())) {
- return tmpNode;
- }
- }
- tmpNode = tmpNode.getNextSibling();
- }
- return null;
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/impl/YangXpathLinker.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/impl/YangXpathLinker.java
deleted file mode 100644
index 25635e5..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/impl/YangXpathLinker.java
+++ /dev/null
@@ -1,799 +0,0 @@
-/*
- * 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.linker.impl;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Stack;
-import org.onosproject.yangutils.datamodel.YangAtomicPath;
-import org.onosproject.yangutils.datamodel.YangAugment;
-import org.onosproject.yangutils.datamodel.YangCase;
-import org.onosproject.yangutils.datamodel.YangChoice;
-import org.onosproject.yangutils.datamodel.YangGrouping;
-import org.onosproject.yangutils.datamodel.YangImport;
-import org.onosproject.yangutils.datamodel.YangInclude;
-import org.onosproject.yangutils.datamodel.YangInput;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangLeafList;
-import org.onosproject.yangutils.datamodel.YangLeafRef;
-import org.onosproject.yangutils.datamodel.YangLeavesHolder;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeIdentifier;
-import org.onosproject.yangutils.datamodel.YangOutput;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.datamodel.YangTypeDef;
-import org.onosproject.yangutils.datamodel.YangUses;
-import org.onosproject.yangutils.linker.exceptions.LinkerException;
-
-import static org.onosproject.yangutils.linker.impl.PrefixResolverType.INTER_TO_INTER;
-import static org.onosproject.yangutils.linker.impl.PrefixResolverType.INTER_TO_INTRA;
-import static org.onosproject.yangutils.linker.impl.PrefixResolverType.INTRA_TO_INTER;
-import static org.onosproject.yangutils.linker.impl.PrefixResolverType.NO_PREFIX_CHANGE_FOR_INTER;
-import static org.onosproject.yangutils.linker.impl.PrefixResolverType.NO_PREFIX_CHANGE_FOR_INTRA;
-import static org.onosproject.yangutils.utils.UtilConstants.INPUT;
-import static org.onosproject.yangutils.utils.UtilConstants.OUTPUT;
-
-/**
- * Represents x-path linking.
- *
- * @param <T> x-path linking can be done for target node or for target leaf/leaf-list
- */
-public class YangXpathLinker<T> {
-
- private List<YangAtomicPath> absPaths;
- private YangNode rootNode;
- private Map<YangAtomicPath, PrefixResolverType> prefixResolverTypes;
- private String curPrefix;
-
- /**
- * Creates an instance of x-path linker.
- */
- public YangXpathLinker() {
- absPaths = new ArrayList<>();
- }
-
- /**
- * Returns prefix resolver list.
- *
- * @return prefix resolver list
- */
- private Map<YangAtomicPath, PrefixResolverType> getPrefixResolverTypes() {
- return prefixResolverTypes;
- }
-
- /**
- * Sets prefix resolver list.
- *
- * @param prefixResolverTypes prefix resolver list.
- */
- private void setPrefixResolverTypes(Map<YangAtomicPath, PrefixResolverType> prefixResolverTypes) {
- this.prefixResolverTypes = prefixResolverTypes;
- }
-
- /**
- * Adds to the prefix resolver type map.
- *
- * @param type resolver type
- * @param path absolute path
- */
- private void addToPrefixResolverList(PrefixResolverType type, YangAtomicPath path) {
- getPrefixResolverTypes().put(path, type);
- }
-
- /**
- * Returns list of target nodes paths.
- *
- * @return target nodes paths
- */
- private List<YangAtomicPath> getAbsPaths() {
- return absPaths;
- }
-
- /**
- * Sets target nodes paths.
- *
- * @param absPaths target nodes paths
- */
- private void setAbsPaths(List<YangAtomicPath> absPaths) {
- this.absPaths = absPaths;
- }
-
- /**
- * Returns current prefix.
- *
- * @return current prefix
- */
- private String getCurPrefix() {
- return curPrefix;
- }
-
- /**
- * Sets current prefix.
- *
- * @param curPrefix current prefix
- */
- private void setCurPrefix(String curPrefix) {
- this.curPrefix = curPrefix;
- }
-
- /**
- * Return root node.
- *
- * @return root Node
- */
- private YangNode getRootNode() {
- return rootNode;
- }
-
- /**
- * Sets root node.
- *
- * @param rootNode root node
- */
- private void setRootNode(YangNode rootNode) {
- this.rootNode = rootNode;
- }
-
- /**
- * Adds node to resolved nodes.
- *
- * @param path absolute path
- * @param node resolved node
- */
- private void addToResolvedNodes(YangAtomicPath path, YangNode node) {
- path.setResolvedNode(node);
- }
-
- /**
- * Returns list of augment nodes.
- *
- * @param node root node
- * @return list of augment nodes
- */
- public List<YangAugment> getListOfYangAugment(YangNode node) {
- node = node.getChild();
- List<YangAugment> augments = new ArrayList<>();
- while (node != null) {
- if (node instanceof YangAugment) {
- augments.add((YangAugment) node);
- }
- node = node.getNextSibling();
- }
- return augments;
- }
-
- /**
- * Process absolute node path for target leaf.
- *
- * @param atomicPaths atomic path node list
- * @param root root node
- * @param leafref instance of YANG leafref
- * @return linked target node
- */
- T processLeafRefXpathLinking(List<YangAtomicPath> atomicPaths, YangNode root, YangLeafRef leafref) {
-
- YangNode targetNode;
- setRootNode(root);
- setPrefixResolverTypes(new HashMap<>());
- parsePrefixResolverList(atomicPaths);
- YangAtomicPath leafRefPath = atomicPaths.get(atomicPaths.size() - 1);
-
- // When leaf-ref path contains only one absolute path.
- if (atomicPaths.size() == 1) {
- targetNode = getTargetNodewhenSizeIsOne(atomicPaths);
- } else {
- atomicPaths.remove(atomicPaths.size() - 1);
-
- setAbsPaths(atomicPaths);
- targetNode = parseData(root);
- }
- if (targetNode == null) {
- targetNode = searchInSubModule(root);
- }
-
- // Invalid path presence in the node list is checked.
- validateInvalidNodesInThePath(leafref);
-
- if (targetNode != null) {
- YangLeaf targetLeaf = searchReferredLeaf(targetNode, leafRefPath.getNodeIdentifier().getName());
- if (targetLeaf == null) {
- YangLeafList targetLeafList = searchReferredLeafList(targetNode,
- leafRefPath.getNodeIdentifier().getName());
- if (targetLeafList != null) {
- return (T) targetLeafList;
- } else {
- LinkerException linkerException = new LinkerException("YANG file error: Unable to find base " +
- "leaf/leaf-list for given leafref path "
- + leafref.getPath());
- linkerException.setCharPosition(leafref.getCharPosition());
- linkerException.setLine(leafref.getLineNumber());
- throw linkerException;
- }
- }
- return (T) targetLeaf;
- }
- return null;
- }
-
- /**
- * Validates the nodes in the path for any invalid node.
- *
- * @param leafref instance of YANG leafref
- */
- private void validateInvalidNodesInThePath(YangLeafRef leafref) {
- for (YangAtomicPath absolutePath : (Iterable<YangAtomicPath>) leafref.getAtomicPath()) {
- YangNode nodeInPath = absolutePath.getResolvedNode();
-
- if (nodeInPath instanceof YangGrouping || nodeInPath instanceof YangUses
- || nodeInPath instanceof YangTypeDef || nodeInPath instanceof YangCase
- || nodeInPath instanceof YangChoice) {
- LinkerException linkerException = new LinkerException("YANG file error: The target node, in the " +
- "leafref path " + leafref.getPath() + ", is invalid.");
- linkerException.setCharPosition(leafref.getCharPosition());
- linkerException.setLine(leafref.getLineNumber());
- throw linkerException;
- }
- }
- }
-
- /**
- * Returns target node when leaf-ref has only one absolute path in list.
- *
- * @param absPaths absolute paths
- * @return target node
- */
- private YangNode getTargetNodewhenSizeIsOne(List<YangAtomicPath> absPaths) {
- if (absPaths.get(0).getNodeIdentifier().getPrefix() != null
- && !absPaths.get(0).getNodeIdentifier().getPrefix().equals(getRootsPrefix(getRootNode()))) {
- return getImportedNode(getRootNode(), absPaths.get(0).getNodeIdentifier());
- }
- return getRootNode();
-
- }
-
- /**
- * Process absolute node path linking for augment.
- *
- * @param absPaths absolute path node list
- * @param root root node
- * @return linked target node
- */
- public YangNode processAugmentXpathLinking(List<YangAtomicPath> absPaths, YangNode root) {
-
- setAbsPaths(absPaths);
- setRootNode(root);
- setPrefixResolverTypes(new HashMap<>());
- parsePrefixResolverList(absPaths);
-
- YangNode targetNode = parseData(root);
-
- if (targetNode == null) {
- targetNode = searchInSubModule(root);
- }
- return targetNode;
-
- }
-
- /**
- * Searches for the referred leaf in target node.
- *
- * @param targetNode target node
- * @param leafName leaf name
- * @return target leaf
- */
- private YangLeaf searchReferredLeaf(YangNode targetNode, String leafName) {
- if (!(targetNode instanceof YangLeavesHolder)) {
- throw new LinkerException("Refered node " + targetNode.getName() +
- "should be of type leaves holder ");
- }
- YangLeavesHolder holder = (YangLeavesHolder) targetNode;
- List<YangLeaf> leaves = holder.getListOfLeaf();
- if (leaves != null && !leaves.isEmpty()) {
- for (YangLeaf leaf : leaves) {
- if (leaf.getName().equals(leafName)) {
- return leaf;
- }
- }
- }
- return null;
- }
-
- /**
- * Searches for the referred leaf-list in target node.
- *
- * @param targetNode target node
- * @param leafListName leaf-list name
- * @return target leaf-list
- */
- private YangLeafList searchReferredLeafList(YangNode targetNode, String leafListName) {
- if (!(targetNode instanceof YangLeavesHolder)) {
- throw new LinkerException("Refered node " + targetNode.getName() +
- "should be of type leaves holder ");
- }
- YangLeavesHolder holder = (YangLeavesHolder) targetNode;
- List<YangLeafList> leavesList = holder.getListOfLeafList();
- if (leavesList != null && !leavesList.isEmpty()) {
- for (YangLeafList leafList : leavesList) {
- if (leafList.getName().equals(leafListName)) {
- return leafList;
- }
- }
- }
- return null;
- }
-
- /**
- * Process linking using for node identifier for inter/intra file.
- *
- * @param root root node
- * @return linked target node
- */
- private YangNode parseData(YangNode root) {
- String rootPrefix = getRootsPrefix(root);
- Iterator<YangAtomicPath> pathIterator = getAbsPaths().iterator();
- YangAtomicPath path = pathIterator.next();
- if (path.getNodeIdentifier().getPrefix() != null
- && !path.getNodeIdentifier().getPrefix().equals(rootPrefix)) {
- return parsePath(getImportedNode(root, path.getNodeIdentifier()));
- } else {
- return parsePath(root);
- }
- }
-
- /**
- * Process linking of target node in root node.
- *
- * @param root root node
- * @return linked target node
- */
- private YangNode parsePath(YangNode root) {
-
- YangNode tempNode = root;
- Stack<YangNode> linkerStack = new Stack<>();
- Iterator<YangAtomicPath> pathIterator = getAbsPaths().iterator();
- YangAtomicPath tempPath = pathIterator.next();
- setCurPrefix(tempPath.getNodeIdentifier().getPrefix());
- int index = 0;
- YangNode tempAugment;
- do {
-
- if (tempPath.getNodeIdentifier().getPrefix() == null) {
- tempAugment = resolveIntraFileAugment(tempPath, root);
- } else {
- tempAugment = resolveInterFileAugment(tempPath, root);
- }
-
- if (tempAugment != null) {
- linkerStack.push(tempNode);
- tempNode = tempAugment;
- }
-
- tempNode = searchTargetNode(tempNode, tempPath.getNodeIdentifier());
- if (tempNode == null && linkerStack.size() != 0) {
- tempNode = linkerStack.peek();
- linkerStack.pop();
- tempNode = searchTargetNode(tempNode, tempPath.getNodeIdentifier());
- }
-
- if (tempNode != null) {
- addToResolvedNodes(tempPath, tempNode);
- }
-
- if (index == getAbsPaths().size() - 1) {
- break;
- }
- tempPath = pathIterator.next();
- index++;
- } while (validate(tempNode, index));
- return tempNode;
- }
-
- /**
- * Resolves intra file augment linking.
- *
- * @param tempPath temporary absolute path
- * @param root root node
- * @return linked target node
- */
- private YangNode resolveIntraFileAugment(YangAtomicPath tempPath, YangNode root) {
- YangNode tempAugment;
- if (getCurPrefix() != tempPath.getNodeIdentifier().getPrefix()) {
- root = getIncludedNode(getRootNode(), tempPath.getNodeIdentifier().getName());
- if (root == null) {
- root = getIncludedNode(getRootNode(), getAugmentNodeIdentifier(tempPath.getNodeIdentifier(), absPaths,
- getRootNode()));
- if (root == null) {
- root = getRootNode();
- }
- }
- } else {
- if (getCurPrefix() != null) {
- root = getImportedNode(root, tempPath.getNodeIdentifier());
- }
- }
-
- setCurPrefix(tempPath.getNodeIdentifier().getPrefix());
- tempAugment = getAugment(tempPath.getNodeIdentifier(), root, getAbsPaths());
- if (tempAugment == null) {
- tempAugment = getAugment(tempPath.getNodeIdentifier(), getRootNode(), getAbsPaths());
- }
- return tempAugment;
- }
-
- /**
- * Resolves inter file augment linking.
- *
- * @param tempPath temporary absolute path
- * @param root root node
- * @return linked target node
- */
- private YangNode resolveInterFileAugment(YangAtomicPath tempPath, YangNode root) {
-
- YangNode tempAugment;
- if (!tempPath.getNodeIdentifier().getPrefix().equals(getCurPrefix())) {
- setCurPrefix(tempPath.getNodeIdentifier().getPrefix());
- root = getImportedNode(getRootNode(), tempPath.getNodeIdentifier());
- }
- tempAugment = getAugment(tempPath.getNodeIdentifier(), root, getAbsPaths());
- if (tempAugment == null) {
- return resolveInterToInterFileAugment(root);
- }
- return tempAugment;
- }
-
- /**
- * Resolves augment when prefix changed from inter file to inter file.
- * it may be possible that the prefix used in imported module is different the
- * given list of node identifiers.
- *
- * @param root root node
- * @return target node
- */
- private YangNode resolveInterToInterFileAugment(YangNode root) {
- List<YangAugment> augments = getListOfYangAugment(root);
- int index;
- List<YangAtomicPath> absPaths = new ArrayList<>();
- for (YangAugment augment : augments) {
- index = 0;
-
- for (YangAtomicPath path : augment.getTargetNode()) {
-
- if (!searchForAugmentInImportedNode(path.getNodeIdentifier(), index)) {
- absPaths.clear();
- break;
- }
- absPaths.add(path);
- index++;
- }
- if (!absPaths.isEmpty() && absPaths.size() == getAbsPaths().size() - 1) {
- return augment;
- } else {
- absPaths.clear();
- }
- }
- return null;
- }
-
- /**
- * Searches for the augment node in imported module when prefix has changed from
- * inter file to inter file.
- *
- * @param nodeId node id
- * @param index index
- * @return true if found
- */
- private boolean searchForAugmentInImportedNode(YangNodeIdentifier nodeId, int index) {
- YangNodeIdentifier tempNodeId = getAbsPaths().get(index).getNodeIdentifier();
- return nodeId.getName().equals(tempNodeId.getName());
- }
-
- /**
- * Returns augment node.
- *
- * @param tempNodeId temporary absolute path id
- * @param root root node
- * @return linked target node
- */
- private YangNode getAugment(YangNodeIdentifier tempNodeId, YangNode root, List<YangAtomicPath> absPaths) {
- String augmentName = getAugmentNodeIdentifier(tempNodeId, absPaths, root);
- if (augmentName != null) {
- return searchAugmentNode(root, augmentName);
- }
- return null;
- }
-
- /**
- * Process linking using import list.
- *
- * @param root root node
- * @param nodeId node identifier
- * @return linked target node
- */
- private YangNode getImportedNode(YangNode root, YangNodeIdentifier nodeId) {
-
- List<YangImport> importList;
-
- if (root instanceof YangModule) {
- importList = ((YangModule) root).getImportList();
- } else {
- importList = ((YangSubModule) root).getImportList();
- }
-
- for (YangImport imported : importList) {
- if (imported.getPrefixId().equals(nodeId.getPrefix())) {
- return imported.getImportedNode();
- }
- }
-
- return root;
- }
-
- /**
- * Searches in sub-module node.
- *
- * @param root root node
- * @return target linked node
- */
- private YangNode searchInSubModule(YangNode root) {
- List<YangInclude> includeList;
- YangNode tempNode;
- if (root instanceof YangModule) {
- includeList = ((YangModule) root).getIncludeList();
- } else {
- includeList = ((YangSubModule) root).getIncludeList();
- }
-
- for (YangInclude included : includeList) {
- tempNode = parseData(included.getIncludedNode());
- if (tempNode != null) {
- return tempNode;
- }
- }
- return null;
- }
-
- /**
- * Process linking using include list.
- *
- * @param root root node
- * @param tempPathName temporary path node name
- * @return linked target node
- */
- private YangNode getIncludedNode(YangNode root, String tempPathName) {
-
- List<YangInclude> includeList;
-
- if (root instanceof YangModule) {
- includeList = ((YangModule) root).getIncludeList();
- } else {
- includeList = ((YangSubModule) root).getIncludeList();
- }
-
- for (YangInclude included : includeList) {
- if (verifyChildNode(included.getIncludedNode(), tempPathName)) {
- return included.getIncludedNode();
- }
- }
-
- return null;
- }
-
- /**
- * Verifies for child nodes in sub module.
- *
- * @param node submodule node
- * @param name name of child node
- * @return true if child node found
- */
- private boolean verifyChildNode(YangNode node, String name) {
- node = node.getChild();
- while (node != null) {
- if (node.getName().equals(name)) {
- return true;
- }
- node = node.getNextSibling();
- }
- return false;
- }
-
-
- /**
- * Returns augment's node id.
- *
- * @param nodeId node identifier
- * @param absPaths absolute paths
- * @param root root node
- * @return augment's node id
- */
- private String getAugmentNodeIdentifier(YangNodeIdentifier nodeId, List<YangAtomicPath> absPaths, YangNode root) {
-
- Iterator<YangAtomicPath> nodeIdIterator = absPaths.iterator();
- YangAtomicPath tempNodeId;
- StringBuilder builder = new StringBuilder();
- String id;
- PrefixResolverType type;
- while (nodeIdIterator.hasNext()) {
- tempNodeId = nodeIdIterator.next();
- if (!tempNodeId.getNodeIdentifier().equals(nodeId)) {
- type = getPrefixResolverTypes().get(tempNodeId);
- switch (type) {
- case INTER_TO_INTRA:
- id = "/" + tempNodeId.getNodeIdentifier().getName();
- break;
- case INTRA_TO_INTER:
- if (!getRootsPrefix(root).equals(tempNodeId.getNodeIdentifier().getPrefix())) {
- id = "/" + tempNodeId.getNodeIdentifier().getPrefix() + ":" + tempNodeId.getNodeIdentifier()
- .getName();
- } else {
- id = "/" + tempNodeId.getNodeIdentifier().getName();
- }
- break;
- case INTER_TO_INTER:
- id = "/" + tempNodeId.getNodeIdentifier().getPrefix() + ":" + tempNodeId.getNodeIdentifier()
- .getName();
- break;
- case NO_PREFIX_CHANGE_FOR_INTRA:
- id = "/" + tempNodeId.getNodeIdentifier().getName();
- break;
- case NO_PREFIX_CHANGE_FOR_INTER:
- if (!getRootsPrefix(root).equals(tempNodeId.getNodeIdentifier().getPrefix())) {
- id = "/" + tempNodeId.getNodeIdentifier().getPrefix() + ":" + tempNodeId.getNodeIdentifier()
- .getName();
- } else {
- id = "/" + tempNodeId.getNodeIdentifier().getName();
- }
- break;
- default:
- id = "/" + tempNodeId.getNodeIdentifier().getName();
- break;
- }
- builder.append(id);
- } else {
- return builder.toString();
- }
- }
- return null;
- }
-
- /**
- * Searches augment node in root node.
- *
- * @param node root node
- * @param tempNodeId node identifier
- * @return target augment node
- */
-
- private YangNode searchAugmentNode(YangNode node, String tempNodeId) {
- node = node.getChild();
- while (node != null) {
- if (node instanceof YangAugment) {
- if (node.getName().equals(tempNodeId)) {
- return node;
- }
- }
- node = node.getNextSibling();
- }
- return null;
- }
-
- /**
- * Validates for target node if target node found or not.
- *
- * @param tempNode temporary node
- * @param index current index of list
- * @return false if target node found
- */
- private boolean validate(YangNode tempNode, int index) {
-
- int size = getAbsPaths().size();
- if (tempNode != null && index != size) {
- return true;
- } else if (tempNode != null) {
- return false;
- // this is your target node.
- } else if (index != size) {
- return true;
- // this could be in submodule as well.
- }
- return false;
- }
-
- /**
- * Searches target node in root node.
- *
- * @param node root node
- * @param curNodeId YANG node identifier
- * @return linked target node
- */
- private YangNode searchTargetNode(YangNode node, YangNodeIdentifier curNodeId) {
-
- if (node != null) {
- node = node.getChild();
- }
-
- while (node != null) {
- if (node instanceof YangInput) {
- if (curNodeId.getName().equalsIgnoreCase(INPUT)) {
- return node;
- }
- } else if (node instanceof YangOutput) {
- if (curNodeId.getName().equalsIgnoreCase(OUTPUT)) {
- return node;
- }
- }
- if (node.getName().equals(curNodeId.getName())) {
- return node;
- }
- node = node.getNextSibling();
- }
- return null;
- }
-
- /**
- * Returns root prefix.
- *
- * @param root root node
- * @return root prefix
- */
- private String getRootsPrefix(YangNode root) {
- if (root instanceof YangModule) {
- return ((YangModule) root).getPrefix();
- } else {
- return ((YangSubModule) root).getPrefix();
- }
- }
-
- /**
- * Resolves prefix and provides prefix resolver list.
- *
- * @param absolutePaths absolute paths
- */
- private void parsePrefixResolverList(List<YangAtomicPath> absolutePaths) {
- Iterator<YangAtomicPath> pathIterator = absolutePaths.iterator();
- YangAtomicPath absPath;
- String prePrefix;
- String curPrefix = null;
- while (pathIterator.hasNext()) {
- prePrefix = curPrefix;
- absPath = pathIterator.next();
- curPrefix = absPath.getNodeIdentifier().getPrefix();
- if (curPrefix != null) {
- if (!curPrefix.equals(prePrefix)) {
- if (prePrefix != null) {
- addToPrefixResolverList(INTER_TO_INTER, absPath);
- } else {
- addToPrefixResolverList(INTRA_TO_INTER, absPath);
- }
- } else {
- addToPrefixResolverList(NO_PREFIX_CHANGE_FOR_INTER, absPath);
- }
- } else {
- if (prePrefix != null) {
- addToPrefixResolverList(INTER_TO_INTRA, absPath);
- } else {
- addToPrefixResolverList(NO_PREFIX_CHANGE_FOR_INTRA, absPath);
- }
- }
- }
-
- }
-
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/impl/package-info.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/impl/package-info.java
deleted file mode 100644
index 1d38e5a..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/impl/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Provide intra/inter file and inter jar linking implementation.
- */
-package org.onosproject.yangutils.linker.impl;
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/package-info.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/package-info.java
deleted file mode 100644
index 04ce9d6..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Provide inter jar and inter file linking abstract interface.
- */
-package org.onosproject.yangutils.linker;
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/YangUtilsParser.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/YangUtilsParser.java
deleted file mode 100644
index ba119f6..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/YangUtilsParser.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.parser;
-
-import java.io.IOException;
-
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-
-/**
- * Abstraction of entity which provides parser service of YANG files for yangutils-maven-plugin.
- */
-public interface YangUtilsParser {
-
- /**
- * Returns the data model node. It is an entry function to initiate the YANG file parsing.
- *
- * @param file input YANG file
- * @return YangNode root node of the data model tree
- * @throws ParserException when fails to get the data model
- * @throws IOException when there is an exception in IO operation
- */
- YangNode getDataModel(String file) throws IOException, ParserException;
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/antlrgencode/GeneratedYangListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/antlrgencode/GeneratedYangListener.java
deleted file mode 100644
index 72e7995..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/antlrgencode/GeneratedYangListener.java
+++ /dev/null
@@ -1,1940 +0,0 @@
-/*
- * 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.
- */
-
-// Generated from GeneratedYang.g4 by ANTLR 4.5
-
-package org.onosproject.yangutils.parser.antlrgencode;
-
-import org.antlr.v4.runtime.tree.ParseTreeListener;
-
-/**
- * Represents ANTLR interfaces to be implemented by listener to traverse the parse tree.
- */
-public interface GeneratedYangListener extends ParseTreeListener {
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule yangfile.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterYangfile(GeneratedYangParser.YangfileContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule yangfile.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitYangfile(GeneratedYangParser.YangfileContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule moduleStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterModuleStatement(GeneratedYangParser.ModuleStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule moduleStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitModuleStatement(GeneratedYangParser.ModuleStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule moduleBody.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterModuleBody(GeneratedYangParser.ModuleBodyContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule moduleBody.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitModuleBody(GeneratedYangParser.ModuleBodyContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule moduleHeaderStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterModuleHeaderStatement(GeneratedYangParser.ModuleHeaderStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule moduleHeaderStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitModuleHeaderStatement(GeneratedYangParser.ModuleHeaderStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule linkageStatements.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterLinkageStatements(GeneratedYangParser.LinkageStatementsContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule linkageStatements.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitLinkageStatements(GeneratedYangParser.LinkageStatementsContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule metaStatements.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterMetaStatements(GeneratedYangParser.MetaStatementsContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule metaStatements.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitMetaStatements(GeneratedYangParser.MetaStatementsContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule revisionStatements.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterRevisionStatements(GeneratedYangParser.RevisionStatementsContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule revisionStatements.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitRevisionStatements(GeneratedYangParser.RevisionStatementsContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule bodyStatements.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterBodyStatements(GeneratedYangParser.BodyStatementsContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule bodyStatements.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitBodyStatements(GeneratedYangParser.BodyStatementsContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule yangVersionStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterYangVersionStatement(GeneratedYangParser.YangVersionStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule yangVersionStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitYangVersionStatement(GeneratedYangParser.YangVersionStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule namespaceStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterNamespaceStatement(GeneratedYangParser.NamespaceStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule namespaceStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitNamespaceStatement(GeneratedYangParser.NamespaceStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule prefixStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterPrefixStatement(GeneratedYangParser.PrefixStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule prefixStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitPrefixStatement(GeneratedYangParser.PrefixStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule importStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterImportStatement(GeneratedYangParser.ImportStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule importStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitImportStatement(GeneratedYangParser.ImportStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule importStatementBody.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterImportStatementBody(GeneratedYangParser.ImportStatementBodyContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule importStatementBody.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitImportStatementBody(GeneratedYangParser.ImportStatementBodyContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule revisionDateStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterRevisionDateStatement(GeneratedYangParser.RevisionDateStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule revisionDateStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitRevisionDateStatement(GeneratedYangParser.RevisionDateStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule includeStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterIncludeStatement(GeneratedYangParser.IncludeStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule includeStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitIncludeStatement(GeneratedYangParser.IncludeStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule organizationStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterOrganizationStatement(GeneratedYangParser.OrganizationStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule organizationStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitOrganizationStatement(GeneratedYangParser.OrganizationStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule contactStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterContactStatement(GeneratedYangParser.ContactStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule contactStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitContactStatement(GeneratedYangParser.ContactStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule descriptionStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterDescriptionStatement(GeneratedYangParser.DescriptionStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule descriptionStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitDescriptionStatement(GeneratedYangParser.DescriptionStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule referenceStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterReferenceStatement(GeneratedYangParser.ReferenceStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule referenceStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitReferenceStatement(GeneratedYangParser.ReferenceStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule revisionStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterRevisionStatement(GeneratedYangParser.RevisionStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule revisionStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitRevisionStatement(GeneratedYangParser.RevisionStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule revisionStatementBody.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterRevisionStatementBody(GeneratedYangParser.RevisionStatementBodyContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule revisionStatementBody.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitRevisionStatementBody(GeneratedYangParser.RevisionStatementBodyContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule subModuleStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterSubModuleStatement(GeneratedYangParser.SubModuleStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule subModuleStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitSubModuleStatement(GeneratedYangParser.SubModuleStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule submoduleBody.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterSubmoduleBody(GeneratedYangParser.SubmoduleBodyContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule submoduleBody.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitSubmoduleBody(GeneratedYangParser.SubmoduleBodyContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule submoduleHeaderStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterSubmoduleHeaderStatement(GeneratedYangParser.SubmoduleHeaderStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule submoduleHeaderStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitSubmoduleHeaderStatement(GeneratedYangParser.SubmoduleHeaderStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule belongstoStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterBelongstoStatement(GeneratedYangParser.BelongstoStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule belongstoStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitBelongstoStatement(GeneratedYangParser.BelongstoStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule belongstoStatementBody.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterBelongstoStatementBody(GeneratedYangParser.BelongstoStatementBodyContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule belongstoStatementBody.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitBelongstoStatementBody(GeneratedYangParser.BelongstoStatementBodyContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule extensionStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterExtensionStatement(GeneratedYangParser.ExtensionStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule extensionStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitExtensionStatement(GeneratedYangParser.ExtensionStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule extensionBody.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterExtensionBody(GeneratedYangParser.ExtensionBodyContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule extensionBody.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitExtensionBody(GeneratedYangParser.ExtensionBodyContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule argumentStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterArgumentStatement(GeneratedYangParser.ArgumentStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule argumentStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitArgumentStatement(GeneratedYangParser.ArgumentStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule argumentBody.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterArgumentBody(GeneratedYangParser.ArgumentBodyContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule argumentBody.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitArgumentBody(GeneratedYangParser.ArgumentBodyContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule yinElementStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterYinElementStatement(GeneratedYangParser.YinElementStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule yinElementStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitYinElementStatement(GeneratedYangParser.YinElementStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule identityStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterIdentityStatement(GeneratedYangParser.IdentityStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule identityStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitIdentityStatement(GeneratedYangParser.IdentityStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule identityBody.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterIdentityBody(GeneratedYangParser.IdentityBodyContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule identityBody.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitIdentityBody(GeneratedYangParser.IdentityBodyContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule baseStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterBaseStatement(GeneratedYangParser.BaseStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule baseStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitBaseStatement(GeneratedYangParser.BaseStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule featureStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterFeatureStatement(GeneratedYangParser.FeatureStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule featureStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitFeatureStatement(GeneratedYangParser.FeatureStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule featureBody.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterFeatureBody(GeneratedYangParser.FeatureBodyContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule featureBody.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitFeatureBody(GeneratedYangParser.FeatureBodyContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule dataDefStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterDataDefStatement(GeneratedYangParser.DataDefStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule dataDefStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitDataDefStatement(GeneratedYangParser.DataDefStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule ifFeatureStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterIfFeatureStatement(GeneratedYangParser.IfFeatureStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule ifFeatureStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitIfFeatureStatement(GeneratedYangParser.IfFeatureStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule unitsStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterUnitsStatement(GeneratedYangParser.UnitsStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule unitsStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitUnitsStatement(GeneratedYangParser.UnitsStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule typedefStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterTypedefStatement(GeneratedYangParser.TypedefStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule typedefStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitTypedefStatement(GeneratedYangParser.TypedefStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule typeStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterTypeStatement(GeneratedYangParser.TypeStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule typeStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitTypeStatement(GeneratedYangParser.TypeStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule typeBodyStatements.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterTypeBodyStatements(GeneratedYangParser.TypeBodyStatementsContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule typeBodyStatements.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitTypeBodyStatements(GeneratedYangParser.TypeBodyStatementsContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule numericalRestrictions.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterDecimal64Specification(GeneratedYangParser.Decimal64SpecificationContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule numericalRestrictions.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitDecimal64Specification(GeneratedYangParser.Decimal64SpecificationContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule numericalRestrictions.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterFractionDigitStatement(GeneratedYangParser.FractionDigitStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule
- * numericalRestrictions.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitFractionDigitStatement(GeneratedYangParser.FractionDigitStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule
- * numericalRestrictions.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterNumericalRestrictions(GeneratedYangParser.NumericalRestrictionsContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule numericalRestrictions.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitNumericalRestrictions(GeneratedYangParser.NumericalRestrictionsContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule rangeStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterRangeStatement(GeneratedYangParser.RangeStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule rangeStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitRangeStatement(GeneratedYangParser.RangeStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule commonStatements.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterCommonStatements(GeneratedYangParser.CommonStatementsContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule commonStatements.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitCommonStatements(GeneratedYangParser.CommonStatementsContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule stringRestrictions.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterStringRestrictions(GeneratedYangParser.StringRestrictionsContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule stringRestrictions.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitStringRestrictions(GeneratedYangParser.StringRestrictionsContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule lengthStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterLengthStatement(GeneratedYangParser.LengthStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule lengthStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitLengthStatement(GeneratedYangParser.LengthStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule patternStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterPatternStatement(GeneratedYangParser.PatternStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule patternStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitPatternStatement(GeneratedYangParser.PatternStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule defaultStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterDefaultStatement(GeneratedYangParser.DefaultStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule defaultStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitDefaultStatement(GeneratedYangParser.DefaultStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule enumSpecification.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterEnumSpecification(GeneratedYangParser.EnumSpecificationContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule enumSpecification.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitEnumSpecification(GeneratedYangParser.EnumSpecificationContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule enumStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterEnumStatement(GeneratedYangParser.EnumStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule enumStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitEnumStatement(GeneratedYangParser.EnumStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule enumStatementBody.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterEnumStatementBody(GeneratedYangParser.EnumStatementBodyContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule enumStatementBody.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitEnumStatementBody(GeneratedYangParser.EnumStatementBodyContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule leafrefSpecification.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterLeafrefSpecification(GeneratedYangParser.LeafrefSpecificationContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule leafrefSpecification.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitLeafrefSpecification(GeneratedYangParser.LeafrefSpecificationContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule pathStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterPathStatement(GeneratedYangParser.PathStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule pathStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitPathStatement(GeneratedYangParser.PathStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule requireInstanceStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterRequireInstanceStatement(GeneratedYangParser.RequireInstanceStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule requireInstanceStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitRequireInstanceStatement(GeneratedYangParser.RequireInstanceStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule instanceIdentifierSpecification.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterInstanceIdentifierSpecification(
- GeneratedYangParser.InstanceIdentifierSpecificationContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule instanceIdentifierSpecification.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitInstanceIdentifierSpecification(GeneratedYangParser.InstanceIdentifierSpecificationContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule identityrefSpecification.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterIdentityrefSpecification(GeneratedYangParser.IdentityrefSpecificationContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule identityrefSpecification.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitIdentityrefSpecification(GeneratedYangParser.IdentityrefSpecificationContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule unionSpecification.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterUnionSpecification(GeneratedYangParser.UnionSpecificationContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule unionSpecification.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitUnionSpecification(GeneratedYangParser.UnionSpecificationContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule bitsSpecification.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterBitsSpecification(GeneratedYangParser.BitsSpecificationContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule bitsSpecification.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitBitsSpecification(GeneratedYangParser.BitsSpecificationContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule bitStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterBitStatement(GeneratedYangParser.BitStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule bitStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitBitStatement(GeneratedYangParser.BitStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule bitBodyStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterBitBodyStatement(GeneratedYangParser.BitBodyStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule bitBodyStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitBitBodyStatement(GeneratedYangParser.BitBodyStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule positionStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterPositionStatement(GeneratedYangParser.PositionStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule positionStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitPositionStatement(GeneratedYangParser.PositionStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule statusStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterStatusStatement(GeneratedYangParser.StatusStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule statusStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitStatusStatement(GeneratedYangParser.StatusStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule configStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterConfigStatement(GeneratedYangParser.ConfigStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule configStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitConfigStatement(GeneratedYangParser.ConfigStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule mandatoryStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterMandatoryStatement(GeneratedYangParser.MandatoryStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule mandatoryStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitMandatoryStatement(GeneratedYangParser.MandatoryStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule presenceStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterPresenceStatement(GeneratedYangParser.PresenceStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule presenceStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitPresenceStatement(GeneratedYangParser.PresenceStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule orderedByStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterOrderedByStatement(GeneratedYangParser.OrderedByStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule orderedByStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitOrderedByStatement(GeneratedYangParser.OrderedByStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule mustStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterMustStatement(GeneratedYangParser.MustStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule mustStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitMustStatement(GeneratedYangParser.MustStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule errorMessageStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterErrorMessageStatement(GeneratedYangParser.ErrorMessageStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule errorMessageStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitErrorMessageStatement(GeneratedYangParser.ErrorMessageStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule errorAppTagStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterErrorAppTagStatement(GeneratedYangParser.ErrorAppTagStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule errorAppTagStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitErrorAppTagStatement(GeneratedYangParser.ErrorAppTagStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule minElementsStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterMinElementsStatement(GeneratedYangParser.MinElementsStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule minElementsStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitMinElementsStatement(GeneratedYangParser.MinElementsStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule maxElementsStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterMaxElementsStatement(GeneratedYangParser.MaxElementsStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule maxElementsStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitMaxElementsStatement(GeneratedYangParser.MaxElementsStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule valueStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterValueStatement(GeneratedYangParser.ValueStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule valueStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitValueStatement(GeneratedYangParser.ValueStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule groupingStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterGroupingStatement(GeneratedYangParser.GroupingStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule groupingStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitGroupingStatement(GeneratedYangParser.GroupingStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule containerStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterContainerStatement(GeneratedYangParser.ContainerStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule containerStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitContainerStatement(GeneratedYangParser.ContainerStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule leafStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterLeafStatement(GeneratedYangParser.LeafStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule leafStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitLeafStatement(GeneratedYangParser.LeafStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule leafListStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterLeafListStatement(GeneratedYangParser.LeafListStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule leafListStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitLeafListStatement(GeneratedYangParser.LeafListStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule listStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterListStatement(GeneratedYangParser.ListStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule listStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitListStatement(GeneratedYangParser.ListStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule keyStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterKeyStatement(GeneratedYangParser.KeyStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule keyStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitKeyStatement(GeneratedYangParser.KeyStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule uniqueStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterUniqueStatement(GeneratedYangParser.UniqueStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule uniqueStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitUniqueStatement(GeneratedYangParser.UniqueStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule choiceStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterChoiceStatement(GeneratedYangParser.ChoiceStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule choiceStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitChoiceStatement(GeneratedYangParser.ChoiceStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule shortCaseStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterShortCaseStatement(GeneratedYangParser.ShortCaseStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule shortCaseStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitShortCaseStatement(GeneratedYangParser.ShortCaseStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule caseStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterCaseStatement(GeneratedYangParser.CaseStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule caseStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitCaseStatement(GeneratedYangParser.CaseStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule anyxmlStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterAnyxmlStatement(GeneratedYangParser.AnyxmlStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule anyxmlStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitAnyxmlStatement(GeneratedYangParser.AnyxmlStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule usesStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterUsesStatement(GeneratedYangParser.UsesStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule usesStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitUsesStatement(GeneratedYangParser.UsesStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule refineStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterRefineStatement(GeneratedYangParser.RefineStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule refineStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitRefineStatement(GeneratedYangParser.RefineStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule refineContainerStatements.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterRefineContainerStatements(GeneratedYangParser.RefineContainerStatementsContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule refineContainerStatements.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitRefineContainerStatements(GeneratedYangParser.RefineContainerStatementsContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule refineLeafStatements.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterRefineLeafStatements(GeneratedYangParser.RefineLeafStatementsContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule refineLeafStatements.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitRefineLeafStatements(GeneratedYangParser.RefineLeafStatementsContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule refineLeafListStatements.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterRefineLeafListStatements(GeneratedYangParser.RefineLeafListStatementsContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule refineLeafListStatements.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitRefineLeafListStatements(GeneratedYangParser.RefineLeafListStatementsContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule refineListStatements.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterRefineListStatements(GeneratedYangParser.RefineListStatementsContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule refineListStatements.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitRefineListStatements(GeneratedYangParser.RefineListStatementsContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule refineChoiceStatements.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterRefineChoiceStatements(GeneratedYangParser.RefineChoiceStatementsContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule refineChoiceStatements.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitRefineChoiceStatements(GeneratedYangParser.RefineChoiceStatementsContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule refineCaseStatements.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterRefineCaseStatements(GeneratedYangParser.RefineCaseStatementsContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule refineCaseStatements.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitRefineCaseStatements(GeneratedYangParser.RefineCaseStatementsContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule refineAnyxmlStatements.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterRefineAnyxmlStatements(GeneratedYangParser.RefineAnyxmlStatementsContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule refineAnyxmlStatements.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitRefineAnyxmlStatements(GeneratedYangParser.RefineAnyxmlStatementsContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule augmentStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterAugmentStatement(GeneratedYangParser.AugmentStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule augmentStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitAugmentStatement(GeneratedYangParser.AugmentStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule whenStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterWhenStatement(GeneratedYangParser.WhenStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule whenStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitWhenStatement(GeneratedYangParser.WhenStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule rpcStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterRpcStatement(GeneratedYangParser.RpcStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule rpcStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitRpcStatement(GeneratedYangParser.RpcStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule inputStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterInputStatement(GeneratedYangParser.InputStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule inputStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitInputStatement(GeneratedYangParser.InputStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule outputStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterOutputStatement(GeneratedYangParser.OutputStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule outputStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitOutputStatement(GeneratedYangParser.OutputStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule notificationStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterNotificationStatement(GeneratedYangParser.NotificationStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule notificationStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitNotificationStatement(GeneratedYangParser.NotificationStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule deviationStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterDeviationStatement(GeneratedYangParser.DeviationStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule deviationStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitDeviationStatement(GeneratedYangParser.DeviationStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule deviateNotSupportedStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterDeviateNotSupportedStatement(GeneratedYangParser.DeviateNotSupportedStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule deviateNotSupportedStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitDeviateNotSupportedStatement(GeneratedYangParser.DeviateNotSupportedStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule deviateAddStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterDeviateAddStatement(GeneratedYangParser.DeviateAddStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule deviateAddStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitDeviateAddStatement(GeneratedYangParser.DeviateAddStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule deviateDeleteStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterDeviateDeleteStatement(GeneratedYangParser.DeviateDeleteStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule deviateDeleteStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitDeviateDeleteStatement(GeneratedYangParser.DeviateDeleteStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule deviateReplaceStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterDeviateReplaceStatement(GeneratedYangParser.DeviateReplaceStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule deviateReplaceStatement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitDeviateReplaceStatement(GeneratedYangParser.DeviateReplaceStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule string.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterString(GeneratedYangParser.StringContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule string.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitString(GeneratedYangParser.StringContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule identifier.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterIdentifier(GeneratedYangParser.IdentifierContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule identifier.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitIdentifier(GeneratedYangParser.IdentifierContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule version.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterVersion(GeneratedYangParser.VersionContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule version.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitVersion(GeneratedYangParser.VersionContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule range.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterRange(GeneratedYangParser.RangeContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule range.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitRange(GeneratedYangParser.RangeContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule dateArgumentString.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterDateArgumentString(GeneratedYangParser.DateArgumentStringContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule dateArgumentString.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitDateArgumentString(GeneratedYangParser.DateArgumentStringContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule length.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterLength(GeneratedYangParser.LengthContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule length.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitLength(GeneratedYangParser.LengthContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule path.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterPath(GeneratedYangParser.PathContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule path.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitPath(GeneratedYangParser.PathContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule position.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterPosition(GeneratedYangParser.PositionContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule position.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitPosition(GeneratedYangParser.PositionContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule status.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterStatus(GeneratedYangParser.StatusContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule status.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitStatus(GeneratedYangParser.StatusContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule config.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterConfig(GeneratedYangParser.ConfigContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule config.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitConfig(GeneratedYangParser.ConfigContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule mandatory.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterMandatory(GeneratedYangParser.MandatoryContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule mandatory.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitMandatory(GeneratedYangParser.MandatoryContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule ordered-by.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterOrderedBy(GeneratedYangParser.OrderedByContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule ordered-by.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitOrderedBy(GeneratedYangParser.OrderedByContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule min elements value.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterMinValue(GeneratedYangParser.MinValueContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule min elements value.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitMinValue(GeneratedYangParser.MinValueContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule max elements value.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterMaxValue(GeneratedYangParser.MaxValueContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule max elements value.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitMaxValue(GeneratedYangParser.MaxValueContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule key.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterKey(GeneratedYangParser.KeyContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule key.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitKey(GeneratedYangParser.KeyContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule unique.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterUnique(GeneratedYangParser.UniqueContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule unique.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitUnique(GeneratedYangParser.UniqueContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule refine.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterRefine(GeneratedYangParser.RefineContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule refine.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitRefine(GeneratedYangParser.RefineContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule augment.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterAugment(GeneratedYangParser.AugmentContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule augment.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitAugment(GeneratedYangParser.AugmentContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule augment.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterFraction(GeneratedYangParser.FractionContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule augment.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitFraction(GeneratedYangParser.FractionContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule deviation.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterDeviation(GeneratedYangParser.DeviationContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule deviation.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitDeviation(GeneratedYangParser.DeviationContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule deviation.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterValue(GeneratedYangParser.ValueContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule deviation.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitValue(GeneratedYangParser.ValueContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule yang construct.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterYangConstruct(GeneratedYangParser.YangConstructContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule yang construct.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitYangConstruct(GeneratedYangParser.YangConstructContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule compiler annotation statement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterCompilerAnnotationStatement(GeneratedYangParser.CompilerAnnotationStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule compiler annotation statement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitCompilerAnnotationStatement(GeneratedYangParser.CompilerAnnotationStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule compiler annotation body statement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterCompilerAnnotationBodyStatement(GeneratedYangParser.CompilerAnnotationBodyStatementContext
- currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule compiler annotation body statement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitCompilerAnnotationBodyStatement(GeneratedYangParser.CompilerAnnotationBodyStatementContext
- currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule app data structure statement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterAppDataStructureStatement(GeneratedYangParser.AppDataStructureStatementContext
- currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule app data structure statement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitAppDataStructureStatement(GeneratedYangParser.AppDataStructureStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule app data structure.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterAppDataStructure(GeneratedYangParser.AppDataStructureContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule app data strcuture.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitAppDataStructure(GeneratedYangParser.AppDataStructureContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule app extended statement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterAppExtendedStatement(GeneratedYangParser.AppExtendedStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule app extended statement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitAppExtendedStatement(GeneratedYangParser.AppExtendedStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule extended name.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterExtendedName(GeneratedYangParser.ExtendedNameContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule extended name.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitExtendedName(GeneratedYangParser.ExtendedNameContext currentContext);
-
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule
- * data structure key statement.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterDataStructureKeyStatement(GeneratedYangParser.DataStructureKeyStatementContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar rule
- * data structure key statement.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitDataStructureKeyStatement(GeneratedYangParser.DataStructureKeyStatementContext currentContext);
-
- /**
- * Enters a parse tree produced by GeneratedYangParser for grammar rule require instance.
- *
- * @param currentContext current context in the parsed tree
- */
- void enterRequireInstance(GeneratedYangParser.RequireInstanceContext currentContext);
-
- /**
- * Exits a parse tree produced by GeneratedYangParser for grammar require instance.
- *
- * @param currentContext current context in the parsed tree
- */
- void exitRequireInstance(GeneratedYangParser.RequireInstanceContext currentContext);
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/antlrgencode/package-info.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/antlrgencode/package-info.java
deleted file mode 100644
index 747974e..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/antlrgencode/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * ANTLR interfaces to be implemented by listener.
- */
-package org.onosproject.yangutils.parser.antlrgencode;
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/exceptions/ParserException.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/exceptions/ParserException.java
deleted file mode 100644
index 6a18b54..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/exceptions/ParserException.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * 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.parser.exceptions;
-
-/**
- * Represents base class for exceptions in parser operations.
- */
-public class ParserException extends RuntimeException {
-
- private static final long serialVersionUID = 20160211L;
- private int lineNumber;
- private int charPositionInLine;
- private String fileName;
-
- /**
- * Creates a new parser exception.
- */
- public ParserException() {
- super();
- }
-
- /**
- * Creates a new parser exception with given message.
- *
- * @param message the detail of exception in string
- */
- public ParserException(String message) {
- super(message);
- }
-
- /**
- * Creates a new parser exception from given message and cause.
- *
- * @param message the detail of exception in string
- * @param cause underlying cause of the error
- */
- public ParserException(final String message, final Throwable cause) {
- super(message, cause);
- }
-
- /**
- * Creates a new parser exception from cause.
- *
- * @param cause underlying cause of the error
- */
- public ParserException(final Throwable cause) {
- super(cause);
- }
-
- /**
- * Returns line number of the exception.
- *
- * @return line number of the exception
- */
- public int getLineNumber() {
- return this.lineNumber;
- }
-
- /**
- * Returns YANG file name of the exception.
- *
- * @return YANG file name of the exception
- */
- public String getFileName() {
- return this.fileName;
- }
-
- /**
- * Returns position of the exception.
- *
- * @return position of the exception
- */
- public int getCharPositionInLine() {
- return this.charPositionInLine;
- }
-
- /**
- * Sets line number of YANG file.
- *
- * @param line line number of YANG file
- */
- public void setLine(int line) {
- this.lineNumber = line;
- }
-
- /**
- * Sets position of exception.
- *
- * @param charPosition position of exception
- */
- public void setCharPosition(int charPosition) {
- this.charPositionInLine = charPosition;
- }
-
- /**
- * Sets file name in parser exception.
- *
- * @param fileName YANG file name
- */
- public void setFileName(String fileName) {
- this.fileName = fileName;
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/exceptions/package-info.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/exceptions/package-info.java
deleted file mode 100644
index ec36b0d..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/exceptions/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Custom parser exceptions.
- */
-package org.onosproject.yangutils.parser.exceptions;
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/TreeWalkListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/TreeWalkListener.java
deleted file mode 100644
index 116f06d..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/TreeWalkListener.java
+++ /dev/null
@@ -1,1562 +0,0 @@
-/*
- * 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.parser.impl;
-
-import org.antlr.v4.runtime.ParserRuleContext;
-import org.antlr.v4.runtime.tree.ErrorNode;
-import org.antlr.v4.runtime.tree.TerminalNode;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangListener;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.impl.listeners.AppDataStructureListener;
-import org.onosproject.yangutils.parser.impl.listeners.AppExtendedNameListener;
-import org.onosproject.yangutils.parser.impl.listeners.ArgumentListener;
-import org.onosproject.yangutils.parser.impl.listeners.AugmentListener;
-import org.onosproject.yangutils.parser.impl.listeners.BaseFileListener;
-import org.onosproject.yangutils.parser.impl.listeners.BaseListener;
-import org.onosproject.yangutils.parser.impl.listeners.BelongsToListener;
-import org.onosproject.yangutils.parser.impl.listeners.BitListener;
-import org.onosproject.yangutils.parser.impl.listeners.BitsListener;
-import org.onosproject.yangutils.parser.impl.listeners.CaseListener;
-import org.onosproject.yangutils.parser.impl.listeners.ChoiceListener;
-import org.onosproject.yangutils.parser.impl.listeners.CompilerAnnotationListener;
-import org.onosproject.yangutils.parser.impl.listeners.ConfigListener;
-import org.onosproject.yangutils.parser.impl.listeners.ContactListener;
-import org.onosproject.yangutils.parser.impl.listeners.ContainerListener;
-import org.onosproject.yangutils.parser.impl.listeners.DataStructureKeyListener;
-import org.onosproject.yangutils.parser.impl.listeners.Decimal64Listener;
-import org.onosproject.yangutils.parser.impl.listeners.DefaultListener;
-import org.onosproject.yangutils.parser.impl.listeners.DescriptionListener;
-import org.onosproject.yangutils.parser.impl.listeners.EnumListener;
-import org.onosproject.yangutils.parser.impl.listeners.EnumerationListener;
-import org.onosproject.yangutils.parser.impl.listeners.ErrorAppTagListener;
-import org.onosproject.yangutils.parser.impl.listeners.ErrorMessageListener;
-import org.onosproject.yangutils.parser.impl.listeners.ExtensionListener;
-import org.onosproject.yangutils.parser.impl.listeners.FeatureListener;
-import org.onosproject.yangutils.parser.impl.listeners.FractionDigitsListener;
-import org.onosproject.yangutils.parser.impl.listeners.GroupingListener;
-import org.onosproject.yangutils.parser.impl.listeners.IdentityListener;
-import org.onosproject.yangutils.parser.impl.listeners.IdentityrefListener;
-import org.onosproject.yangutils.parser.impl.listeners.IfFeatureListener;
-import org.onosproject.yangutils.parser.impl.listeners.ImportListener;
-import org.onosproject.yangutils.parser.impl.listeners.IncludeListener;
-import org.onosproject.yangutils.parser.impl.listeners.InputListener;
-import org.onosproject.yangutils.parser.impl.listeners.KeyListener;
-import org.onosproject.yangutils.parser.impl.listeners.LeafListListener;
-import org.onosproject.yangutils.parser.impl.listeners.LeafListener;
-import org.onosproject.yangutils.parser.impl.listeners.LeafrefListener;
-import org.onosproject.yangutils.parser.impl.listeners.LengthRestrictionListener;
-import org.onosproject.yangutils.parser.impl.listeners.ListListener;
-import org.onosproject.yangutils.parser.impl.listeners.MandatoryListener;
-import org.onosproject.yangutils.parser.impl.listeners.MaxElementsListener;
-import org.onosproject.yangutils.parser.impl.listeners.MinElementsListener;
-import org.onosproject.yangutils.parser.impl.listeners.ModuleListener;
-import org.onosproject.yangutils.parser.impl.listeners.MustListener;
-import org.onosproject.yangutils.parser.impl.listeners.NamespaceListener;
-import org.onosproject.yangutils.parser.impl.listeners.NotificationListener;
-import org.onosproject.yangutils.parser.impl.listeners.OrganizationListener;
-import org.onosproject.yangutils.parser.impl.listeners.OutputListener;
-import org.onosproject.yangutils.parser.impl.listeners.PathListener;
-import org.onosproject.yangutils.parser.impl.listeners.PatternRestrictionListener;
-import org.onosproject.yangutils.parser.impl.listeners.PositionListener;
-import org.onosproject.yangutils.parser.impl.listeners.PrefixListener;
-import org.onosproject.yangutils.parser.impl.listeners.PresenceListener;
-import org.onosproject.yangutils.parser.impl.listeners.RangeRestrictionListener;
-import org.onosproject.yangutils.parser.impl.listeners.ReferenceListener;
-import org.onosproject.yangutils.parser.impl.listeners.RequireInstanceListener;
-import org.onosproject.yangutils.parser.impl.listeners.RevisionDateListener;
-import org.onosproject.yangutils.parser.impl.listeners.RevisionListener;
-import org.onosproject.yangutils.parser.impl.listeners.RpcListener;
-import org.onosproject.yangutils.parser.impl.listeners.ShortCaseListener;
-import org.onosproject.yangutils.parser.impl.listeners.StatusListener;
-import org.onosproject.yangutils.parser.impl.listeners.SubModuleListener;
-import org.onosproject.yangutils.parser.impl.listeners.TypeDefListener;
-import org.onosproject.yangutils.parser.impl.listeners.TypeListener;
-import org.onosproject.yangutils.parser.impl.listeners.UnionListener;
-import org.onosproject.yangutils.parser.impl.listeners.UniqueListener;
-import org.onosproject.yangutils.parser.impl.listeners.UnitsListener;
-import org.onosproject.yangutils.parser.impl.listeners.UsesListener;
-import org.onosproject.yangutils.parser.impl.listeners.ValueListener;
-import org.onosproject.yangutils.parser.impl.listeners.VersionListener;
-import org.onosproject.yangutils.parser.impl.listeners.WhenListener;
-
-import java.util.Stack;
-
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.handleUnsupportedYangConstruct;
-import static org.onosproject.yangutils.utils.UtilConstants.CURRENTLY_UNSUPPORTED;
-import static org.onosproject.yangutils.utils.UtilConstants.UNSUPPORTED_YANG_CONSTRUCT;
-
-/**
- * Represents ANTLR generates parse-tree. ANTLR generates a parse-tree listener interface that responds to events
- * triggered by the built-in tree walker. The methods in listener are just
- * callbacks. This class implements listener interface and generates the
- * corresponding data model tree.
- */
-public class TreeWalkListener implements GeneratedYangListener {
-
- // List of parsable node entries maintained in stack
- private Stack<Parsable> parsedDataStack = new Stack<>();
-
- // Parse tree root node
- private YangNode rootNode;
-
- /**
- * Parent depth of grouping count for any node.
- */
- private int groupingDepth;
-
- /**
- * Returns number of grouping parents, by a node, at any level.
- *
- * @return depth of grouping
- */
- public int getGroupingDepth() {
- return groupingDepth;
- }
-
- /**
- * Sets number of grouping parents by a node at any level.
- */
- public void increaseGroupingDepth() {
- groupingDepth++;
- }
-
- /**
- * Sets number of grouping parents by a node at any level.
- */
- public void decreaseGroupingDepth() {
- groupingDepth--;
- }
-
- /**
- * Returns stack of parsable data.
- *
- * @return stack of parsable data
- */
- public Stack<Parsable> getParsedDataStack() {
- return parsedDataStack;
- }
-
- /**
- * Returns root node.
- *
- * @return rootNode of data model tree
- */
- public YangNode getRootNode() {
- return rootNode;
- }
-
- /**
- * Set parsed data stack.
- *
- * @param parsedDataStack stack of parsable data objects
- */
- public void setParsedDataStack(Stack<Parsable> parsedDataStack) {
- this.parsedDataStack = parsedDataStack;
- }
-
- /**
- * Set root node.
- *
- * @param rootNode root node of data model tree
- */
- public void setRootNode(YangNode rootNode) {
- this.rootNode = rootNode;
- }
-
- @Override
- public void enterYangfile(GeneratedYangParser.YangfileContext ctx) {
- BaseFileListener.processYangFileEntry(this, ctx);
- }
-
- @Override
- public void exitYangfile(GeneratedYangParser.YangfileContext ctx) {
- BaseFileListener.processYangFileExit(this, ctx);
- }
-
- @Override
- public void enterModuleStatement(GeneratedYangParser.ModuleStatementContext ctx) {
- ModuleListener.processModuleEntry(this, ctx);
- }
-
- @Override
- public void exitModuleStatement(GeneratedYangParser.ModuleStatementContext ctx) {
- ModuleListener.processModuleExit(this, ctx);
- }
-
- @Override
- public void enterModuleBody(GeneratedYangParser.ModuleBodyContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitModuleBody(GeneratedYangParser.ModuleBodyContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterModuleHeaderStatement(GeneratedYangParser.ModuleHeaderStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitModuleHeaderStatement(GeneratedYangParser.ModuleHeaderStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterLinkageStatements(GeneratedYangParser.LinkageStatementsContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitLinkageStatements(GeneratedYangParser.LinkageStatementsContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterMetaStatements(GeneratedYangParser.MetaStatementsContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitMetaStatements(GeneratedYangParser.MetaStatementsContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterRevisionStatements(GeneratedYangParser.RevisionStatementsContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitRevisionStatements(GeneratedYangParser.RevisionStatementsContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterBodyStatements(GeneratedYangParser.BodyStatementsContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitBodyStatements(GeneratedYangParser.BodyStatementsContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterYangVersionStatement(GeneratedYangParser.YangVersionStatementContext ctx) {
- VersionListener.processVersionEntry(this, ctx);
- }
-
- @Override
- public void exitYangVersionStatement(GeneratedYangParser.YangVersionStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterNamespaceStatement(GeneratedYangParser.NamespaceStatementContext ctx) {
- NamespaceListener.processNamespaceEntry(this, ctx);
- }
-
- @Override
- public void exitNamespaceStatement(GeneratedYangParser.NamespaceStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterPrefixStatement(GeneratedYangParser.PrefixStatementContext ctx) {
- PrefixListener.processPrefixEntry(this, ctx);
- }
-
- @Override
- public void exitPrefixStatement(GeneratedYangParser.PrefixStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterImportStatement(GeneratedYangParser.ImportStatementContext ctx) {
- ImportListener.processImportEntry(this, ctx);
- }
-
- @Override
- public void exitImportStatement(GeneratedYangParser.ImportStatementContext ctx) {
- ImportListener.processImportExit(this, ctx);
- }
-
- @Override
- public void enterImportStatementBody(GeneratedYangParser.ImportStatementBodyContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitImportStatementBody(GeneratedYangParser.ImportStatementBodyContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterRevisionDateStatement(GeneratedYangParser.RevisionDateStatementContext ctx) {
- RevisionDateListener.processRevisionDateEntry(this, ctx);
- }
-
- @Override
- public void exitRevisionDateStatement(GeneratedYangParser.RevisionDateStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterIncludeStatement(GeneratedYangParser.IncludeStatementContext ctx) {
- IncludeListener.processIncludeEntry(this, ctx);
- }
-
- @Override
- public void exitIncludeStatement(GeneratedYangParser.IncludeStatementContext ctx) {
- IncludeListener.processIncludeExit(this, ctx);
- }
-
- @Override
- public void enterOrganizationStatement(GeneratedYangParser.OrganizationStatementContext ctx) {
- OrganizationListener.processOrganizationEntry(this, ctx);
- }
-
- @Override
- public void exitOrganizationStatement(GeneratedYangParser.OrganizationStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterContactStatement(GeneratedYangParser.ContactStatementContext ctx) {
- ContactListener.processContactEntry(this, ctx);
- }
-
- @Override
- public void exitContactStatement(GeneratedYangParser.ContactStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterDescriptionStatement(GeneratedYangParser.DescriptionStatementContext ctx) {
- DescriptionListener.processDescriptionEntry(this, ctx);
- }
-
- @Override
- public void exitDescriptionStatement(GeneratedYangParser.DescriptionStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterReferenceStatement(GeneratedYangParser.ReferenceStatementContext ctx) {
- ReferenceListener.processReferenceEntry(this, ctx);
- }
-
- @Override
- public void exitReferenceStatement(GeneratedYangParser.ReferenceStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterRevisionStatement(GeneratedYangParser.RevisionStatementContext ctx) {
- RevisionListener.processRevisionEntry(this, ctx);
- }
-
- @Override
- public void exitRevisionStatement(GeneratedYangParser.RevisionStatementContext ctx) {
- RevisionListener.processRevisionExit(this, ctx);
- }
-
- @Override
- public void enterRevisionStatementBody(GeneratedYangParser.RevisionStatementBodyContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitRevisionStatementBody(GeneratedYangParser.RevisionStatementBodyContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterSubModuleStatement(GeneratedYangParser.SubModuleStatementContext ctx) {
- SubModuleListener.processSubModuleEntry(this, ctx);
- }
-
- @Override
- public void exitSubModuleStatement(GeneratedYangParser.SubModuleStatementContext ctx) {
- SubModuleListener.processSubModuleExit(this, ctx);
- }
-
- @Override
- public void enterSubmoduleBody(GeneratedYangParser.SubmoduleBodyContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitSubmoduleBody(GeneratedYangParser.SubmoduleBodyContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterSubmoduleHeaderStatement(GeneratedYangParser.SubmoduleHeaderStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitSubmoduleHeaderStatement(GeneratedYangParser.SubmoduleHeaderStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterBelongstoStatement(GeneratedYangParser.BelongstoStatementContext ctx) {
- BelongsToListener.processBelongsToEntry(this, ctx);
- }
-
- @Override
- public void exitBelongstoStatement(GeneratedYangParser.BelongstoStatementContext ctx) {
- BelongsToListener.processBelongsToExit(this, ctx);
- }
-
- @Override
- public void enterBelongstoStatementBody(GeneratedYangParser.BelongstoStatementBodyContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitBelongstoStatementBody(GeneratedYangParser.BelongstoStatementBodyContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterExtensionStatement(GeneratedYangParser.ExtensionStatementContext ctx) {
- ExtensionListener.processExtensionEntry(this, ctx);
- }
-
- @Override
- public void exitExtensionStatement(GeneratedYangParser.ExtensionStatementContext ctx) {
- ExtensionListener.processExtensionExit(this, ctx);
- }
-
- @Override
- public void enterExtensionBody(GeneratedYangParser.ExtensionBodyContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitExtensionBody(GeneratedYangParser.ExtensionBodyContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterArgumentStatement(GeneratedYangParser.ArgumentStatementContext ctx) {
- ArgumentListener.processArgumentEntry(this, ctx);
- }
-
- @Override
- public void exitArgumentStatement(GeneratedYangParser.ArgumentStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterArgumentBody(GeneratedYangParser.ArgumentBodyContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitArgumentBody(GeneratedYangParser.ArgumentBodyContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterYinElementStatement(GeneratedYangParser.YinElementStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitYinElementStatement(GeneratedYangParser.YinElementStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterIdentityStatement(GeneratedYangParser.IdentityStatementContext ctx) {
- IdentityListener.processIdentityEntry(this, ctx);
- }
-
- @Override
- public void exitIdentityStatement(GeneratedYangParser.IdentityStatementContext ctx) {
- IdentityListener.processIdentityExit(this, ctx);
- }
-
- @Override
- public void enterIdentityBody(GeneratedYangParser.IdentityBodyContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitIdentityBody(GeneratedYangParser.IdentityBodyContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterBaseStatement(GeneratedYangParser.BaseStatementContext ctx) {
- BaseListener.processBaseEntry(this, ctx);
- }
-
- @Override
- public void exitBaseStatement(GeneratedYangParser.BaseStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterFeatureStatement(GeneratedYangParser.FeatureStatementContext ctx) {
- FeatureListener.processFeatureEntry(this, ctx);
- }
-
- @Override
- public void exitFeatureStatement(GeneratedYangParser.FeatureStatementContext ctx) {
- FeatureListener.processFeatureExit(this, ctx);
- }
-
- @Override
- public void enterFeatureBody(GeneratedYangParser.FeatureBodyContext ctx) {
- // do nothing
- }
-
- @Override
- public void exitFeatureBody(GeneratedYangParser.FeatureBodyContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterDataDefStatement(GeneratedYangParser.DataDefStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitDataDefStatement(GeneratedYangParser.DataDefStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterIfFeatureStatement(GeneratedYangParser.IfFeatureStatementContext ctx) {
- IfFeatureListener.processIfFeatureEntry(this, ctx);
- }
-
- @Override
- public void exitIfFeatureStatement(GeneratedYangParser.IfFeatureStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterUnitsStatement(GeneratedYangParser.UnitsStatementContext ctx) {
- UnitsListener.processUnitsEntry(this, ctx);
- }
-
- @Override
- public void exitUnitsStatement(GeneratedYangParser.UnitsStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterTypedefStatement(GeneratedYangParser.TypedefStatementContext ctx) {
- TypeDefListener.processTypeDefEntry(this, ctx);
- }
-
- @Override
- public void exitTypedefStatement(GeneratedYangParser.TypedefStatementContext ctx) {
- TypeDefListener.processTypeDefExit(this, ctx);
- }
-
- @Override
- public void enterTypeStatement(GeneratedYangParser.TypeStatementContext ctx) {
- TypeListener.processTypeEntry(this, ctx);
- }
-
- @Override
- public void exitTypeStatement(GeneratedYangParser.TypeStatementContext ctx) {
- TypeListener.processTypeExit(this, ctx);
- }
-
- @Override
- public void enterTypeBodyStatements(GeneratedYangParser.TypeBodyStatementsContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitTypeBodyStatements(GeneratedYangParser.TypeBodyStatementsContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterDecimal64Specification(GeneratedYangParser.Decimal64SpecificationContext ctx) {
- Decimal64Listener.processDecimal64Entry(this, ctx);
- }
-
- @Override
- public void exitDecimal64Specification(GeneratedYangParser.Decimal64SpecificationContext ctx) {
- Decimal64Listener.processDecimal64Exit(this, ctx);
- }
-
- @Override
- public void enterFractionDigitStatement(GeneratedYangParser.FractionDigitStatementContext ctx) {
- FractionDigitsListener.processFractionDigitsEntry(this, ctx);
- }
-
- @Override
- public void exitFractionDigitStatement(GeneratedYangParser.FractionDigitStatementContext currentContext) {
- // do nothing
- }
-
- @Override
- public void enterNumericalRestrictions(GeneratedYangParser.NumericalRestrictionsContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitNumericalRestrictions(GeneratedYangParser.NumericalRestrictionsContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterRangeStatement(GeneratedYangParser.RangeStatementContext ctx) {
- RangeRestrictionListener.processRangeRestrictionEntry(this, ctx);
- }
-
- @Override
- public void exitRangeStatement(GeneratedYangParser.RangeStatementContext ctx) {
- RangeRestrictionListener.processRangeRestrictionExit(this, ctx);
- }
-
- @Override
- public void enterCommonStatements(GeneratedYangParser.CommonStatementsContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitCommonStatements(GeneratedYangParser.CommonStatementsContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterStringRestrictions(GeneratedYangParser.StringRestrictionsContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitStringRestrictions(GeneratedYangParser.StringRestrictionsContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterLengthStatement(GeneratedYangParser.LengthStatementContext ctx) {
- LengthRestrictionListener.processLengthRestrictionEntry(this, ctx);
- }
-
- @Override
- public void exitLengthStatement(GeneratedYangParser.LengthStatementContext ctx) {
- LengthRestrictionListener.processLengthRestrictionExit(this, ctx);
- }
-
- @Override
- public void enterPatternStatement(GeneratedYangParser.PatternStatementContext ctx) {
- PatternRestrictionListener.processPatternRestrictionEntry(this, ctx);
- }
-
- @Override
- public void exitPatternStatement(GeneratedYangParser.PatternStatementContext ctx) {
- PatternRestrictionListener.processPatternRestrictionExit(this, ctx);
- }
-
- @Override
- public void enterDefaultStatement(GeneratedYangParser.DefaultStatementContext ctx) {
- DefaultListener.processDefaultEntry(this, ctx);
- }
-
- @Override
- public void exitDefaultStatement(GeneratedYangParser.DefaultStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterEnumSpecification(GeneratedYangParser.EnumSpecificationContext ctx) {
- EnumerationListener.processEnumerationEntry(this, ctx);
- }
-
- @Override
- public void exitEnumSpecification(GeneratedYangParser.EnumSpecificationContext ctx) {
- EnumerationListener.processEnumerationExit(this, ctx);
- }
-
- @Override
- public void enterEnumStatement(GeneratedYangParser.EnumStatementContext ctx) {
- EnumListener.processEnumEntry(this, ctx);
- }
-
- @Override
- public void exitEnumStatement(GeneratedYangParser.EnumStatementContext ctx) {
- EnumListener.processEnumExit(this, ctx);
- }
-
- @Override
- public void enterEnumStatementBody(GeneratedYangParser.EnumStatementBodyContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitEnumStatementBody(GeneratedYangParser.EnumStatementBodyContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterLeafrefSpecification(GeneratedYangParser.LeafrefSpecificationContext ctx) {
- LeafrefListener.processLeafrefEntry(this, ctx);
- }
-
- @Override
- public void exitLeafrefSpecification(GeneratedYangParser.LeafrefSpecificationContext ctx) {
- LeafrefListener.processLeafrefExit(this, ctx);
- }
-
- @Override
- public void enterPathStatement(GeneratedYangParser.PathStatementContext ctx) {
- PathListener.processPathEntry(this, ctx);
- }
-
- @Override
- public void exitPathStatement(GeneratedYangParser.PathStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterRequireInstanceStatement(GeneratedYangParser.RequireInstanceStatementContext ctx) {
- RequireInstanceListener.processRequireInstanceEntry(this, ctx);
- }
-
- @Override
- public void exitRequireInstanceStatement(GeneratedYangParser.RequireInstanceStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterInstanceIdentifierSpecification(GeneratedYangParser.InstanceIdentifierSpecificationContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitInstanceIdentifierSpecification(GeneratedYangParser.InstanceIdentifierSpecificationContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterIdentityrefSpecification(GeneratedYangParser.IdentityrefSpecificationContext ctx) {
- IdentityrefListener.processIdentityrefEntry(this, ctx);
- }
-
- @Override
- public void exitIdentityrefSpecification(GeneratedYangParser.IdentityrefSpecificationContext ctx) {
- IdentityrefListener.processIdentityrefExit(this, ctx);
- }
-
- @Override
- public void enterUnionSpecification(GeneratedYangParser.UnionSpecificationContext ctx) {
- UnionListener.processUnionEntry(this, ctx);
- }
-
- @Override
- public void exitUnionSpecification(GeneratedYangParser.UnionSpecificationContext ctx) {
- UnionListener.processUnionExit(this, ctx);
- }
-
- @Override
- public void enterBitsSpecification(GeneratedYangParser.BitsSpecificationContext ctx) {
- BitsListener.processBitsEntry(this, ctx);
- }
-
- @Override
- public void exitBitsSpecification(GeneratedYangParser.BitsSpecificationContext ctx) {
- BitsListener.processBitsExit(this, ctx);
- }
-
- @Override
- public void enterBitStatement(GeneratedYangParser.BitStatementContext ctx) {
- BitListener.processBitEntry(this, ctx);
- }
-
- @Override
- public void exitBitStatement(GeneratedYangParser.BitStatementContext ctx) {
- BitListener.processBitExit(this, ctx);
- }
-
- @Override
- public void enterBitBodyStatement(GeneratedYangParser.BitBodyStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitBitBodyStatement(GeneratedYangParser.BitBodyStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterPositionStatement(GeneratedYangParser.PositionStatementContext ctx) {
- PositionListener.processPositionEntry(this, ctx);
- }
-
- @Override
- public void exitPositionStatement(GeneratedYangParser.PositionStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterStatusStatement(GeneratedYangParser.StatusStatementContext ctx) {
- StatusListener.processStatusEntry(this, ctx);
- }
-
- @Override
- public void exitStatusStatement(GeneratedYangParser.StatusStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterConfigStatement(GeneratedYangParser.ConfigStatementContext ctx) {
- ConfigListener.processConfigEntry(this, ctx);
- }
-
- @Override
- public void exitConfigStatement(GeneratedYangParser.ConfigStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterMandatoryStatement(GeneratedYangParser.MandatoryStatementContext ctx) {
- MandatoryListener.processMandatoryEntry(this, ctx);
- }
-
- @Override
- public void exitMandatoryStatement(GeneratedYangParser.MandatoryStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterPresenceStatement(GeneratedYangParser.PresenceStatementContext ctx) {
- PresenceListener.processPresenceEntry(this, ctx);
- }
-
- @Override
- public void exitPresenceStatement(GeneratedYangParser.PresenceStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterOrderedByStatement(GeneratedYangParser.OrderedByStatementContext ctx) {
- handleUnsupportedYangConstruct(YangConstructType.ORDERED_BY_DATA, ctx, CURRENTLY_UNSUPPORTED);
- }
-
- @Override
- public void exitOrderedByStatement(GeneratedYangParser.OrderedByStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterMustStatement(GeneratedYangParser.MustStatementContext ctx) {
- MustListener.processMustEntry(this, ctx);
- }
-
- @Override
- public void exitMustStatement(GeneratedYangParser.MustStatementContext ctx) {
- MustListener.processMustExit(this, ctx);
- }
-
- @Override
- public void enterErrorMessageStatement(GeneratedYangParser.ErrorMessageStatementContext ctx) {
- ErrorMessageListener.processErrorMessageEntry(this, ctx);
- }
-
- @Override
- public void exitErrorMessageStatement(GeneratedYangParser.ErrorMessageStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterErrorAppTagStatement(GeneratedYangParser.ErrorAppTagStatementContext ctx) {
- ErrorAppTagListener.processErrorAppTagMessageEntry(this, ctx);
- }
-
- @Override
- public void exitErrorAppTagStatement(GeneratedYangParser.ErrorAppTagStatementContext ctx) {
- //do nothing
- }
-
- @Override
- public void enterMinElementsStatement(GeneratedYangParser.MinElementsStatementContext ctx) {
- MinElementsListener.processMinElementsEntry(this, ctx);
- }
-
- @Override
- public void exitMinElementsStatement(GeneratedYangParser.MinElementsStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterMaxElementsStatement(GeneratedYangParser.MaxElementsStatementContext ctx) {
- MaxElementsListener.processMaxElementsEntry(this, ctx);
- }
-
- @Override
- public void exitMaxElementsStatement(GeneratedYangParser.MaxElementsStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterValueStatement(GeneratedYangParser.ValueStatementContext ctx) {
- ValueListener.processValueEntry(this, ctx);
- }
-
- @Override
- public void exitValueStatement(GeneratedYangParser.ValueStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterGroupingStatement(GeneratedYangParser.GroupingStatementContext ctx) {
- GroupingListener.processGroupingEntry(this, ctx);
- }
-
- @Override
- public void exitGroupingStatement(GeneratedYangParser.GroupingStatementContext ctx) {
- GroupingListener.processGroupingExit(this, ctx);
- }
-
- @Override
- public void enterContainerStatement(GeneratedYangParser.ContainerStatementContext ctx) {
- ContainerListener.processContainerEntry(this, ctx);
- }
-
- @Override
- public void exitContainerStatement(GeneratedYangParser.ContainerStatementContext ctx) {
- ContainerListener.processContainerExit(this, ctx);
- }
-
- @Override
- public void enterLeafStatement(GeneratedYangParser.LeafStatementContext ctx) {
- LeafListener.processLeafEntry(this, ctx);
- }
-
- @Override
- public void exitLeafStatement(GeneratedYangParser.LeafStatementContext ctx) {
- LeafListener.processLeafExit(this, ctx);
- }
-
- @Override
- public void enterLeafListStatement(GeneratedYangParser.LeafListStatementContext ctx) {
- LeafListListener.processLeafListEntry(this, ctx);
- }
-
- @Override
- public void exitLeafListStatement(GeneratedYangParser.LeafListStatementContext ctx) {
- LeafListListener.processLeafListExit(this, ctx);
- }
-
- @Override
- public void enterListStatement(GeneratedYangParser.ListStatementContext ctx) {
- ListListener.processListEntry(this, ctx);
- }
-
- @Override
- public void exitListStatement(GeneratedYangParser.ListStatementContext ctx) {
- ListListener.processListExit(this, ctx);
- }
-
- @Override
- public void enterKeyStatement(GeneratedYangParser.KeyStatementContext ctx) {
- KeyListener.processKeyEntry(this, ctx);
- }
-
- @Override
- public void exitKeyStatement(GeneratedYangParser.KeyStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterUniqueStatement(GeneratedYangParser.UniqueStatementContext ctx) {
- UniqueListener.processUniqueEntry(this, ctx);
- }
-
- @Override
- public void exitUniqueStatement(GeneratedYangParser.UniqueStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterChoiceStatement(GeneratedYangParser.ChoiceStatementContext ctx) {
- ChoiceListener.processChoiceEntry(this, ctx);
- }
-
- @Override
- public void exitChoiceStatement(GeneratedYangParser.ChoiceStatementContext ctx) {
- ChoiceListener.processChoiceExit(this, ctx);
- }
-
- @Override
- public void enterShortCaseStatement(GeneratedYangParser.ShortCaseStatementContext ctx) {
- ShortCaseListener.processShortCaseEntry(this, ctx);
- }
-
- @Override
- public void exitShortCaseStatement(GeneratedYangParser.ShortCaseStatementContext ctx) {
- ShortCaseListener.processShortCaseExit(this, ctx);
- }
-
- @Override
- public void enterCaseStatement(GeneratedYangParser.CaseStatementContext ctx) {
- CaseListener.processCaseEntry(this, ctx);
- }
-
- @Override
- public void exitCaseStatement(GeneratedYangParser.CaseStatementContext ctx) {
- CaseListener.processCaseExit(this, ctx);
- }
-
- @Override
- public void enterAnyxmlStatement(GeneratedYangParser.AnyxmlStatementContext ctx) {
- handleUnsupportedYangConstruct(YangConstructType.ANYXML_DATA, ctx, UNSUPPORTED_YANG_CONSTRUCT);
- }
-
- @Override
- public void exitAnyxmlStatement(GeneratedYangParser.AnyxmlStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterUsesStatement(GeneratedYangParser.UsesStatementContext ctx) {
- UsesListener.processUsesEntry(this, ctx);
- }
-
- @Override
- public void exitUsesStatement(GeneratedYangParser.UsesStatementContext ctx) {
- UsesListener.processUsesExit(this, ctx);
- }
-
- @Override
- public void enterRefineStatement(GeneratedYangParser.RefineStatementContext ctx) {
- handleUnsupportedYangConstruct(YangConstructType.REFINE_DATA, ctx, UNSUPPORTED_YANG_CONSTRUCT);
- }
-
- @Override
- public void exitRefineStatement(GeneratedYangParser.RefineStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterRefineContainerStatements(GeneratedYangParser.RefineContainerStatementsContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitRefineContainerStatements(GeneratedYangParser.RefineContainerStatementsContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterRefineLeafStatements(GeneratedYangParser.RefineLeafStatementsContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitRefineLeafStatements(GeneratedYangParser.RefineLeafStatementsContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterRefineLeafListStatements(GeneratedYangParser.RefineLeafListStatementsContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitRefineLeafListStatements(GeneratedYangParser.RefineLeafListStatementsContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterRefineListStatements(GeneratedYangParser.RefineListStatementsContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitRefineListStatements(GeneratedYangParser.RefineListStatementsContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterRefineChoiceStatements(GeneratedYangParser.RefineChoiceStatementsContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitRefineChoiceStatements(GeneratedYangParser.RefineChoiceStatementsContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterRefineCaseStatements(GeneratedYangParser.RefineCaseStatementsContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitRefineCaseStatements(GeneratedYangParser.RefineCaseStatementsContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterRefineAnyxmlStatements(GeneratedYangParser.RefineAnyxmlStatementsContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitRefineAnyxmlStatements(GeneratedYangParser.RefineAnyxmlStatementsContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterAugmentStatement(GeneratedYangParser.AugmentStatementContext ctx) {
- AugmentListener.processAugmentEntry(this, ctx);
- }
-
- @Override
- public void exitAugmentStatement(GeneratedYangParser.AugmentStatementContext ctx) {
- AugmentListener.processAugmentExit(this, ctx);
- }
-
- @Override
- public void enterWhenStatement(GeneratedYangParser.WhenStatementContext ctx) {
- WhenListener.processWhenEntry(this, ctx);
- }
-
- @Override
- public void exitWhenStatement(GeneratedYangParser.WhenStatementContext ctx) {
- WhenListener.processWhenExit(this, ctx);
- }
-
- @Override
- public void enterRpcStatement(GeneratedYangParser.RpcStatementContext ctx) {
- RpcListener.processRpcEntry(this, ctx);
- }
-
- @Override
- public void exitRpcStatement(GeneratedYangParser.RpcStatementContext ctx) {
- RpcListener.processRpcExit(this, ctx);
- }
-
- @Override
- public void enterInputStatement(GeneratedYangParser.InputStatementContext ctx) {
- InputListener.processInputEntry(this, ctx);
- }
-
- @Override
- public void exitInputStatement(GeneratedYangParser.InputStatementContext ctx) {
- InputListener.processInputExit(this, ctx);
- }
-
- @Override
- public void enterOutputStatement(GeneratedYangParser.OutputStatementContext ctx) {
- OutputListener.processOutputEntry(this, ctx);
- }
-
- @Override
- public void exitOutputStatement(GeneratedYangParser.OutputStatementContext ctx) {
- OutputListener.processOutputExit(this, ctx);
- }
-
- @Override
- public void enterNotificationStatement(GeneratedYangParser.NotificationStatementContext ctx) {
- NotificationListener.processNotificationEntry(this, ctx);
- }
-
- @Override
- public void exitNotificationStatement(GeneratedYangParser.NotificationStatementContext ctx) {
- NotificationListener.processNotificationExit(this, ctx);
- }
-
- @Override
- public void enterDeviationStatement(GeneratedYangParser.DeviationStatementContext ctx) {
- handleUnsupportedYangConstruct(YangConstructType.DEVIATION_DATA, ctx, UNSUPPORTED_YANG_CONSTRUCT);
- }
-
- @Override
- public void exitDeviationStatement(GeneratedYangParser.DeviationStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterDeviateNotSupportedStatement(GeneratedYangParser.DeviateNotSupportedStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitDeviateNotSupportedStatement(GeneratedYangParser.DeviateNotSupportedStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterDeviateAddStatement(GeneratedYangParser.DeviateAddStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitDeviateAddStatement(GeneratedYangParser.DeviateAddStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterDeviateDeleteStatement(GeneratedYangParser.DeviateDeleteStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitDeviateDeleteStatement(GeneratedYangParser.DeviateDeleteStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterDeviateReplaceStatement(GeneratedYangParser.DeviateReplaceStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitDeviateReplaceStatement(GeneratedYangParser.DeviateReplaceStatementContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterString(GeneratedYangParser.StringContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitString(GeneratedYangParser.StringContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterIdentifier(GeneratedYangParser.IdentifierContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitIdentifier(GeneratedYangParser.IdentifierContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterDateArgumentString(GeneratedYangParser.DateArgumentStringContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitDateArgumentString(GeneratedYangParser.DateArgumentStringContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterRange(GeneratedYangParser.RangeContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitRange(GeneratedYangParser.RangeContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterLength(GeneratedYangParser.LengthContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitLength(GeneratedYangParser.LengthContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterPath(GeneratedYangParser.PathContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitPath(GeneratedYangParser.PathContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterPosition(GeneratedYangParser.PositionContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitPosition(GeneratedYangParser.PositionContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterStatus(GeneratedYangParser.StatusContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitStatus(GeneratedYangParser.StatusContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterConfig(GeneratedYangParser.ConfigContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitConfig(GeneratedYangParser.ConfigContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterMandatory(GeneratedYangParser.MandatoryContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitMandatory(GeneratedYangParser.MandatoryContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterOrderedBy(GeneratedYangParser.OrderedByContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitOrderedBy(GeneratedYangParser.OrderedByContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterMinValue(GeneratedYangParser.MinValueContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitMinValue(GeneratedYangParser.MinValueContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterMaxValue(GeneratedYangParser.MaxValueContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitMaxValue(GeneratedYangParser.MaxValueContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterKey(GeneratedYangParser.KeyContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitKey(GeneratedYangParser.KeyContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterUnique(GeneratedYangParser.UniqueContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitUnique(GeneratedYangParser.UniqueContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterRefine(GeneratedYangParser.RefineContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitRefine(GeneratedYangParser.RefineContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterAugment(GeneratedYangParser.AugmentContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitAugment(GeneratedYangParser.AugmentContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterDeviation(GeneratedYangParser.DeviationContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitDeviation(GeneratedYangParser.DeviationContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterYangConstruct(GeneratedYangParser.YangConstructContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitYangConstruct(GeneratedYangParser.YangConstructContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterCompilerAnnotationStatement(GeneratedYangParser.CompilerAnnotationStatementContext ctx) {
- CompilerAnnotationListener.processCompilerAnnotationEntry(this, ctx);
- }
-
- @Override
- public void exitCompilerAnnotationStatement(GeneratedYangParser.CompilerAnnotationStatementContext ctx) {
- CompilerAnnotationListener.processCompilerAnnotationExit(this, ctx);
- }
-
- @Override
- public void enterCompilerAnnotationBodyStatement(GeneratedYangParser.CompilerAnnotationBodyStatementContext ctx) {
- // do nothing
- }
-
- @Override
- public void exitCompilerAnnotationBodyStatement(GeneratedYangParser.CompilerAnnotationBodyStatementContext ctx) {
- // do nothing
- }
-
- @Override
- public void enterAppDataStructureStatement(GeneratedYangParser.AppDataStructureStatementContext ctx) {
- AppDataStructureListener.processAppDataStructureEntry(this, ctx);
- }
-
- @Override
- public void exitAppDataStructureStatement(GeneratedYangParser.AppDataStructureStatementContext ctx) {
- AppDataStructureListener.processAppDataStructureExit(this, ctx);
- }
-
- @Override
- public void enterAppDataStructure(GeneratedYangParser.AppDataStructureContext currentContext) {
- // do nothing
- }
-
- @Override
- public void exitAppDataStructure(GeneratedYangParser.AppDataStructureContext currentContext) {
- // do nothing
- }
-
- @Override
- public void enterAppExtendedStatement(GeneratedYangParser.AppExtendedStatementContext currentContext) {
- AppExtendedNameListener.processAppExtendedNameEntry(this, currentContext);
- }
-
- @Override
- public void exitAppExtendedStatement(GeneratedYangParser.AppExtendedStatementContext currentContext) {
- // TODO : to be implemented
- }
-
- @Override
- public void enterExtendedName(GeneratedYangParser.ExtendedNameContext currentContext) {
- // do nothing
- }
-
- @Override
- public void exitExtendedName(GeneratedYangParser.ExtendedNameContext currentContext) {
- // do nothing
- }
-
- @Override
- public void enterDataStructureKeyStatement(GeneratedYangParser.DataStructureKeyStatementContext ctx) {
- DataStructureKeyListener.processDataStructureKeyEntry(this, ctx);
- }
-
- @Override
- public void exitDataStructureKeyStatement(GeneratedYangParser.DataStructureKeyStatementContext ctx) {
- // do nothing
- }
-
- @Override
- public void enterVersion(GeneratedYangParser.VersionContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitVersion(GeneratedYangParser.VersionContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterValue(GeneratedYangParser.ValueContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitValue(GeneratedYangParser.ValueContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterRequireInstance(GeneratedYangParser.RequireInstanceContext ctx) {
- // do nothing.
- }
-
- @Override
- public void exitRequireInstance(GeneratedYangParser.RequireInstanceContext ctx) {
- // do nothing.
- }
-
- @Override
- public void enterFraction(GeneratedYangParser.FractionContext ctx) {
- // TODO: implement the method.
- }
-
- @Override
- public void exitFraction(GeneratedYangParser.FractionContext ctx) {
- // TODO: implement the method.
- }
-
- @Override
- public void visitTerminal(TerminalNode terminalNode) {
- // do nothing.
- }
-
- @Override
- public void visitErrorNode(ErrorNode errorNode) {
- // do nothing.
- }
-
- @Override
- public void enterEveryRule(ParserRuleContext parserRuleContext) {
- // do nothing.
- }
-
- @Override
- public void exitEveryRule(ParserRuleContext parserRuleContext) {
- // do nothing.
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/YangUtilsParserManager.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/YangUtilsParserManager.java
deleted file mode 100644
index b04f617..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/YangUtilsParserManager.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * 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.parser.impl;
-
-import java.io.IOException;
-
-import org.antlr.v4.runtime.ANTLRFileStream;
-import org.antlr.v4.runtime.ANTLRInputStream;
-import org.antlr.v4.runtime.CommonTokenStream;
-import org.antlr.v4.runtime.tree.ParseTree;
-import org.antlr.v4.runtime.tree.ParseTreeWalker;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.parser.YangUtilsParser;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangLexer;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.parserutils.ParseTreeErrorListener;
-
-/**
- * Represents file parsing, parse tree creation and data model tree creation
- * corresponding to an input YANG file.
- */
-public class YangUtilsParserManager implements YangUtilsParser {
-
- @Override
- public YangNode getDataModel(String yangFile) throws IOException, ParserException {
-
- /**
- * Create a char stream that reads from YANG file. Throws an exception
- * in case input YANG file is either null or non existent.
- */
- ANTLRInputStream input;
- try {
- input = new ANTLRFileStream(yangFile);
- } catch (IOException e) {
- throw new ParserException("YANG file error : YANG file does not exist.");
- }
-
- // Create a lexer that feeds off of input char stream.
- GeneratedYangLexer lexer = new GeneratedYangLexer(input);
-
- // Create a buffer of tokens pulled from the lexer.
- CommonTokenStream tokens = new CommonTokenStream(lexer);
-
- // Create a parser that feeds off the tokens buffer.
- GeneratedYangParser parser = new GeneratedYangParser(tokens);
-
- // Remove console error listener.
- parser.removeErrorListeners();
-
- // Create instance of customized error listener.
- ParseTreeErrorListener parseTreeErrorListener = new ParseTreeErrorListener();
-
- // Add customized error listener to catch errors during parsing.
- parser.addErrorListener(parseTreeErrorListener);
-
- ParseTree tree;
-
- try {
- // Begin parsing YANG file and generate parse tree.
- tree = parser.yangfile();
- } catch (ParserException parserException) {
- parserException.setFileName(yangFile);
- throw parserException;
- }
-
- // Create a walker to walk the parse tree.
- ParseTreeWalker walker = new ParseTreeWalker();
-
- // Create a listener implementation class object.
- TreeWalkListener treeWalker = new TreeWalkListener();
-
- /**
- * Walk parse tree, provide call backs to methods in listener and build
- * data model tree.
- */
- try {
- walker.walk(treeWalker, tree);
- } catch (ParserException listenerException) {
- // TODO free incomplete data model tree.
- listenerException.setFileName(yangFile);
- throw listenerException;
- } finally {
- // TODO free parsable stack
- }
-
- // Returns the Root Node of the constructed data model tree.
- return treeWalker.getRootNode();
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/AppDataStructureListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/AppDataStructureListener.java
deleted file mode 100644
index e6628b3..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/AppDataStructureListener.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangAppDataStructure;
-import org.onosproject.yangutils.datamodel.YangCompilerAnnotation;
-import org.onosproject.yangutils.datamodel.YangDataStructure;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.YangDataStructure.getType;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.APP_DATA_STRUCTURE;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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_CURRENT_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getValidPrefix;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * app-data-structure-stmt = prefix:app-data-structure-keyword string
- * (";" /
- * "{"
- * [data-structure-key-stmt stmtsep]
- * "}")
- *
- * ANTLR grammar rule
- * appDataStructureStatement : APP_DATA_STRUCTURE appDataStructure (STMTEND | (LEFT_CURLY_BRACE
- * dataStructureKeyStatement? RIGHT_CURLY_BRACE));
- */
-
-/**
- * Represents listener based call back function corresponding to the "app-data-structure"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class AppDataStructureListener {
-
- /**
- * Creates a new app-data-structure listener.
- */
- private AppDataStructureListener() {
- }
-
- /**
- * Performs validation and updates the data model tree. It is called when parser receives an
- * input matching the grammar rule(app-data-structure).
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processAppDataStructureEntry(TreeWalkListener listener,
- GeneratedYangParser.AppDataStructureStatementContext ctx) {
-
- checkStackIsNotEmpty(listener, MISSING_HOLDER, APP_DATA_STRUCTURE, "", ENTRY);
-
- String prefix = getValidPrefix(ctx.APP_DATA_STRUCTURE().getText(), APP_DATA_STRUCTURE, ctx);
- YangDataStructure dataStructure = getType(ctx.appDataStructure().getText());
-
- YangAppDataStructure appDataStructure = new YangAppDataStructure();
- appDataStructure.setPrefix(prefix);
- appDataStructure.setDataStructure(dataStructure);
-
- Parsable curData = listener.getParsedDataStack().peek();
- if (curData instanceof YangCompilerAnnotation) {
- YangCompilerAnnotation compilerAnnotation = ((YangCompilerAnnotation) curData);
- compilerAnnotation.setYangAppDataStructure(appDataStructure);
- listener.getParsedDataStack().push(appDataStructure);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, APP_DATA_STRUCTURE,
- "", ENTRY));
- }
- }
-
- /**
- * Performs validation and updates the data model tree. It is called when parser
- * exits from grammar rule (app-data-structure).
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processAppDataStructureExit(TreeWalkListener listener,
- GeneratedYangParser.AppDataStructureStatementContext ctx) {
-
- checkStackIsNotEmpty(listener, MISSING_HOLDER, APP_DATA_STRUCTURE, "", EXIT);
- if (!(listener.getParsedDataStack().peek() instanceof YangAppDataStructure)) {
- throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, APP_DATA_STRUCTURE,
- "", EXIT));
- }
- listener.getParsedDataStack().pop();
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/AppExtendedNameListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/AppExtendedNameListener.java
deleted file mode 100644
index 3ec31c7..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/AppExtendedNameListener.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangAppExtendedName;
-import org.onosproject.yangutils.datamodel.YangCompilerAnnotation;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.APP_EXTENDED_NAME_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.ListenerUtil.getValidPrefix;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.removeQuotesAndHandleConcat;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * app-extended-stmt = prefix:app-extended-name-keyword string ";"
- *
- * ANTLR grammar rule
- * appExtendedStatement : APP_EXTENDED extendedName STMTEND;
- */
-
-/**
- * Represents listener based call back function corresponding to the "app-extended-name"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class AppExtendedNameListener {
-
- /**
- * Creates a new app-extended-name listener.
- */
- private AppExtendedNameListener() {
- }
-
- /**
- * Performs validation and updates the data model tree. It is called when parser receives an
- * input matching the grammar rule(app-extended-name).
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processAppExtendedNameEntry(TreeWalkListener listener,
- GeneratedYangParser.AppExtendedStatementContext ctx) {
-
- checkStackIsNotEmpty(listener, MISSING_HOLDER, APP_EXTENDED_NAME_DATA, ctx.extendedName().getText(), ENTRY);
-
- String prefix = getValidPrefix(ctx.APP_EXTENDED().getText(), APP_EXTENDED_NAME_DATA, ctx);
- YangAppExtendedName extendedName = new YangAppExtendedName();
- extendedName.setPrefix(prefix);
- extendedName.setYangAppExtendedName(removeQuotesAndHandleConcat(ctx.extendedName().getText()));
-
- Parsable curData = listener.getParsedDataStack().peek();
- if (curData instanceof YangCompilerAnnotation) {
- YangCompilerAnnotation compilerAnnotation = ((YangCompilerAnnotation) curData);
- compilerAnnotation.setYangAppExtendedName(extendedName);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, APP_EXTENDED_NAME_DATA,
- ctx.extendedName().getText(), ENTRY));
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ArgumentListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ArgumentListener.java
deleted file mode 100644
index 2d06fa4..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ArgumentListener.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangExtension;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.ARGUMENT_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.ListenerUtil.getValidIdentifier;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * argument-stmt = argument-keyword sep identifier-arg-str optsep
- * (";" /
- * "{" stmtsep
- * [yin-element-stmt stmtsep]
- * "}")
- * *
- * ANTLR grammar rule
- * argumentStatement : ARGUMENT_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE argumentBody RIGHT_CURLY_BRACE);
- * argumentBody : yinElementStatement?;
- */
-
-/**
- * Represents listener based call back function corresponding to the "argument"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class ArgumentListener {
-
- /**
- * Creates a new argument listener.
- */
- private ArgumentListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule
- * (argument), performs validation and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processArgumentEntry(TreeWalkListener listener,
- GeneratedYangParser.ArgumentStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, ARGUMENT_DATA, ctx.identifier().getText(), ENTRY);
-
- String identifier = getValidIdentifier(ctx.identifier().getText(), ARGUMENT_DATA, ctx);
-
- Parsable curData = listener.getParsedDataStack().peek();
- if (curData instanceof YangExtension) {
- YangExtension extension = ((YangExtension) curData);
- extension.setArgumentName(identifier);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, ARGUMENT_DATA,
- ctx.identifier().getText(), ENTRY));
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/AugmentListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/AugmentListener.java
deleted file mode 100644
index 6c6a38d..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/AugmentListener.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import java.util.List;
-
-import org.onosproject.yangutils.datamodel.YangAtomicPath;
-import org.onosproject.yangutils.datamodel.YangAugment;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.datamodel.YangUses;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.linker.impl.YangResolutionInfoImpl;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.addResolutionInfo;
-import static org.onosproject.yangutils.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.AUGMENT_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.CASE_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.DATA_DEF_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.DESCRIPTION_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.REFERENCE_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.STATUS_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.WHEN_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerCollisionDetector.detectCollidingChildUtil;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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_CURRENT_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.getValidAbsoluteSchemaNodeId;
-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.parser.impl.parserutils.ListenerValidation.validateCardinalityEitherOne;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.validateCardinalityMaxOne;
-import static org.onosproject.yangutils.translator.tojava.YangDataModelFactory.getYangAugmentNode;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * augment-stmt = augment-keyword sep augment-arg-str optsep
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [when-stmt stmtsep]
- * *(if-feature-stmt stmtsep)
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * 1*((data-def-stmt stmtsep) /
- * (case-stmt stmtsep))
- * "}"
- *
- * ANTLR grammar rule
- * augmentStatement : AUGMENT_KEYWORD augment LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | statusStatement
- * | descriptionStatement | referenceStatement | dataDefStatement | caseStatement)* RIGHT_CURLY_BRACE;
- */
-
-/**
- * Represents listener based call back function corresponding to the "augment"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class AugmentListener {
-
- /**
- * Creates a new augment listener.
- */
- private AugmentListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule
- * (augment), performs validation and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processAugmentEntry(TreeWalkListener listener,
- GeneratedYangParser.AugmentStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, AUGMENT_DATA, ctx.augment().getText(), ENTRY);
-
- // Validate augment argument string
- List<YangAtomicPath> targetNodes = getValidAbsoluteSchemaNodeId(ctx.augment().getText(),
- AUGMENT_DATA, ctx);
-
- // Validate sub statement cardinality.
- validateSubStatementsCardinality(ctx);
-
- // Check for identifier collision
- int line = ctx.getStart().getLine();
- int charPositionInLine = ctx.getStart().getCharPositionInLine();
- detectCollidingChildUtil(listener, line, charPositionInLine, "", AUGMENT_DATA);
-
- Parsable curData = listener.getParsedDataStack().peek();
- if (curData instanceof YangModule || curData instanceof YangSubModule || curData instanceof YangUses) {
- YangNode curNode = (YangNode) curData;
- YangAugment yangAugment = getYangAugmentNode(JAVA_GENERATION);
-
- //validateTargetNodePath(targetNodes, curNode, ctx);
- // TODO: handle in linker.
-
- yangAugment.setTargetNode(targetNodes);
- yangAugment.setName(removeQuotesAndHandleConcat(ctx.augment().getText()));
-
- try {
- curNode.addChild(yangAugment);
- } catch (DataModelException e) {
- throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
- AUGMENT_DATA, ctx.augment().getText(), ENTRY, e.getMessage()));
- }
- listener.getParsedDataStack().push(yangAugment);
-
- // Add resolution information to the list
- YangResolutionInfoImpl resolutionInfo = new YangResolutionInfoImpl<YangAugment>(yangAugment,
- curNode, line,
- charPositionInLine);
- addToResolutionList(resolutionInfo, ctx);
-
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, AUGMENT_DATA,
- ctx.augment().getText(), ENTRY));
- }
-
- }
-
- /**
- * It is called when parser exits from grammar rule (augment), it perform
- * validations and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processAugmentExit(TreeWalkListener listener,
- GeneratedYangParser.AugmentStatementContext ctx) {
-
- //Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, AUGMENT_DATA, ctx.augment().getText(), EXIT);
-
- if (!(listener.getParsedDataStack().peek() instanceof YangAugment)) {
- throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, AUGMENT_DATA,
- ctx.augment().getText(), EXIT));
- }
- listener.getParsedDataStack().pop();
- }
-
- /**
- * Validates the cardinality of augment sub-statements as per grammar.
- *
- * @param ctx context object of the grammar rule
- */
- private static void validateSubStatementsCardinality(GeneratedYangParser.AugmentStatementContext ctx) {
- validateCardinalityMaxOne(ctx.statusStatement(), STATUS_DATA, AUGMENT_DATA, ctx.augment().getText());
- validateCardinalityMaxOne(ctx.descriptionStatement(), DESCRIPTION_DATA, AUGMENT_DATA, ctx.augment().getText());
- validateCardinalityMaxOne(ctx.referenceStatement(), REFERENCE_DATA, AUGMENT_DATA, ctx.augment().getText());
- validateCardinalityMaxOne(ctx.whenStatement(), WHEN_DATA, AUGMENT_DATA, ctx.augment().getText());
- validateCardinalityEitherOne(ctx.dataDefStatement(), DATA_DEF_DATA, ctx.caseStatement(),
- CASE_DATA, AUGMENT_DATA, ctx.augment().getText(), ctx);
- }
-
- /**
- * Add to resolution list.
- *
- * @param resolutionInfo resolution information.
- * @param ctx context object of the grammar rule
- */
- private static void addToResolutionList(YangResolutionInfoImpl<YangAugment> resolutionInfo,
- GeneratedYangParser.AugmentStatementContext ctx) {
-
- try {
- addResolutionInfo(resolutionInfo);
- } catch (DataModelException e) {
- throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
- AUGMENT_DATA, ctx.augment().getText(), EXIT, e.getMessage()));
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/BaseFileListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/BaseFileListener.java
deleted file mode 100644
index 8ba4d02..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/BaseFileListener.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.YANGBASE_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_CHILD;
-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.checkStackIsEmpty;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ANTLR grammar rule
- * yangfile : module_stmt
- * | submodule_stmt;
- */
-
-/**
- * Representation of call back function corresponding to the "base rule" defined in
- * ANTLR grammar file.
- */
-public final class BaseFileListener {
-
- /**
- * Creates a new base listener.
- */
- private BaseFileListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule
- * (yangfile), perform validations and update the data model tree.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processYangFileEntry(TreeWalkListener listener, GeneratedYangParser.YangfileContext ctx) {
-
- // Check if stack is empty.
- checkStackIsEmpty(listener, INVALID_HOLDER, YANGBASE_DATA, "", ENTRY);
-
- }
-
- /**
- * It is called when parser exits from grammar rule (yangfile), it perform
- * validations and update the data model tree.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processYangFileExit(TreeWalkListener listener, GeneratedYangParser.YangfileContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, YANGBASE_DATA, "", EXIT);
-
- // Data Model tree root node is set.
- if (listener.getParsedDataStack().peek() instanceof YangModule
- || listener.getParsedDataStack().peek() instanceof YangSubModule) {
- listener.setRootNode((YangNode) listener.getParsedDataStack().pop());
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_CHILD, YANGBASE_DATA, "", EXIT));
- }
-
- // Check if stack is empty.
- checkStackIsEmpty(listener, INVALID_HOLDER, YANGBASE_DATA, "", EXIT);
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/BaseListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/BaseListener.java
deleted file mode 100644
index 1925375..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/BaseListener.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangBase;
-import org.onosproject.yangutils.datamodel.YangIdentity;
-import org.onosproject.yangutils.datamodel.YangIdentityRef;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeIdentifier;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.linker.impl.YangResolutionInfoImpl;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.addResolutionInfo;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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.*;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getValidNodeIdentifier;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.BASE_DATA;
-
-/**
- * base-stmt = base-keyword sep identifier-ref-arg-str
- * optsep stmtend*
- * identifier-ref-arg = [prefix ":"] identifier
- */
-
-/**
- * Represents listener based call back function corresponding to the "base"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class BaseListener {
-
- //Creates a new base listener.
- private BaseListener() {
- }
-
- /**
- * Performs validation and updates the data model tree when parser receives an
- * input matching the grammar rule (base).
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processBaseEntry(TreeWalkListener listener,
- GeneratedYangParser.BaseStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, BASE_DATA, ctx.string().getText(), ENTRY);
-
- YangNodeIdentifier nodeIdentifier = getValidNodeIdentifier(ctx.string().getText(), BASE_DATA, ctx);
-
- Parsable tmpData = listener.getParsedDataStack().peek();
-
- /**
- * For identityref base node identifier is copied in identity listener itself, so no need to process
- * base statement for indentityref
- */
- if (tmpData instanceof YangIdentityRef) {
- return;
- }
-
- if (!(tmpData instanceof YangIdentity)) {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, BASE_DATA,
- ctx.string().getText(), ENTRY));
- }
-
- YangBase yangBase = new YangBase();
- yangBase.setBaseIdentifier(nodeIdentifier);
- ((YangIdentity) tmpData).setBaseNode(yangBase);
-
- int errorLine = ctx.getStart().getLine();
- int errorPosition = ctx.getStart().getCharPositionInLine();
-
- // Add resolution information to the list
- YangResolutionInfoImpl resolutionInfo =
- new YangResolutionInfoImpl<YangBase>(yangBase, (YangNode) tmpData, errorLine, errorPosition);
- addToResolutionList(resolutionInfo, ctx);
- }
-
- /**
- * Add to resolution list.
- *
- * @param resolutionInfo resolution information
- * @param ctx context object of the grammar rule
- */
- private static void addToResolutionList(YangResolutionInfoImpl<YangBase> resolutionInfo,
- GeneratedYangParser.BaseStatementContext ctx) {
-
- try {
- addResolutionInfo(resolutionInfo);
- } catch (DataModelException e) {
- throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
- BASE_DATA, ctx.string().getText(), EXIT, e.getMessage()));
- }
- }
-
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/BelongsToListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/BelongsToListener.java
deleted file mode 100644
index ab12d46..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/BelongsToListener.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangBelongsTo;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.BELONGS_TO_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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_CURRENT_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * submodule-header-stmts =
- * ;; these stmts can appear in any order
- * [yang-version-stmt stmtsep]
- * belongs-to-stmt stmtsep
- *
- * belongs-to-stmt = belongs-to-keyword sep identifier-arg-str
- * optsep
- * "{" stmtsep
- * prefix-stmt stmtsep
- * "}"
- *
- * ANTLR grammar rule
- * submodule_header_statement : yang_version_stmt? belongs_to_stmt
- * | belongs_to_stmt yang_version_stmt?
- * ;
- * belongs_to_stmt : BELONGS_TO_KEYWORD identifier LEFT_CURLY_BRACE belongs_to_stmt_body RIGHT_CURLY_BRACE;
- * belongs_to_stmt_body : prefix_stmt;
- */
-
-/**
- * Represents listener based call back function corresponding to the
- * "belongs to" rule defined in ANTLR grammar file for corresponding ABNF rule
- * in RFC 6020.
- */
-public final class BelongsToListener {
-
- /**
- * Creates a new belongto listener.
- */
- private BelongsToListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule
- * (belongsto), perform validations and update the data model tree.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processBelongsToEntry(TreeWalkListener listener,
- GeneratedYangParser.BelongstoStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, BELONGS_TO_DATA, ctx.identifier().getText(),
- ENTRY);
-
- String identifier = getValidIdentifier(ctx.identifier().getText(), BELONGS_TO_DATA, ctx);
-
- YangBelongsTo belongstoNode = new YangBelongsTo();
- belongstoNode.setBelongsToModuleName(identifier);
-
- // Set the line number and character position in line for the belongs to.
- int errorLine = ctx.getStart().getLine();
- int errorPosition = ctx.getStart().getCharPositionInLine();
- belongstoNode.setLineNumber(errorLine);
- belongstoNode.setCharPosition(errorPosition);
-
- // Push belongsto into the stack.
- listener.getParsedDataStack().push(belongstoNode);
- }
-
- /**
- * It is called when parser exits from grammar rule (belongsto), it perform
- * validations and update the data model tree.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processBelongsToExit(TreeWalkListener listener,
- GeneratedYangParser.BelongstoStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, BELONGS_TO_DATA, ctx.identifier().getText(),
- EXIT);
-
- Parsable tmpBelongstoNode = listener.getParsedDataStack().peek();
- if (tmpBelongstoNode instanceof YangBelongsTo) {
- listener.getParsedDataStack().pop();
-
- // Check for stack to be empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, BELONGS_TO_DATA,
- ctx.identifier().getText(), EXIT);
-
- Parsable tmpNode = listener.getParsedDataStack().peek();
- switch (tmpNode.getYangConstructType()) {
- case SUB_MODULE_DATA: {
- YangSubModule subModule = (YangSubModule) tmpNode;
- subModule.setBelongsTo((YangBelongsTo) tmpBelongstoNode);
- subModule.setPrefix(subModule.getBelongsTo().getPrefix());
- break;
- }
- default:
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, BELONGS_TO_DATA,
- ctx.identifier().getText(),
- EXIT));
- }
- } else {
- throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, BELONGS_TO_DATA,
- ctx.identifier().getText(), EXIT));
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/BitListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/BitListener.java
deleted file mode 100644
index 4dce199..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/BitListener.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * bit-stmt = bit-keyword sep identifier-arg-str optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [position-stmt stmtsep]
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * "}"
- * "}")
- *
- * ANTLR grammar rule
- * bitStatement : BIT_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE bitBodyStatement RIGHT_CURLY_BRACE);
- *
- * bitBodyStatement : positionStatement? statusStatement? descriptionStatement? referenceStatement?
- * | positionStatement? statusStatement? referenceStatement? descriptionStatement?
- * | positionStatement? descriptionStatement? statusStatement? referenceStatement?
- * | positionStatement? descriptionStatement? referenceStatement? statusStatement?
- * | positionStatement? referenceStatement? statusStatement? descriptionStatement?
- * | positionStatement? referenceStatement? descriptionStatement? statusStatement?
- * | statusStatement? positionStatement? descriptionStatement? referenceStatement?
- * | statusStatement? positionStatement? referenceStatement? descriptionStatement?
- * | statusStatement? descriptionStatement? descriptionStatement? positionStatement?
- * | statusStatement? descriptionStatement? positionStatement? descriptionStatement?
- * | statusStatement? referenceStatement? positionStatement? descriptionStatement?
- * | statusStatement? referenceStatement? descriptionStatement? positionStatement?
- * | descriptionStatement? positionStatement? statusStatement? referenceStatement?
- * | descriptionStatement? positionStatement? referenceStatement? statusStatement?
- * | descriptionStatement? statusStatement? positionStatement? referenceStatement?
- * | descriptionStatement? statusStatement? referenceStatement? positionStatement?
- * | descriptionStatement? referenceStatement? positionStatement? statusStatement?
- * | descriptionStatement? referenceStatement? statusStatement? positionStatement?
- * | referenceStatement? positionStatement? descriptionStatement? statusStatement?
- * | referenceStatement? positionStatement? statusStatement? descriptionStatement?
- * | referenceStatement? statusStatement? descriptionStatement? positionStatement?
- * | referenceStatement? statusStatement? positionStatement? descriptionStatement?
- * | referenceStatement? descriptionStatement? positionStatement? statusStatement?
- * | referenceStatement? descriptionStatement? statusStatement? positionStatement?
- * ;
- */
-
-import java.util.Map;
-
-import org.onosproject.yangutils.datamodel.YangBit;
-import org.onosproject.yangutils.datamodel.YangBits;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.BIT_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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_CONTENT;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-
-/**
- * Represents listener based call back function corresponding to the "bit"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class BitListener {
-
- /**
- * Creates a new bit listener.
- */
- private BitListener() {
- }
-
- /**
- * It is called when parser enters grammar rule (bit), it perform
- * validations and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processBitEntry(TreeWalkListener listener,
- GeneratedYangParser.BitStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, BIT_DATA, ctx.identifier().getText(), ENTRY);
-
- String identifier = getValidIdentifier(ctx.identifier().getText(), BIT_DATA, ctx);
-
- YangBit bitNode = new YangBit();
- bitNode.setBitName(identifier);
- listener.getParsedDataStack().push(bitNode);
- }
-
- /**
- * It is called when parser exits from grammar rule (bit), it perform
- * validations and update the data model tree.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processBitExit(TreeWalkListener listener,
- GeneratedYangParser.BitStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, BIT_DATA, ctx.identifier().getText(), EXIT);
-
- Parsable tmpBitNode = listener.getParsedDataStack().peek();
- if (tmpBitNode instanceof YangBit) {
- listener.getParsedDataStack().pop();
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, BIT_DATA, ctx.identifier().getText(), EXIT);
-
- Parsable tmpNode = listener.getParsedDataStack().peek();
- switch (tmpNode.getYangConstructType()) {
- case BITS_DATA: {
- YangBits yangBits = (YangBits) tmpNode;
- if (ctx.bitBodyStatement() == null || ctx.bitBodyStatement().positionStatement() == null) {
- int maxPosition = 0;
- boolean isPositionPresent = false;
-
- for (Map.Entry<Integer, YangBit> element : yangBits.getBitPositionMap().entrySet()) {
- if (maxPosition <= element.getKey()) {
- maxPosition = element.getKey();
- isPositionPresent = true;
- }
- }
-
- if (isPositionPresent) {
- maxPosition++;
- }
- ((YangBit) tmpBitNode).setPosition(maxPosition);
- }
- try {
- yangBits.addBitInfo((YangBit) tmpBitNode);
- } catch (DataModelException e) {
- ParserException parserException = new ParserException(constructExtendedListenerErrorMessage(
- INVALID_CONTENT, BIT_DATA, ctx.identifier().getText(), EXIT, e.getMessage()));
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
- break;
- }
- default:
- throw new ParserException(
- constructListenerErrorMessage(INVALID_HOLDER, BIT_DATA, ctx.identifier().getText(), EXIT));
- }
- } else {
- throw new ParserException(
- constructListenerErrorMessage(MISSING_CURRENT_HOLDER, BIT_DATA, ctx.identifier().getText(), EXIT));
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/BitsListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/BitsListener.java
deleted file mode 100644
index c53a516..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/BitsListener.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * type-body-stmts = numerical-restrictions /
- * decimal64-specification /
- * string-restrictions /
- * enum-specification /
- * leafref-specification /
- * identityref-specification /
- * instance-identifier-specification /
- * bits-specification /
- * union-specification
- *
- * bits-specification = 1*(bit-stmt stmtsep)
- *
- * ANTLR grammar rule
- *
- * typeBodyStatements : numericalRestrictions | stringRestrictions | enumSpecification
- * | leafrefSpecification | identityrefSpecification | instanceIdentifierSpecification
- * | bitsSpecification | unionSpecification;
- *
- * bitsSpecification : bitStatement+;
- */
-
-import org.onosproject.yangutils.datamodel.YangBits;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangLeafList;
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.datamodel.YangTypeDef;
-import org.onosproject.yangutils.datamodel.YangUnion;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.BITS_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.TYPE_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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_CURRENT_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-
-/**
- * Represents listener based call back function corresponding to the "bits" rule
- * defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class BitsListener {
-
- /**
- * Creates a new bits listener.
- */
- private BitsListener() {
- }
-
- /**
- * It is called when parser enters grammar rule (bits), it perform
- * validations and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processBitsEntry(TreeWalkListener listener,
- GeneratedYangParser.BitsSpecificationContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, BITS_DATA, "", ENTRY);
-
- if (listener.getParsedDataStack().peek() instanceof YangType) {
- YangBits bitsNode = new YangBits();
- Parsable typeData = listener.getParsedDataStack().pop();
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, BITS_DATA, "", ENTRY);
-
- Parsable tmpData = listener.getParsedDataStack().peek();
-
- switch (tmpData.getYangConstructType()) {
- case LEAF_DATA:
- bitsNode.setBitsName(((YangLeaf) tmpData).getName());
- break;
- case LEAF_LIST_DATA:
- bitsNode.setBitsName(((YangLeafList) tmpData).getName());
- break;
- case TYPEDEF_DATA:
- bitsNode.setBitsName(((YangTypeDef) tmpData).getName());
- break;
- case UNION_DATA:
- bitsNode.setBitsName(((YangUnion) tmpData).getName());
- break;
- // TODO typedef, union, deviate.
- default:
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, TYPE_DATA,
- ((YangType<?>) typeData).getDataTypeName(), ENTRY));
- }
- listener.getParsedDataStack().push(typeData);
- listener.getParsedDataStack().push(bitsNode);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, BITS_DATA, "", ENTRY));
- }
- }
-
- /**
- * It is called when parser exits from grammar rule (bits), it perform
- * validations and update the data model tree.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processBitsExit(TreeWalkListener listener,
- GeneratedYangParser.BitsSpecificationContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, BITS_DATA, "", EXIT);
-
- Parsable tmpBitsNode = listener.getParsedDataStack().peek();
- if (tmpBitsNode instanceof YangBits) {
- YangBits bitsNode = (YangBits) tmpBitsNode;
- listener.getParsedDataStack().pop();
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, BITS_DATA, "", EXIT);
-
- Parsable tmpNode = listener.getParsedDataStack().peek();
- switch (tmpNode.getYangConstructType()) {
- case TYPE_DATA: {
- YangType<YangBits> typeNode = (YangType<YangBits>) tmpNode;
- typeNode.setDataTypeExtendedInfo(bitsNode);
- break;
- }
- default:
- throw new ParserException(
- constructListenerErrorMessage(INVALID_HOLDER, BITS_DATA, "", EXIT));
- }
- } else {
- throw new ParserException(
- constructListenerErrorMessage(MISSING_CURRENT_HOLDER, BITS_DATA, "", EXIT));
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/CaseListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/CaseListener.java
deleted file mode 100644
index 3078c08..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/CaseListener.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangAugment;
-import org.onosproject.yangutils.datamodel.YangCase;
-import org.onosproject.yangutils.datamodel.YangChoice;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.CASE_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.DESCRIPTION_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.REFERENCE_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.STATUS_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.WHEN_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerCollisionDetector.detectCollidingChildUtil;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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_CURRENT_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.getValidIdentifier;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.validateCardinalityMaxOne;
-import static org.onosproject.yangutils.translator.tojava.YangDataModelFactory.getYangCaseNode;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * case-stmt = case-keyword sep identifier-arg-str optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [when-stmt stmtsep]
- * *(if-feature-stmt stmtsep)
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * *(data-def-stmt stmtsep)
- * "}")
- *
- * ANTLR grammar rule
- * caseStatement : CASE_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement
- * | statusStatement | descriptionStatement | referenceStatement | dataDefStatement)* RIGHT_CURLY_BRACE);
- */
-
-/**
- * Represents listener based call back function corresponding to the "case" rule
- * defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class CaseListener {
-
- /**
- * Create a new case listener.
- */
- private CaseListener() {
- }
-
- /**
- * It is called when parser enters grammar rule (case), it perform
- * validations and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processCaseEntry(TreeWalkListener listener,
- GeneratedYangParser.CaseStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, CASE_DATA, ctx.identifier().getText(), ENTRY);
-
- // Check validity of identifier and remove double quotes.
- String identifier = getValidIdentifier(ctx.identifier().getText(), CASE_DATA, ctx);
-
- // Validate sub statement cardinality.
- validateSubStatementsCardinality(ctx);
-
- Parsable curData = listener.getParsedDataStack().peek();
-
- // Check for identifier collision
- int line = ctx.getStart().getLine();
- int charPositionInLine = ctx.getStart().getCharPositionInLine();
- detectCollidingChildUtil(listener, line, charPositionInLine, identifier, CASE_DATA);
-
- if (curData instanceof YangChoice || curData instanceof YangAugment) {
- YangCase caseNode = getYangCaseNode(JAVA_GENERATION);
- caseNode.setName(identifier);
- YangNode curNode = (YangNode) curData;
- try {
- curNode.addChild(caseNode);
- } catch (DataModelException e) {
- throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
- CASE_DATA, ctx.identifier().getText(), ENTRY, e.getMessage()));
- }
- listener.getParsedDataStack().push(caseNode);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, CASE_DATA,
- ctx.identifier().getText(), ENTRY));
- }
- }
-
- /**
- * It is called when parser exits from grammar rule (case), it perform
- * validations and update the data model tree.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processCaseExit(TreeWalkListener listener,
- GeneratedYangParser.CaseStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, CASE_DATA, ctx.identifier().getText(), EXIT);
-
- if (listener.getParsedDataStack().peek() instanceof YangCase) {
- listener.getParsedDataStack().pop();
- } else {
- throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, CASE_DATA,
- ctx.identifier().getText(), EXIT));
- }
- }
-
- /**
- * Validates the cardinality of case sub-statements as per grammar.
- *
- * @param ctx context object of the grammar rule
- */
- private static void validateSubStatementsCardinality(GeneratedYangParser.CaseStatementContext ctx) {
-
- validateCardinalityMaxOne(ctx.whenStatement(), WHEN_DATA, CASE_DATA, ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.statusStatement(), STATUS_DATA, CASE_DATA, ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.descriptionStatement(), DESCRIPTION_DATA, CASE_DATA, ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.referenceStatement(), REFERENCE_DATA, CASE_DATA, ctx.identifier().getText());
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ChoiceListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ChoiceListener.java
deleted file mode 100644
index 1bfee32..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ChoiceListener.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangAugment;
-import org.onosproject.yangutils.datamodel.YangCase;
-import org.onosproject.yangutils.datamodel.YangChoice;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangGrouping;
-import org.onosproject.yangutils.datamodel.YangInput;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNotification;
-import org.onosproject.yangutils.datamodel.YangOutput;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.CHOICE_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.CONFIG_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.DEFAULT_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.DESCRIPTION_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.MANDATORY_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.REFERENCE_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.STATUS_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.WHEN_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerCollisionDetector.detectCollidingChildUtil;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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.INVALID_CONTENT;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_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.getValidIdentifier;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.validateCardinalityMaxOne;
-import static org.onosproject.yangutils.translator.tojava.YangDataModelFactory.getYangChoiceNode;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * choice-stmt = choice-keyword sep identifier-arg-str optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [when-stmt stmtsep]
- * *(if-feature-stmt stmtsep)
- * [default-stmt stmtsep]
- * [config-stmt stmtsep]
- * [mandatory-stmt stmtsep]
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * *((short-case-stmt / case-stmt) stmtsep)
- * "}")
- *
- * ANTLR grammar rule
- * choiceStatement : CHOICE_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement
- * | defaultStatement | configStatement | mandatoryStatement | statusStatement | descriptionStatement
- * | referenceStatement | shortCaseStatement | caseStatement)* RIGHT_CURLY_BRACE);
- */
-
-/**
- * Represents listener based call back function corresponding to the "choice"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class ChoiceListener {
-
- /**
- * Create a new choice listener.
- */
- private ChoiceListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule
- * (choice), perform validations and update the data model tree.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processChoiceEntry(TreeWalkListener listener,
- GeneratedYangParser.ChoiceStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, CHOICE_DATA, ctx.identifier().getText(), ENTRY);
-
- // Check validity of identifier and remove double quotes.
- String identifier = getValidIdentifier(ctx.identifier().getText(), CHOICE_DATA, ctx);
-
- // Validate sub statement cardinality.
- validateSubStatementsCardinality(ctx);
-
- Parsable curData = listener.getParsedDataStack().peek();
-
- // Check for identifier collision
- int line = ctx.getStart().getLine();
- int charPositionInLine = ctx.getStart().getCharPositionInLine();
- detectCollidingChildUtil(listener, line, charPositionInLine, identifier, CHOICE_DATA);
-
- if (curData instanceof YangModule || curData instanceof YangSubModule || curData instanceof YangContainer
- || curData instanceof YangList || curData instanceof YangCase || curData instanceof YangGrouping
- || curData instanceof YangAugment || curData instanceof YangInput || curData instanceof YangOutput
- || curData instanceof YangNotification) {
-
- YangChoice choiceNode = getYangChoiceNode(JAVA_GENERATION);
- choiceNode.setName(identifier);
-
- YangNode curNode = (YangNode) curData;
- try {
- curNode.addChild(choiceNode);
- } catch (DataModelException e) {
- throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
- CHOICE_DATA, ctx.identifier().getText(), ENTRY, e.getMessage()));
- }
- listener.getParsedDataStack().push(choiceNode);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER,
- CHOICE_DATA, ctx.identifier().getText(), ENTRY));
- }
- }
-
- /**
- * It is called when parser exits from grammar rule (choice), it perform
- * validations and update the data model tree.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processChoiceExit(TreeWalkListener listener,
- GeneratedYangParser.ChoiceStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, CHOICE_DATA, ctx.identifier().getText(), EXIT);
-
- if (listener.getParsedDataStack().peek() instanceof YangChoice) {
- YangChoice choiceNode = (YangChoice) listener.getParsedDataStack().peek();
- try {
- choiceNode.validateDataOnExit();
- } catch (DataModelException e) {
- throw new ParserException(constructListenerErrorMessage(INVALID_CONTENT, CHOICE_DATA,
- ctx.identifier().getText(), EXIT));
- }
- listener.getParsedDataStack().pop();
- } else {
- throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, CHOICE_DATA,
- ctx.identifier().getText(), EXIT));
- }
- }
-
- /**
- * Validates the cardinality of choice sub-statements as per grammar.
- *
- * @param ctx context object of the grammar rule.
- */
- private static void validateSubStatementsCardinality(GeneratedYangParser.ChoiceStatementContext ctx) {
-
- validateCardinalityMaxOne(ctx.whenStatement(), WHEN_DATA, CHOICE_DATA, ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.defaultStatement(), DEFAULT_DATA, CHOICE_DATA, ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.configStatement(), CONFIG_DATA, CHOICE_DATA, ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.mandatoryStatement(), MANDATORY_DATA, CHOICE_DATA, ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.statusStatement(), STATUS_DATA, CHOICE_DATA, ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.descriptionStatement(), DESCRIPTION_DATA, CHOICE_DATA,
- ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.referenceStatement(), REFERENCE_DATA, CHOICE_DATA, ctx.identifier().getText());
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/CompilerAnnotationListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/CompilerAnnotationListener.java
deleted file mode 100644
index c89e99a..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/CompilerAnnotationListener.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangCompilerAnnotation;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.COMPILER_ANNOTATION_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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_CURRENT_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getValidPrefix;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.removeQuotesAndHandleConcat;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * compiler-annotation-stmt = prefix:compiler-annotation-keyword string
- * "{"
- * [app-data-structure-stmt stmtsep]
- * [app-extended-stmt stmtsep]
- * "}"
- *
- * ANTLR grammar rule
- * compilerAnnotationStatement : COMPILER_ANNOTATION string LEFT_CURLY_BRACE
- * compilerAnnotationBodyStatement RIGHT_CURLY_BRACE;
- *
- * compilerAnnotationBodyStatement : appDataStructureStatement? appExtendedStatement? ;
- */
-
-/**
- * Represents listener based call back function corresponding to the "compiler-annotation"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class CompilerAnnotationListener {
-
- /**
- * Creates a new compiler-annotation listener.
- */
- private CompilerAnnotationListener() {
- }
-
- /**
- * Performs validation and updates the data model tree. It is called when parser receives an
- * input matching the grammar rule(compiler-annotation).
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processCompilerAnnotationEntry(TreeWalkListener listener,
- GeneratedYangParser.CompilerAnnotationStatementContext ctx) {
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, COMPILER_ANNOTATION_DATA, ctx.string().getText(), ENTRY);
- String prefix = getValidPrefix(ctx.COMPILER_ANNOTATION().getText(), COMPILER_ANNOTATION_DATA, ctx);
-
- YangCompilerAnnotation compilerAnnotation = new YangCompilerAnnotation();
- compilerAnnotation.setPrefix(prefix);
- compilerAnnotation.setPath(removeQuotesAndHandleConcat(ctx.string().getText()));
-
- Parsable curData = listener.getParsedDataStack().peek();
- switch (curData.getYangConstructType()) {
- case MODULE_DATA:
- YangModule module = ((YangModule) curData);
- module.addCompilerAnnotation(compilerAnnotation);
- break;
- case SUB_MODULE_DATA:
- YangSubModule subModule = ((YangSubModule) curData);
- subModule.addCompilerAnnotation(compilerAnnotation);
- break;
- default:
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, COMPILER_ANNOTATION_DATA,
- ctx.string().getText(), ENTRY));
- }
- listener.getParsedDataStack().push(compilerAnnotation);
- }
-
- /**
- * Performs validation and updates the data model tree. It is called when parser
- * exits from grammar rule (compiler-annotation).
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processCompilerAnnotationExit(TreeWalkListener listener,
- GeneratedYangParser.CompilerAnnotationStatementContext ctx) {
-
- checkStackIsNotEmpty(listener, MISSING_HOLDER, COMPILER_ANNOTATION_DATA, ctx.string().getText(), EXIT);
- if (!(listener.getParsedDataStack().peek() instanceof YangCompilerAnnotation)) {
- throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, COMPILER_ANNOTATION_DATA,
- ctx.string().getText(), EXIT));
- }
- listener.getParsedDataStack().pop();
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ConfigListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ConfigListener.java
deleted file mode 100644
index d595cb0..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ConfigListener.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangLeafList;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.CONFIG_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.ListenerUtil.getValidBooleanValue;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * config-stmt = config-keyword sep
- * config-arg-str stmtend
- * config-arg-str = < a string that matches the rule
- * config-arg >
- * config-arg = true-keyword / false-keyword
- *
- * ANTLR grammar rule
- * configStatement : CONFIG_KEYWORD config STMTEND;
- * config : string;
- */
-
-/**
- * Represents listener based call back function corresponding to the "config"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class ConfigListener {
-
- /**
- * Creates a new config listener.
- */
- private ConfigListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule
- * (config), performs validation and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processConfigEntry(TreeWalkListener listener,
- GeneratedYangParser.ConfigStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, CONFIG_DATA, "", ENTRY);
-
- boolean isConfig = getValidBooleanValue(ctx.config().getText(), CONFIG_DATA, ctx);
-
- Parsable tmpData = listener.getParsedDataStack().peek();
- switch (tmpData.getYangConstructType()) {
- case LEAF_DATA:
- YangLeaf leaf = (YangLeaf) tmpData;
- leaf.setConfig(isConfig);
- break;
- case CONTAINER_DATA:
- YangContainer container = (YangContainer) tmpData;
- container.setConfig(isConfig);
- break;
- case LEAF_LIST_DATA:
- YangLeafList leafList = (YangLeafList) tmpData;
- leafList.setConfig(isConfig);
- break;
- case LIST_DATA:
- YangList yangList = (YangList) tmpData;
- yangList.setConfig(isConfig);
- break;
- case CHOICE_DATA: // TODO
- break;
- default:
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, CONFIG_DATA, "", ENTRY));
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ContactListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ContactListener.java
deleted file mode 100644
index 4cab95d..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ContactListener.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.CONTACT_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;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * meta-stmts = ;; these stmts can appear in any order
- * [organization-stmt stmtsep]
- * [contact-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * contact-stmt = contact-keyword sep string optsep stmtend
- *
- * ANTLR grammar rule
- * meta_stmts : organization_stmt? contact_stmt? description_stmt? reference_stmt?
- * | organization_stmt? contact_stmt? reference_stmt? description_stmt?
- * | organization_stmt? description_stmt? contact_stmt? reference_stmt?
- * | organization_stmt? description_stmt? reference_stmt? contact_stmt?
- * | organization_stmt? reference_stmt? contact_stmt? description_stmt?
- * | organization_stmt? reference_stmt? description_stmt? contact_stmt?
- * | contact_stmt? organization_stmt? description_stmt? reference_stmt?
- * | contact_stmt? organization_stmt? reference_stmt? description_stmt?
- * | contact_stmt? reference_stmt? organization_stmt? description_stmt?
- * | contact_stmt? reference_stmt? description_stmt? organization_stmt?
- * | contact_stmt? description_stmt? reference_stmt? organization_stmt?
- * | contact_stmt? description_stmt? organization_stmt? reference_stmt?
- * | reference_stmt? contact_stmt? organization_stmt? description_stmt?
- * | reference_stmt? contact_stmt? description_stmt? organization_stmt?
- * | reference_stmt? organization_stmt? contact_stmt? description_stmt?
- * | reference_stmt? organization_stmt? description_stmt? contact_stmt?
- * | reference_stmt? description_stmt? organization_stmt? contact_stmt?
- * | reference_stmt? description_stmt? contact_stmt? organization_stmt?
- * | description_stmt? reference_stmt? contact_stmt? organization_stmt?
- * | description_stmt? reference_stmt? organization_stmt? contact_stmt?
- * | description_stmt? contact_stmt? reference_stmt? organization_stmt?
- * | description_stmt? contact_stmt? organization_stmt? reference_stmt?
- * | description_stmt? organization_stmt? contact_stmt? reference_stmt?
- * | description_stmt? organization_stmt? reference_stmt? contact_stmt?
- * ;
- * contact_stmt : CONTACT_KEYWORD string STMTEND;
- */
-
-/**
- * Represents listener based call back function corresponding to the "contact"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class ContactListener {
-
- /**
- * Creates a new contact listener.
- */
- private ContactListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule
- * (contact), perform validations and update the data model tree.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processContactEntry(TreeWalkListener listener, GeneratedYangParser.ContactStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, CONTACT_DATA, ctx.string().getText(), ENTRY);
-
- // Obtain the node of the stack.
- Parsable tmpNode = listener.getParsedDataStack().peek();
- switch (tmpNode.getYangConstructType()) {
- case MODULE_DATA: {
- YangModule module = (YangModule) tmpNode;
- module.setContact(ctx.string().getText());
- break;
- }
- case SUB_MODULE_DATA: {
- YangSubModule subModule = (YangSubModule) tmpNode;
- subModule.setContact(ctx.string().getText());
- break;
- }
- default:
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, CONTACT_DATA,
- ctx.string().getText(), ENTRY));
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ContainerListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ContainerListener.java
deleted file mode 100644
index 5a89cc3..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ContainerListener.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangAugment;
-import org.onosproject.yangutils.datamodel.YangCase;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangGrouping;
-import org.onosproject.yangutils.datamodel.YangInput;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNotification;
-import org.onosproject.yangutils.datamodel.YangOutput;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.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.parser.impl.parserutils.ListenerValidation;
-
-import static org.onosproject.yangutils.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.CONFIG_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.CONTAINER_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.DESCRIPTION_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.PRESENCE_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.REFERENCE_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.STATUS_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerCollisionDetector.detectCollidingChildUtil;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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_CURRENT_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.getValidIdentifier;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.validateCardinalityMaxOne;
-import static org.onosproject.yangutils.translator.tojava.YangDataModelFactory.getYangContainerNode;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * container-stmt = container-keyword sep identifier-arg-str optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [when-stmt stmtsep]
- * *(if-feature-stmt stmtsep)
- * *(must-stmt stmtsep)
- * [presence-stmt stmtsep]
- * [config-stmt stmtsep]
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * *((typedef-stmt /
- * grouping-stmt) stmtsep)
- * *(data-def-stmt stmtsep)
- * "}")
- *
- * ANTLR grammar rule
- * containerStatement : CONTAINER_KEYWORD identifier
- * (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | mustStatement |
- * presenceStatement | configStatement | statusStatement | descriptionStatement |
- * referenceStatement | typedefStatement | groupingStatement
- * | dataDefStatement)* RIGHT_CURLY_BRACE);
- */
-
-/**
- * Represents listener based call back function corresponding to the "container"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class ContainerListener {
-
- /**
- * Creates a new container listener.
- */
- private ContainerListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule
- * (container), performs validation and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processContainerEntry(TreeWalkListener listener,
- GeneratedYangParser.ContainerStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, CONTAINER_DATA, ctx.identifier().getText(), ENTRY);
-
- String identifier = getValidIdentifier(ctx.identifier().getText(), CONTAINER_DATA, ctx);
-
- // Validate sub statement cardinality.
- validateSubStatementsCardinality(ctx);
-
- // Check for identifier collision
- int line = ctx.getStart().getLine();
- int charPositionInLine = ctx.getStart().getCharPositionInLine();
- detectCollidingChildUtil(listener, line, charPositionInLine, identifier, CONTAINER_DATA);
-
- YangContainer container = getYangContainerNode(JAVA_GENERATION);
- container.setName(identifier);
-
- /*
- * If "config" is not specified, the default is the same as the parent
- * schema node's "config" value.
- */
- if (ctx.configStatement().isEmpty()) {
- boolean parentConfig = ListenerValidation.getParentNodeConfig(listener);
- container.setConfig(parentConfig);
- }
-
- Parsable curData = listener.getParsedDataStack().peek();
- if (curData instanceof YangModule || curData instanceof YangSubModule
- || curData instanceof YangContainer || curData instanceof YangList
- || curData instanceof YangCase || curData instanceof YangNotification
- || curData instanceof YangInput || curData instanceof YangOutput
- || curData instanceof YangAugment || curData instanceof YangGrouping) {
- YangNode curNode = (YangNode) curData;
- try {
- curNode.addChild(container);
- } catch (DataModelException e) {
- throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
- CONTAINER_DATA, ctx.identifier().getText(), ENTRY, e.getMessage()));
- }
- listener.getParsedDataStack().push(container);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, CONTAINER_DATA,
- ctx.identifier().getText(), ENTRY));
- }
- }
-
- /**
- * It is called when parser exits from grammar rule (container), it perform
- * validations and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processContainerExit(TreeWalkListener listener,
- GeneratedYangParser.ContainerStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, CONTAINER_DATA, ctx.identifier().getText(), EXIT);
-
- if (listener.getParsedDataStack().peek() instanceof YangContainer) {
- YangContainer yangContainer = (YangContainer) listener.getParsedDataStack().peek();
- try {
- yangContainer.validateDataOnExit();
- } catch (DataModelException e) {
- ParserException parserException = new ParserException(constructExtendedListenerErrorMessage(
- UNHANDLED_PARSED_DATA, CONTAINER_DATA, ctx.identifier().getText(), EXIT, e.getMessage()));
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
- listener.getParsedDataStack().pop();
- } else {
- throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, CONTAINER_DATA,
- ctx.identifier().getText(), EXIT));
- }
- }
-
- /**
- * Validates the cardinality of container sub-statements as per grammar.
- *
- * @param ctx context object of the grammar rule
- */
- private static void validateSubStatementsCardinality(GeneratedYangParser.ContainerStatementContext ctx) {
-
- validateCardinalityMaxOne(ctx.presenceStatement(), PRESENCE_DATA, CONTAINER_DATA, ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.configStatement(), CONFIG_DATA, CONTAINER_DATA, ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.descriptionStatement(), DESCRIPTION_DATA, CONTAINER_DATA,
- ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.referenceStatement(), REFERENCE_DATA, CONTAINER_DATA, ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.statusStatement(), STATUS_DATA, CONTAINER_DATA, ctx.identifier().getText());
- // TODO validate 'when' cardinality
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/DataStructureKeyListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/DataStructureKeyListener.java
deleted file mode 100644
index 65fc50b..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/DataStructureKeyListener.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangAppDataStructure;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.KEY_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.ListenerUtil.removeQuotesAndHandleConcat;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-import static org.onosproject.yangutils.utils.UtilConstants.SPACE;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * data-structure-key-stmt = prefix:key-keyword string ";"
- *
- * ANTLR grammar rule
- * dataStructureKeyStatement : DATA_STRUCTURE_KEY string STMTEND;
- */
-
-/**
- * Represents listener based call back function corresponding to the "key"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class DataStructureKeyListener {
-
- /**
- * Creates a new data-structure-key listener.
- */
- private DataStructureKeyListener() {
- }
-
- /**
- * Performs validation and updates the data model tree. It is called when parser receives an
- * input matching the grammar rule(key).
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processDataStructureKeyEntry(TreeWalkListener listener,
- GeneratedYangParser.DataStructureKeyStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, KEY_DATA, ctx.string().getText(), ENTRY);
-
- Parsable tmpData = listener.getParsedDataStack().peek();
- if (listener.getParsedDataStack().peek() instanceof YangAppDataStructure) {
- YangAppDataStructure dataStructure = (YangAppDataStructure) tmpData;
- String tmpKeyValue = removeQuotesAndHandleConcat(ctx.string().getText());
- if (tmpKeyValue.contains(SPACE)) {
- String[] keyValues = tmpKeyValue.split(SPACE);
- for (String keyValue : keyValues) {
- dataStructure.addKey(keyValue);
- }
- } else {
- dataStructure.addKey(tmpKeyValue);
- }
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, KEY_DATA, ctx.string().getText(),
- ENTRY));
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/Decimal64Listener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/Decimal64Listener.java
deleted file mode 100644
index 45f58c8..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/Decimal64Listener.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * type-body-stmts = numerical-restrictions /
- * decimal64-specification /
- * string-restrictions /
- * enum-specification /
- * leafref-specification /
- * identityref-specification /
- * instance-identifier-specification /
- * bits-specification /
- * union-specification
- *
- * decimal64-specification = fraction-digits-stmt [range-stmt stmtsep]
- *
- * fraction-digits-stmt = fraction-digits-keyword sep
- * fraction-digits-arg-str stmtend
- *
- * fraction-digits-arg-str = < a string that matches the rule
- * fraction-digits-arg >
- *
- * fraction-digits-arg = ("1" ["0" / "1" / "2" / "3" / "4" /
- * "5" / "6" / "7" / "8"])
- * / "2" / "3" / "4" / "5" / "6" / "7" / "8" / "9"
- *
- * range-stmt = range-keyword sep range-arg-str optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [error-message-stmt stmtsep]
- * [error-app-tag-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * "}")
- * ANTLR grammar rule
- *
- * typeBodyStatements : numericalRestrictions | decimal64Specification | stringRestrictions | enumSpecification
- * | leafrefSpecification | identityrefSpecification | instanceIdentifierSpecification
- * | bitsSpecification | unionSpecification;
- *
- * decimal64Specification : fractionDigitStatement rangeStatement?;
- *
- * fractionDigitStatement : FRACTION_DIGITS_KEYWORD fraction STMTEND;
- *
- * fraction : string;
- */
-
-import org.onosproject.yangutils.datamodel.YangDecimal64;
-import org.onosproject.yangutils.datamodel.YangRangeRestriction;
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.DECIMAL64_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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;
-
-/**
- * Represents listener based call back function corresponding to the "decimal64" rule
- * defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class Decimal64Listener {
-
- /**
- * Creates a new Decimal64 listener.
- */
- private Decimal64Listener() {
- }
-
- /**
- * It is called when parser enters grammar rule (decimal64), it perform
- * validations and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processDecimal64Entry(TreeWalkListener listener,
- GeneratedYangParser.Decimal64SpecificationContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, DECIMAL64_DATA, "", ENTRY);
-
- Parsable tmpNode = listener.getParsedDataStack().peek();
- if (tmpNode instanceof YangType) {
- YangType<YangDecimal64<YangRangeRestriction>> typeNode =
- (YangType<YangDecimal64<YangRangeRestriction>>) tmpNode;
- YangDecimal64 decimal64Node = new YangDecimal64();
- typeNode.setDataTypeExtendedInfo(decimal64Node);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, DECIMAL64_DATA, "", ENTRY));
- }
- }
-
- /**
- * Performs validation and updates the data model tree.
- * It is called when parser exits from grammar rule (decimal64).
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processDecimal64Exit(TreeWalkListener listener,
- GeneratedYangParser.Decimal64SpecificationContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, DECIMAL64_DATA, "", EXIT);
-
- Parsable tmpNode = listener.getParsedDataStack().peek();
- if (tmpNode instanceof YangType) {
- YangType<YangDecimal64<YangRangeRestriction>> typeNode =
- (YangType<YangDecimal64<YangRangeRestriction>>) tmpNode;
- YangDecimal64<YangRangeRestriction> decimal64Node = typeNode.getDataTypeExtendedInfo();
- try {
- decimal64Node.validateRange();
- } catch (DataModelException e) {
- throw new ParserException(e);
- }
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, DECIMAL64_DATA, "", EXIT));
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/DefaultListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/DefaultListener.java
deleted file mode 100644
index 23c621c..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/DefaultListener.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * typedef-stmt = typedef-keyword sep identifier-arg-str optsep
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * type-stmt stmtsep
- * [units-stmt stmtsep]
- * [default-stmt stmtsep]
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * "}"
- * default-stmt = default-keyword sep string stmtend
-
- *
- * ANTLR grammar rule
- * typedefStatement : TYPEDEF_KEYWORD IDENTIFIER LEFT_CURLY_BRACE
- * (typeStatement | unitsStatement | defaultStatement | statusStatement
- * | descriptionStatement | referenceStatement)* RIGHT_CURLY_BRACE;
- * defaultStatement : DEFAULT_KEYWORD string STMTEND;
- */
-
-import org.onosproject.yangutils.datamodel.YangChoice;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangTypeDef;
-import org.onosproject.yangutils.datamodel.utils.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.parser.impl.parserutils.ListenerUtil;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.DEFAULT_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;
-
-/**
- * Represents listener for default YANG statement.
- */
-public final class DefaultListener {
-
- /**
- * Creates a new default listener.
- */
- private DefaultListener() {
- }
-
- /**
- * It is called when parser enters grammar rule (default), it perform
- * validations and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processDefaultEntry(TreeWalkListener listener,
- GeneratedYangParser.DefaultStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, DEFAULT_DATA, ctx.string().getText(), ENTRY);
-
- Parsable tmpNode = listener.getParsedDataStack().peek();
- switch (tmpNode.getYangConstructType()) {
- case TYPEDEF_DATA: {
- YangTypeDef typeDef = (YangTypeDef) tmpNode;
- typeDef.setDefaultValueInString(ListenerUtil.removeQuotesAndHandleConcat(ctx.string().getText()));
- break;
- }
- case LEAF_DATA: {
- YangLeaf leaf = (YangLeaf) tmpNode;
- leaf.setDefaultValueInString(ListenerUtil.removeQuotesAndHandleConcat(ctx.string().getText()));
- break;
- }
- case CHOICE_DATA: {
- YangChoice choice = (YangChoice) tmpNode;
- choice.setDefaultValueInString(ListenerUtil.removeQuotesAndHandleConcat(ctx.string().getText()));
- break;
- }
- default:
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER,
- DEFAULT_DATA, ctx.string().getText(), ENTRY));
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/DescriptionListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/DescriptionListener.java
deleted file mode 100644
index c7988a8..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/DescriptionListener.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangDesc;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.DESCRIPTION_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;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * description-stmt = description-keyword sep string optsep stmtend
- *
- * ANTLR grammar rule
- * descriptionStatement : DESCRIPTION_KEYWORD string STMTEND;
- */
-
-/**
- * Represents listener based call back function corresponding to the
- * "description" rule defined in ANTLR grammar file for corresponding ABNF rule
- * in RFC 6020.
- */
-public final class DescriptionListener {
-
- /**
- * Creates a new description listener.
- */
- private DescriptionListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule
- * (description), perform validations and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processDescriptionEntry(TreeWalkListener listener,
- GeneratedYangParser.DescriptionStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, DESCRIPTION_DATA, ctx.string().getText(), ENTRY);
-
- Parsable tmpData = listener.getParsedDataStack().peek();
- if (tmpData instanceof YangDesc) {
- YangDesc description = (YangDesc) tmpData;
- description.setDescription(ctx.string().getText());
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, DESCRIPTION_DATA,
- ctx.string().getText(), ENTRY));
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/EnumListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/EnumListener.java
deleted file mode 100644
index 9cfc5aa..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/EnumListener.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * enum-stmt = enum-keyword sep string optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [value-stmt stmtsep]
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * "}")
- *
- * ANTLR grammar rule
- * enumStatement : ENUM_KEYWORD string (STMTEND | LEFT_CURLY_BRACE enumStatementBody RIGHT_CURLY_BRACE);
- *
- * enumStatementBody : valueStatement? statusStatement? descriptionStatement? referenceStatement?
- * | valueStatement? statusStatement? referenceStatement? descriptionStatement?
- * | valueStatement? descriptionStatement? statusStatement? referenceStatement?
- * | valueStatement? descriptionStatement? referenceStatement? statusStatement?
- * | valueStatement? referenceStatement? statusStatement? descriptionStatement?
- * | valueStatement? referenceStatement? descriptionStatement? statusStatement?
- * | statusStatement? valueStatement? descriptionStatement? referenceStatement?
- * | statusStatement? valueStatement? referenceStatement? descriptionStatement?
- * | statusStatement? descriptionStatement? descriptionStatement? valueStatement?
- * | statusStatement? descriptionStatement? valueStatement? descriptionStatement?
- * | statusStatement? referenceStatement? valueStatement? descriptionStatement?
- * | statusStatement? referenceStatement? descriptionStatement? valueStatement?
- * | descriptionStatement? valueStatement? statusStatement? referenceStatement?
- * | descriptionStatement? valueStatement? referenceStatement? statusStatement?
- * | descriptionStatement? statusStatement? valueStatement? referenceStatement?
- * | descriptionStatement? statusStatement? referenceStatement? valueStatement?
- * | descriptionStatement? referenceStatement? valueStatement? statusStatement?
- * | descriptionStatement? referenceStatement? statusStatement? valueStatement?
- * | referenceStatement? valueStatement? descriptionStatement? statusStatement?
- * | referenceStatement? valueStatement? statusStatement? descriptionStatement?
- * | referenceStatement? statusStatement? descriptionStatement? valueStatement?
- * | referenceStatement? statusStatement? valueStatement? descriptionStatement?
- * | referenceStatement? descriptionStatement? valueStatement? statusStatement?
- * | referenceStatement? descriptionStatement? statusStatement? valueStatement?
- * ;
- */
-
-import org.onosproject.yangutils.datamodel.YangEnum;
-import org.onosproject.yangutils.datamodel.YangEnumeration;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.ENUM_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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.DUPLICATE_ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_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.UtilConstants.QUOTES;
-import static org.onosproject.yangutils.utils.UtilConstants.EMPTY_STRING;
-
-/**
- * Represents listener based call back function corresponding to the "enum" rule
- * defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class EnumListener {
-
- /**
- * Creates a new enum listener.
- */
- private EnumListener() {
- }
-
- /**
- * It is called when parser enters grammar rule (enum), it perform
- * validations and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processEnumEntry(TreeWalkListener listener, GeneratedYangParser.EnumStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, ENUM_DATA, ctx.string().getText(), ENTRY);
-
- YangEnum enumNode = new YangEnum();
- enumNode.setNamedValue(getValidNamedValue(ctx.string().getText()));
- listener.getParsedDataStack().push(enumNode);
- }
-
- /*Removes quotes from the enum name if present.*/
- private static String getValidNamedValue(String name) {
- if (name.contains(QUOTES)) {
- name = name.replace(QUOTES, EMPTY_STRING);
- }
- return name;
- }
-
- /**
- * It is called when parser exits from grammar rule (enum), it perform
- * validations and update the data model tree.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processEnumExit(TreeWalkListener listener, GeneratedYangParser.EnumStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, ENUM_DATA, ctx.string().getText(), EXIT);
-
- Parsable tmpEnumNode = listener.getParsedDataStack().peek();
- if (tmpEnumNode instanceof YangEnum) {
- listener.getParsedDataStack().pop();
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, ENUM_DATA, ctx.string().getText(), EXIT);
-
- Parsable tmpNode = listener.getParsedDataStack().peek();
- switch (tmpNode.getYangConstructType()) {
- case ENUMERATION_DATA: {
- YangEnumeration yangEnumeration = (YangEnumeration) tmpNode;
- if (ctx.enumStatementBody() == null || ctx.enumStatementBody().valueStatement() == null) {
- int maxValue = 0;
- boolean isValuePresent = false;
-
- for (YangEnum curEnum : yangEnumeration.getEnumSet()) {
- if (curEnum.getValue() == Integer.MAX_VALUE) {
- ParserException parserException = new ParserException("YANG file error : "
- + "An enum value MUST be specified for enum substatements following the one"
- + "with the current highest value");
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- } else if (maxValue <= curEnum.getValue()) {
- maxValue = curEnum.getValue();
- isValuePresent = true;
- }
- }
- if (isValuePresent) {
- maxValue++;
- }
- ((YangEnum) tmpEnumNode).setValue(maxValue);
- }
- try {
- yangEnumeration.addEnumInfo((YangEnum) tmpEnumNode);
- } catch (DataModelException e) {
- ParserException parserException = new ParserException(constructExtendedListenerErrorMessage(
- DUPLICATE_ENTRY, ENUM_DATA, ctx.string().getText(), EXIT, e.getMessage()));
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
- break;
- }
- default:
- throw new ParserException(
- constructListenerErrorMessage(INVALID_HOLDER, ENUM_DATA, ctx.string().getText(), EXIT));
- }
- } else {
- throw new ParserException(
- constructListenerErrorMessage(MISSING_CURRENT_HOLDER, ENUM_DATA, ctx.string().getText(), EXIT));
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/EnumerationListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/EnumerationListener.java
deleted file mode 100644
index 2db40f3..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/EnumerationListener.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * type-body-stmts = numerical-restrictions /
- * decimal64-specification /
- * string-restrictions /
- * enum-specification /
- * leafref-specification /
- * identityref-specification /
- * instance-identifier-specification /
- * bits-specification /
- * union-specification
- *
- * enum-specification = 1*(enum-stmt stmtsep)
- *
- * ANTLR grammar rule
- *
- * typeBodyStatements : numericalRestrictions | stringRestrictions | enumSpecification
- * | leafrefSpecification | identityrefSpecification | instanceIdentifierSpecification
- * | bitsSpecification | unionSpecification;
- *
- * enumSpecification : enumStatement+;
- */
-
-import org.onosproject.yangutils.datamodel.YangEnumeration;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangLeafList;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.datamodel.YangTypeDef;
-import org.onosproject.yangutils.datamodel.YangUnion;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.ENUMERATION_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.TYPE_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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_CURRENT_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.translator.tojava.YangDataModelFactory.getYangEnumerationNode;
-
-/**
- * Represents listener based call back function corresponding to the
- * "enumeration" rule defined in ANTLR grammar file for corresponding ABNF rule
- * in RFC 6020.
- */
-public final class EnumerationListener {
-
- /**
- * Suffix to be used while creating enumeration class.
- */
- private static final String ENUMERATION_CLASS_SUFFIX = "_enum";
-
- /**
- * Creates a new enumeration listener.
- */
- private EnumerationListener() {
- }
-
- /**
- * It is called when parser enters grammar rule (enumeration), it perform
- * validations and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processEnumerationEntry(TreeWalkListener listener,
- GeneratedYangParser.EnumSpecificationContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, ENUMERATION_DATA, "", ENTRY);
-
- if (listener.getParsedDataStack().peek() instanceof YangType) {
- YangEnumeration enumerationNode = getYangEnumerationNode(JAVA_GENERATION);
- Parsable typeData = listener.getParsedDataStack().pop();
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, ENUMERATION_DATA, "", ENTRY);
-
- Parsable tmpData = listener.getParsedDataStack().peek();
-
- switch (tmpData.getYangConstructType()) {
- case LEAF_DATA:
- // Set the name of enumeration same as leaf.
- enumerationNode.setName(((YangLeaf) tmpData).getName() + ENUMERATION_CLASS_SUFFIX);
- // Pop the stack entry to obtain the parent YANG node.
- Parsable leaf = listener.getParsedDataStack().pop();
- // Add the enumeration node to the parent holder of leaf.
- addChildToParentNode(listener, enumerationNode);
- // Push the popped entry back to the stack.
- listener.getParsedDataStack().push(leaf);
- break;
- case LEAF_LIST_DATA:
- // Set the name of enumeration same as leaf list.
- enumerationNode.setName(((YangLeafList) tmpData).getName() + ENUMERATION_CLASS_SUFFIX);
- // Pop the stack entry to obtain the parent YANG node.
- Parsable leafList = listener.getParsedDataStack().pop();
- // Add the enumeration node to the parent holder of leaf.
- addChildToParentNode(listener, enumerationNode);
- // Push the popped entry back to the stack.
- listener.getParsedDataStack().push(leafList);
- break;
- case UNION_DATA:
- YangUnion yangUnion = (YangUnion) tmpData;
- /*
- * In case parent of enumeration is a union, name of the
- * enumeration is parent union name suffixed with running
- * integer number, this is done because under union there
- * could be multiple child union types.
- */
- enumerationNode.setName(yangUnion.getName() + ENUMERATION_CLASS_SUFFIX
- + yangUnion.getChildUnionNumber());
- // Increment the running number.
- yangUnion.setChildUnionNumber(yangUnion.getChildUnionNumber() + 1);
- // Add union as a child to parent union.
- addChildToParentNode(listener, enumerationNode);
- break;
- case TYPEDEF_DATA:
- YangTypeDef typeDef = (YangTypeDef) tmpData;
- // Set the name of enumeration same as typedef name.
- enumerationNode.setName(typeDef.getName() + ENUMERATION_CLASS_SUFFIX);
- // Add enumeration as a child to parent type def.
- addChildToParentNode(listener, enumerationNode);
- break;
- // TODO deviate.
- default:
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, TYPE_DATA,
- ((YangType<?>) typeData).getDataTypeName(), ENTRY));
- }
- listener.getParsedDataStack().push(typeData);
- listener.getParsedDataStack().push(enumerationNode);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, ENUMERATION_DATA, "", ENTRY));
- }
- }
-
- /**
- * It is called when parser exits from grammar rule (enumeration), it
- * perform validations and update the data model tree.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processEnumerationExit(TreeWalkListener listener,
- GeneratedYangParser.EnumSpecificationContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, ENUMERATION_DATA, "", EXIT);
-
- Parsable tmpEnumerationNode = listener.getParsedDataStack().peek();
- if (tmpEnumerationNode instanceof YangEnumeration) {
- YangEnumeration enumerationNode = (YangEnumeration) tmpEnumerationNode;
- listener.getParsedDataStack().pop();
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, ENUMERATION_DATA, "", EXIT);
-
- Parsable tmpNode = listener.getParsedDataStack().peek();
- switch (tmpNode.getYangConstructType()) {
- case TYPE_DATA: {
- YangType<YangEnumeration> typeNode = (YangType<YangEnumeration>) tmpNode;
- typeNode.setDataTypeExtendedInfo(enumerationNode);
- break;
- }
- default:
- throw new ParserException(
- constructListenerErrorMessage(INVALID_HOLDER, ENUMERATION_DATA, "", EXIT));
- }
- } else {
- throw new ParserException(
- constructListenerErrorMessage(MISSING_CURRENT_HOLDER, ENUMERATION_DATA, "", EXIT));
- }
- }
-
- /**
- * Adds the enumeration node to the parent holder.
- *
- * @param listener listener's object
- * @param enumerationNode enumeration node which needs to be added to parent
- */
- private static void addChildToParentNode(TreeWalkListener listener, YangEnumeration enumerationNode) {
- if (!(listener.getParsedDataStack().peek() instanceof YangNode)) {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, ENUMERATION_DATA,
- "", ENTRY));
- } else {
- YangNode curNode = (YangNode) listener.getParsedDataStack().peek();
- try {
- curNode.addChild(enumerationNode);
- } catch (DataModelException e) {
- throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
- YangConstructType.ENUMERATION_DATA, "", ENTRY, e.getMessage()));
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ErrorAppTagListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ErrorAppTagListener.java
deleted file mode 100644
index befc70a..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ErrorAppTagListener.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangAppErrorHolder;
-import org.onosproject.yangutils.datamodel.YangAppErrorInfo;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.ERROR_APP_TAG_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.ListenerUtil.removeQuotesAndHandleConcat;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-
-/*
- * Reference: RFC 6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC 6020
- *
- * error-app-tag-stmt = error-app-tag-keyword sep string stmtend
- *
- * ANTLR grammar rule
- * errorAppTagStatement : ERROR_APP_TAG_KEYWORD string STMTEND;
- */
-
-/**
- * Represents listener based call back function corresponding to the
- * error app tag defined in ANTLR grammar file for corresponding ABNF rule
- * in RFC 6020.
- */
-public final class ErrorAppTagListener {
-
- /**
- * Creates a new error app tag listener.
- */
- private ErrorAppTagListener() {
- }
-
- /**
- * Performs validations and updates the data model tree. It is called when parser
- * receives an input matching the grammar rule error app tag.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processErrorAppTagMessageEntry(TreeWalkListener listener,
- GeneratedYangParser.ErrorAppTagStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, ERROR_APP_TAG_DATA, ctx.string().getText(), ENTRY);
- String errorMessage = removeQuotesAndHandleConcat(ctx.string().getText());
- // Obtain the node of the stack.
- Parsable tmpNode = listener.getParsedDataStack().peek();
- if (tmpNode instanceof YangAppErrorHolder) {
- YangAppErrorInfo yangAppErrorInfo = ((YangAppErrorHolder) tmpNode).getAppErrorInfo();
- yangAppErrorInfo.setErrorAppTag(errorMessage);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, ERROR_APP_TAG_DATA,
- ctx.string().getText(), ENTRY));
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ErrorMessageListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ErrorMessageListener.java
deleted file mode 100644
index b6722b5..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ErrorMessageListener.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangAppErrorHolder;
-import org.onosproject.yangutils.datamodel.YangAppErrorInfo;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.ERROR_MESSAGE_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.ListenerUtil.removeQuotesAndHandleConcat;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- *
- * error-message-stmt = error-message-keyword sep string stmtend
- *
- * ANTLR grammar rule
- * errorMessageStatement : ERROR_MESSAGE_KEYWORD string STMTEND;
- */
-
-/**
- * Represents listener based call back function corresponding to the
- * app error message defined in ANTLR grammar file for corresponding ABNF rule
- * in RFC 6020.
- */
-public final class ErrorMessageListener {
-
- /**
- * Creates a new must listener.
- */
- private ErrorMessageListener() {
- }
-
- /**
- * Performs validations and updates the data model tree. It is called when parser
- * receives an input matching the grammar rule (app error message).
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processErrorMessageEntry(TreeWalkListener listener,
- GeneratedYangParser.ErrorMessageStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, ERROR_MESSAGE_DATA, ctx.string().getText(), ENTRY);
- String errorMessage = removeQuotesAndHandleConcat(ctx.string().getText());
-
- // Obtain the node of the stack.
- Parsable tmpNode = listener.getParsedDataStack().peek();
- if (tmpNode instanceof YangAppErrorHolder) {
- YangAppErrorInfo yangAppErrorInfo = ((YangAppErrorHolder) tmpNode).getAppErrorInfo();
- yangAppErrorInfo.setErrorMessage(errorMessage);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, ERROR_MESSAGE_DATA,
- ctx.string().getText(), ENTRY));
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ExtensionListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ExtensionListener.java
deleted file mode 100644
index 2169640..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ExtensionListener.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangExtension;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.EXTENSION_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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_CURRENT_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * extension-stmt = extension-keyword sep identifier-arg-str optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [argument-stmt stmtsep]
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * "}")
- *
- * ANTLR grammar rule
- * extensionStatement : EXTENSION_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE extensionBody RIGHT_CURLY_BRACE);
- */
-
-/**
- * Represents listener based call back function corresponding to the "extension"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class ExtensionListener {
-
- /**
- * Creates a new extension listener.
- */
- private ExtensionListener() {
- }
-
- /**
- * Performs validation and updates the data model tree. It is called when parser
- * receives an input matching the grammar rule (extension).
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processExtensionEntry(TreeWalkListener listener,
- GeneratedYangParser.ExtensionStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, EXTENSION_DATA, ctx.identifier().getText(), ENTRY);
-
- String identifier = getValidIdentifier(ctx.identifier().getText(), EXTENSION_DATA, ctx);
-
- YangExtension extension = new YangExtension();
- extension.setName(identifier);
-
- Parsable curData = listener.getParsedDataStack().peek();
- switch (curData.getYangConstructType()) {
- case MODULE_DATA:
- YangModule module = ((YangModule) curData);
- module.addExtension(extension);
- break;
- case SUB_MODULE_DATA:
- YangSubModule subModule = ((YangSubModule) curData);
- subModule.addExtension(extension);
- break;
- default:
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, EXTENSION_DATA,
- ctx.identifier().getText(), ENTRY));
- }
- listener.getParsedDataStack().push(extension);
- }
-
- /**
- * Performs validation and updates the data model tree. It is called when parser exits
- * from grammar rule(extension).
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processExtensionExit(TreeWalkListener listener,
- GeneratedYangParser.ExtensionStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, EXTENSION_DATA, ctx.identifier().getText(), EXIT);
-
- if (!(listener.getParsedDataStack().peek() instanceof YangExtension)) {
- throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, EXTENSION_DATA,
- ctx.identifier().getText(), EXIT));
- }
- listener.getParsedDataStack().pop();
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/FeatureListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/FeatureListener.java
deleted file mode 100644
index 6a70f31..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/FeatureListener.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * feature-stmt = feature-keyword sep identifier-arg-str optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * *(if-feature-stmt stmtsep)
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * "}")
- *
- *
- *
- * ANTLR grammar rule
- * featureStatement : FEATURE_KEYWORD string (STMTEND | LEFT_CURLY_BRACE featureBody RIGHT_CURLY_BRACE);
- */
-
-import org.onosproject.yangutils.datamodel.YangFeature;
-import org.onosproject.yangutils.datamodel.YangFeatureHolder;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.FEATURE_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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_CURRENT_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-
-/**
- * Represents listener based call back function corresponding to the "feature"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class FeatureListener {
-
- /**
- * Creates a new feature listener.
- */
- private FeatureListener() {
- }
-
- /**
- * Performs validation and updates the data model tree.It is called when parser receives
- * an input matching the grammar rule (feature).
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processFeatureEntry(TreeWalkListener listener,
- GeneratedYangParser.FeatureStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, FEATURE_DATA, ctx.string().getText(), ENTRY);
-
- String identifier = getValidIdentifier(ctx.string().getText(), FEATURE_DATA, ctx);
-
- // Obtain the node of the stack.
- Parsable tmpNode = listener.getParsedDataStack().peek();
- if (tmpNode instanceof YangFeatureHolder) {
- YangFeatureHolder featureHolder = (YangFeatureHolder) tmpNode;
-
- YangFeature feature = new YangFeature();
- feature.setName(identifier);
-
- featureHolder.addFeatureList(feature);
- listener.getParsedDataStack().push(feature);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, FEATURE_DATA,
- ctx.string().getText(), ENTRY));
- }
- }
-
- /**
- * Perform validations and updates the data model tree.It is called when parser exits from
- * grammar rule(feature).
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processFeatureExit(TreeWalkListener listener,
- GeneratedYangParser.FeatureStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, FEATURE_DATA, ctx.string().getText(), EXIT);
-
- if (listener.getParsedDataStack().peek() instanceof YangFeature) {
- listener.getParsedDataStack().pop();
- } else {
- throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, FEATURE_DATA,
- ctx.string().getText(), EXIT));
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/FractionDigitsListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/FractionDigitsListener.java
deleted file mode 100644
index baeb252..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/FractionDigitsListener.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * decimal64-specification = fraction-digits-stmt
- *
- * fraction-digits-stmt = fraction-digits-keyword sep
- * fraction-digits-arg-str stmtend
- *
- * fraction-digits-arg-str = < a string that matches the rule
- * fraction-digits-arg >
- *
- * fraction-digits-arg = ("1" ["0" / "1" / "2" / "3" / "4" /
- * "5" / "6" / "7" / "8"])
- * / "2" / "3" / "4" / "5" / "6" / "7" / "8" / "9"
- *
- * ANTLR grammar rule
- * decimal64Specification : FRACTION_DIGITS_KEYWORD fraction STMTEND;
- *
- * fraction : string;
- */
-
-import org.onosproject.yangutils.datamodel.YangDecimal64;
-import org.onosproject.yangutils.datamodel.YangRangeRestriction;
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.FRACTION_DIGITS_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;
-
-/**
- * Represents listener based call back function corresponding to the "fraction-digits"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class FractionDigitsListener {
-
- /**
- * Creates a new bit listener.
- */
- private FractionDigitsListener() {
- }
-
- /**
- * It is called when parser enters grammar rule (fraction-digits), it perform
- * validations and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processFractionDigitsEntry(TreeWalkListener listener,
- GeneratedYangParser.FractionDigitStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, FRACTION_DIGITS_DATA, ctx.fraction().getText(), ENTRY);
-
- int value = getValidFractionDigits(ctx);
-
- Parsable tmpNode = listener.getParsedDataStack().peek();
- if (tmpNode instanceof YangType) {
- YangType<YangDecimal64<YangRangeRestriction>> typeNode =
- (YangType<YangDecimal64<YangRangeRestriction>>) tmpNode;
- YangDecimal64 decimal64Node = typeNode.getDataTypeExtendedInfo();
- decimal64Node.setFractionDigit(value);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, FRACTION_DIGITS_DATA,
- ctx.fraction().getText(), ENTRY));
- }
- }
-
- /**
- * Validate fraction digits.
- *
- * @param ctx context object of the grammar rule
- * @return validated fraction-digits
- */
- public static int getValidFractionDigits(GeneratedYangParser.FractionDigitStatementContext ctx) {
- String value = ctx.fraction().getText().trim();
- ParserException parserException;
-
- int fractionDigits = Integer.parseInt(value);
- if ((fractionDigits >= YangDecimal64.MIN_FRACTION_DIGITS_VALUE) &&
- (fractionDigits <= YangDecimal64.MAX_FRACTION_DIGITS_VALUE)) {
- return fractionDigits;
- } else {
- parserException =
- new ParserException("YANG file error : fraction-digits value should be between 1 and 18.");
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/GroupingListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/GroupingListener.java
deleted file mode 100644
index fd2ac3d..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/GroupingListener.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangGrouping;
-import org.onosproject.yangutils.datamodel.YangInput;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNotification;
-import org.onosproject.yangutils.datamodel.YangOutput;
-import org.onosproject.yangutils.datamodel.YangRpc;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.DESCRIPTION_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.GROUPING_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.REFERENCE_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.STATUS_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerCollisionDetector.detectCollidingChildUtil;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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_CURRENT_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.getValidIdentifier;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.validateCardinalityMaxOne;
-import static org.onosproject.yangutils.translator.tojava.YangDataModelFactory.getYangGroupingNode;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * grouping-stmt = grouping-keyword sep identifier-arg-str optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * *((typedef-stmt /
- * grouping-stmt) stmtsep)
- * *(data-def-stmt stmtsep)
- * "}")
- *
- * ANTLR grammar rule
- * groupingStatement : GROUPING_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE
- * (statusStatement | descriptionStatement | referenceStatement | typedefStatement | groupingStatement
- * | dataDefStatement)* RIGHT_CURLY_BRACE);
- */
-
-/**
- * Represents listener based call back function corresponding to the "grouping"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class GroupingListener {
-
- /**
- * Creates a new grouping listener.
- */
- private GroupingListener() {
- }
-
- /**
- * It is called when parser enters grammar rule (grouping), it perform
- * validations and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processGroupingEntry(TreeWalkListener listener,
- GeneratedYangParser.GroupingStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, GROUPING_DATA, ctx.identifier().getText(), ENTRY);
-
- // Check validity of identifier and remove double quotes.
- String identifier = getValidIdentifier(ctx.identifier().getText(), GROUPING_DATA, ctx);
-
- // Validate sub statement cardinality.
- validateSubStatementsCardinality(ctx);
-
- // Increase the grouping count by one.
- listener.increaseGroupingDepth();
- Parsable curData = listener.getParsedDataStack().peek();
-
- // Check for identifier collision
- int line = ctx.getStart().getLine();
- int charPositionInLine = ctx.getStart().getCharPositionInLine();
- detectCollidingChildUtil(listener, line, charPositionInLine, identifier, GROUPING_DATA);
-
- if (curData instanceof YangModule || curData instanceof YangSubModule
- || curData instanceof YangContainer || curData instanceof YangNotification
- || curData instanceof YangList || curData instanceof YangGrouping
- || curData instanceof YangRpc || curData instanceof YangInput
- || curData instanceof YangOutput) {
-
- YangGrouping groupingNode = getYangGroupingNode(JAVA_GENERATION);
- groupingNode.setName(identifier);
-
- YangNode curNode = (YangNode) curData;
- try {
- curNode.addChild(groupingNode);
- } catch (DataModelException e) {
- throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
- GROUPING_DATA, ctx.identifier().getText(), ENTRY, e.getMessage()));
- }
- listener.getParsedDataStack().push(groupingNode);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER,
- GROUPING_DATA, ctx.identifier().getText(), ENTRY));
- }
- }
-
- /**
- * It is called when parser exits from grammar rule (grouping), it perform
- * validations and update the data model tree.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processGroupingExit(TreeWalkListener listener,
- GeneratedYangParser.GroupingStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, GROUPING_DATA, ctx.identifier().getText(), EXIT);
-
- // Decrease the grouping count by one.
- listener.decreaseGroupingDepth();
- if (listener.getParsedDataStack().peek() instanceof YangGrouping) {
- listener.getParsedDataStack().pop();
- } else {
- throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, GROUPING_DATA,
- ctx.identifier().getText(), EXIT));
- }
- }
-
- /**
- * Validates the cardinality of case sub-statements as per grammar.
- *
- * @param ctx context object of the grammar rule
- */
- private static void validateSubStatementsCardinality(GeneratedYangParser.GroupingStatementContext ctx) {
-
- validateCardinalityMaxOne(ctx.statusStatement(), STATUS_DATA, GROUPING_DATA, ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.descriptionStatement(), DESCRIPTION_DATA, GROUPING_DATA,
- ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.referenceStatement(), REFERENCE_DATA, GROUPING_DATA, ctx.identifier().getText());
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/IdentityListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/IdentityListener.java
deleted file mode 100644
index d8dec2c..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/IdentityListener.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangIdentity;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
-import static org.onosproject.yangutils.translator.tojava.YangDataModelFactory.getYangIdentityNode;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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.MISSING_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.IDENTITY_DATA;
-
-/**
- * Reference: RFC6020 and YANG ANTLR Grammar.
- *
- * ABNF grammar as per RFC6020
- * identity-stmt = identity-keyword sep identifier-arg-str optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [base-stmt stmtsep]
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * "}")
- */
-
-/**
- * Represents listener based call back function corresponding to the "identity"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class IdentityListener {
-
- //Creates a identity listener.
- private IdentityListener() {
- }
-
- /**
- * Performs validations and update the data model tree when parser receives an input
- * matching the grammar rule (identity).
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processIdentityEntry(TreeWalkListener listener,
- GeneratedYangParser.IdentityStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, IDENTITY_DATA, ctx.identifier().getText(), ENTRY);
-
- String identifier = getValidIdentifier(ctx.identifier().getText(), IDENTITY_DATA, ctx);
-
- YangIdentity identity = getYangIdentityNode(JAVA_GENERATION);
- identity.setName(identifier);
-
- Parsable curData = listener.getParsedDataStack().peek();
- if (curData instanceof YangModule || curData instanceof YangSubModule) {
- YangNode curNode = (YangNode) curData;
- try {
- curNode.addChild(identity);
- } catch (DataModelException e) {
- throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
- IDENTITY_DATA, ctx.identifier().getText(), ENTRY, e.getMessage()));
- }
- // Push identity node to the stack.
- listener.getParsedDataStack().push(identity);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, IDENTITY_DATA,
- ctx.identifier().getText(), ENTRY));
- }
-
- }
-
- /**
- * Performs validations and update the data model tree when parser exits from grammar
- * rule (identity).
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processIdentityExit(TreeWalkListener listener,
- GeneratedYangParser.IdentityStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_CURRENT_HOLDER, IDENTITY_DATA, ctx.identifier().getText(), EXIT);
-
- Parsable parsableType = listener.getParsedDataStack().pop();
- if (!(parsableType instanceof YangIdentity)) {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, IDENTITY_DATA,
- ctx.identifier().getText(), EXIT));
- }
- }
-
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/IdentityrefListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/IdentityrefListener.java
deleted file mode 100644
index 49037e2..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/IdentityrefListener.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangIdentityRef;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeIdentifier;
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.linker.impl.YangResolutionInfoImpl;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.addResolutionInfo;
-import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.UNRESOLVED;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.BASE_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.IDENTITYREF_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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.MISSING_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getValidNodeIdentifier;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-
-/**
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * identityref-specification =
- * base-stmt stmtsep
- * base-stmt = base-keyword sep identifier-ref-arg-str
- * optsep stmtend*
- * identifier-ref-arg = [prefix ":"] identifier
- */
-
-/**
- * Represents listener based call back function corresponding to the "identityref"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class IdentityrefListener {
-
- //Creates a new type listener.
- private IdentityrefListener() {
- }
-
- /**
- * Performs validation and updates the data model tree when parser receives an input
- * matching the grammar rule (identityref).
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processIdentityrefEntry(TreeWalkListener listener,
- GeneratedYangParser.IdentityrefSpecificationContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, IDENTITYREF_DATA, "", ENTRY);
-
- if (listener.getParsedDataStack().peek() instanceof YangType) {
-
- YangIdentityRef identityRef = new YangIdentityRef();
- Parsable typeData = listener.getParsedDataStack().pop();
- YangDataTypes yangDataTypes = ((YangType) typeData).getDataType();
- YangResolutionInfoImpl resolutionInfo;
-
- // Validate node identifier.
- YangNodeIdentifier nodeIdentifier = getValidNodeIdentifier(ctx.baseStatement().string().getText(),
- BASE_DATA, ctx);
- identityRef.setBaseIdentity(nodeIdentifier);
- ((YangType) typeData).setDataTypeExtendedInfo(identityRef);
-
- int errorLine = ctx.getStart().getLine();
- int errorPosition = ctx.getStart().getCharPositionInLine();
-
- Parsable tmpData = listener.getParsedDataStack().peek();
- switch (tmpData.getYangConstructType()) {
- case LEAF_DATA:
-
- // Pop the stack entry to obtain the parent YANG node.
- Parsable leaf = listener.getParsedDataStack().pop();
- Parsable parentNodeOfLeaf = listener.getParsedDataStack().peek();
-
- // Push the popped entry back to the stack.
- listener.getParsedDataStack().push(leaf);
-
- // Verify parent node of leaf
- if (!(parentNodeOfLeaf instanceof YangNode)) {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER,
- IDENTITYREF_DATA, ctx.getText(), EXIT));
- }
-
- identityRef.setResolvableStatus(UNRESOLVED);
-
- // Add resolution information to the list
- resolutionInfo = new YangResolutionInfoImpl<YangIdentityRef>(identityRef,
- (YangNode) parentNodeOfLeaf, errorLine, errorPosition);
- addToResolutionList(resolutionInfo, ctx);
-
- break;
- case LEAF_LIST_DATA:
-
- // Pop the stack entry to obtain the parent YANG node.
- Parsable leafList = listener.getParsedDataStack().pop();
- Parsable parentNodeOfLeafList = listener.getParsedDataStack().peek();
-
- // Push the popped entry back to the stack.
- listener.getParsedDataStack().push(leafList);
-
- // Verify parent node of leaf
- if (!(parentNodeOfLeafList instanceof YangNode)) {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER,
- IDENTITYREF_DATA, ctx.getText(), EXIT));
- }
-
- identityRef.setResolvableStatus(UNRESOLVED);
-
- // Add resolution information to the list
- resolutionInfo = new YangResolutionInfoImpl<YangIdentityRef>(identityRef,
- (YangNode) parentNodeOfLeafList, errorLine, errorPosition);
- addToResolutionList(resolutionInfo, ctx);
- break;
- case UNION_DATA:
-
- Parsable parentNodeOfUnionNode = listener.getParsedDataStack().peek();
-
- // Verify parent node of leaf
- if (!(parentNodeOfUnionNode instanceof YangNode)) {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER,
- IDENTITYREF_DATA, ctx.getText(), EXIT));
- }
-
- identityRef.setResolvableStatus(UNRESOLVED);
-
- // Add resolution information to the list
- resolutionInfo = new YangResolutionInfoImpl<YangIdentityRef>(identityRef,
- (YangNode) parentNodeOfUnionNode, errorLine, errorPosition);
- addToResolutionList(resolutionInfo, ctx);
-
- break;
- case TYPEDEF_DATA:
- /**
- * Do not add the identity ref to resolution list. It needs to be
- * added to resolution list, when leaf/leaf list references to
- * this typedef. At this time that leaf/leaf-list becomes the
- * parent for the identityref.
- */
- break;
- default:
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, IDENTITYREF_DATA,
- ctx.getText(), EXIT));
- }
- listener.getParsedDataStack().push(typeData);
- listener.getParsedDataStack().push(identityRef);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, IDENTITYREF_DATA, "", ENTRY));
- }
- }
-
- /**
- * Performs validations and update the data model tree when parser exits from grammar
- * rule (identityref).
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processIdentityrefExit(TreeWalkListener listener,
- GeneratedYangParser.IdentityrefSpecificationContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_CURRENT_HOLDER, IDENTITYREF_DATA, ctx.getText(), EXIT);
-
- Parsable parsableType = listener.getParsedDataStack().pop();
- if (!(parsableType instanceof YangIdentityRef)) {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, IDENTITYREF_DATA,
- ctx.getText(), EXIT));
- }
- }
-
- /**
- * Adds to resolution list.
- *
- * @param resolutionInfo resolution information
- * @param ctx context object of the grammar rule
- */
- private static void addToResolutionList(YangResolutionInfoImpl<YangIdentityRef> resolutionInfo,
- GeneratedYangParser.IdentityrefSpecificationContext ctx) {
- try {
- addResolutionInfo(resolutionInfo);
- } catch (DataModelException e) {
- throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
- IDENTITYREF_DATA, ctx.getText(), ENTRY, e.getMessage()));
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/IfFeatureListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/IfFeatureListener.java
deleted file mode 100644
index 29899de..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/IfFeatureListener.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- *
- * if-feature-stmt = if-feature-keyword sep identifier-ref-arg-str
- * optsep stmtend
- *
- * ANTLR grammar rule
- * ifFeatureStatement : IF_FEATURE_KEYWORD string STMTEND;
- */
-
-import org.onosproject.yangutils.datamodel.YangFeature;
-import org.onosproject.yangutils.datamodel.YangIfFeature;
-import org.onosproject.yangutils.datamodel.YangIfFeatureHolder;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangLeafList;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeIdentifier;
-import org.onosproject.yangutils.datamodel.YangResolutionInfo;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.linker.impl.YangResolutionInfoImpl;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.addResolutionInfo;
-import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.UNRESOLVED;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.IF_FEATURE_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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.getValidNodeIdentifier;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-
-/**
- * Represents listener based call back function corresponding to the "if-feature"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class IfFeatureListener {
-
- /**
- * Creates a new IfFeature listener.
- */
- private IfFeatureListener() {
- }
-
- /**
- * Performs validation and updates the data model tree.It is called when parser receives
- * an input matching the grammar rule (if-feature).
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processIfFeatureEntry(TreeWalkListener listener,
- GeneratedYangParser.IfFeatureStatementContext ctx) {
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, IF_FEATURE_DATA, ctx.string().getText(), ENTRY);
-
- // Validate if-feature argument string
- YangNodeIdentifier nodeIdentifier = getValidNodeIdentifier(ctx.string().getText(),
- IF_FEATURE_DATA, ctx);
-
- YangIfFeature ifFeature = new YangIfFeature();
- ifFeature.setName(nodeIdentifier);
- ifFeature.setResolvableStatus(UNRESOLVED);
- YangIfFeatureHolder ifFeatureHolder;
-
- // Obtain the node of the stack.
- Parsable tmpNode = listener.getParsedDataStack().peek();
- if (tmpNode instanceof YangIfFeatureHolder) {
- ifFeatureHolder = (YangIfFeatureHolder) tmpNode;
- ifFeatureHolder.addIfFeatureList(ifFeature);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, IF_FEATURE_DATA,
- ctx.string().getText(), ENTRY));
- }
-
- // Add resolution information to the list
- Parsable parentNode;
- if (tmpNode instanceof YangLeafList || tmpNode instanceof YangLeaf
- || tmpNode instanceof YangFeature) {
- Parsable leafData = listener.getParsedDataStack().pop();
- parentNode = listener.getParsedDataStack().peek();
- listener.getParsedDataStack().push(leafData);
- } else {
- parentNode = tmpNode;
- }
-
- // Verify parent node of leaf
- if (!(parentNode instanceof YangNode)) {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, IF_FEATURE_DATA,
- ctx.string().getText(), EXIT));
- }
-
- int errorLine = ctx.getStart().getLine();
- int errorPosition = ctx.getStart().getCharPositionInLine();
- YangResolutionInfoImpl resolutionInfo = new YangResolutionInfoImpl<YangIfFeature>(ifFeature,
- (YangNode) parentNode, errorLine,
- errorPosition);
- addToResolutionList(resolutionInfo, ctx);
- }
-
- /**
- * Add to resolution list.
- *
- * @param resolutionInfo resolution information.
- * @param ctx context object of the grammar rule
- */
- private static void addToResolutionList(YangResolutionInfo<YangIfFeature> resolutionInfo,
- GeneratedYangParser.IfFeatureStatementContext ctx) {
-
- try {
- addResolutionInfo(resolutionInfo);
- } catch (DataModelException e) {
- throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
- IF_FEATURE_DATA, ctx.string().getText(), EXIT, e.getMessage()));
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ImportListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ImportListener.java
deleted file mode 100644
index 76a2e30..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ImportListener.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangImport;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.IMPORT_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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_CURRENT_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * linkage-stmts = ;; these stmts can appear in any order
- * *(import-stmt stmtsep)
- * *(include-stmt stmtsep)
- *
- * import-stmt = import-keyword sep identifier-arg-str optsep
- * "{" stmtsep
- * prefix-stmt stmtsep
- * [revision-date-stmt stmtsep]
- * "}"
- *
- * ANTLR grammar rule
- * linkage_stmts : (import_stmt
- * | include_stmt)*;
- * import_stmt : IMPORT_KEYWORD identifier LEFT_CURLY_BRACE import_stmt_body
- * RIGHT_CURLY_BRACE;
- * import_stmt_body : prefix_stmt revision_date_stmt?;
- */
-
-/**
- * Represents listener based call back function corresponding to the "import"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class ImportListener {
-
- /**
- * Creates a new import listener.
- */
- private ImportListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule
- * (import), perform validations and update the data model tree.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processImportEntry(TreeWalkListener listener, GeneratedYangParser.ImportStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, IMPORT_DATA, ctx.identifier().getText(), ENTRY);
-
- String identifier = getValidIdentifier(ctx.identifier().getText(), IMPORT_DATA, ctx);
-
- YangImport importNode = new YangImport();
- importNode.setModuleName(identifier);
-
- // Set the line number and character position in line for the belongs to.
- int errorLine = ctx.getStart().getLine();
- int errorPosition = ctx.getStart().getCharPositionInLine();
- importNode.setLineNumber(errorLine);
- importNode.setCharPosition(errorPosition);
-
- // Push import node to the stack.
- listener.getParsedDataStack().push(importNode);
- }
-
- /**
- * It is called when parser exits from grammar rule (import), it perform
- * validations and update the data model tree.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processImportExit(TreeWalkListener listener, GeneratedYangParser.ImportStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, IMPORT_DATA, ctx.identifier().getText(), EXIT);
-
- Parsable tmpImportNode = listener.getParsedDataStack().peek();
- if (tmpImportNode instanceof YangImport) {
- listener.getParsedDataStack().pop();
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, IMPORT_DATA, ctx.identifier().getText(),
- EXIT);
-
- Parsable tmpNode = listener.getParsedDataStack().peek();
- switch (tmpNode.getYangConstructType()) {
- case MODULE_DATA: {
- YangModule module = (YangModule) tmpNode;
- module.addToImportList((YangImport) tmpImportNode);
- break;
- }
- case SUB_MODULE_DATA: {
- YangSubModule subModule = (YangSubModule) tmpNode;
- subModule.addToImportList((YangImport) tmpImportNode);
- break;
- }
- default:
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, IMPORT_DATA,
- ctx.identifier().getText(),
- EXIT));
- }
- } else {
- throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, IMPORT_DATA,
- ctx.identifier().getText(), EXIT));
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/IncludeListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/IncludeListener.java
deleted file mode 100644
index 847712f..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/IncludeListener.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangInclude;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.INCLUDE_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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_CURRENT_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * linkage-stmts = ;; these stmts can appear in any order
- * *(import-stmt stmtsep)
- * *(include-stmt stmtsep)
- *
- * include-stmt = include-keyword sep identifier-arg-str optsep
- * (";" /
- * "{" stmtsep
- * [revision-date-stmt stmtsep]
- * "}")
- *
- * ANTLR grammar rule
- * linkage_stmts : (import_stmt
- * | include_stmt)*;
- * include_stmt : INCLUDE_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE
- * revision_date_stmt? RIGHT_CURLY_BRACE);
- */
-
-/**
- * Represents listener based call back function corresponding to the "include"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class IncludeListener {
-
- /**
- * Creates a new include listener.
- */
- private IncludeListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule
- * (include), perform validations and update the data model tree.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processIncludeEntry(TreeWalkListener listener, GeneratedYangParser.IncludeStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, INCLUDE_DATA, ctx.identifier().getText(),
- ENTRY);
-
- String identifier = getValidIdentifier(ctx.identifier().getText(), INCLUDE_DATA, ctx);
-
- YangInclude includeNode = new YangInclude();
- includeNode.setSubModuleName(identifier);
-
- // Set the line number and character position in line for the belongs to.
- int errorLine = ctx.getStart().getLine();
- int errorPosition = ctx.getStart().getCharPositionInLine();
- includeNode.setLineNumber(errorLine);
- includeNode.setCharPosition(errorPosition);
-
- listener.getParsedDataStack().push(includeNode);
- }
-
- /**
- * It is called when parser exits from grammar rule (include), it perform
- * validations and update the data model tree.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processIncludeExit(TreeWalkListener listener, GeneratedYangParser.IncludeStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, INCLUDE_DATA, ctx.identifier().getText(), EXIT);
-
- Parsable tmpIncludeNode = listener.getParsedDataStack().peek();
- if (tmpIncludeNode instanceof YangInclude) {
- listener.getParsedDataStack().pop();
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, INCLUDE_DATA, ctx.identifier().getText(),
- EXIT);
-
- Parsable tmpNode = listener.getParsedDataStack().peek();
- switch (tmpNode.getYangConstructType()) {
- case MODULE_DATA: {
- YangModule module = (YangModule) tmpNode;
- module.addToIncludeList((YangInclude) tmpIncludeNode);
- break;
- }
- case SUB_MODULE_DATA: {
- YangSubModule subModule = (YangSubModule) tmpNode;
- subModule.addToIncludeList((YangInclude) tmpIncludeNode);
- break;
- }
- default:
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, INCLUDE_DATA,
- ctx.identifier().getText(),
- EXIT));
- }
- } else {
- throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, INCLUDE_DATA,
- ctx.identifier().getText(), EXIT));
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/InputListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/InputListener.java
deleted file mode 100644
index 92e61f8..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/InputListener.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangInput;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangRpc;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.INPUT_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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_CURRENT_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.translator.tojava.YangDataModelFactory.getYangInputNode;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- *
- * input-stmt = input-keyword optsep
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * *((typedef-stmt /
- * grouping-stmt) stmtsep)
- * 1*(data-def-stmt stmtsep)
- * "}"
- *
- * inputStatement : INPUT_KEYWORD LEFT_CURLY_BRACE inputStatementBody RIGHT_CURLY_BRACE;
-
- * inputStatementBody : typedefStatement* dataDefStatement+
- * | dataDefStatement+ typedefStatement*
- * | groupingStatement* dataDefStatement+
- * | dataDefStatement+ groupingStatement*;
- */
-
-/**
- * Represents listener based call back function corresponding to the "input"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class InputListener {
-
- private static final String INPUT_KEYWORD = "_input";
-
- /**
- * Creates a new input listener.
- */
- private InputListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule
- * (input), performs validation and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processInputEntry(TreeWalkListener listener,
- GeneratedYangParser.InputStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, INPUT_DATA, "", ENTRY);
-
- Parsable curData = listener.getParsedDataStack().peek();
- if (curData instanceof YangRpc) {
-
- YangInput yangInput = getYangInputNode(JAVA_GENERATION);
- yangInput.setName(((YangRpc) curData).getName() + INPUT_KEYWORD);
- YangNode curNode = (YangNode) curData;
- try {
- curNode.addChild(yangInput);
- } catch (DataModelException e) {
- throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
- INPUT_DATA, "", ENTRY, e.getMessage()));
- }
- listener.getParsedDataStack().push(yangInput);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, INPUT_DATA,
- "", ENTRY));
- }
- }
-
- /**
- * It is called when parser exits from grammar rule (input), it perform
- * validations and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processInputExit(TreeWalkListener listener,
- GeneratedYangParser.InputStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, INPUT_DATA, "", EXIT);
-
- if (!(listener.getParsedDataStack().peek() instanceof YangInput)) {
- throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, INPUT_DATA,
- "", EXIT));
- }
- listener.getParsedDataStack().pop();
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/KeyListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/KeyListener.java
deleted file mode 100644
index 889de0a..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/KeyListener.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.KEY_DATA;
-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;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * key-stmt = key-keyword sep key-arg-str stmtend
- *
- * ANTLR grammar rule
- * keyStatement : KEY_KEYWORD key STMTEND;
- * key : string;
- */
-
-/**
- * Represesnts listener based call back function corresponding to the "key" rule
- * defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class KeyListener {
-
- /**
- * Creates a new key listener.
- */
- private KeyListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule
- * (key), perform validations and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processKeyEntry(TreeWalkListener listener,
- GeneratedYangParser.KeyStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, KEY_DATA, ctx.key().getText(), ENTRY);
-
- Parsable tmpData = listener.getParsedDataStack().peek();
- if (listener.getParsedDataStack().peek() instanceof YangList) {
- YangList yangList = (YangList) tmpData;
- String tmpKeyValue = removeQuotesAndHandleConcat(ctx.key().getText());
- if (tmpKeyValue.contains(" ")) {
- String[] keyValues = tmpKeyValue.split(" ");
- for (String keyValue : keyValues) {
- try {
- yangList.addKey(keyValue);
- } catch (DataModelException e) {
- throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA, KEY_DATA,
- ctx.key().getText(), ENTRY, e.getMessage()));
- }
- }
- } else {
- try {
- yangList.addKey(tmpKeyValue);
- } catch (DataModelException e) {
- throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA, KEY_DATA,
- ctx.key().getText(), ENTRY, e.getMessage()));
- }
- }
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, KEY_DATA, ctx.key().getText(),
- ENTRY));
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListener.java
deleted file mode 100644
index 6d3a97e..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListener.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangLeafList;
-import org.onosproject.yangutils.datamodel.YangLeavesHolder;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.CONFIG_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.DESCRIPTION_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.LEAF_LIST_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.MAX_ELEMENT_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.MIN_ELEMENT_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.REFERENCE_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.STATUS_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.TYPE_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.UNITS_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerCollisionDetector.detectCollidingChildUtil;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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_CURRENT_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.validateCardinalityEqualsOne;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.validateCardinalityMaxOne;
-import static org.onosproject.yangutils.translator.tojava.YangDataModelFactory.getYangLeafList;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * leaf-list-stmt = leaf-list-keyword sep identifier-arg-str optsep
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [when-stmt stmtsep]
- * *(if-feature-stmt stmtsep)
- * type-stmt stmtsep
- * [units-stmt stmtsep]
- * *(must-stmt stmtsep)
- * [config-stmt stmtsep]
- * [min-elements-stmt stmtsep]
- * [max-elements-stmt stmtsep]
- * [ordered-by-stmt stmtsep]
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * "}"
- *
- * ANTLR grammar rule
- * leafListStatement : LEAF_LIST_KEYWORD identifier LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement |
- * typeStatement | unitsStatement | mustStatement | configStatement | minElementsStatement | maxElementsStatement |
- * orderedByStatement | statusStatement | descriptionStatement | referenceStatement)* RIGHT_CURLY_BRACE;
- */
-
-/**
- * Represents listener based call back function corresponding to the "leaf-list"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class LeafListListener {
-
- /**
- * Creates a new leaf list listener.
- */
- private LeafListListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule
- * (leaf-list), performs validation and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processLeafListEntry(TreeWalkListener listener,
- GeneratedYangParser.LeafListStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, LEAF_LIST_DATA, ctx.identifier().getText(), ENTRY);
-
- String identifier = getValidIdentifier(ctx.identifier().getText(), LEAF_LIST_DATA, ctx);
-
- // Validate sub statement cardinality.
- validateSubStatementsCardinality(ctx);
-
- // Check for identifier collision
- int line = ctx.getStart().getLine();
- int charPositionInLine = ctx.getStart().getCharPositionInLine();
- detectCollidingChildUtil(listener, line, charPositionInLine, identifier, LEAF_LIST_DATA);
-
- YangLeafList leafList = getYangLeafList(JAVA_GENERATION);
- leafList.setLeafName(identifier);
-
- Parsable tmpData = listener.getParsedDataStack().peek();
- YangLeavesHolder leavesHolder;
-
- if (tmpData instanceof YangLeavesHolder) {
- leavesHolder = (YangLeavesHolder) tmpData;
- leavesHolder.addLeafList(leafList);
- leafList.setContainedIn(leavesHolder);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, LEAF_LIST_DATA,
- ctx.identifier().getText(), ENTRY));
- }
- listener.getParsedDataStack().push(leafList);
- }
-
- /**
- * It is called when parser exits from grammar rule (leaf-list), it performs
- * validation and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processLeafListExit(TreeWalkListener listener,
- GeneratedYangParser.LeafListStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, LEAF_LIST_DATA, ctx.identifier().getText(), EXIT);
-
- if (listener.getParsedDataStack().peek() instanceof YangLeafList) {
- listener.getParsedDataStack().pop();
- } else {
- throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, LEAF_LIST_DATA,
- ctx.identifier().getText(), EXIT));
- }
- }
-
- /**
- * Validates the cardinality of leaf-list sub-statements as per grammar.
- *
- * @param ctx context object of the grammar rule
- */
- private static void validateSubStatementsCardinality(GeneratedYangParser.LeafListStatementContext ctx) {
-
- validateCardinalityEqualsOne(ctx.typeStatement(), TYPE_DATA, LEAF_LIST_DATA, ctx.identifier().getText(), ctx);
- validateCardinalityMaxOne(ctx.unitsStatement(), UNITS_DATA, LEAF_LIST_DATA, ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.configStatement(), CONFIG_DATA, LEAF_LIST_DATA, ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.maxElementsStatement(), MAX_ELEMENT_DATA, LEAF_LIST_DATA,
- ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.minElementsStatement(), MIN_ELEMENT_DATA, LEAF_LIST_DATA,
- ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.descriptionStatement(), DESCRIPTION_DATA, LEAF_LIST_DATA,
- ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.referenceStatement(), REFERENCE_DATA, LEAF_LIST_DATA, ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.statusStatement(), STATUS_DATA, LEAF_LIST_DATA, ctx.identifier().getText());
- //TODO ordered by
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListener.java
deleted file mode 100644
index ad59e12..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListener.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Implements listener based call back function corresponding to the "leaf"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-package org.onosproject.yangutils.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangLeavesHolder;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.CONFIG_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.DESCRIPTION_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.LEAF_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.MANDATORY_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.REFERENCE_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.STATUS_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.TYPE_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.UNITS_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerCollisionDetector.detectCollidingChildUtil;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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.INVALID_CONTENT;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.validateCardinalityEqualsOne;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.validateCardinalityMaxOne;
-import static org.onosproject.yangutils.translator.tojava.YangDataModelFactory.getYangLeaf;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * leaf-stmt = leaf-keyword sep identifier-arg-str optsep
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [when-stmt stmtsep]
- * *(if-feature-stmt stmtsep)
- * type-stmt stmtsep
- * [units-stmt stmtsep]
- * *(must-stmt stmtsep)
- * [default-stmt stmtsep]
- * [config-stmt stmtsep]
- * [mandatory-stmt stmtsep]
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * "}"
- *
- * ANTLR grammar rule
- * leafStatement : LEAF_KEYWORD identifier LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | typeStatement |
- * unitsStatement | mustStatement | defaultStatement | configStatement | mandatoryStatement | statusStatement |
- * descriptionStatement | referenceStatement)* RIGHT_CURLY_BRACE;
- */
-
-/**
- * Represents listener based call back function corresponding to the "leaf" rule
- * defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class LeafListener {
-
- /**
- * Creates a new leaf listener.
- */
- private LeafListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule
- * (leaf), performs validation and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processLeafEntry(TreeWalkListener listener,
- GeneratedYangParser.LeafStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, LEAF_DATA, ctx.identifier().getText(), ENTRY);
-
- String identifier = getValidIdentifier(ctx.identifier().getText(), LEAF_DATA, ctx);
-
- // Validate sub statement cardinality.
- validateSubStatementsCardinality(ctx);
-
- // Check for identifier collision
- int line = ctx.getStart().getLine();
- int charPositionInLine = ctx.getStart().getCharPositionInLine();
- detectCollidingChildUtil(listener, line, charPositionInLine, identifier, LEAF_DATA);
-
- YangLeaf leaf = getYangLeaf(JAVA_GENERATION);
- leaf.setLeafName(identifier);
-
- Parsable tmpData = listener.getParsedDataStack().peek();
- YangLeavesHolder leavesHolder;
-
- if (tmpData instanceof YangLeavesHolder) {
- leavesHolder = (YangLeavesHolder) tmpData;
- leavesHolder.addLeaf(leaf);
- leaf.setContainedIn(leavesHolder);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, LEAF_DATA,
- ctx.identifier().getText(), ENTRY));
- }
-
- listener.getParsedDataStack().push(leaf);
- }
-
- /**
- * It is called when parser exits from grammar rule (leaf), performs
- * validation and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processLeafExit(TreeWalkListener listener,
- GeneratedYangParser.LeafStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, LEAF_DATA, ctx.identifier().getText(), EXIT);
-
- if (listener.getParsedDataStack().peek() instanceof YangLeaf) {
- YangLeaf leafNode = (YangLeaf) listener.getParsedDataStack().peek();
- try {
- leafNode.validateDataOnExit();
- } catch (DataModelException e) {
- throw new ParserException(constructListenerErrorMessage(INVALID_CONTENT, LEAF_DATA,
- ctx.identifier().getText(), EXIT));
- }
- listener.getParsedDataStack().pop();
- } else {
- throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, LEAF_DATA,
- ctx.identifier().getText(), EXIT));
- }
- }
-
- /**
- * Validates the cardinality of leaf sub-statements as per grammar.
- *
- * @param ctx context object of the grammar rule
- */
- private static void validateSubStatementsCardinality(GeneratedYangParser.LeafStatementContext ctx) {
-
- validateCardinalityEqualsOne(ctx.typeStatement(), TYPE_DATA, LEAF_DATA, ctx.identifier().getText(), ctx);
- validateCardinalityMaxOne(ctx.unitsStatement(), UNITS_DATA, LEAF_DATA, ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.configStatement(), CONFIG_DATA, LEAF_DATA, ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.mandatoryStatement(), MANDATORY_DATA, LEAF_DATA, ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.descriptionStatement(), DESCRIPTION_DATA, LEAF_DATA, ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.referenceStatement(), REFERENCE_DATA, LEAF_DATA, ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.statusStatement(), STATUS_DATA, LEAF_DATA, ctx.identifier().getText());
- //TODO when.
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafrefListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafrefListener.java
deleted file mode 100644
index ef4237b..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafrefListener.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangLeafList;
-import org.onosproject.yangutils.datamodel.YangLeafRef;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.linker.impl.YangResolutionInfoImpl;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.addResolutionInfo;
-import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.UNRESOLVED;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.LEAFREF_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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_CURRENT_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;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * type-body-stmts = numerical-restrictions /
- * decimal64-specification /
- * string-restrictions /
- * enum-specification /
- * leafref-specification /
- * identityref-specification /
- * instance-identifier-specification /
- * bits-specification /
- * union-specification
- *
- * leafref-specification =
- * ;; these stmts can appear in any order
- * path-stmt stmtsep
- * [require-instance-stmt stmtsep]
- *
- * ANTLR grammar rule
- *
- * typeBodyStatements : numericalRestrictions | stringRestrictions | enumSpecification
- * | leafrefSpecification | identityrefSpecification | instanceIdentifierSpecification
- * | bitsSpecification | unionSpecification;
- *
- * leafrefSpecification : (pathStatement (requireInstanceStatement)?) | ((requireInstanceStatement)? pathStatement);
- */
-
-/**
- * Represents listener based call back function corresponding to the
- * "leafref" rule defined in ANTLR grammar file for corresponding ABNF rule
- * in RFC 6020.
- */
-public final class LeafrefListener {
-
- /**
- * Creates a new leafref listener.
- */
- private LeafrefListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule
- * (leafref), perform validations and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processLeafrefEntry(TreeWalkListener listener,
- GeneratedYangParser.LeafrefSpecificationContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, LEAFREF_DATA, "", ENTRY);
-
- int errorLine = ctx.getStart().getLine();
- int errorPosition = ctx.getStart().getCharPositionInLine();
-
- YangLeafRef<?> leafRef = new YangLeafRef<>();
-
- leafRef.setLineNumber(errorLine);
- leafRef.setCharPosition(errorPosition);
- Parsable typeData = listener.getParsedDataStack().pop();
-
- if (!(typeData instanceof YangType)) {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, LEAFREF_DATA,
- "", ENTRY));
- }
-
- YangType type = (YangType) typeData;
- type.setDataTypeExtendedInfo(leafRef);
-
- // Setting by default the value of require-instance as true.
- leafRef.setRequireInstance(true);
- Parsable tmpData = listener.getParsedDataStack().peek();
-
- switch (tmpData.getYangConstructType()) {
-
- case LEAF_DATA:
-
- // Parent YANG node of leaf to be added in resolution information.
- YangLeaf leaf = (YangLeaf) listener.getParsedDataStack().pop();
- Parsable parentNodeOfLeaf = listener.getParsedDataStack().peek();
- listener.getParsedDataStack().push(leaf);
-
- // Verify parent node of leaf.
- if (!(parentNodeOfLeaf instanceof YangNode)) {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, LEAFREF_DATA,
- "", ENTRY));
- }
-
- leafRef.setResolvableStatus(UNRESOLVED);
- leafRef.setParentNodeOfLeafref((YangNode) parentNodeOfLeaf);
- if (listener.getGroupingDepth() == 0) {
- // Add resolution information to the list.
- YangResolutionInfoImpl resolutionInfo = new YangResolutionInfoImpl<YangLeafRef>(leafRef,
- (YangNode) parentNodeOfLeaf, errorLine, errorPosition);
- addToResolutionList(resolutionInfo);
- }
- break;
-
- case LEAF_LIST_DATA:
-
- // Parent YANG node of leaf-list to be added in resolution information.
- YangLeafList leafList = (YangLeafList) listener.getParsedDataStack().pop();
- Parsable parentNodeOfLeafList = listener.getParsedDataStack().peek();
- listener.getParsedDataStack().push(leafList);
-
- // Verify parent node of leaf-list.
- if (!(parentNodeOfLeafList instanceof YangNode)) {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, LEAFREF_DATA,
- "", ENTRY));
- }
-
- leafRef.setResolvableStatus(UNRESOLVED);
- leafRef.setParentNodeOfLeafref((YangNode) parentNodeOfLeafList);
-
- if (listener.getGroupingDepth() == 0) {
- // Add resolution information to the list.
- YangResolutionInfoImpl resolutionInfoImpl = new YangResolutionInfoImpl<YangLeafRef>(leafRef,
- (YangNode) parentNodeOfLeafList, errorLine, errorPosition);
- addToResolutionList(resolutionInfoImpl);
- }
- break;
-
- case TYPEDEF_DATA:
- Parsable parentNodeOfLeafref = listener.getParsedDataStack().peek();
- leafRef.setParentNodeOfLeafref((YangNode) parentNodeOfLeafref);
- /*
- * Do not add the leaf ref to resolution list. It needs to be
- * added to resolution list, when leaf/leaf list references to
- * this typedef. At this time that leaf/leaf-list becomes the
- * parent for the leafref.
- */
- break;
-
- default:
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, LEAFREF_DATA,
- "", ENTRY));
- }
- listener.getParsedDataStack().push(typeData);
- listener.getParsedDataStack().push(leafRef);
- }
-
- /**
- * It is called when parser exits from grammar rule (leafref), it performs
- * validation and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processLeafrefExit(TreeWalkListener listener,
- GeneratedYangParser.LeafrefSpecificationContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_CURRENT_HOLDER, LEAFREF_DATA, "", EXIT);
-
- Parsable parsableType = listener.getParsedDataStack().pop();
- if (!(parsableType instanceof YangLeafRef)) {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, LEAFREF_DATA,
- "", EXIT));
- }
- }
-
- /**
- * Adds to resolution list.
- *
- * @param resolutionInfo resolution information
- */
- private static void addToResolutionList(YangResolutionInfoImpl resolutionInfo) {
-
- try {
- addResolutionInfo(resolutionInfo);
- } catch (DataModelException e) {
- throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
- LEAFREF_DATA, "", ENTRY, e.getMessage()));
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LengthRestrictionListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LengthRestrictionListener.java
deleted file mode 100644
index 52b7143..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LengthRestrictionListener.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangDerivedInfo;
-import org.onosproject.yangutils.datamodel.YangRangeRestriction;
-import org.onosproject.yangutils.datamodel.YangStringRestriction;
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.BINARY;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.DERIVED;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.STRING;
-import static org.onosproject.yangutils.datamodel.utils.RestrictionResolver.processLengthRestriction;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.LENGTH_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.TYPE_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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_CURRENT_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * length-stmt = length-keyword sep length-arg-str optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [error-message-stmt stmtsep]
- * [error-app-tag-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * "}")
- *
- *
- * ANTLR grammar rule
- * lengthStatement : LENGTH_KEYWORD length
- * (STMTEND | LEFT_CURLY_BRACE commonStatements RIGHT_CURLY_BRACE);
- */
-
-/**
- * Represents listener based call back function corresponding to the "length"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class LengthRestrictionListener {
-
- /**
- * Creates a new length restriction listener.
- */
- private LengthRestrictionListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar
- * rule (length), performs validation and updates the data model
- * tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processLengthRestrictionEntry(TreeWalkListener listener,
- GeneratedYangParser.LengthStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, LENGTH_DATA, ctx.length().getText(), ENTRY);
-
- Parsable tmpData = listener.getParsedDataStack().peek();
- if (tmpData.getYangConstructType() == TYPE_DATA) {
- YangType type = (YangType) tmpData;
- setLengthRestriction(listener, type, ctx);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, LENGTH_DATA,
- ctx.length().getText(), ENTRY));
- }
- }
-
- /**
- * Sets the length restriction to type.
- *
- * @param listener listener's object
- * @param type Yang type for which length restriction to be set
- * @param ctx context object of the grammar rule
- */
- private static void setLengthRestriction(TreeWalkListener listener, YangType type,
- 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() != STRING && type.getDataType() != BINARY) {
- 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/binary or types derived from string/binary.");
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
-
- YangRangeRestriction lengthRestriction = null;
- try {
- lengthRestriction = processLengthRestriction(null, ctx.getStart().getLine(),
- ctx.getStart().getCharPositionInLine(), false, ctx.length().getText());
- } catch (DataModelException e) {
- ParserException parserException = new ParserException(e.getMessage());
- parserException.setCharPosition(e.getCharPositionInLine());
- parserException.setLine(e.getLineNumber());
- throw parserException;
- }
-
- if (type.getDataType() == STRING) {
- YangStringRestriction stringRestriction = (YangStringRestriction) type.getDataTypeExtendedInfo();
- if (stringRestriction == null) {
- stringRestriction = new YangStringRestriction();
- type.setDataTypeExtendedInfo(stringRestriction);
- }
-
- stringRestriction.setLengthRestriction(lengthRestriction);
- } else {
- type.setDataTypeExtendedInfo(lengthRestriction);
- }
-
- listener.getParsedDataStack().push(lengthRestriction);
- }
-
- /**
- * Performs validation and updates the data model tree.
- * It is called when parser exits from grammar rule (length).
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processLengthRestrictionExit(TreeWalkListener listener,
- GeneratedYangParser.LengthStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, LENGTH_DATA, ctx.length().getText(), EXIT);
-
- Parsable tmpData = listener.getParsedDataStack().peek();
- if (tmpData instanceof YangRangeRestriction) {
- listener.getParsedDataStack().pop();
- } else if (tmpData instanceof YangType
- && ((YangType) tmpData).getDataType() == DERIVED) {
- // TODO : need to handle in linker
- } else {
- throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, LENGTH_DATA,
- ctx.length().getText(), EXIT));
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ListListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ListListener.java
deleted file mode 100644
index 1891595..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ListListener.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangAugment;
-import org.onosproject.yangutils.datamodel.YangCase;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangGrouping;
-import org.onosproject.yangutils.datamodel.YangInput;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNotification;
-import org.onosproject.yangutils.datamodel.YangOutput;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.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.parser.impl.parserutils.ListenerValidation;
-
-import static org.onosproject.yangutils.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.CONFIG_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.DATA_DEF_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.DESCRIPTION_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.KEY_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.LIST_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.MAX_ELEMENT_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.MIN_ELEMENT_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.REFERENCE_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.STATUS_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerCollisionDetector.detectCollidingChildUtil;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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_CURRENT_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.getValidIdentifier;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.validateUniqueInList;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.validateCardinalityMaxOne;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.validateCardinalityNonZero;
-import static org.onosproject.yangutils.translator.tojava.YangDataModelFactory.getYangListNode;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * list-stmt = list-keyword sep identifier-arg-str optsep
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [when-stmt stmtsep]
- * *(if-feature-stmt stmtsep)
- * *(must-stmt stmtsep)
- * [key-stmt stmtsep]
- * *(unique-stmt stmtsep)
- * [config-stmt stmtsep]
- * [min-elements-stmt stmtsep]
- * [max-elements-stmt stmtsep]
- * [ordered-by-stmt stmtsep]
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * *((typedef-stmt /
- * grouping-stmt) stmtsep)
- * 1*(data-def-stmt stmtsep)
- * "}"
- *
- * ANTLR grammar rule
- * listStatement : LIST_KEYWORD identifier LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | mustStatement |
- * keyStatement | uniqueStatement | configStatement | minElementsStatement | maxElementsStatement |
- * orderedByStatement | statusStatement | descriptionStatement | referenceStatement | typedefStatement |
- * groupingStatement| dataDefStatement)* RIGHT_CURLY_BRACE;
- */
-
-/**
- * Represents listener based call back function corresponding to the "list" rule
- * defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class ListListener {
-
- /**
- * Creates a new list listener.
- */
- private ListListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule
- * (list), performs validation and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processListEntry(TreeWalkListener listener,
- GeneratedYangParser.ListStatementContext ctx) {
-
- YangNode curNode;
-
- checkStackIsNotEmpty(listener, MISSING_HOLDER, LIST_DATA, ctx.identifier().getText(), ENTRY);
-
- String identifier = getValidIdentifier(ctx.identifier().getText(), LIST_DATA, ctx);
-
- // Validate sub statement cardinality.
- validateSubStatementsCardinality(ctx);
-
- // Check for identifier collision
- int line = ctx.getStart().getLine();
- int charPositionInLine = ctx.getStart().getCharPositionInLine();
- detectCollidingChildUtil(listener, line, charPositionInLine, identifier, LIST_DATA);
-
- YangList yangList = getYangListNode(JAVA_GENERATION);
- yangList.setName(identifier);
-
- /*
- * If "config" is not specified, the default is the same as the parent
- * schema node's "config" value.
- */
- if (ctx.configStatement().isEmpty()) {
- boolean parentConfig = ListenerValidation.getParentNodeConfig(listener);
- yangList.setConfig(parentConfig);
- }
-
- Parsable curData = listener.getParsedDataStack().peek();
- if (curData instanceof YangModule || curData instanceof YangContainer
- || curData instanceof YangList || curData instanceof YangCase
- || curData instanceof YangNotification || curData instanceof YangInput
- || curData instanceof YangOutput || curData instanceof YangAugment
- || curData instanceof YangGrouping || curData instanceof YangSubModule) {
- curNode = (YangNode) curData;
- try {
- curNode.addChild(yangList);
- } catch (DataModelException e) {
- throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
- LIST_DATA, ctx.identifier().getText(), ENTRY, e.getMessage()));
- }
- listener.getParsedDataStack().push(yangList);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, LIST_DATA,
- ctx.identifier().getText(), ENTRY));
- }
- }
-
- /**
- * It is called when parser exits from grammar rule (list), it performs
- * validation and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processListExit(TreeWalkListener listener,
- GeneratedYangParser.ListStatementContext ctx) {
-
- checkStackIsNotEmpty(listener, MISSING_HOLDER, LIST_DATA, ctx.identifier().getText(), EXIT);
-
- if (listener.getParsedDataStack().peek() instanceof YangList) {
- YangList yangList = (YangList) listener.getParsedDataStack().peek();
- try {
- yangList.validateDataOnExit();
- validateUniqueInList(yangList, ctx);
- } catch (DataModelException e) {
- throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
- LIST_DATA, ctx.identifier().getText(), EXIT, e.getMessage()));
- }
- listener.getParsedDataStack().pop();
- } else {
- throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, LIST_DATA,
- ctx.identifier().getText(), EXIT));
- }
- }
-
- /**
- * Validates the cardinality of list sub-statements as per grammar.
- *
- * @param ctx context object of the grammar rule
- */
- private static void validateSubStatementsCardinality(GeneratedYangParser.ListStatementContext ctx) {
-
- validateCardinalityMaxOne(ctx.keyStatement(), KEY_DATA, LIST_DATA, ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.configStatement(), CONFIG_DATA, LIST_DATA, ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.maxElementsStatement(), MAX_ELEMENT_DATA, LIST_DATA, ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.minElementsStatement(), MIN_ELEMENT_DATA, LIST_DATA, ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.descriptionStatement(), DESCRIPTION_DATA, LIST_DATA, ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.referenceStatement(), REFERENCE_DATA, LIST_DATA, ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.statusStatement(), STATUS_DATA, LIST_DATA, ctx.identifier().getText());
- validateCardinalityNonZero(ctx.dataDefStatement(), DATA_DEF_DATA, LIST_DATA, ctx.identifier().getText(), ctx);
- //TODO when, typedef, grouping, unique
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/MandatoryListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/MandatoryListener.java
deleted file mode 100644
index b945f81..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/MandatoryListener.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.MANDATORY_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.ListenerUtil.getValidBooleanValue;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * mandatory-stmt = mandatory-keyword sep
- * mandatory-arg-str stmtend
- *
- * mandatory-arg-str = < a string that matches the rule
- * mandatory-arg >
- *
- * mandatory-arg = true-keyword / false-keyword
- *
- * ANTLR grammar rule
- * mandatoryStatement : MANDATORY_KEYWORD mandatory STMTEND;
- * mandatory : string;
- */
-
-/**
- * Represents listener based call back function corresponding to the "mandatory"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class MandatoryListener {
-
- /**
- * Creates a new mandatory listener.
- */
- private MandatoryListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar
- * rule (mandatory), performs validation and updates the data model
- * tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processMandatoryEntry(TreeWalkListener listener,
- GeneratedYangParser.MandatoryStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, MANDATORY_DATA, "", ENTRY);
-
- boolean isMandatory = getValidBooleanValue(ctx.mandatory().getText(), MANDATORY_DATA, ctx);
-
- Parsable tmpNode = listener.getParsedDataStack().peek();
- switch (tmpNode.getYangConstructType()) {
- case LEAF_DATA:
- YangLeaf leaf = (YangLeaf) tmpNode;
- leaf.setMandatory(isMandatory);
- break;
- case CHOICE_DATA: // TODO
- break;
- default:
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, MANDATORY_DATA, "", ENTRY));
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/MaxElementsListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/MaxElementsListener.java
deleted file mode 100644
index 90acba6..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/MaxElementsListener.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangLeafList;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangMaxElement;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.MAX_ELEMENT_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.ListenerUtil.removeQuotesAndHandleConcat;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * max-elements-stmt = max-elements-keyword sep
- * max-value-arg-str stmtend
- * max-value-arg-str = < a string that matches the rule
- * max-value-arg >
- *
- * ANTLR grammar rule
- * maxElementsStatement : MAX_ELEMENTS_KEYWORD maxValue STMTEND;
- * maxValue : string;
- */
-
-/**
- * Represents listener based call back function corresponding to the
- * "max-elements" rule defined in ANTLR grammar file for corresponding ABNF rule
- * in RFC 6020.
- */
-public final class MaxElementsListener {
-
- private static final String POSITIVE_INTEGER_PATTERN = "[1-9][0-9]*";
- private static final String UNBOUNDED_KEYWORD = "unbounded";
-
- /**
- * Creates a new max-elements listener.
- */
- private MaxElementsListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule
- * (max-elements), performs validation and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processMaxElementsEntry(TreeWalkListener listener,
- GeneratedYangParser.MaxElementsStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, MAX_ELEMENT_DATA, "", ENTRY);
-
- int maxElementsValue = getValidMaxElementValue(ctx);
-
- Parsable tmpData = listener.getParsedDataStack().peek();
- switch (tmpData.getYangConstructType()) {
- case LEAF_LIST_DATA:
- YangLeafList leafList = (YangLeafList) tmpData;
- YangMaxElement maxLeafListElement = new YangMaxElement();
- maxLeafListElement.setMaxElement(maxElementsValue);
- leafList.setMaxElements(maxLeafListElement);
- break;
- case LIST_DATA:
- YangList yangList = (YangList) tmpData;
- YangMaxElement maxListElement = new YangMaxElement();
- maxListElement.setMaxElement(maxElementsValue);
- yangList.setMaxElements(maxListElement);
- break;
- default:
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, MAX_ELEMENT_DATA, "", ENTRY));
- }
- }
-
- /**
- * Validates max element value and returns the value from context.
- *
- * @param ctx context object of the grammar rule
- * @return max element's value
- */
- private static int getValidMaxElementValue(GeneratedYangParser.MaxElementsStatementContext ctx) {
-
- int maxElementsValue;
-
- String value = removeQuotesAndHandleConcat(ctx.maxValue().getText());
- if (value.equals(UNBOUNDED_KEYWORD)) {
- maxElementsValue = Integer.MAX_VALUE;
- } else if (value.matches(POSITIVE_INTEGER_PATTERN)) {
- try {
- maxElementsValue = Integer.parseInt(value);
- } catch (NumberFormatException e) {
- ParserException parserException = new ParserException("YANG file error : " +
- YangConstructType.getYangConstructType(MAX_ELEMENT_DATA) + " value " + value + " is not " +
- "valid.");
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
- } else {
- ParserException parserException = new ParserException("YANG file error : " +
- YangConstructType.getYangConstructType(MAX_ELEMENT_DATA) + " value " + value + " is not " +
- "valid.");
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
-
- return maxElementsValue;
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/MinElementsListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/MinElementsListener.java
deleted file mode 100644
index 7e7ed78..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/MinElementsListener.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangLeafList;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangMinElement;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.MIN_ELEMENT_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.ListenerUtil.getValidNonNegativeIntegerValue;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * min-elements-stmt = min-elements-keyword sep
- * min-value-arg-str stmtend
- * min-value-arg-str = < a string that matches the rule
- * min-value-arg >
- * min-value-arg = non-negative-integer-value
- *
- * ANTLR grammar rule
- * minElementsStatement : MIN_ELEMENTS_KEYWORD minValue STMTEND;
- * minValue : string;
- */
-
-/**
- * Represents listener based call back function corresponding to the "min-elements"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class MinElementsListener {
-
- /**
- * Creates a new min-elements listener.
- */
- private MinElementsListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar
- * rule (min-elements), performs validation and updates the data model
- * tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processMinElementsEntry(TreeWalkListener listener,
- GeneratedYangParser.MinElementsStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, MIN_ELEMENT_DATA, ctx.minValue().getText(), ENTRY);
-
- int minElementValue = getValidNonNegativeIntegerValue(ctx.minValue().getText(), MIN_ELEMENT_DATA, ctx);
-
- Parsable tmpData = listener.getParsedDataStack().peek();
- switch (tmpData.getYangConstructType()) {
- case LEAF_LIST_DATA:
- YangLeafList leafList = (YangLeafList) tmpData;
- YangMinElement minLeafListElement = new YangMinElement();
- minLeafListElement.setMinElement(minElementValue);
- leafList.setMinElements(minLeafListElement);
- break;
- case LIST_DATA:
- YangList yangList = (YangList) tmpData;
- YangMinElement minElement = new YangMinElement();
- minElement.setMinElement(minElementValue);
- yangList.setMinElements(minElement);
- break;
- default:
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, MIN_ELEMENT_DATA,
- ctx.minValue().getText(), ENTRY));
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ModuleListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ModuleListener.java
deleted file mode 100644
index 5b50ff9..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ModuleListener.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import java.util.Date;
-import org.onosproject.yangutils.datamodel.ResolvableType;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangReferenceResolver;
-import org.onosproject.yangutils.datamodel.YangRevision;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.linker.exceptions.LinkerException;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.MODULE_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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_CURRENT_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getCurrentDateForRevision;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsEmpty;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-import static org.onosproject.yangutils.translator.tojava.YangDataModelFactory.getYangModuleNode;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * module-stmt = optsep module-keyword sep identifier-arg-str
- * optsep
- * "{" stmtsep
- * module-header-stmts
- * linkage-stmts
- * meta-stmts
- * revision-stmts
- * body-stmts
- * "}" optsep
- *
- * ANTLR grammar rule
- * module_stmt : MODULE_KEYWORD identifier LEFT_CURLY_BRACE module_body* RIGHT_CURLY_BRACE;
- */
-
-/**
- * Represents listener based call back function corresponding to the "module"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class ModuleListener {
-
- /**
- * Creates a new module listener.
- */
- private ModuleListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule
- * (module), perform validations and update the data model tree.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processModuleEntry(TreeWalkListener listener, GeneratedYangParser.ModuleStatementContext ctx) {
-
- // Check if stack is empty.
- checkStackIsEmpty(listener, INVALID_HOLDER, MODULE_DATA, ctx.identifier().getText(), ENTRY);
-
- String identifier = getValidIdentifier(ctx.identifier().getText(), MODULE_DATA, ctx);
-
- YangModule yangModule = getYangModuleNode(JAVA_GENERATION);
- yangModule.setName(identifier);
-
- if (ctx.moduleBody().moduleHeaderStatement().yangVersionStatement() == null) {
- yangModule.setVersion((byte) 1);
- }
-
- listener.getParsedDataStack().push(yangModule);
- }
-
- /**
- * It is called when parser exits from grammar rule (module), it perform
- * validations and update the data model tree.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processModuleExit(TreeWalkListener listener, GeneratedYangParser.ModuleStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, MODULE_DATA, ctx.identifier().getText(), EXIT);
-
- Parsable tmpNode = listener.getParsedDataStack().peek();
- if (!(tmpNode instanceof YangModule)) {
- throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, MODULE_DATA,
- ctx.identifier().getText(), EXIT));
- }
-
- if (((YangModule) tmpNode).getRevision() == null) {
- Date currentDate = getCurrentDateForRevision();
- YangRevision currentRevision = new YangRevision();
- currentRevision.setRevDate(currentDate);
- ((YangModule) tmpNode).setRevision(currentRevision);
- }
-
- try {
- ((YangReferenceResolver) listener.getParsedDataStack()
- .peek()).resolveSelfFileLinking(ResolvableType.YANG_IF_FEATURE);
- ((YangReferenceResolver) listener.getParsedDataStack()
- .peek()).resolveSelfFileLinking(ResolvableType.YANG_USES);
- ((YangReferenceResolver) listener.getParsedDataStack()
- .peek()).resolveSelfFileLinking(ResolvableType.YANG_DERIVED_DATA_TYPE);
- ((YangReferenceResolver) listener.getParsedDataStack()
- .peek()).resolveSelfFileLinking(ResolvableType.YANG_LEAFREF);
- ((YangReferenceResolver) listener.getParsedDataStack()
- .peek()).resolveSelfFileLinking(ResolvableType.YANG_BASE);
- ((YangReferenceResolver) listener.getParsedDataStack()
- .peek()).resolveSelfFileLinking(ResolvableType.YANG_IDENTITYREF);
- } catch (DataModelException e) {
- LinkerException linkerException = new LinkerException(e.getMessage());
- linkerException.setLine(e.getLineNumber());
- linkerException.setCharPosition(e.getCharPositionInLine());
- throw linkerException;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/MustListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/MustListener.java
deleted file mode 100644
index b6cbf20..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/MustListener.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangMust;
-import org.onosproject.yangutils.datamodel.YangMustHolder;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.MUST_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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_CURRENT_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.removeQuotesAndHandleConcat;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- *
- * must-stmt = must-keyword sep string optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [error-message-stmt stmtsep]
- * [error-app-tag-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * "}")
- *
- * ANTLR grammar rule
- * mustStatement : MUST_KEYWORD string (STMTEND | LEFT_CURLY_BRACE commonStatements RIGHT_CURLY_BRACE);
- */
-
-/**
- * Represents listener based call back function corresponding to the
- * "must" rule defined in ANTLR grammar file for corresponding ABNF rule
- * in RFC 6020.
- */
-public final class MustListener {
-
- /**
- * Creates a new must listener.
- */
- private MustListener() {
- }
-
- /**
- * Perform validations and updates the data model tree.It is called when parser
- * receives an input matching the grammar rule (must).
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processMustEntry(TreeWalkListener listener,
- GeneratedYangParser.MustStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, MUST_DATA, ctx.string().getText(), ENTRY);
- String constraint = removeQuotesAndHandleConcat(ctx.string().getText());
-
- // Obtain the node of the stack.
- Parsable tmpNode = listener.getParsedDataStack().peek();
- if (tmpNode instanceof YangMustHolder) {
-
- YangMust must = new YangMust();
- must.setConstraint(constraint);
-
- YangMustHolder mustHolder = (YangMustHolder) tmpNode;
- mustHolder.addMust(must);
-
- listener.getParsedDataStack().push(must);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, MUST_DATA,
- ctx.string().getText(), ENTRY));
- }
-
- }
-
- /**
- * Performs validation and updates the data model tree.It is called when parser
- * exits from grammar rule (must).
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processMustExit(TreeWalkListener listener,
- GeneratedYangParser.MustStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, MUST_DATA, ctx.string().getText(), EXIT);
-
- if (listener.getParsedDataStack().peek() instanceof YangMust) {
- listener.getParsedDataStack().pop();
- } else {
- throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, MUST_DATA,
- ctx.string().getText(), EXIT));
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/NamespaceListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/NamespaceListener.java
deleted file mode 100644
index f32a4ed..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/NamespaceListener.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import java.net.URI;
-
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNameSpace;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.NAMESPACE_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;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * module-header-stmts = ;; these stmts can appear in any order
- * [yang-version-stmt stmtsep]
- * namespace-stmt stmtsep
- * prefix-stmt stmtsep
- *
- * namespace-stmt = namespace-keyword sep uri-str optsep stmtend
- *
- * ANTLR grammar rule
- * module_header_statement : yang_version_stmt? namespace_stmt prefix_stmt
- * | yang_version_stmt? prefix_stmt namespace_stmt
- * | namespace_stmt yang_version_stmt? prefix_stmt
- * | namespace_stmt prefix_stmt yang_version_stmt?
- * | prefix_stmt namespace_stmt yang_version_stmt?
- * | prefix_stmt yang_version_stmt? namespace_stmt
- * ;
- * namespace_stmt : NAMESPACE_KEYWORD string STMTEND;
- */
-
-/**
- * Represents listener based call back function corresponding to the "namespace"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class NamespaceListener {
-
- /**
- * Creates a new namespace listener.
- */
- private NamespaceListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule
- * (namespace), perform validations and update the data model tree.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processNamespaceEntry(TreeWalkListener listener,
- GeneratedYangParser.NamespaceStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, NAMESPACE_DATA, ctx.string().getText(), ENTRY);
-
- if (!validateUriValue(ctx.string().getText())) {
- ParserException parserException = new ParserException("YANG file error: Invalid namespace URI");
- parserException.setLine(ctx.string().STRING(0).getSymbol().getLine());
- parserException.setCharPosition(ctx.string().STRING(0).getSymbol().getCharPositionInLine());
- throw parserException;
- }
-
- // Obtain the node of the stack.
- Parsable tmpNode = listener.getParsedDataStack().peek();
- switch (tmpNode.getYangConstructType()) {
- case MODULE_DATA: {
- YangModule module = (YangModule) tmpNode;
- YangNameSpace uri = new YangNameSpace();
- uri.setUri(ctx.string().getText());
- module.setNameSpace(uri);
- break;
- }
- default:
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, NAMESPACE_DATA,
- ctx.string().getText(), ENTRY));
- }
- }
-
- /**
- * Validate input URI.
- *
- * @param uri input namespace URI
- * @return validation result
- */
- private static boolean validateUriValue(String uri) {
- uri = uri.replace("\"", "");
- try {
- URI.create(uri);
- } catch (Exception e1) {
- return false;
- }
- return true;
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/NotificationListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/NotificationListener.java
deleted file mode 100644
index 4ed7493..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/NotificationListener.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNotification;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.DESCRIPTION_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.NOTIFICATION_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.REFERENCE_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.STATUS_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerCollisionDetector.detectCollidingChildUtil;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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_CURRENT_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.getValidIdentifier;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.validateCardinalityMaxOne;
-import static org.onosproject.yangutils.translator.tojava.YangDataModelFactory.getYangNotificationNode;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * notification-stmt = notification-keyword sep
- * identifier-arg-str optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * *(if-feature-stmt stmtsep)
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * *((typedef-stmt /
- * grouping-stmt) stmtsep)
- * *(data-def-stmt stmtsep)
- * "}")
- *
- * ANTLR grammar rule
- * notificationStatement : NOTIFICATION_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE (ifFeatureStatement
- * | statusStatement | descriptionStatement | referenceStatement | typedefStatement
- * | groupingStatement | dataDefStatement)* RIGHT_CURLY_BRACE);
- */
-
-/**
- * Represents listener based call back function corresponding to the "notification"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class NotificationListener {
-
- /**
- * Creates a new notification listener.
- */
- private NotificationListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule
- * (notification), performs validation and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processNotificationEntry(TreeWalkListener listener,
- GeneratedYangParser.NotificationStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, NOTIFICATION_DATA, ctx.identifier().getText(), ENTRY);
-
- String identifier = getValidIdentifier(ctx.identifier().getText(), NOTIFICATION_DATA, ctx);
-
- // Validate sub statement cardinality.
- validateSubStatementsCardinality(ctx);
-
- // Check for identifier collision
- int line = ctx.getStart().getLine();
- int charPositionInLine = ctx.getStart().getCharPositionInLine();
- detectCollidingChildUtil(listener, line, charPositionInLine, identifier, NOTIFICATION_DATA);
-
- Parsable curData = listener.getParsedDataStack().peek();
- if (curData instanceof YangModule || curData instanceof YangSubModule) {
-
- YangNotification notification = getYangNotificationNode(JAVA_GENERATION);
- notification.setName(identifier);
- YangNode curNode = (YangNode) curData;
- try {
- curNode.addChild(notification);
- } catch (DataModelException e) {
- throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
- NOTIFICATION_DATA, ctx.identifier().getText(), ENTRY, e.getMessage()));
- }
- listener.getParsedDataStack().push(notification);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, NOTIFICATION_DATA,
- ctx.identifier().getText(), ENTRY));
- }
- }
-
- /**
- * It is called when parser exits from grammar rule (notification), it perform
- * validations and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processNotificationExit(TreeWalkListener listener,
- GeneratedYangParser.NotificationStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, NOTIFICATION_DATA, ctx.identifier().getText(), EXIT);
-
- if (listener.getParsedDataStack().peek() instanceof YangNotification) {
- listener.getParsedDataStack().pop();
- } else {
- throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, NOTIFICATION_DATA,
- ctx.identifier().getText(), EXIT));
- }
- }
-
- /**
- * Validates the cardinality of notification sub-statements as per grammar.
- *
- * @param ctx context object of the grammar rule
- */
- private static void validateSubStatementsCardinality(GeneratedYangParser.NotificationStatementContext ctx) {
-
- validateCardinalityMaxOne(ctx.statusStatement(), STATUS_DATA, NOTIFICATION_DATA, ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.descriptionStatement(), DESCRIPTION_DATA, NOTIFICATION_DATA,
- ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.referenceStatement(), REFERENCE_DATA, NOTIFICATION_DATA,
- ctx.identifier().getText());
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/OrganizationListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/OrganizationListener.java
deleted file mode 100644
index 20a42c1..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/OrganizationListener.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.ORGANIZATION_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;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * meta-stmts = ;; these stmts can appear in any order
- * [organization-stmt stmtsep]
- * [contact-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * organization-stmt = organization-keyword sep string
- * optsep stmtend
- *
- * ANTLR grammar rule
- * meta_stmts : organization_stmt? contact_stmt? description_stmt? reference_stmt?
- * | organization_stmt? contact_stmt? reference_stmt? description_stmt?
- * | organization_stmt? description_stmt? contact_stmt? reference_stmt?
- * | organization_stmt? description_stmt? reference_stmt? contact_stmt?
- * | organization_stmt? reference_stmt? contact_stmt? description_stmt?
- * | organization_stmt? reference_stmt? description_stmt? contact_stmt?
- * | contact_stmt? organization_stmt? description_stmt? reference_stmt?
- * | contact_stmt? organization_stmt? reference_stmt? description_stmt?
- * | contact_stmt? reference_stmt? organization_stmt? description_stmt?
- * | contact_stmt? reference_stmt? description_stmt? organization_stmt?
- * | contact_stmt? description_stmt? reference_stmt? organization_stmt?
- * | contact_stmt? description_stmt? organization_stmt? reference_stmt?
- * | reference_stmt? contact_stmt? organization_stmt? description_stmt?
- * | reference_stmt? contact_stmt? description_stmt? organization_stmt?
- * | reference_stmt? organization_stmt? contact_stmt? description_stmt?
- * | reference_stmt? organization_stmt? description_stmt? contact_stmt?
- * | reference_stmt? description_stmt? organization_stmt? contact_stmt?
- * | reference_stmt? description_stmt? contact_stmt? organization_stmt?
- * | description_stmt? reference_stmt? contact_stmt? organization_stmt?
- * | description_stmt? reference_stmt? organization_stmt? contact_stmt?
- * | description_stmt? contact_stmt? reference_stmt? organization_stmt?
- * | description_stmt? contact_stmt? organization_stmt? reference_stmt?
- * | description_stmt? organization_stmt? contact_stmt? reference_stmt?
- * | description_stmt? organization_stmt? reference_stmt? contact_stmt?
- * ;
- * organization_stmt : ORGANIZATION_KEYWORD string STMTEND;
- */
-
-/**
- * Represents listener based call back function corresponding to the
- * "organization" rule defined in ANTLR grammar file for corresponding ABNF rule
- * in RFC 6020.
- */
-public final class OrganizationListener {
-
- /**
- * Creates a new organization listener.
- */
- private OrganizationListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule
- * (organization), perform validations and update the data model tree.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processOrganizationEntry(TreeWalkListener listener,
- GeneratedYangParser.OrganizationStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, ORGANIZATION_DATA, ctx.string().getText(),
- ENTRY);
-
- // Obtain the node of the stack.
- Parsable tmpNode = listener.getParsedDataStack().peek();
- switch (tmpNode.getYangConstructType()) {
- case MODULE_DATA: {
- YangModule module = (YangModule) tmpNode;
- module.setOrganization(ctx.string().getText());
- break;
- }
- case SUB_MODULE_DATA: {
- YangSubModule subModule = (YangSubModule) tmpNode;
- subModule.setOrganization(ctx.string().getText());
- break;
- }
- default:
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, ORGANIZATION_DATA,
- ctx.string().getText(), ENTRY));
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/OutputListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/OutputListener.java
deleted file mode 100644
index d0ef568..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/OutputListener.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangOutput;
-import org.onosproject.yangutils.datamodel.YangRpc;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.OUTPUT_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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_CURRENT_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.translator.tojava.YangDataModelFactory.getYangOutputNode;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- *
- * output-stmt = output-keyword optsep
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * *((typedef-stmt /
- * grouping-stmt) stmtsep)
- * 1*(data-def-stmt stmtsep)
- * "}"
- *
- * outputStatement : OUTPUT_KEYWORD LEFT_CURLY_BRACE outputStatementBody RIGHT_CURLY_BRACE;
-
- * outputStatementBody : typedefStatement* dataDefStatement+
- * | dataDefStatement+ typedefStatement*
- * | groupingStatement* dataDefStatement+
- * | dataDefStatement+ groupingStatement*;
- */
-
-/**
- * Represents listener based call back function corresponding to the "output"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class OutputListener {
-
- private static final String OUTPUT_KEYWORD = "_output";
-
- /**
- * Creates a new output listener.
- */
- private OutputListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule
- * (output), performs validation and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processOutputEntry(TreeWalkListener listener,
- GeneratedYangParser.OutputStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, OUTPUT_DATA, "", ENTRY);
-
- Parsable curData = listener.getParsedDataStack().peek();
- if (curData instanceof YangRpc) {
-
- YangOutput yangOutput = getYangOutputNode(JAVA_GENERATION);
- yangOutput.setName(((YangRpc) curData).getName() + OUTPUT_KEYWORD);
- YangNode curNode = (YangNode) curData;
- try {
- curNode.addChild(yangOutput);
- } catch (DataModelException e) {
- throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
- OUTPUT_DATA, "", ENTRY, e.getMessage()));
- }
- listener.getParsedDataStack().push(yangOutput);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, OUTPUT_DATA,
- "", ENTRY));
- }
- }
-
- /**
- * It is called when parser exits from grammar rule (output), it perform
- * validations and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processOutputExit(TreeWalkListener listener,
- GeneratedYangParser.OutputStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, OUTPUT_DATA, "", EXIT);
-
- if (!(listener.getParsedDataStack().peek() instanceof YangOutput)) {
- throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, OUTPUT_DATA,
- "", EXIT));
- }
- listener.getParsedDataStack().pop();
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/PathListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/PathListener.java
deleted file mode 100644
index b02c6f4..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/PathListener.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangLeafRef;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.validatePathArgument;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.PATH_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * leafref-specification =
- * ;; these stmts can appear in any order
- * path-stmt stmtsep
- * [require-instance-stmt stmtsep]
- *
- * path-stmt = path-keyword sep path-arg-str stmtend
- *
- * ANTLR grammar rule
- *
- * leafrefSpecification : (pathStatement (requireInstanceStatement)?) | ((requireInstanceStatement)? pathStatement);
- *
- * pathStatement : PATH_KEYWORD path STMTEND;
- */
-
-/**
- * Represents listener based call back function corresponding to the
- * "path" rule defined in ANTLR grammar file for corresponding ABNF rule
- * in RFC 6020.
- */
-public final class PathListener {
-
- /**
- * Creates a new path listener.
- */
- private PathListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule
- * (path), performs validation and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processPathEntry(TreeWalkListener listener,
- GeneratedYangParser.PathStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, PATH_DATA, ctx.path().getText(), ENTRY);
-
- Parsable curData = listener.getParsedDataStack().peek();
-
- // Checks the holder of path as leafref, else throws error.
- if (curData instanceof YangLeafRef) {
-
- // Splitting the path argument and updating it in the datamodel tree.
- validatePathArgument(ctx.path().getText(), PATH_DATA, ctx, (YangLeafRef) curData);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, PATH_DATA,
- ctx.path().getText(), ENTRY));
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/PatternRestrictionListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/PatternRestrictionListener.java
deleted file mode 100644
index 0d6d1f4..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/PatternRestrictionListener.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import java.util.regex.Pattern;
-import java.util.regex.PatternSyntaxException;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.datamodel.YangDerivedInfo;
-import org.onosproject.yangutils.datamodel.YangPatternRestriction;
-import org.onosproject.yangutils.datamodel.YangStringRestriction;
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.DERIVED;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.PATTERN_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.TYPE_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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_CURRENT_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * pattern-stmt = pattern-keyword sep string optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [error-message-stmt stmtsep]
- * [error-app-tag-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * "}")
- *
- * ANTLR grammar rule
- * patternStatement : PATTERN_KEYWORD string (STMTEND | LEFT_CURLY_BRACE commonStatements RIGHT_CURLY_BRACE);
- */
-
-/**
- * Represents listener based call back function corresponding to the "pattern"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class PatternRestrictionListener {
-
- private static final String EMPTY_STRING = "";
-
- /**
- * Creates a new pattern restriction listener.
- */
- private PatternRestrictionListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar
- * rule (pattern), performs validation and updates the data model
- * tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processPatternRestrictionEntry(TreeWalkListener listener,
- GeneratedYangParser.PatternStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, PATTERN_DATA, ctx.string().getText(), ENTRY);
-
- Parsable tmpData = listener.getParsedDataStack().peek();
- if (tmpData.getYangConstructType() == TYPE_DATA) {
- YangType type = (YangType) tmpData;
- setPatternRestriction(listener, type, ctx);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, PATTERN_DATA,
- ctx.string().getText(), ENTRY));
- }
- }
-
- /**
- * Sets the pattern restriction to type.
- *
- * @param listener listener's object
- * @param type Yang type for which pattern restriction to be set
- * @param ctx context object of the grammar rule
- */
- private static void setPatternRestriction(TreeWalkListener listener, YangType type,
- GeneratedYangParser.PatternStatementContext ctx) {
-
- if (type.getDataType() != YangDataTypes.STRING && type.getDataType() != YangDataTypes.DERIVED) {
-
- ParserException parserException = new ParserException("YANG file error : " +
- YangConstructType.getYangConstructType(PATTERN_DATA) + " name " + ctx.string().getText() +
- " can be used to restrict the built-in type string or types derived from string.");
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
-
- // Validate and get valid pattern restriction string.
- String patternArgument = getValidPattern(ctx);
-
- if (type.getDataType() == YangDataTypes.STRING) {
- YangStringRestriction stringRestriction = (YangStringRestriction) type.getDataTypeExtendedInfo();
- if (stringRestriction == null) {
- stringRestriction = new YangStringRestriction();
- type.setDataTypeExtendedInfo(stringRestriction);
- stringRestriction.addPattern(patternArgument);
- } else {
- stringRestriction.addPattern(patternArgument);
- }
- listener.getParsedDataStack().push(stringRestriction);
- } 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);
- }
- }
- }
-
- /**
- * Performs validation and updates the data model tree.
- * It is called when parser exits from grammar rule (pattern).
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processPatternRestrictionExit(TreeWalkListener listener,
- GeneratedYangParser.PatternStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, PATTERN_DATA, ctx.string().getText(), EXIT);
-
- Parsable tmpData = listener.getParsedDataStack().peek();
- if (tmpData instanceof YangStringRestriction) {
- listener.getParsedDataStack().pop();
- } else if (tmpData instanceof YangType
- && ((YangType) tmpData).getDataType() == DERIVED) {
- // TODO : need to handle in linker
- } else {
- throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, PATTERN_DATA,
- ctx.string().getText(), EXIT));
- }
- }
-
- /**
- * Validates and return the valid pattern.
- *
- * @param ctx context object of the grammar rule
- * @return validated string
- */
- private static String getValidPattern(GeneratedYangParser.PatternStatementContext ctx) {
- String userInputPattern = ctx.string().getText().replace("\"", EMPTY_STRING);
- try {
- Pattern.compile(userInputPattern);
- } catch (PatternSyntaxException exception) {
- ParserException parserException = new ParserException("YANG file error : " +
- YangConstructType.getYangConstructType(PATTERN_DATA) + " name " + ctx.string().getText() +
- " is not a valid regular expression");
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
- return userInputPattern;
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/PositionListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/PositionListener.java
deleted file mode 100644
index 3a14927..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/PositionListener.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * position-stmt = position-keyword sep
- * position-value-arg-str stmtend
- * position-value-arg-str = < a string that matches the rule
- * position-value-arg >
- * position-value-arg = non-negative-integer-value
- * non-negative-integer-value = "0" / positive-integer-value
- * positive-integer-value = (non-zero-digit *DIGIT)
- * zero-integer-value = 1*DIGIT
- *
- * ANTLR grammar rule
- * positionStatement : POSITION_KEYWORD position STMTEND;
- * position : string;
- */
-
-import org.onosproject.yangutils.datamodel.YangBit;
-import org.onosproject.yangutils.datamodel.YangBits;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.POSITION_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.ListenerUtil.getValidNonNegativeIntegerValue;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-
-/**
- * Represents listener based call back function corresponding to the "position"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class PositionListener {
-
- /**
- * Creates a new position listener.
- */
- private PositionListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule
- * (position), perform validations and update the data model tree.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processPositionEntry(TreeWalkListener listener,
- GeneratedYangParser.PositionStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, POSITION_DATA, ctx.position().getText(), ENTRY);
-
- // Obtain the node of the stack.
- Parsable tmpNode = listener.getParsedDataStack().peek();
- switch (tmpNode.getYangConstructType()) {
- case BIT_DATA: {
- YangBit bitNode = (YangBit) tmpNode;
- int positionValue = getValidBitPosition(listener, ctx);
- bitNode.setPosition(positionValue);
- break;
- }
- default:
- throw new ParserException(
- constructListenerErrorMessage(INVALID_HOLDER, POSITION_DATA, ctx.position().getText(), ENTRY));
- }
- }
-
- /**
- * Validates BITS position value correctness and uniqueness.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- * @return position value
- */
- private static int getValidBitPosition(TreeWalkListener listener,
- GeneratedYangParser.PositionStatementContext ctx) {
- Parsable bitNode = listener.getParsedDataStack().pop();
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, POSITION_DATA, ctx.position().getText(), ENTRY);
-
- int positionValue = getValidNonNegativeIntegerValue(ctx.position().getText(), POSITION_DATA, ctx);
-
- Parsable tmpNode = listener.getParsedDataStack().peek();
- switch (tmpNode.getYangConstructType()) {
- case BITS_DATA: {
- YangBits yangBits = (YangBits) tmpNode;
- listener.getParsedDataStack().push(bitNode);
- if (yangBits.isBitPositionExists(positionValue)) {
- ParserException parserException = new ParserException("YANG file error: Duplicate value of " +
- "position is invalid.");
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
- return positionValue;
- }
- default:
- listener.getParsedDataStack().push(bitNode);
- throw new ParserException(
- constructListenerErrorMessage(INVALID_HOLDER, POSITION_DATA, ctx.position().getText(), ENTRY));
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/PrefixListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/PrefixListener.java
deleted file mode 100644
index b75f77c..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/PrefixListener.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangBelongsTo;
-import org.onosproject.yangutils.datamodel.YangImport;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.PREFIX_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.ListenerUtil.getValidIdentifier;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * module-header-stmts = ;; these stmts can appear in any order
- * [yang-version-stmt stmtsep]
- * namespace-stmt stmtsep
- * prefix-stmt stmtsep
- *
- * prefix-stmt = prefix-keyword sep prefix-arg-str
- * optsep stmtend
- *
- * ANTLR grammar rule
- * module_header_statement : yang_version_stmt? namespace_stmt prefix_stmt
- * | yang_version_stmt? prefix_stmt namespace_stmt
- * | namespace_stmt yang_version_stmt? prefix_stmt
- * | namespace_stmt prefix_stmt yang_version_stmt?
- * | prefix_stmt namespace_stmt yang_version_stmt?
- * | prefix_stmt yang_version_stmt? namespace_stmt
- * ;
- * prefix_stmt : PREFIX_KEYWORD identifier STMTEND;
- */
-
-/**
- * Represents listener based call back function corresponding to the "prefix"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class PrefixListener {
-
- /**
- * Creates a new prefix listener.
- */
- private PrefixListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule
- * (prefix),perform validations and update the data model tree.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processPrefixEntry(TreeWalkListener listener, GeneratedYangParser.PrefixStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, PREFIX_DATA, ctx.identifier().getText(), ENTRY);
-
- String identifier = getValidIdentifier(ctx.identifier().getText(), PREFIX_DATA, ctx);
-
- // Obtain the node of the stack.
- Parsable tmpNode = listener.getParsedDataStack().peek();
- switch (tmpNode.getYangConstructType()) {
- case MODULE_DATA: {
- YangModule module = (YangModule) tmpNode;
- module.setPrefix(identifier);
- break;
- }
- case IMPORT_DATA: {
- YangImport importNode = (YangImport) tmpNode;
- importNode.setPrefixId(identifier);
- break;
- }
- case BELONGS_TO_DATA: {
- YangBelongsTo belongstoNode = (YangBelongsTo) tmpNode;
- belongstoNode.setPrefix(identifier);
- break;
- }
- default:
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, PREFIX_DATA,
- ctx.identifier().getText(), ENTRY));
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/PresenceListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/PresenceListener.java
deleted file mode 100644
index ef744d5..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/PresenceListener.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.CONTAINER_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.PRESENCE_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;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * presence-stmt = presence-keyword sep string stmtend
- *
- * ANTLR grammar rule
- * presenceStatement : PRESENCE_KEYWORD string STMTEND;
- */
-
-/**
- * Represents listener based call back function corresponding to the "presence"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class PresenceListener {
-
- /**
- * Creates a new presence listener.
- */
- private PresenceListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar
- * rule (presence), performs validation and updates the data model
- * tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processPresenceEntry(TreeWalkListener listener,
- GeneratedYangParser.PresenceStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, PRESENCE_DATA, ctx.string().getText(), ENTRY);
-
- Parsable tmpData = listener.getParsedDataStack().peek();
- if (tmpData.getYangConstructType() == CONTAINER_DATA) {
- YangContainer container = (YangContainer) tmpData;
- container.setPresence(ctx.string().getText());
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, PRESENCE_DATA,
- ctx.string().getText(), ENTRY));
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/RangeRestrictionListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/RangeRestrictionListener.java
deleted file mode 100644
index 3b4ae43..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/RangeRestrictionListener.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangDecimal64;
-import org.onosproject.yangutils.datamodel.YangDerivedInfo;
-import org.onosproject.yangutils.datamodel.YangRangeRestriction;
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.DECIMAL64;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.DERIVED;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypeUtils.isOfRangeRestrictedType;
-import static org.onosproject.yangutils.datamodel.utils.RestrictionResolver.processRangeRestriction;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.RANGE_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.TYPE_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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_CURRENT_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * range-stmt = range-keyword sep range-arg-str optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [error-message-stmt stmtsep]
- * [error-app-tag-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * "}")
- *
- * ANTLR grammar rule
- * rangeStatement : RANGE_KEYWORD range (STMTEND | LEFT_CURLY_BRACE commonStatements RIGHT_CURLY_BRACE);
- */
-
-/**
- * Represents listener based call back function corresponding to the "range"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class RangeRestrictionListener {
-
- /**
- * Creates a new range restriction listener.
- */
- private RangeRestrictionListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar
- * rule (range), performs validation and updates the data model
- * tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processRangeRestrictionEntry(TreeWalkListener listener,
- GeneratedYangParser.RangeStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, RANGE_DATA, ctx.range().getText(), ENTRY);
-
- Parsable tmpData = listener.getParsedDataStack().peek();
- if (tmpData.getYangConstructType() == TYPE_DATA) {
- YangType type = (YangType) tmpData;
- setRangeRestriction(listener, type, ctx);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, RANGE_DATA,
- ctx.range().getText(), ENTRY));
- }
- }
-
- /**
- * Sets the range restriction to type.
- *
- * @param listener listener's object
- * @param type YANG type for which range restriction to be added
- * @param ctx context object of the grammar rule
- */
- private static void setRangeRestriction(TreeWalkListener listener, YangType type,
- 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;
- }
-
- if (!(isOfRangeRestrictedType(type.getDataType())) && (type.getDataType() != DECIMAL64)) {
- 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 = null;
- try {
- if (type.getDataType() == DECIMAL64) {
- YangDecimal64 yangDecimal64 = (YangDecimal64) type.getDataTypeExtendedInfo();
- rangeRestriction = processRangeRestriction(yangDecimal64.getDefaultRangeRestriction(),
- ctx.getStart().getLine(),
- ctx.getStart().getCharPositionInLine(),
- true, ctx.range().getText(), type.getDataType());
- } else {
- rangeRestriction = processRangeRestriction(null, ctx.getStart().getLine(),
- ctx.getStart().getCharPositionInLine(),
- false, ctx.range().getText(), type.getDataType());
- }
- } catch (DataModelException e) {
- ParserException parserException = new ParserException(e.getMessage());
- parserException.setCharPosition(e.getCharPositionInLine());
- parserException.setLine(e.getLineNumber());
- throw parserException;
- }
-
- if (rangeRestriction != null) {
- if (type.getDataType() == DECIMAL64) {
- ((YangDecimal64<YangRangeRestriction>) type.getDataTypeExtendedInfo())
- .setRangeRestrictedExtendedInfo(rangeRestriction);
- } else {
- type.setDataTypeExtendedInfo(rangeRestriction);
- }
- }
- listener.getParsedDataStack().push(rangeRestriction);
- }
-
- /**
- * Performs validation and updates the data model tree.
- * It is called when parser exits from grammar rule (range).
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processRangeRestrictionExit(TreeWalkListener listener,
- GeneratedYangParser.RangeStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, RANGE_DATA, ctx.range().getText(), EXIT);
-
- Parsable tmpData = listener.getParsedDataStack().peek();
- if (tmpData instanceof YangRangeRestriction) {
- listener.getParsedDataStack().pop();
- } else if (tmpData instanceof YangType
- && ((YangType) tmpData).getDataType() == DERIVED) {
- // TODO : need to handle in linker
- } else {
- throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, RANGE_DATA,
- ctx.range().getText(), EXIT));
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ReferenceListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ReferenceListener.java
deleted file mode 100644
index 02cdf62..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ReferenceListener.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangReference;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.REFERENCE_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;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * reference-stmt = reference-keyword sep string optsep stmtend
- *
- * ANTLR grammar rule
- * referenceStatement : REFERENCE_KEYWORD string STMTEND;
- */
-
-/**
- * Represents listener based call back function corresponding to the "reference"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class ReferenceListener {
-
- /**
- * Creates a new reference listener.
- */
- private ReferenceListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar
- * rule (reference), performs validation and updates the data model
- * tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processReferenceEntry(TreeWalkListener listener,
- GeneratedYangParser.ReferenceStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, REFERENCE_DATA, ctx.string().getText(), ENTRY);
-
- Parsable tmpData = listener.getParsedDataStack().peek();
- if (tmpData instanceof YangReference) {
- YangReference reference = (YangReference) tmpData;
- reference.setReference(ctx.string().getText());
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, REFERENCE_DATA,
- ctx.string().getText(), ENTRY));
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/RequireInstanceListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/RequireInstanceListener.java
deleted file mode 100644
index 21c7533..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/RequireInstanceListener.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangLeafRef;
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.REQUIRE_INSTANCE_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getValidBooleanValue;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * require-instance-stmt = require-instance-keyword sep
- * require-instance-arg-str stmtend
- *
- * require-instance-arg-str = < a string that matches the rule
- * require-instance-arg >
- *
- * require-instance-arg = true-keyword / false-keyword
- *
- * ANTLR grammar rule
- *
- * requireInstanceStatement : REQUIRE_INSTANCE_KEYWORD requireInstance STMTEND;
- *
- * requireInstance : string;
- */
-
-/**
- * Represents listener based call back function corresponding to the
- * "require-instance" rule defined in ANTLR grammar file for corresponding ABNF rule
- * in RFC 6020.
- */
-public final class RequireInstanceListener {
-
- /**
- * Creates a new require instance listener.
- */
- private RequireInstanceListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule
- * (require-instance), performs validation and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processRequireInstanceEntry(TreeWalkListener listener,
- GeneratedYangParser.RequireInstanceStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, REQUIRE_INSTANCE_DATA, "", ENTRY);
-
- Parsable curData = listener.getParsedDataStack().peek();
-
- // Gets the status of require instance
- boolean isRequireInstance = getValidBooleanValue(ctx.requireInstance().getText(), REQUIRE_INSTANCE_DATA, ctx);
-
- // Checks the holder of require-instance as leafref or type, else throws error.
- if (curData instanceof YangLeafRef) {
-
- // Sets the require-instance status to leafref.
- ((YangLeafRef) curData).setRequireInstance(isRequireInstance);
- } else if (curData instanceof YangType) {
-
- // Checks type should be instance-identifier, else throw error.
- if (((YangType) curData).getDataType() == YangDataTypes.INSTANCE_IDENTIFIER) {
-
- // Sets the require-instance status to instance-identifier type.
- ((YangType) curData).setDataTypeExtendedInfo(isRequireInstance);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, REQUIRE_INSTANCE_DATA,
- ctx.getText(), ENTRY));
- }
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, REQUIRE_INSTANCE_DATA,
- ctx.getText(), ENTRY));
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/RevisionDateListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/RevisionDateListener.java
deleted file mode 100644
index 3ff67fe..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/RevisionDateListener.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import java.util.Date;
-import org.onosproject.yangutils.datamodel.YangImport;
-import org.onosproject.yangutils.datamodel.YangInclude;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.REVISION_DATE_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.ListenerUtil.getValidDateFromString;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * import-stmt = import-keyword sep identifier-arg-str optsep
- * "{" stmtsep
- * prefix-stmt stmtsep
- * [revision-date-stmt stmtsep]
- * "}"
- * include-stmt = include-keyword sep identifier-arg-str optsep
- * (";" /
- * "{" stmtsep
- * [revision-date-stmt stmtsep]
- * "}")
- * revision-date-stmt = revision-date-keyword sep revision-date stmtend
- *
- * ANTLR grammar rule
- * import_stmt : IMPORT_KEYWORD IDENTIFIER LEFT_CURLY_BRACE import_stmt_body
- * RIGHT_CURLY_BRACE;
- * import_stmt_body : prefix_stmt revision_date_stmt?;
- *
- * include_stmt : INCLUDE_KEYWORD IDENTIFIER (STMTEND | LEFT_CURLY_BRACE
- * revision_date_stmt_body? RIGHT_CURLY_BRACE);
- *
- * revision_date_stmt : REVISION_DATE_KEYWORD DATE_ARG STMTEND;
- *
- */
-
-/**
- * Represents listener based call back function corresponding to the
- * "revision date" rule defined in ANTLR grammar file for corresponding ABNF
- * rule in RFC 6020.
- */
-public final class RevisionDateListener {
-
- /**
- * Creates a new revision date listener.
- */
- private RevisionDateListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule
- * (revision date),perform validations and update the data model tree.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processRevisionDateEntry(TreeWalkListener listener,
- GeneratedYangParser.RevisionDateStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, REVISION_DATE_DATA, ctx.dateArgumentString().getText(),
- ENTRY);
-
- Date date = getValidDateFromString(ctx.dateArgumentString().getText(), ctx);
-
- // Obtain the node of the stack.
- Parsable tmpNode = listener.getParsedDataStack().peek();
- switch (tmpNode.getYangConstructType()) {
- case IMPORT_DATA: {
- YangImport importNode = (YangImport) tmpNode;
- importNode.setRevision(date);
- break;
- }
- case INCLUDE_DATA: {
- YangInclude includeNode = (YangInclude) tmpNode;
- includeNode.setRevision(date);
- break;
- }
- default:
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, REVISION_DATE_DATA,
- ctx.dateArgumentString().getText(), ENTRY));
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/RevisionListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/RevisionListener.java
deleted file mode 100644
index cb633b8..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/RevisionListener.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import java.util.Date;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangRevision;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.REVISION_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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_CURRENT_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getValidDateFromString;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * module-stmt = optsep module-keyword sep identifier-arg-str
- * optsep
- * "{" stmtsep
- * module-header-stmts
- * linkage-stmts
- * meta-stmts
- * revision-stmts
- * body-stmts
- * "}" optsep
- *
- * revision-stmt = revision-keyword sep revision-date optsep
- * (";" /
- * "{" stmtsep
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * "}")
- *
- * ANTLR grammar rule
- * module_stmt : MODULE_KEYWORD IDENTIFIER LEFT_CURLY_BRACE module_body* RIGHT_CURLY_BRACE;
- *
- * revision_stmt : REVISION_KEYWORD DATE_ARG (STMTEND | LEFT_CURLY_BRACE revision_stmt_body RIGHT_CURLY_BRACE);
- * revision_stmt_body : description_stmt? reference_stmt?;
- */
-
-/**
- * Represents listener based call back function corresponding to the "revision"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class RevisionListener {
-
- /**
- * Creates a new revision listener.
- */
- private RevisionListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule
- * (revision),perform validations and update the data model tree.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processRevisionEntry(TreeWalkListener listener,
- GeneratedYangParser.RevisionStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, REVISION_DATA, ctx.dateArgumentString().getText(), ENTRY);
-
- Date date = getValidDateFromString(ctx.dateArgumentString().getText(), ctx);
-
- YangRevision revisionNode = new YangRevision();
- revisionNode.setRevDate(date);
-
- listener.getParsedDataStack().push(revisionNode);
- }
-
- /**
- * It is called when parser exits from grammar rule (revision), it perform
- * validations and update the data model tree.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processRevisionExit(TreeWalkListener listener, GeneratedYangParser.RevisionStatementContext
- ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, REVISION_DATA, ctx.dateArgumentString().getText(), EXIT);
-
- Parsable tmpRevisionNode = listener.getParsedDataStack().peek();
- if (tmpRevisionNode instanceof YangRevision) {
- listener.getParsedDataStack().pop();
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, REVISION_DATA, ctx.dateArgumentString().getText(),
- EXIT);
-
- Parsable tmpNode = listener.getParsedDataStack().peek();
- switch (tmpNode.getYangConstructType()) {
- case MODULE_DATA: {
- YangModule module = (YangModule) tmpNode;
- if (module.getRevision() != null) {
- Date curRevisionDate = module.getRevision().getRevDate();
- if (curRevisionDate.before(((YangRevision) tmpRevisionNode).getRevDate())) {
- module.setRevision((YangRevision) tmpRevisionNode);
- }
- } else {
- module.setRevision((YangRevision) tmpRevisionNode);
- }
- break;
- }
- case SUB_MODULE_DATA: {
- YangSubModule subModule = (YangSubModule) tmpNode;
- if (subModule.getRevision() != null) {
- Date curRevisionDate = subModule.getRevision().getRevDate();
- if (curRevisionDate.before(((YangRevision) tmpRevisionNode).getRevDate())) {
- subModule.setRevision((YangRevision) tmpRevisionNode);
- }
- } else {
- subModule.setRevision((YangRevision) tmpRevisionNode);
- }
- break;
- }
- default:
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, REVISION_DATA,
- ctx.dateArgumentString().getText(),
- EXIT));
- }
- } else {
- throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, REVISION_DATA,
- ctx.dateArgumentString().getText(), EXIT));
- }
- }
-
- /**
- * Validate revision.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- * @return validation result
- */
- private static boolean validateRevision(TreeWalkListener listener,
- GeneratedYangParser.RevisionStatementContext ctx) {
- // TODO to be implemented
- return true;
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/RpcListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/RpcListener.java
deleted file mode 100644
index 1c56fe5..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/RpcListener.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangRpc;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.DESCRIPTION_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.INPUT_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.OUTPUT_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.REFERENCE_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.RPC_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.STATUS_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerCollisionDetector.detectCollidingChildUtil;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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_CURRENT_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.getValidIdentifier;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.validateCardinalityMaxOne;
-import static org.onosproject.yangutils.translator.tojava.YangDataModelFactory.getYangRpcNode;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * rpc-stmt = rpc-keyword sep identifier-arg-str optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * *(if-feature-stmt stmtsep)
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * *((typedef-stmt /
- * grouping-stmt) stmtsep)
- * [input-stmt stmtsep]
- * [output-stmt stmtsep]
- * "}")
- *
- * ANTLR grammar rule
- * rpcStatement : RPC_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE (ifFeatureStatement | statusStatement
- * | descriptionStatement | referenceStatement | typedefStatement | groupingStatement | inputStatement
- * | outputStatement)* RIGHT_CURLY_BRACE);
- */
-
-/**
- * Represents listener based call back function corresponding to the "rpc"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class RpcListener {
-
- /**
- * Creates a new rpc listener.
- */
- private RpcListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule
- * (rpc), performs validation and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processRpcEntry(TreeWalkListener listener,
- GeneratedYangParser.RpcStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, RPC_DATA, ctx.identifier().getText(), ENTRY);
-
- String identifier = getValidIdentifier(ctx.identifier().getText(), RPC_DATA, ctx);
-
- // Validate sub statement cardinality.
- validateSubStatementsCardinality(ctx);
-
- // Check for identifier collision
- int line = ctx.getStart().getLine();
- int charPositionInLine = ctx.getStart().getCharPositionInLine();
- detectCollidingChildUtil(listener, line, charPositionInLine, identifier, RPC_DATA);
-
- Parsable curData = listener.getParsedDataStack().peek();
- if (curData instanceof YangModule || curData instanceof YangSubModule) {
-
- YangNode curNode = (YangNode) curData;
- YangRpc yangRpc = getYangRpcNode(JAVA_GENERATION);
- yangRpc.setName(identifier);
- try {
- curNode.addChild(yangRpc);
- } catch (DataModelException e) {
- throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
- RPC_DATA, ctx.identifier().getText(), ENTRY, e.getMessage()));
- }
- listener.getParsedDataStack().push(yangRpc);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, RPC_DATA,
- ctx.identifier().getText(), ENTRY));
- }
- }
-
- /**
- * It is called when parser exits from grammar rule (rpc), it perform
- * validations and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processRpcExit(TreeWalkListener listener,
- GeneratedYangParser.RpcStatementContext ctx) {
-
- //Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, RPC_DATA, ctx.identifier().getText(), EXIT);
-
- if (!(listener.getParsedDataStack().peek() instanceof YangRpc)) {
- throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, RPC_DATA,
- ctx.identifier().getText(), EXIT));
- }
- listener.getParsedDataStack().pop();
- }
-
- /**
- * Validates the cardinality of rpc sub-statements as per grammar.
- *
- * @param ctx context object of the grammar rule
- */
- private static void validateSubStatementsCardinality(GeneratedYangParser.RpcStatementContext ctx) {
-
- validateCardinalityMaxOne(ctx.statusStatement(), STATUS_DATA, RPC_DATA, ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.descriptionStatement(), DESCRIPTION_DATA, RPC_DATA, ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.referenceStatement(), REFERENCE_DATA, RPC_DATA, ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.inputStatement(), INPUT_DATA, RPC_DATA, ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.outputStatement(), OUTPUT_DATA, RPC_DATA, ctx.identifier().getText());
- }
-
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ShortCaseListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ShortCaseListener.java
deleted file mode 100644
index 612fe3b..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ShortCaseListener.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.antlr.v4.runtime.ParserRuleContext;
-import org.antlr.v4.runtime.tree.ParseTree;
-import org.onosproject.yangutils.datamodel.YangCase;
-import org.onosproject.yangutils.datamodel.YangChoice;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.CASE_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.SHORT_CASE_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerCollisionDetector.detectCollidingChildUtil;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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_CHILD;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_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.getValidIdentifier;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-import static org.onosproject.yangutils.translator.tojava.YangDataModelFactory.getYangCaseNode;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * short-case-stmt = container-stmt /
- * leaf-stmt /
- * leaf-list-stmt /
- * list-stmt /
- * anyxml-stmt
- *
- * ANTLR grammar rule
- * shortCaseStatement : containerStatement | leafStatement | leafListStatement | listStatement;
- */
-
-/**
- * Represents listener based call back function corresponding to the "short
- * case" rule defined in ANTLR grammar file for corresponding ABNF rule in RFC
- * 6020.
- */
-public final class ShortCaseListener {
-
- /**
- * Create a new short case listener.
- */
- private ShortCaseListener() {
- }
-
- /**
- * It is called when parser enters grammar rule (short case), it perform
- * validations and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processShortCaseEntry(TreeWalkListener listener,
- GeneratedYangParser.ShortCaseStatementContext ctx) {
-
- ParseTree errorConstructContext;
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, SHORT_CASE_DATA, "", ENTRY);
-
- YangCase caseNode = getYangCaseNode(JAVA_GENERATION);
-
- if (ctx.containerStatement() != null) {
- caseNode.setName(getValidIdentifier(ctx.containerStatement().identifier().getText(), CASE_DATA, ctx));
- errorConstructContext = ctx.containerStatement();
- } else if (ctx.listStatement() != null) {
- caseNode.setName(getValidIdentifier(ctx.listStatement().identifier().getText(), CASE_DATA, ctx));
- errorConstructContext = ctx.listStatement();
- } else if (ctx.leafListStatement() != null) {
- caseNode.setName(getValidIdentifier(ctx.leafListStatement().identifier().getText(), CASE_DATA, ctx));
- errorConstructContext = ctx.leafListStatement();
- } else if (ctx.leafStatement() != null) {
- caseNode.setName(getValidIdentifier(ctx.leafStatement().identifier().getText(), CASE_DATA, ctx));
- errorConstructContext = ctx.leafStatement();
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_CHILD, SHORT_CASE_DATA, "", ENTRY));
- }
- // TODO implement for augment.
-
- int line = ((ParserRuleContext) errorConstructContext).getStart().getLine();
- int charPositionInLine = ((ParserRuleContext) errorConstructContext).getStart().getCharPositionInLine();
-
- // Check for identifier collision
- detectCollidingChildUtil(listener, line, charPositionInLine, caseNode.getName(), CASE_DATA);
-
- if ((listener.getParsedDataStack().peek()) instanceof YangChoice) {
- try {
- ((YangChoice) listener.getParsedDataStack().peek()).addChild(caseNode);
- } catch (DataModelException e) {
- throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
- SHORT_CASE_DATA, caseNode.getName(), ENTRY, e.getMessage()));
- }
- listener.getParsedDataStack().push(caseNode);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, SHORT_CASE_DATA,
- caseNode.getName(), ENTRY));
- }
- }
-
- /**
- * It is called when parser exits from grammar rule (short case), it perform
- * validations and update the data model tree.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processShortCaseExit(TreeWalkListener listener,
- GeneratedYangParser.ShortCaseStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, SHORT_CASE_DATA, "", EXIT);
-
- if (listener.getParsedDataStack().peek() instanceof YangCase) {
- listener.getParsedDataStack().pop();
- } else {
- throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, SHORT_CASE_DATA,
- "", EXIT));
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/StatusListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/StatusListener.java
deleted file mode 100644
index 81d6b61..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/StatusListener.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangStatus;
-import org.onosproject.yangutils.datamodel.YangStatusType;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.STATUS_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.ListenerUtil.removeQuotesAndHandleConcat;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * status-stmt = status-keyword sep status-arg-str stmtend
- * status-arg-str = < a string that matches the rule
- * status-arg >
- * status-arg = current-keyword /
- * obsolete-keyword /
- * deprecated-keyword
- *
- * ANTLR grammar rule
- * statusStatement : STATUS_KEYWORD status STMTEND;
- */
-
-/**
- * Represents listener based call back function corresponding to the "status"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class StatusListener {
-
- private static final String CURRENT_KEYWORD = "current";
- private static final String DEPRECATED_KEYWORD = "deprecated";
- private static final String OBSOLETE_KEYWORD = "obsolete";
-
- /**
- * Creates a new status listener.
- */
- private StatusListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar
- * rule (status), performs validation and updates the data model
- * tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processStatusEntry(TreeWalkListener listener,
- GeneratedYangParser.StatusStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, STATUS_DATA, "", ENTRY);
-
- YangStatusType status = getValidStatus(ctx);
-
- Parsable tmpData = listener.getParsedDataStack().peek();
- if (tmpData instanceof YangStatus) {
- YangStatus yangStatus = (YangStatus) tmpData;
- yangStatus.setStatus(status);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, STATUS_DATA, "", ENTRY));
- }
- }
-
- /**
- * Validates status value and returns the value from context.
- *
- * @param ctx context object of the grammar rule
- * @return status current/deprecated/obsolete
- */
- private static YangStatusType getValidStatus(GeneratedYangParser.StatusStatementContext ctx) {
-
- YangStatusType status;
-
- String value = removeQuotesAndHandleConcat(ctx.status().getText());
- switch (value) {
- case CURRENT_KEYWORD: {
- status = YangStatusType.CURRENT;
- break;
- }
- case DEPRECATED_KEYWORD: {
- status = YangStatusType.DEPRECATED;
- break;
- }
- case OBSOLETE_KEYWORD: {
- status = YangStatusType.OBSOLETE;
- break;
- }
- default: {
- ParserException parserException = new ParserException("YANG file error : " +
- YangConstructType.getYangConstructType(STATUS_DATA) + " " + ctx.status().getText() +
- " is not valid.");
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
- }
-
- return status;
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/SubModuleListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/SubModuleListener.java
deleted file mode 100644
index d2c4f48..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/SubModuleListener.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import java.util.Date;
-import org.onosproject.yangutils.datamodel.ResolvableType;
-import org.onosproject.yangutils.datamodel.YangReferenceResolver;
-import org.onosproject.yangutils.datamodel.YangRevision;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.linker.exceptions.LinkerException;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.SUB_MODULE_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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_CURRENT_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getCurrentDateForRevision;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsEmpty;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-import static org.onosproject.yangutils.translator.tojava.YangDataModelFactory.getYangSubModuleNode;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * submodule-stmt = optsep submodule-keyword sep identifier-arg-str
- * optsep
- * "{" stmtsep
- * submodule-header-stmts
- * linkage-stmts
- * meta-stmts
- * revision-stmts
- * body-stmts
- * "}" optsep
- *
- * ANTLR grammar rule
- * submodule_stmt : SUBMODULE_KEYWORD identifier LEFT_CURLY_BRACE submodule_body* RIGHT_CURLY_BRACE;
- * submodule_body : submodule_header_statement linkage_stmts meta_stmts revision_stmts body_stmts;
- */
-
-/**
- * Represents listener based call back function corresponding to the "submodule"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class SubModuleListener {
-
- /**
- * Creates a new sub module listener.
- */
- private SubModuleListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule (sub
- * module), perform validations and update the data model tree.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processSubModuleEntry(TreeWalkListener listener,
- GeneratedYangParser.SubModuleStatementContext ctx) {
-
- // Check if stack is empty.
- checkStackIsEmpty(listener, INVALID_HOLDER, SUB_MODULE_DATA, ctx.identifier().getText(),
- ENTRY);
-
- String identifier = getValidIdentifier(ctx.identifier().getText(), SUB_MODULE_DATA, ctx);
-
- YangSubModule yangSubModule = getYangSubModuleNode(JAVA_GENERATION);
- yangSubModule.setName(identifier);
-
- if (ctx.submoduleBody().submoduleHeaderStatement().yangVersionStatement() == null) {
- yangSubModule.setVersion((byte) 1);
- }
-
- listener.getParsedDataStack().push(yangSubModule);
- }
-
- /**
- * It is called when parser exits from grammar rule (submodule), it perform
- * validations and update the data model tree.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processSubModuleExit(TreeWalkListener listener,
- GeneratedYangParser.SubModuleStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, SUB_MODULE_DATA, ctx.identifier().getText(),
- EXIT);
-
- Parsable tmpNode = listener.getParsedDataStack().peek();
- if (!(tmpNode instanceof YangSubModule)) {
- throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, SUB_MODULE_DATA,
- ctx.identifier().getText(), EXIT));
- }
-
- if (((YangSubModule) tmpNode).getRevision() == null) {
- Date currentDate = getCurrentDateForRevision();
- YangRevision currentRevision = new YangRevision();
- currentRevision.setRevDate(currentDate);
- ((YangSubModule) tmpNode).setRevision(currentRevision);
- }
-
- try {
- ((YangReferenceResolver) listener.getParsedDataStack().peek())
- .resolveSelfFileLinking(ResolvableType.YANG_IF_FEATURE);
- ((YangReferenceResolver) listener.getParsedDataStack().peek())
- .resolveSelfFileLinking(ResolvableType.YANG_USES);
- ((YangReferenceResolver) listener.getParsedDataStack().peek())
- .resolveSelfFileLinking(ResolvableType.YANG_DERIVED_DATA_TYPE);
- ((YangReferenceResolver) listener.getParsedDataStack().peek())
- .resolveSelfFileLinking(ResolvableType.YANG_LEAFREF);
- ((YangReferenceResolver) listener.getParsedDataStack().peek())
- .resolveSelfFileLinking(ResolvableType.YANG_BASE);
- ((YangReferenceResolver) listener.getParsedDataStack().peek())
- .resolveSelfFileLinking(ResolvableType.YANG_IDENTITYREF);
- } catch (DataModelException e) {
- LinkerException linkerException = new LinkerException(e.getMessage());
- linkerException.setLine(e.getLineNumber());
- linkerException.setCharPosition(e.getCharPositionInLine());
- throw linkerException;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/TypeDefListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/TypeDefListener.java
deleted file mode 100644
index 4a629ba..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/TypeDefListener.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangGrouping;
-import org.onosproject.yangutils.datamodel.YangInput;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNotification;
-import org.onosproject.yangutils.datamodel.YangOutput;
-import org.onosproject.yangutils.datamodel.YangRpc;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.datamodel.YangTypeDef;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.DEFAULT_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.DESCRIPTION_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.REFERENCE_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.STATUS_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.TYPEDEF_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.TYPE_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.UNITS_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerCollisionDetector.detectCollidingChildUtil;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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_CONTENT;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_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.getValidIdentifier;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.validateCardinalityEqualsOne;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.validateCardinalityMaxOne;
-import static org.onosproject.yangutils.translator.tojava.YangDataModelFactory.getYangTypeDefNode;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * body-stmts = *((extension-stmt /
- * feature-stmt /
- * identity-stmt /
- * typedef-stmt /
- * grouping-stmt /
- * data-def-stmt /
- * augment-stmt /
- * rpc-stmt /
- * notification-stmt /
- * deviation-stmt) stmtsep)
- *
- * typedef-stmt = typedef-keyword sep identifier-arg-str optsep
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * type-stmt stmtsep
- * [units-stmt stmtsep]
- * [default-stmt stmtsep]
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * "}"
- *
- * ANTLR grammar rule
- * typedefStatement : TYPEDEF_KEYWORD identifier LEFT_CURLY_BRACE
- * (typeStatement | unitsStatement | defaultStatement | statusStatement
- * | descriptionStatement | referenceStatement)* RIGHT_CURLY_BRACE;
- */
-
-/**
- * Represents listener based call back function corresponding to the "typedef"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class TypeDefListener {
-
- /**
- * Creates a new typedef listener.
- */
- private TypeDefListener() {
- }
-
- /**
- * It is called when parser enters grammar rule (typedef), it perform
- * validations and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processTypeDefEntry(TreeWalkListener listener,
- GeneratedYangParser.TypedefStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, TYPEDEF_DATA, ctx.identifier().getText(), ENTRY);
-
- String identifier = getValidIdentifier(ctx.identifier().getText(), TYPEDEF_DATA, ctx);
-
- // Validate sub statement cardinality.
- validateSubStatementsCardinality(ctx);
-
- // Check for identifier collision
- int line = ctx.getStart().getLine();
- int charPositionInLine = ctx.getStart().getCharPositionInLine();
- detectCollidingChildUtil(listener, line, charPositionInLine, identifier, TYPEDEF_DATA);
-
- /*
- * Create a derived type information, the base type must be set in type
- * listener.
- */
- YangTypeDef typeDefNode = getYangTypeDefNode(JAVA_GENERATION);
- typeDefNode.setName(identifier);
-
- Parsable curData = listener.getParsedDataStack().peek();
-
- if (curData instanceof YangModule || curData instanceof YangSubModule || curData instanceof YangContainer
- || curData instanceof YangList || curData instanceof YangNotification || curData instanceof YangRpc
- || curData instanceof YangInput || curData instanceof YangOutput || curData instanceof YangGrouping) {
-
- YangNode curNode = (YangNode) curData;
- try {
- curNode.addChild(typeDefNode);
- } catch (DataModelException e) {
- throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
- TYPEDEF_DATA, ctx.identifier().getText(), ENTRY, e.getMessage()));
- }
- listener.getParsedDataStack().push(typeDefNode);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER,
- TYPEDEF_DATA, ctx.identifier().getText(), ENTRY));
- }
- }
-
- /**
- * It is called when parser exits from grammar rule (typedef), it perform
- * validations and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processTypeDefExit(TreeWalkListener listener,
- GeneratedYangParser.TypedefStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, TYPEDEF_DATA, ctx.identifier().getText(), EXIT);
-
- if (listener.getParsedDataStack().peek() instanceof YangTypeDef) {
- YangTypeDef typeDefNode = (YangTypeDef) listener.getParsedDataStack().peek();
- try {
- typeDefNode.validateDataOnExit();
- } catch (DataModelException e) {
- throw new ParserException(constructListenerErrorMessage(INVALID_CONTENT, TYPEDEF_DATA,
- ctx.identifier().getText(), EXIT));
- }
-
- listener.getParsedDataStack().pop();
- } else {
- throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, TYPEDEF_DATA,
- ctx.identifier().getText(), EXIT));
- }
- }
-
- /**
- * Validates the cardinality of typedef sub-statements as per grammar.
- *
- * @param ctx context object of the grammar rule
- */
- private static void validateSubStatementsCardinality(GeneratedYangParser.TypedefStatementContext ctx) {
-
- validateCardinalityMaxOne(ctx.unitsStatement(), UNITS_DATA, TYPEDEF_DATA, ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.defaultStatement(), DEFAULT_DATA, TYPEDEF_DATA, ctx.identifier().getText());
- validateCardinalityEqualsOne(ctx.typeStatement(), TYPE_DATA, TYPEDEF_DATA, ctx.identifier().getText(), ctx);
- validateCardinalityMaxOne(ctx.descriptionStatement(), DESCRIPTION_DATA, TYPEDEF_DATA,
- ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.referenceStatement(), REFERENCE_DATA, TYPEDEF_DATA, ctx.identifier().getText());
- validateCardinalityMaxOne(ctx.statusStatement(), STATUS_DATA, TYPEDEF_DATA, ctx.identifier().getText());
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/TypeListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/TypeListener.java
deleted file mode 100644
index 3c7fba9..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/TypeListener.java
+++ /dev/null
@@ -1,330 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangDerivedInfo;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangLeafList;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeIdentifier;
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.datamodel.YangTypeDef;
-import org.onosproject.yangutils.datamodel.YangUnion;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.linker.impl.YangResolutionInfoImpl;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.addResolutionInfo;
-import static org.onosproject.yangutils.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
-import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.UNRESOLVED;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.TYPE_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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_CURRENT_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.getValidNodeIdentifier;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-import static org.onosproject.yangutils.translator.tojava.YangDataModelFactory.getYangType;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * type-stmt = type-keyword sep identifier-ref-arg-str optsep
- * (";" /
- * "{" stmtsep
- * type-body-stmts
- * "}")
- *
- * ANTLR grammar rule
- * typeStatement : TYPE_KEYWORD string (STMTEND | LEFT_CURLY_BRACE typeBodyStatements RIGHT_CURLY_BRACE);
- */
-
-/**
- * Represents listener based call back function corresponding to the "type" rule
- * defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class TypeListener {
-
- /**
- * Creates a new type listener.
- */
- private TypeListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule
- * (type), performs validation and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processTypeEntry(TreeWalkListener listener,
- GeneratedYangParser.TypeStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, TYPE_DATA, ctx.string().getText(), ENTRY);
-
- // Validate node identifier.
- YangNodeIdentifier nodeIdentifier = getValidNodeIdentifier(ctx.string().getText(), TYPE_DATA,
- ctx);
-
- // Obtain the YANG data type.
- YangDataTypes yangDataTypes = YangDataTypes.getType(ctx.string().getText());
-
- // validate type sub-statement cardinality
- validateTypeSubStatementCardinality(ctx, yangDataTypes);
-
- // Create YANG type object and fill the values.
- YangType<?> type = getYangType(JAVA_GENERATION);
- type.setNodeIdentifier(nodeIdentifier);
- type.setDataType(yangDataTypes);
-
- // Set default require instance value as true for instance identifier.
- setDefaultRequireInstanceForInstanceIdentifier(type);
-
- int errorLine = ctx.getStart().getLine();
- int errorPosition = ctx.getStart().getCharPositionInLine();
-
- Parsable tmpData = listener.getParsedDataStack().peek();
- switch (tmpData.getYangConstructType()) {
- case LEAF_DATA:
- YangLeaf leaf = (YangLeaf) tmpData;
- leaf.setDataType(type);
-
- /*
- * If data type is derived, resolution information to be added
- * in resolution list.
- */
- if (yangDataTypes == YangDataTypes.DERIVED) {
- // Parent YANG node of leaf to be added in resolution information.
- Parsable leafData = listener.getParsedDataStack().pop();
- Parsable parentNodeOfLeaf = listener.getParsedDataStack().peek();
- listener.getParsedDataStack().push(leafData);
-
- // Verify parent node of leaf
- if (!(parentNodeOfLeaf instanceof YangNode)) {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, TYPE_DATA,
- ctx.string().getText(), EXIT));
- }
-
- // Create empty derived info and attach it to type extended info.
- YangDerivedInfo<?> yangDerivedInfo = new YangDerivedInfo<>();
- ((YangType<YangDerivedInfo>) type).setDataTypeExtendedInfo(yangDerivedInfo);
-
- type.setResolvableStatus(UNRESOLVED);
-
- // Add resolution information to the list
- YangResolutionInfoImpl resolutionInfo = new YangResolutionInfoImpl<YangType>(type,
- (YangNode) parentNodeOfLeaf, errorLine, errorPosition);
- addToResolutionList(resolutionInfo, ctx);
- }
- break;
- case LEAF_LIST_DATA:
- YangLeafList leafList = (YangLeafList) tmpData;
- leafList.setDataType(type);
-
- /*
- * If data type is derived, resolution information to be added
- * in resolution list.
- */
- if (yangDataTypes == YangDataTypes.DERIVED) {
- // Parent YANG node of leaf list to be added in resolution information.
- Parsable leafListData = listener.getParsedDataStack().pop();
- Parsable parentNodeOfLeafList = listener.getParsedDataStack().peek();
- listener.getParsedDataStack().push(leafListData);
-
- // Verify parent node of leaf
- if (!(parentNodeOfLeafList instanceof YangNode)) {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, TYPE_DATA,
- ctx.string().getText(), EXIT));
- }
-
- // Create empty derived info and attach it to type extended info.
- YangDerivedInfo<?> yangDerivedInfo = new YangDerivedInfo<>();
- ((YangType<YangDerivedInfo>) type).setDataTypeExtendedInfo(yangDerivedInfo);
-
- // Add resolution information to the list
- YangResolutionInfoImpl resolutionInfo =
- new YangResolutionInfoImpl<YangType>(type, (YangNode) parentNodeOfLeafList, errorLine,
- errorPosition);
- addToResolutionList(resolutionInfo, ctx);
- }
- break;
- case UNION_DATA:
- YangUnion unionNode = (YangUnion) tmpData;
- try {
- unionNode.addType(type);
- } catch (DataModelException e) {
- ParserException parserException = new ParserException(e.getMessage());
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
-
- /*
- * If data type is derived, resolution information to be added
- * in resolution list.
- */
- if (yangDataTypes == YangDataTypes.DERIVED) {
-
- // Create empty derived info and attach it to type extended info.
- YangDerivedInfo<?> yangDerivedInfo = new YangDerivedInfo<>();
- ((YangType<YangDerivedInfo>) type).setDataTypeExtendedInfo(yangDerivedInfo);
-
- type.setResolvableStatus(UNRESOLVED);
-
- // Add resolution information to the list
- YangResolutionInfoImpl resolutionInfo =
- new YangResolutionInfoImpl<YangType>(type, unionNode, errorLine, errorPosition);
- addToResolutionList(resolutionInfo, ctx);
- }
-
- break;
- case TYPEDEF_DATA:
- /* Prepare the base type info and set in derived type */
- YangTypeDef typeDef = (YangTypeDef) tmpData;
- typeDef.setDataType(type);
-
- /*
- * If data type is derived, resolution information to be added
- * in resolution list.
- */
- if (yangDataTypes == YangDataTypes.DERIVED) {
- // Create empty derived info and attach it to type extended info.
- YangDerivedInfo<?> yangDerivedInfo = new YangDerivedInfo<>();
- ((YangType<YangDerivedInfo>) type).setDataTypeExtendedInfo(yangDerivedInfo);
-
- type.setResolvableStatus(UNRESOLVED);
-
- // Add resolution information to the list
- YangResolutionInfoImpl resolutionInfo =
- new YangResolutionInfoImpl<YangType>(type, typeDef, errorLine, errorPosition);
- addToResolutionList(resolutionInfo, ctx);
- }
- break;
- //TODO: deviate replacement statement.
-
- default:
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, TYPE_DATA,
- ctx.string().getText(), EXIT));
- }
-
- // Push the type to the stack.
- listener.getParsedDataStack().push(type);
- }
-
- /**
- * Sets the default require instance value as true when the type is instance identifier.
- *
- * @param type type to which the value has to be set
- */
- private static void setDefaultRequireInstanceForInstanceIdentifier(YangType<?> type) {
-
- if (type.getDataType() == YangDataTypes.INSTANCE_IDENTIFIER) {
- ((YangType<Boolean>) type).setDataTypeExtendedInfo(true);
- }
- }
-
- /**
- * It is called when parser exits from grammar rule (type), it perform
- * validations and update the data model tree.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processTypeExit(TreeWalkListener listener,
- GeneratedYangParser.TypeStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_CURRENT_HOLDER, TYPE_DATA, ctx.string().getText(), EXIT);
-
- Parsable parsableType = listener.getParsedDataStack().pop();
- if (!(parsableType instanceof YangType)) {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, TYPE_DATA,
- ctx.string().getText(), EXIT));
- }
- }
-
- /**
- * Adds to resolution list.
- *
- * @param resolutionInfo resolution information
- * @param ctx context object of the grammar rule
- */
- private static void addToResolutionList(YangResolutionInfoImpl<YangType> resolutionInfo,
- GeneratedYangParser.TypeStatementContext ctx) {
- try {
- addResolutionInfo(resolutionInfo);
- } catch (DataModelException e) {
- throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
- TYPE_DATA, ctx.string().getText(), ENTRY, e.getMessage()));
- }
- }
-
- /**
- * Validates type body statements cardinality.
- *
- * @param ctx context object of the grammar rule
- * @param yangDataType yang data type
- */
- private static void validateTypeSubStatementCardinality(GeneratedYangParser.TypeStatementContext ctx,
- YangDataTypes yangDataType) {
- if (ctx.typeBodyStatements() == null || ctx.typeBodyStatements().isEmpty()) {
- ParserException parserException;
- switch (yangDataType) {
- case UNION:
- parserException = new ParserException("YANG file error : a type union" +
- " must have atleast one type statement.");
- break;
- case ENUMERATION:
- parserException = new ParserException("YANG file error : a type enumeration" +
- " must have atleast one enum statement.");
- break;
- case BITS:
- parserException = new ParserException("YANG file error : a type bits" +
- " must have atleast one bit statement.");
- break;
- case DECIMAL64:
- parserException = new ParserException("YANG file error : a type decimal64" +
- " must have fraction-digits statement.");
- break;
- case LEAFREF:
- parserException = new ParserException("YANG file error : a type leafref" +
- " must have one path statement.");
- break;
- case IDENTITYREF:
- parserException = new ParserException("YANG file error : a type identityref" +
- " must have base statement.");
- break;
- default:
- return;
- }
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/UnionListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/UnionListener.java
deleted file mode 100644
index 32eb4d9..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/UnionListener.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * type-body-stmts = numerical-restrictions /
- * decimal64-specification /
- * string-restrictions /
- * enum-specification /
- * leafref-specification /
- * identityref-specification /
- * instance-identifier-specification /
- * bits-specification /
- * union-specification
- *
- * union-specification = 1*(type-stmt stmtsep)
- *
- * ANTLR grammar rule
- * typeBodyStatements : numericalRestrictions | stringRestrictions | enumSpecification
- * | leafrefSpecification | identityrefSpecification | instanceIdentifierSpecification
- * | bitsSpecification | unionSpecification;
- *
- * unionSpecification : typeStatement+;
- */
-
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangLeafList;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.datamodel.YangTypeDef;
-import org.onosproject.yangutils.datamodel.YangUnion;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.TYPE_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.UNION_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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_CURRENT_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.translator.tojava.YangDataModelFactory.getYangUnionNode;
-
-/**
- * Represents listener based call back function corresponding to the "union" rule
- * defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class UnionListener {
-
- /**
- * Suffix to be used while creating union class.
- */
- private static final String UNION_CLASS_SUFFIX = "_union";
-
- /**
- * Creates a new union listener.
- */
- private UnionListener() {
- }
-
- /**
- * It is called when parser enters grammar rule (union), it perform
- * validations and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processUnionEntry(TreeWalkListener listener,
- GeneratedYangParser.UnionSpecificationContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, UNION_DATA, "", ENTRY);
-
- if (listener.getParsedDataStack().peek() instanceof YangType) {
- YangUnion unionNode = getYangUnionNode(JAVA_GENERATION);
- Parsable typeData = listener.getParsedDataStack().pop();
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, UNION_DATA, "", ENTRY);
-
- Parsable tmpData = listener.getParsedDataStack().peek();
-
- switch (tmpData.getYangConstructType()) {
- case LEAF_DATA:
- // Set the name of union same as leaf.
- unionNode.setName(((YangLeaf) tmpData).getName() + UNION_CLASS_SUFFIX);
- // Pop the stack entry to obtain the parent YANG node.
- Parsable leaf = listener.getParsedDataStack().pop();
- // Add the union node to the parent holder of leaf.
- addChildToParentNode(listener, unionNode);
- // Push the popped entry back to the stack.
- listener.getParsedDataStack().push(leaf);
- break;
- case LEAF_LIST_DATA:
- // Set the name of union same as leaf list.
- unionNode.setName(((YangLeafList) tmpData).getName() + UNION_CLASS_SUFFIX);
- // Pop the stack entry to obtain the parent YANG node.
- Parsable leafList = listener.getParsedDataStack().pop();
- // Add the union node to the parent holder of leaf.
- addChildToParentNode(listener, unionNode);
- // Push the popped entry back to the stack.
- listener.getParsedDataStack().push(leafList);
- break;
- case UNION_DATA:
- YangUnion parentUnion = (YangUnion) tmpData;
- /*
- * In case parent of union is again a union, name of the
- * child union is parent union name suffixed with running
- * integer number, this is done because under union there
- * could be multiple child union types.
- */
- unionNode.setName(parentUnion.getName() + UNION_CLASS_SUFFIX + parentUnion.getChildUnionNumber());
- // Increment the running number.
- parentUnion.setChildUnionNumber(parentUnion.getChildUnionNumber() + 1);
- // Add union as a child to parent union.
- addChildToParentNode(listener, unionNode);
- break;
- case TYPEDEF_DATA:
- YangTypeDef typeDef = (YangTypeDef) tmpData;
- // Set the name of union same as typedef name.
- unionNode.setName(typeDef.getName() + UNION_CLASS_SUFFIX);
- // Add union as a child to parent type def.
- addChildToParentNode(listener, unionNode);
- break;
- // TODO deviate.
- default:
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, TYPE_DATA,
- ((YangType<?>) typeData).getDataTypeName(), ENTRY));
- }
- listener.getParsedDataStack().push(typeData);
- listener.getParsedDataStack().push(unionNode);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, UNION_DATA, "", ENTRY));
- }
- }
-
- /**
- * It is called when parser exits from grammar rule (union), it perform
- * validations and update the data model tree.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processUnionExit(TreeWalkListener listener,
- GeneratedYangParser.UnionSpecificationContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, UNION_DATA, "", EXIT);
-
- Parsable tmpUnionNode = listener.getParsedDataStack().peek();
- if (tmpUnionNode instanceof YangUnion) {
- YangUnion unionNode = (YangUnion) tmpUnionNode;
- listener.getParsedDataStack().pop();
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, UNION_DATA, "", EXIT);
-
- Parsable tmpNode = listener.getParsedDataStack().peek();
- switch (tmpNode.getYangConstructType()) {
- case TYPE_DATA: {
- YangType<YangUnion> typeNode = (YangType<YangUnion>) tmpNode;
- typeNode.setDataTypeExtendedInfo(unionNode);
- break;
- }
- default:
- throw new ParserException(
- constructListenerErrorMessage(INVALID_HOLDER, UNION_DATA, "", EXIT));
- }
- } else {
- throw new ParserException(
- constructListenerErrorMessage(MISSING_CURRENT_HOLDER, UNION_DATA, "", EXIT));
- }
- }
-
- /**
- * Adds the union node to the parent holder.
- *
- * @param listener listener's object
- * @param unionNode union node which needs to be added to parent
- */
- private static void addChildToParentNode(TreeWalkListener listener, YangUnion unionNode) {
- if (!(listener.getParsedDataStack().peek() instanceof YangNode)) {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, UNION_DATA,
- "", ENTRY));
- } else {
- YangNode curNode = (YangNode) listener.getParsedDataStack().peek();
- try {
- curNode.addChild(unionNode);
- } catch (DataModelException e) {
- throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
- UNION_DATA, "", ENTRY, e.getMessage()));
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/UniqueListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/UniqueListener.java
deleted file mode 100644
index 59920fe..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/UniqueListener.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.UNIQUE_DATA;
-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;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * unique-stmt = unique-keyword sep unique-arg-str stmtend
- *
- * ANTLR grammar rule
- * uniqueStatement: UNIQUE_KEYWORD unique STMTEND;
- * unique : string;
- */
-
-/**
- * Represesnts listener based call back function corresponding to the "unique" rule
- * defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class UniqueListener {
-
- /**
- * Creates a new unique listener.
- */
- private UniqueListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule
- * (unique), perform validations and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processUniqueEntry(TreeWalkListener listener,
- GeneratedYangParser.UniqueStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, UNIQUE_DATA, ctx.unique().getText(), ENTRY);
-
- Parsable tmpData = listener.getParsedDataStack().peek();
- if (listener.getParsedDataStack().peek() instanceof YangList) {
- YangList yangList = (YangList) tmpData;
- String tmpUniqueValue = removeQuotesAndHandleConcat(ctx.unique().getText());
-
- if (tmpUniqueValue.contains(" ")) {
- String[] uniqueValues = tmpUniqueValue.split(" ");
- for (String uniqueValue : uniqueValues) {
- try {
- yangList.addUnique(uniqueValue);
- } catch (DataModelException e) {
- throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
- UNIQUE_DATA,
- ctx.unique().getText(), ENTRY, e.getMessage()));
- }
- }
- } else {
- try {
- yangList.addUnique(tmpUniqueValue);
- } catch (DataModelException e) {
- throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA, UNIQUE_DATA,
- ctx.unique().getText(), ENTRY, e.getMessage()));
- }
- }
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, UNIQUE_DATA, ctx.unique().getText(),
- ENTRY));
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/UnitsListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/UnitsListener.java
deleted file mode 100644
index e7acccf..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/UnitsListener.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangLeafList;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.UNITS_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;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * units-stmt = units-keyword sep string optsep stmtend
- *
- * ANTLR grammar rule
- * unitsStatement : UNITS_KEYWORD string STMTEND;
- */
-
-/**
- * Represents listener based call back function corresponding to the "units"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class UnitsListener {
-
- /**
- * Creates a new units listener.
- */
- private UnitsListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar
- * rule (units), performs validation and updates the data model
- * tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processUnitsEntry(TreeWalkListener listener,
- GeneratedYangParser.UnitsStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, UNITS_DATA, ctx.string().getText(), ENTRY);
-
- Parsable tmpData = listener.getParsedDataStack().peek();
- switch (tmpData.getYangConstructType()) {
- case LEAF_DATA:
- YangLeaf leaf = (YangLeaf) tmpData;
- leaf.setUnits(ctx.string().getText());
- break;
- case LEAF_LIST_DATA:
- YangLeafList leafList = (YangLeafList) tmpData;
- leafList.setUnits(ctx.string().getText());
- break;
- case TYPEDEF_DATA:
- // TODO
- break;
- default:
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, UNITS_DATA,
- ctx.string().getText(), ENTRY));
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/UsesListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/UsesListener.java
deleted file mode 100644
index 6e27a1b..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/UsesListener.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangAugment;
-import org.onosproject.yangutils.datamodel.YangCase;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangGrouping;
-import org.onosproject.yangutils.datamodel.YangInput;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeIdentifier;
-import org.onosproject.yangutils.datamodel.YangNotification;
-import org.onosproject.yangutils.datamodel.YangOutput;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.datamodel.YangUses;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.linker.impl.YangResolutionInfoImpl;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.addResolutionInfo;
-import static org.onosproject.yangutils.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.DESCRIPTION_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.REFERENCE_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.STATUS_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.USES_DATA;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.WHEN_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerCollisionDetector.detectCollidingChildUtil;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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.getValidNodeIdentifier;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.validateCardinalityMaxOne;
-import static org.onosproject.yangutils.translator.tojava.YangDataModelFactory.getYangUsesNode;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * data-def-stmt = container-stmt /
- * leaf-stmt /
- * leaf-list-stmt /
- * list-stmt /
- * choice-stmt /
- * anyxml-stmt /
- * uses-stmt
- *
- * uses-stmt = uses-keyword sep identifier-ref-arg-str optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [when-stmt stmtsep]
- * *(if-feature-stmt stmtsep)
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * *(refine-stmt stmtsep)
- * *(uses-augment-stmt stmtsep)
- * "}")
- *
- * ANTLR grammar rule
- * dataDefStatement : containerStatement
- * | leafStatement
- * | leafListStatement
- * | listStatement
- * | choiceStatement
- * | usesStatement;
- *
- * usesStatement : USES_KEYWORD string (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement
- * | statusStatement | descriptionStatement | referenceStatement | refineStatement
- * | usesAugmentStatement)* RIGHT_CURLY_BRACE);
- */
-
-/**
- * Represents listener based call back function corresponding to the "uses"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class UsesListener {
-
- /**
- * Creates a new uses listener.
- */
- private UsesListener() {
- }
-
- /**
- * It is called when parser enters grammar rule (uses), it perform
- * validations and updates the data model tree.
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processUsesEntry(TreeWalkListener listener, GeneratedYangParser.UsesStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, USES_DATA, ctx.string().getText(), ENTRY);
-
- // Validate sub statement cardinality.
- validateSubStatementsCardinality(ctx);
-
- // Check for identifier collision
- int line = ctx.getStart().getLine();
- int charPositionInLine = ctx.getStart().getCharPositionInLine();
-
- detectCollidingChildUtil(listener, line, charPositionInLine, ctx.string().getText(), USES_DATA);
- Parsable curData = listener.getParsedDataStack().peek();
-
- if (curData instanceof YangModule || curData instanceof YangSubModule
- || curData instanceof YangContainer || curData instanceof YangList
- || curData instanceof YangUses || curData instanceof YangAugment
- || curData instanceof YangCase || curData instanceof YangGrouping
- || curData instanceof YangInput || curData instanceof YangOutput
- || curData instanceof YangNotification) {
-
- YangUses usesNode = getYangUsesNode(JAVA_GENERATION);
- YangNodeIdentifier nodeIdentifier = getValidNodeIdentifier(ctx.string().getText(), USES_DATA, ctx);
- usesNode.setNodeIdentifier(nodeIdentifier);
- usesNode.setCurrentGroupingDepth(listener.getGroupingDepth());
- YangNode curNode = (YangNode) curData;
-
- try {
- curNode.addChild(usesNode);
- } catch (DataModelException e) {
- throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
- USES_DATA, ctx.string().getText(), ENTRY, e.getMessage()));
- }
- listener.getParsedDataStack().push(usesNode);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER,
- USES_DATA, ctx.string().getText(), ENTRY));
- }
- }
-
- /**
- * It is called when parser exits from grammar rule (uses), it perform
- * validations and update the data model tree.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processUsesExit(TreeWalkListener listener,
- GeneratedYangParser.UsesStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, USES_DATA, ctx.string().getText(), EXIT);
-
- Parsable parsableUses = listener.getParsedDataStack().pop();
- if (!(parsableUses instanceof YangUses)) {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, USES_DATA,
- ctx.string().getText(), EXIT));
- }
- YangUses uses = (YangUses) parsableUses;
- int errorLine = ctx.getStart().getLine();
- int errorPosition = ctx.getStart().getCharPositionInLine();
-
- // Parent YANG node of uses to be added in resolution information.
- Parsable parentNode = listener.getParsedDataStack().peek();
-
- // Verify parent node of leaf
- if (!(parentNode instanceof YangNode)) {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, USES_DATA,
- ctx.string().getText(), EXIT));
- }
-
- // Add resolution information to the list
- YangResolutionInfoImpl resolutionInfo = new YangResolutionInfoImpl<YangUses>(uses,
- (YangNode) parentNode, errorLine,
- errorPosition);
- addToResolutionList(resolutionInfo, ctx);
- }
-
- // TODO linker to handle collision scenarios like leaf obtained by uses, conflicts with some existing leaf.
-
- /**
- * Validates the cardinality of case sub-statements as per grammar.
- *
- * @param ctx context object of the grammar rule
- */
- private static void validateSubStatementsCardinality(GeneratedYangParser.UsesStatementContext ctx) {
- validateCardinalityMaxOne(ctx.whenStatement(), WHEN_DATA, USES_DATA, ctx.string().getText());
- validateCardinalityMaxOne(ctx.statusStatement(), STATUS_DATA, USES_DATA, ctx.string().getText());
- validateCardinalityMaxOne(ctx.descriptionStatement(), DESCRIPTION_DATA, USES_DATA, ctx.string().getText());
- validateCardinalityMaxOne(ctx.referenceStatement(), REFERENCE_DATA, USES_DATA, ctx.string().getText());
- }
-
- /**
- * Add to resolution list.
- *
- * @param resolutionInfo resolution information.
- * @param ctx context object of the grammar rule
- */
- private static void addToResolutionList(YangResolutionInfoImpl<YangUses> resolutionInfo,
- GeneratedYangParser.UsesStatementContext ctx) {
-
- try {
- addResolutionInfo(resolutionInfo);
- } catch (DataModelException e) {
- throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
- USES_DATA, ctx.string().getText(), EXIT, e.getMessage()));
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ValueListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ValueListener.java
deleted file mode 100644
index 39efa6b..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ValueListener.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * value-stmt = value-keyword sep integer-value stmtend
- *
- * ANTLR grammar rule
- * valueStatement : VALUE_KEYWORD ((MINUS INTEGER) | INTEGER) STMTEND;
- */
-
-import org.onosproject.yangutils.datamodel.YangEnum;
-import org.onosproject.yangutils.datamodel.YangEnumeration;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.VALUE_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.parser.impl.parserutils.ListenerUtil.getValidIntegerValue;
-
-/**
- * Represents listener based call back function corresponding to the "value"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class ValueListener {
-
- /**
- * Creates a new value listener.
- */
- private ValueListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule
- * (value), perform validations and update the data model tree.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processValueEntry(TreeWalkListener listener, GeneratedYangParser.ValueStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, VALUE_DATA, ctx.value().getText(), ENTRY);
-
- // Validate value
- int value = getValidIntegerValue(ctx.value().getText(), VALUE_DATA, ctx);
-
- // Obtain the node of the stack.
- Parsable tmpNode = listener.getParsedDataStack().peek();
- switch (tmpNode.getYangConstructType()) {
- case ENUM_DATA: {
- YangEnum enumNode = (YangEnum) tmpNode;
- if (!isEnumValueValid(listener, ctx, value)) {
- ParserException parserException = new ParserException("Duplicate Value Entry");
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
- enumNode.setValue(value);
- break;
- }
- default:
- throw new ParserException(
- constructListenerErrorMessage(INVALID_HOLDER, VALUE_DATA, ctx.value().getText(), ENTRY));
- }
- }
-
- /**
- * Validates ENUM value uniqueness.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- * @param value enum value
- * @return validation result
- */
- private static boolean isEnumValueValid(TreeWalkListener listener, GeneratedYangParser.ValueStatementContext ctx,
- int value) {
- Parsable enumNode = listener.getParsedDataStack().pop();
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, VALUE_DATA, ctx.value().getText(), ENTRY);
-
- Parsable tmpNode = listener.getParsedDataStack().peek();
- switch (tmpNode.getYangConstructType()) {
- case ENUMERATION_DATA: {
- YangEnumeration yangEnumeration = (YangEnumeration) tmpNode;
- for (YangEnum curEnum : yangEnumeration.getEnumSet()) {
- if (value == curEnum.getValue()) {
- listener.getParsedDataStack().push(enumNode);
- return false;
- }
- }
- listener.getParsedDataStack().push(enumNode);
- return true;
- }
- default:
- listener.getParsedDataStack().push(enumNode);
- throw new ParserException(
- constructListenerErrorMessage(INVALID_HOLDER, VALUE_DATA, ctx.value().getText(), ENTRY));
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/VersionListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/VersionListener.java
deleted file mode 100644
index 80caaa2..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/VersionListener.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getValidVersion;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.VERSION_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;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- * module-header-stmts = ;; these stmts can appear in any order
- * [yang-version-stmt stmtsep]
- * namespace-stmt stmtsep
- * prefix-stmt stmtsep
- *
- * submodule-header-stmts =
- * ;; these stmts can appear in any order
- * [yang-version-stmt stmtsep]
- * belongs-to-stmt stmtsep
- *
- * yang-version-stmt = yang-version-keyword sep yang-version-arg-str
- * optsep stmtend
- *
- *
- * ANTLR grammar rule
- * module_header_statement : yang_version_stmt? namespace_stmt prefix_stmt
- * | yang_version_stmt? prefix_stmt namespace_stmt
- * | namespace_stmt yang_version_stmt? prefix_stmt
- * | namespace_stmt prefix_stmt yang_version_stmt?
- * | prefix_stmt namespace_stmt yang_version_stmt?
- * | prefix_stmt yang_version_stmt? namespace_stmt?
- * ;
- * submodule_header_statement : yang_version_stmt? belongs_to_stmt
- * | belongs_to_stmt yang_version_stmt?
- * ;
- * yang_version_stmt : YANG_VERSION_KEYWORD version STMTEND;
- * version : string;
- */
-
-/**
- * Represents listener based call back function corresponding to the "version"
- * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
- */
-public final class VersionListener {
-
- /**
- * Creates a new version listener.
- */
- private VersionListener() {
- }
-
- /**
- * It is called when parser receives an input matching the grammar rule
- * (version), perform validations and update the data model tree.
- *
- * @param listener Listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processVersionEntry(TreeWalkListener listener,
- GeneratedYangParser.YangVersionStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, VERSION_DATA, ctx.version().getText(), ENTRY);
-
- byte version = getValidVersion(ctx);
-
- // Obtain the node of the stack.
- Parsable tmpNode = listener.getParsedDataStack().peek();
- switch (tmpNode.getYangConstructType()) {
- case MODULE_DATA: {
- YangModule module = (YangModule) tmpNode;
- module.setVersion(version);
- break;
- }
- case SUB_MODULE_DATA: {
- YangSubModule subModule = (YangSubModule) tmpNode;
- subModule.setVersion(version);
- break;
- }
- default:
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, VERSION_DATA,
- ctx.version().getText(), ENTRY));
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/WhenListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/WhenListener.java
deleted file mode 100644
index 15092a1..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/WhenListener.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.onosproject.yangutils.datamodel.YangWhen;
-import org.onosproject.yangutils.datamodel.YangWhenHolder;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.WHEN_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-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_CURRENT_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.removeQuotesAndHandleConcat;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-
-/*
- * Reference: RFC6020 and YANG ANTLR Grammar
- *
- * ABNF grammar as per RFC6020
- *
- * when-stmt = when-keyword sep string optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * "}")
- *
- * ANTLR grammar rule
- * whenStatement : WHEN_KEYWORD string (STMTEND | LEFT_CURLY_BRACE ((descriptionStatement? referenceStatement?)
- * | (referenceStatement? descriptionStatement?)) RIGHT_CURLY_BRACE);
- */
-
-/**
- * Represents listener based call back function corresponding to the
- * "when" rule defined in ANTLR grammar file for corresponding ABNF rule
- * in RFC 6020.
- */
-public final class WhenListener {
-
- /**
- * Creates a new when listener.
- */
- private WhenListener() {
- }
-
- /**
- * Perform validations and updates the data model tree.It is called when parser
- * receives an input matching the grammar rule (when).
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processWhenEntry(TreeWalkListener listener,
- GeneratedYangParser.WhenStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, WHEN_DATA, ctx.string().getText(), ENTRY);
- String condition = removeQuotesAndHandleConcat(ctx.string().getText());
-
- YangWhenHolder whenHolder;
-
- // Obtain the node of the stack.
- Parsable tmpNode = listener.getParsedDataStack().peek();
- if (tmpNode instanceof YangWhenHolder) {
- whenHolder = (YangWhenHolder) tmpNode;
-
- YangWhen when = new YangWhen();
- when.setCondition(condition);
-
- whenHolder.setWhen(when);
- listener.getParsedDataStack().push(when);
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER,
- WHEN_DATA, ctx.string().getText(), ENTRY));
- }
- }
-
- /**
- * Performs validation and updates the data model tree.It is called when parser
- * exits from grammar rule (when).
- *
- * @param listener listener's object
- * @param ctx context object of the grammar rule
- */
- public static void processWhenExit(TreeWalkListener listener,
- GeneratedYangParser.WhenStatementContext ctx) {
-
- // Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, WHEN_DATA, ctx.string().getText(), EXIT);
-
- if (listener.getParsedDataStack().peek() instanceof YangWhen) {
- listener.getParsedDataStack().pop();
- } else {
- throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, WHEN_DATA,
- ctx.string().getText(), EXIT));
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/package-info.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/package-info.java
deleted file mode 100644
index 240cd55..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Provide call back functions for listeners based tree walk.
- */
-package org.onosproject.yangutils.parser.impl.listeners;
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/package-info.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/package-info.java
deleted file mode 100644
index d935f7b..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Parse the YANG information from ANTLR generated parse tree.
- */
-package org.onosproject.yangutils.parser.impl;
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/AugmentListenerUtil.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/AugmentListenerUtil.java
deleted file mode 100644
index 341cbf9..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/AugmentListenerUtil.java
+++ /dev/null
@@ -1,309 +0,0 @@
-/*
- * 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.parser.impl.parserutils;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.onosproject.yangutils.datamodel.CollisionDetector;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeIdentifier;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.AUGMENT_DATA;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase;
-
-/**
- * Represents a utility which provides listener utilities augment node.
- */
-public final class AugmentListenerUtil {
-
- /**
- * Prefix to be added to generated java file for augment node.
- */
- private static final String AUGMENTED = "Augmented";
-
- /**
- * The number of time augment has updated the same target node in same module/submodule.
- */
- private static int occurrenceCount = 1;
-
- /**
- * List of names for augment's generated java file.
- */
- private static List<String> augmentJavaFileNameList = new ArrayList<>();
-
- private static final int ONE = 1;
- private static final int TWO = 2;
- private static final int ZERO = 0;
-
- /**
- * Creates an instance of augment java file name generator utility.
- */
- private AugmentListenerUtil() {
- }
-
- /**
- * Sets the augment java file name list.
- *
- * @param nameList name list
- */
- private static void setAugmentJavaFileNameList(List<String> nameList) {
- augmentJavaFileNameList = nameList;
- }
-
- /**
- * Returns augment java file name list.
- *
- * @return augment java file name list
- */
- public static List<String> getAugmentJavaFileNameList() {
- return augmentJavaFileNameList;
- }
-
- /**
- * Sets occurrence count.
- *
- * @param occurrence occurrence count
- */
- private static void setOccurrenceCount(int occurrence) {
- occurrenceCount = occurrence;
- }
-
- /**
- * Returns occurrence count.
- *
- * @return occurrence count
- */
- private static int getOccurrenceCount() {
- return occurrenceCount;
- }
-
- /**
- * Generates name for augment node also detects collision for java file generation of augment node when
- * augment is updating the same target node in same parent multiple times.
- *
- * @param curData parsable data
- * @param targetNodes list of target nodes
- * @param listener tree walk listener
- * @return name for augment node
- */
- public static String generateNameForAugmentNode(Parsable curData, List<YangNodeIdentifier> targetNodes,
- TreeWalkListener listener) {
-
- String curPrefix = getParentsPrefix((YangNode) curData);
- YangNodeIdentifier nodeId = targetNodes.get(targetNodes.size() - 1);
- boolean isPrefix = isPrefixPresent(nodeId, curPrefix);
- String generateName = createValidNameForAugment(nodeId, isPrefix);
-
- if (listener.getParsedDataStack().peek() instanceof CollisionDetector) {
- try {
- ((CollisionDetector) listener.getParsedDataStack().peek()).detectCollidingChild(generateName,
- AUGMENT_DATA);
- } catch (DataModelException e) {
- return updateNameWhenHasMultipleOuccrrence(nodeId, isPrefix);
- }
- }
-
- clearOccurrenceCount();
- return generateName;
- }
-
- /**
- * Creates a name identifier for augment.
- *
- * @param nodeId node identifier
- * @param isPrefix if prefix is present or it is not equals to parent's prefix
- * @return valid name for augment
- */
- public static String createValidNameForAugment(YangNodeIdentifier nodeId, boolean isPrefix) {
- getAugmentJavaFileNameList().add(createName(nodeId, isPrefix));
- setAugmentJavaFileNameList(getAugmentJavaFileNameList());
- return getAugmentJavaFileNameList().get(getAugmentJavaFileNameList().size() - 1);
- }
-
- /**
- * Creates name for the current augment file.
- *
- * @param nodeId node identifier
- * @param isPrefix if prefix is present or it is not equals to parent's prefix
- */
- private static String createName(YangNodeIdentifier nodeId, boolean isPrefix) {
- if (isPrefix) {
- return AUGMENTED + getCapitalCase(nodeId.getPrefix()) + getCapitalCase(nodeId.getName());
- } else {
- return AUGMENTED + getCapitalCase(nodeId.getName());
- }
- }
-
- /**
- * Updates occurrence count of augment.
- */
- private static void updateOccurenceCount() {
- int count = getOccurrenceCount();
- count++;
- setOccurrenceCount(count);
- }
-
- /**
- * Updates the list of name when augment has occurred multiple times to update the same target node
- * and returns a valid name for augment node's generated java file.
- *
- * @param nodeId YANG node identifier
- * @param isPrefix true if a prefix is present and it is not equals to parents prefix
- * @return valid name for augment node
- */
- public static String updateNameWhenHasMultipleOuccrrence(YangNodeIdentifier nodeId, boolean isPrefix) {
- String name = "";
- updateOccurenceCount();
-
- if (getOccurrenceCount() == TWO) {
- String previousAugmentsName = getAugmentJavaFileNameList().get(getAugmentJavaFileNameList().size() - ONE);
- getAugmentJavaFileNameList().remove(ZERO);
- getAugmentJavaFileNameList().add(previousAugmentsName + ONE);
- //TODO: update when already contains the name.
- name = createName(nodeId, isPrefix) + TWO;
- } else {
- name = createName(nodeId, isPrefix) + getOccurrenceCount();
- }
- getAugmentJavaFileNameList().add(name);
- return name;
- }
-
- /**
- * Resets occurrence count to one.
- */
- public static void clearOccurrenceCount() {
- setOccurrenceCount(ONE);
- }
-
- /**
- * Returns true if a prefix is present and it is not equals to parents prefix.
- *
- * @param nodeId YANG node identifier
- * @param parentsPrefix parent's prefix
- * @return true if a prefix is present and it is not equals to parents prefix
- */
- private static boolean isPrefixPresent(YangNodeIdentifier nodeId, String parentsPrefix) {
- return nodeId.getPrefix() != null && nodeId.getPrefix() != parentsPrefix;
- }
-
- /**
- * Validates whether current node in target path is valid or not.
- *
- * @param curNode current YANG node
- * @param targetNodes list of target nodes
- * @param ctx augment statement context
- */
- public static void validateNodeInTargetPath(YangNode curNode, List<YangNodeIdentifier> targetNodes,
- GeneratedYangParser.AugmentStatementContext ctx) {
-
- curNode = curNode.getChild();
- YangNode tempNode = validateCurrentTargetNode(targetNodes, curNode);
- if (tempNode != null) {
- switch (tempNode.getNodeType()) {
- case CONTAINER_NODE:
- break;
- case LIST_NODE:
- break;
- case CHOICE_NODE:
- break;
- case CASE_NODE:
- break;
- case INPUT_NODE:
- break;
- case OUTPUT_NODE:
- break;
- case NOTIFICATION_NODE:
- break;
- default:
- throw parserException(ctx);
- }
- } else {
- throw parserException(ctx);
- }
- }
-
- /**
- * Validates whether nodes in target node list are valid or not.
- *
- * @param targetNodes target node
- * @param curNode YANG node
- * @return true or false
- */
- private static YangNode validateCurrentTargetNode(List<YangNodeIdentifier> targetNodes, YangNode curNode) {
- YangNode tempNode = null;
- while (curNode != null) {
- tempNode = curNode;
- for (int i = 1; i < targetNodes.size(); i++) {
- if (curNode.getName().equals(targetNodes.get(i).getName())) {
- if (curNode.getChild() != null && targetNodes.size() - 1 != i) {
- curNode = curNode.getChild();
- } else if (curNode.getChild() != null && targetNodes.size() - 1 == i) {
- return curNode;
- } else if (curNode.getChild() == null && targetNodes.size() - 1 == i) {
- return curNode;
- } else {
- break;
- }
- } else {
- curNode = tempNode;
- break;
- }
- }
- curNode = curNode.getNextSibling();
- }
- return null;
- }
-
- /**
- * Builds parser exception.
- *
- * @param ctx augment statement context
- * @return parser exception
- */
- public static ParserException parserException(GeneratedYangParser.AugmentStatementContext ctx) {
- int line = ctx.getStart().getLine();
- int charPositionInLine = ctx.getStart().getCharPositionInLine();
- ParserException exception = new ParserException("invalid target node path.");
- exception.setLine(line);
- exception.setCharPosition(charPositionInLine);
- return exception;
- }
-
- /**
- * Returns parent nodes prefix.
- *
- * @param curNode current YANG node
- * @return parent nodes prefix
- */
- public static String getParentsPrefix(YangNode curNode) {
- String curPrefix = null;
- if (curNode instanceof YangModule) {
- curPrefix = ((YangModule) curNode).getPrefix();
- } else if (curNode instanceof YangSubModule) {
- curPrefix = ((YangSubModule) curNode).getPrefix();
- }
- return curPrefix;
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerCollisionDetector.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerCollisionDetector.java
deleted file mode 100644
index 632f50d..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerCollisionDetector.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.parser.impl.parserutils;
-
-import org.onosproject.yangutils.datamodel.CollisionDetector;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
-
-/**
- * Represents the detector of YANG construct collision in a YANG file.
- */
-public final class ListenerCollisionDetector {
-
- /**
- * Creates a new listener collision.
- */
- private ListenerCollisionDetector() {
- }
-
- /**
- * Detects that the identifiers of all these child nodes must be unique
- * within all cases in a choice.
- *
- * @param listener listener's object
- * @param line line of identifier in YANG file, required for error
- * reporting
- * @param charPosition character position of identifier in YANG file,
- * required for error reporting
- * @param identifierName name for which uniqueness is to be detected
- * @param constructType type of YANG construct for which collision check is
- * to be performed
- * @throws ParserException if identifier is not unique
- */
- public static void detectCollidingChildUtil(TreeWalkListener listener, int line, int charPosition,
- String identifierName, YangConstructType constructType)
- throws ParserException {
-
- if (listener.getParsedDataStack().peek() instanceof CollisionDetector) {
- try {
- ((CollisionDetector) listener.getParsedDataStack().peek()).detectCollidingChild(
- identifierName, constructType);
- } catch (DataModelException e) {
- ParserException parserException = new ParserException(e.getMessage());
- parserException.setLine(line);
- parserException.setCharPosition(charPosition);
- throw parserException;
- }
- } else {
- throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, constructType, identifierName,
- EXIT));
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerErrorLocation.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerErrorLocation.java
deleted file mode 100644
index c1c2888..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerErrorLocation.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.parser.impl.parserutils;
-
-/**
- * Represents listener error location.
- */
-public enum ListenerErrorLocation {
- /**
- * Represents that the error location is before processing.
- */
- ENTRY(),
-
- /**
- * Represents that the error location is before processing.
- */
- EXIT();
-
- /**
- * Returns the message corresponding to listener error location.
- *
- * @param errorLocation enum value for type of error
- * @return message corresponding to listener error location
- */
- public static String getErrorLocationMessage(ListenerErrorLocation errorLocation) {
-
- switch (errorLocation) {
- case ENTRY:
- return "before";
- case EXIT:
- return "after";
- default:
- return "during";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerErrorMessageConstruction.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerErrorMessageConstruction.java
deleted file mode 100644
index 15b2170..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerErrorMessageConstruction.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * 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.parser.impl.parserutils;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.getYangConstructType;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.getErrorLocationMessage;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.getErrorType;
-
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-
-/**
- * Represents a utility to help construct detailed error message.
- */
-public final class ListenerErrorMessageConstruction {
-
- /**
- * Creates a object of listen error message.
- */
- private ListenerErrorMessageConstruction() {
- }
-
- /**
- * Constructs message for error with extended information and returns the
- * same.
- *
- * @param errorType error type needs to be set in error message
- * @param yangConstructType type of parsable data in which error occurred
- * @param parsableDataTypeName identifier/string of parsable data type in
- * which error occurred
- * @param errorLocation location where error occurred
- * @param extendedErrorInformation extended error information
- * @return constructed error message
- */
- public static String constructExtendedListenerErrorMessage(ListenerErrorType errorType,
- YangConstructType yangConstructType,
- String parsableDataTypeName,
- ListenerErrorLocation errorLocation,
- String extendedErrorInformation) {
- String newErrorMessage;
- newErrorMessage = constructListenerErrorMessage(errorType, yangConstructType, parsableDataTypeName,
- errorLocation)
- + "\n"
- + "Error Information: "
- + extendedErrorInformation;
- return newErrorMessage;
- }
-
- /**
- * Constructs message for error during listener based tree walk and returns
- * the same.
- *
- * @param errorType error type needs to be set in error message
- * @param yangConstructType type of parsable data in which error occurred
- * @param parsableDataTypeName identifier/string of parsable data type in
- * which error occurred
- * @param errorLocation location where error occurred
- * @return constructed error message
- */
- public static String constructListenerErrorMessage(ListenerErrorType errorType,
- YangConstructType yangConstructType,
- String parsableDataTypeName,
- ListenerErrorLocation errorLocation) {
-
- String errorMessage;
-
- errorMessage = "Internal parser error detected: " + getErrorType(errorType) + " "
- + getYangConstructType(yangConstructType);
-
- if (!parsableDataTypeName.isEmpty()) {
- errorMessage = errorMessage + " \"" + parsableDataTypeName + "\" ";
- } else {
- errorMessage = errorMessage + " ";
-
- }
- errorMessage = errorMessage + getErrorLocationMessage(errorLocation) + " processing.";
- return errorMessage;
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerErrorType.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerErrorType.java
deleted file mode 100644
index f1cb284..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerErrorType.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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.parser.impl.parserutils;
-
-/**
- * Represents listener error type.
- */
-public enum ListenerErrorType {
- /**
- * Represents the parent holder in parsable stack for given YANG construct
- * is invalid.
- */
- INVALID_HOLDER(),
-
- /**
- * Represents the parent holder in parsable stack for given YANG construct
- * is missing.
- */
- MISSING_HOLDER(),
-
- /**
- * Represents the current holder in parsable stack for given YANG construct
- * is missing.
- */
- MISSING_CURRENT_HOLDER(),
-
- /**
- * Represents that the child in parsable stack for given YANG construct is
- * invalid.
- */
- INVALID_CHILD(),
-
- /**
- * Represents that the cardinality for given YANG construct is invalid.
- */
- INVALID_CARDINALITY(),
-
- /**
- * Represents that the entry is duplicate.
- */
- DUPLICATE_ENTRY(),
-
- /**
- * Represents that the content is invalid.
- */
- INVALID_CONTENT(),
-
- /**
- * Represents that the identifier collision is detected.
- */
- IDENTIFIER_COLLISION(),
-
- /**
- * Represents that some of earlier parsed data is not handled correctly.
- */
- UNHANDLED_PARSED_DATA();
-
- /**
- * Returns the message corresponding to listener error type.
- *
- * @param errorType enum value for type of error
- * @return message corresponding to listener error type
- */
- public static String getErrorType(ListenerErrorType errorType) {
-
- switch (errorType) {
- case INVALID_HOLDER:
- return "Invalid holder for";
- case MISSING_HOLDER:
- return "Missing holder at";
- case MISSING_CURRENT_HOLDER:
- return "Missing";
- case INVALID_CHILD:
- return "Invalid child in";
- case INVALID_CARDINALITY:
- return "Invalid cardinality in";
- case DUPLICATE_ENTRY:
- return "Duplicate";
- case INVALID_CONTENT:
- return "Invalid content in";
- case IDENTIFIER_COLLISION:
- return "Identifier collision detected for";
- case UNHANDLED_PARSED_DATA:
- return "Unhandled parsed data at";
- default:
- return "Problem in";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerUtil.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerUtil.java
deleted file mode 100644
index 5fe0970..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerUtil.java
+++ /dev/null
@@ -1,1053 +0,0 @@
-/*
- * 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.parser.impl.parserutils;
-
-import org.antlr.v4.runtime.ParserRuleContext;
-import org.onosproject.yangutils.datamodel.YangAtomicPath;
-import org.onosproject.yangutils.datamodel.YangImport;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangLeafRef;
-import org.onosproject.yangutils.datamodel.YangLeavesHolder;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeIdentifier;
-import org.onosproject.yangutils.datamodel.YangPathPredicate;
-import org.onosproject.yangutils.datamodel.YangReferenceResolver;
-import org.onosproject.yangutils.datamodel.YangRelativePath;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.regex.Pattern;
-
-import static org.onosproject.yangutils.datamodel.YangPathArgType.ABSOLUTE_PATH;
-import static org.onosproject.yangutils.datamodel.YangPathArgType.RELATIVE_PATH;
-import static org.onosproject.yangutils.datamodel.YangPathOperator.EQUALTO;
-import static org.onosproject.yangutils.utils.UtilConstants.ADD;
-import static org.onosproject.yangutils.utils.UtilConstants.ANCESTOR_ACCESSOR;
-import static org.onosproject.yangutils.utils.UtilConstants.ANCESTOR_ACCESSOR_IN_PATH;
-import static org.onosproject.yangutils.utils.UtilConstants.CARET;
-import static org.onosproject.yangutils.utils.UtilConstants.CHAR_OF_CLOSE_SQUARE_BRACKET;
-import static org.onosproject.yangutils.utils.UtilConstants.CHAR_OF_OPEN_SQUARE_BRACKET;
-import static org.onosproject.yangutils.utils.UtilConstants.CHAR_OF_SLASH;
-import static org.onosproject.yangutils.utils.UtilConstants.CLOSE_PARENTHESIS;
-import static org.onosproject.yangutils.utils.UtilConstants.COLON;
-import static org.onosproject.yangutils.utils.UtilConstants.CURRENT;
-import static org.onosproject.yangutils.utils.UtilConstants.EMPTY_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.FALSE;
-import static org.onosproject.yangutils.utils.UtilConstants.OPEN_SQUARE_BRACKET;
-import static org.onosproject.yangutils.utils.UtilConstants.QUOTES;
-import static org.onosproject.yangutils.utils.UtilConstants.SLASH;
-import static org.onosproject.yangutils.utils.UtilConstants.SLASH_FOR_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.TRUE;
-import static org.onosproject.yangutils.utils.UtilConstants.YANG_FILE_ERROR;
-
-/**
- * Represents an utility for listener.
- */
-public final class ListenerUtil {
-
- private static final Pattern IDENTIFIER_PATTERN = Pattern.compile("[a-zA-Z_][a-zA-Z0-9_.-]*");
- private static final String DATE_PATTERN = "[0-9]{4}-([0-9]{2}|[0-9])-([0-9]{2}|[0-9])";
- private static final String NON_NEGATIVE_INTEGER_PATTERN = "[0-9]+";
- private static final Pattern INTEGER_PATTERN = Pattern.compile("[-][0-9]+|[0-9]+");
- private static final Pattern PATH_PREDICATE_PATTERN = Pattern.compile("\\[(.*?)\\]");
- private static final String XML = "xml";
- private static final String ONE = "1";
- private static final int IDENTIFIER_LENGTH = 64;
- private static final String DATE_FORMAT = "yyyy-MM-dd";
-
- /**
- * Creates a new listener util.
- */
- private ListenerUtil() {
- }
-
- /**
- * Removes doubles quotes and concatenates if string has plus symbol.
- *
- * @param yangStringData string from yang file
- * @return concatenated string after removing double quotes
- */
- public static String removeQuotesAndHandleConcat(String yangStringData) {
-
- yangStringData = yangStringData.replace("\"", EMPTY_STRING);
- String[] tmpData = yangStringData.split(Pattern.quote(ADD));
- StringBuilder builder = new StringBuilder();
- for (String yangString : tmpData) {
- builder.append(yangString);
- }
- return builder.toString();
- }
-
- /**
- * Validates identifier and returns concatenated string if string contains plus symbol.
- *
- * @param identifier string from yang file
- * @param yangConstruct yang construct for creating error message
- * @param ctx yang construct's context to get the line number and character position
- * @return concatenated string after removing double quotes
- */
- public static String getValidIdentifier(String identifier, YangConstructType yangConstruct, ParserRuleContext ctx) {
-
- String identifierString = removeQuotesAndHandleConcat(identifier);
- ParserException parserException;
-
- if (identifierString.length() > IDENTIFIER_LENGTH) {
- parserException = new ParserException("YANG file error : " +
- YangConstructType.getYangConstructType(yangConstruct) + " name " + identifierString + " is " +
- "greater than 64 characters.");
- } else if (!IDENTIFIER_PATTERN.matcher(identifierString).matches()) {
- parserException = new ParserException("YANG file error : " +
- YangConstructType.getYangConstructType(yangConstruct) + " name " + identifierString + " is not " +
- "valid.");
- } else if (identifierString.toLowerCase().startsWith(XML)) {
- parserException = new ParserException("YANG file error : " +
- YangConstructType.getYangConstructType(yangConstruct) + " identifier " + identifierString +
- " must not start with (('X'|'x') ('M'|'m') ('L'|'l')).");
- } else {
- return identifierString;
- }
-
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
-
- /**
- * Validates identifier and returns concatenated string if string contains plus symbol.
- *
- * @param identifier string from yang file
- * @param yangConstruct yang construct for creating error message
- * @param ctx yang construct's context to get the line number and character position
- * @param yangLeafRef instance of leafref where the path argument has to be set
- * @return concatenated string after removing double quotes
- */
- public static String getValidIdentifierForLeafref(String identifier, YangConstructType yangConstruct,
- ParserRuleContext ctx, YangLeafRef yangLeafRef) {
-
- String identifierString = removeQuotesAndHandleConcat(identifier);
- ParserException parserException;
-
- if (identifierString.length() > IDENTIFIER_LENGTH) {
- parserException = new ParserException("YANG file error : " + " identifier " + identifierString + " in " +
- YangConstructType.getYangConstructType(yangConstruct) + " " + yangLeafRef.getPath() + " is " +
- "greater than 64 characters.");
- } else if (!IDENTIFIER_PATTERN.matcher(identifierString).matches()) {
- parserException = new ParserException("YANG file error : " + " identifier " + identifierString + " in " +
- YangConstructType.getYangConstructType(yangConstruct) + " " + yangLeafRef.getPath() + " is not " +
- "valid.");
- } else if (identifierString.toLowerCase().startsWith(XML)) {
- parserException = new ParserException("YANG file error : " + " identifier " + identifierString + " in " +
- YangConstructType.getYangConstructType(yangConstruct) + " " + yangLeafRef.getPath() +
- " must not start with (('X'|'x') ('M'|'m') ('L'|'l')).");
- } else {
- return identifierString;
- }
-
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
-
- /**
- * Validates the revision date.
- *
- * @param dateToValidate input revision date
- * @return validation result, true for success, false for failure
- */
- public static boolean isDateValid(String dateToValidate) {
- if (dateToValidate == null || !dateToValidate.matches(DATE_PATTERN)) {
- return false;
- }
-
- SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
- sdf.setLenient(false);
-
- try {
- //if not valid, it will throw ParseException
- sdf.parse(dateToValidate);
- } catch (ParseException e) {
- return false;
- }
-
- return true;
- }
-
- /**
- * Validates YANG version.
- *
- * @param ctx version context object of the grammar rule
- * @return valid version
- */
- public static byte getValidVersion(GeneratedYangParser.YangVersionStatementContext ctx) {
-
- String value = removeQuotesAndHandleConcat(ctx.version().getText());
- if (!value.equals(ONE)) {
- ParserException parserException = new ParserException("YANG file error: Input version not supported");
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
-
- return Byte.valueOf(value);
- }
-
- /**
- * Validates non negative integer value.
- *
- * @param integerValue integer to be validated
- * @param yangConstruct yang construct for creating error message
- * @param ctx context object of the grammar rule
- * @return valid non negative integer value
- */
- public static int getValidNonNegativeIntegerValue(String integerValue, YangConstructType yangConstruct,
- ParserRuleContext ctx) {
-
- String value = removeQuotesAndHandleConcat(integerValue);
- if (!value.matches(NON_NEGATIVE_INTEGER_PATTERN)) {
- ParserException parserException = new ParserException("YANG file error : " +
- YangConstructType.getYangConstructType(yangConstruct) + " value " + value + " is not " +
- "valid.");
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
-
- int valueInInteger;
- try {
- valueInInteger = Integer.parseInt(value);
- } catch (NumberFormatException e) {
- ParserException parserException = new ParserException("YANG file error : " +
- YangConstructType.getYangConstructType(yangConstruct) + " value " + value + " is not " +
- "valid.");
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
- return valueInInteger;
- }
-
- /**
- * Validates integer value.
- *
- * @param integerValue integer to be validated
- * @param yangConstruct yang construct for creating error message
- * @param ctx context object of the grammar rule
- * @return valid integer value
- */
- public static int getValidIntegerValue(String integerValue, YangConstructType yangConstruct,
- ParserRuleContext ctx) {
-
- String value = removeQuotesAndHandleConcat(integerValue);
- if (!INTEGER_PATTERN.matcher(value).matches()) {
- ParserException parserException = new ParserException("YANG file error : " +
- YangConstructType.getYangConstructType(yangConstruct) + " value " + value + " is not " +
- "valid.");
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
-
- int valueInInteger;
- try {
- valueInInteger = Integer.parseInt(value);
- } catch (NumberFormatException e) {
- ParserException parserException = new ParserException("YANG file error : " +
- YangConstructType.getYangConstructType(yangConstruct) + " value " + value + " is not " +
- "valid.");
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
- return valueInInteger;
- }
-
- /**
- * Validates boolean value.
- *
- * @param booleanValue value to be validated
- * @param yangConstruct yang construct for creating error message
- * @param ctx context object of the grammar rule
- * @return boolean value either true or false
- */
- public static boolean getValidBooleanValue(String booleanValue, YangConstructType yangConstruct,
- ParserRuleContext ctx) {
-
- String value = removeQuotesAndHandleConcat(booleanValue);
- if (value.equals(TRUE)) {
- return true;
- } else if (value.equals(FALSE)) {
- return false;
- } else {
- ParserException parserException = new ParserException("YANG file error : " +
- YangConstructType.getYangConstructType(yangConstruct) + " value " + value + " is not " +
- "valid.");
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
- }
-
- /**
- * Returns current date and makes it in usable format for revision.
- *
- * @return usable current date format for revision
- */
- public static Date getCurrentDateForRevision() {
-
- SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT);
-
- Date date = new Date();
- String dateInString = dateFormat.format(date);
- try {
- //if not valid, it will throw ParseException
- Date now = dateFormat.parse(dateInString);
- return date;
- } catch (ParseException e) {
- ParserException parserException = new ParserException("YANG file error: Input date is not correct");
- throw parserException;
- }
- }
-
- /**
- * Checks and return valid node identifier.
- *
- * @param nodeIdentifierString string from yang file
- * @param yangConstruct yang construct for creating error message
- * @param ctx yang construct's context to get the line number and character position
- * @return valid node identifier
- */
- public static YangNodeIdentifier getValidNodeIdentifier(String nodeIdentifierString,
- YangConstructType yangConstruct, ParserRuleContext ctx) {
- String tmpIdentifierString = removeQuotesAndHandleConcat(nodeIdentifierString);
- String[] tmpData = tmpIdentifierString.split(Pattern.quote(COLON));
- if (tmpData.length == 1) {
- YangNodeIdentifier nodeIdentifier = new YangNodeIdentifier();
- nodeIdentifier.setName(getValidIdentifier(tmpData[0], yangConstruct, ctx));
- return nodeIdentifier;
- } else if (tmpData.length == 2) {
- YangNodeIdentifier nodeIdentifier = new YangNodeIdentifier();
- nodeIdentifier.setPrefix(getValidIdentifier(tmpData[0], yangConstruct, ctx));
- nodeIdentifier.setName(getValidIdentifier(tmpData[1], yangConstruct, ctx));
- return nodeIdentifier;
- } else {
- ParserException parserException = new ParserException("YANG file error : " +
- YangConstructType.getYangConstructType(yangConstruct) + " name " + nodeIdentifierString +
- " is not valid.");
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
- }
-
- /**
- * Checks and return valid node identifier specific to nodes in leafref path.
- *
- * @param nodeIdentifierString string from yang file
- * @param yangConstruct yang construct for creating error message
- * @param ctx yang construct's context to get the line number and character position
- * @param yangLeafRef instance of leafref where the path argument has to be set
- * @return valid node identifier
- */
- public static YangNodeIdentifier getValidNodeIdentifierForLeafref(String nodeIdentifierString,
- YangConstructType yangConstruct,
- ParserRuleContext ctx, YangLeafRef yangLeafRef) {
-
- String tmpIdentifierString = removeQuotesAndHandleConcat(nodeIdentifierString);
- String[] tmpData = tmpIdentifierString.split(Pattern.quote(COLON));
- if (tmpData.length == 1) {
- YangNodeIdentifier nodeIdentifier = new YangNodeIdentifier();
- nodeIdentifier.setName(getValidIdentifierForLeafref(tmpData[0], yangConstruct, ctx, yangLeafRef));
- return nodeIdentifier;
- } else if (tmpData.length == 2) {
- YangNodeIdentifier nodeIdentifier = new YangNodeIdentifier();
- nodeIdentifier.setPrefix(getValidIdentifierForLeafref(tmpData[0], yangConstruct, ctx, yangLeafRef));
- nodeIdentifier.setName(getValidIdentifierForLeafref(tmpData[1], yangConstruct, ctx, yangLeafRef));
- return nodeIdentifier;
- } else {
- ParserException parserException = new ParserException("YANG file error : " +
- YangConstructType.getYangConstructType(yangConstruct) + yangLeafRef.getPath() +
- " is not valid.");
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
- }
-
- /**
- * Validates the path argument. It can be either absolute or relative path.
- *
- * @param pathString the path string from the path type
- * @param yangConstruct yang construct for creating error message
- * @param ctx yang construct's context to get the line number and character position
- * @param yangLeafRef instance of leafref where the path argument has to be set
- */
- public static void validatePathArgument(String pathString, YangConstructType yangConstruct,
- ParserRuleContext ctx, YangLeafRef yangLeafRef) {
-
- String completePathString = removeQuotesAndHandleConcat(pathString);
- yangLeafRef.setPath(completePathString);
- if (completePathString.startsWith(SLASH)) {
- yangLeafRef.setPathType(ABSOLUTE_PATH);
- List<YangAtomicPath> yangAtomicPathListList = validateAbsolutePath(completePathString, yangConstruct, ctx,
- yangLeafRef);
- validatePrefixAndYangNode(yangAtomicPathListList, yangLeafRef);
- yangLeafRef.setAtomicPath(yangAtomicPathListList);
- } else if (completePathString.startsWith(ANCESTOR_ACCESSOR)) {
- yangLeafRef.setPathType(RELATIVE_PATH);
- validateRelativePath(completePathString, yangConstruct, ctx, yangLeafRef);
- } else {
- ParserException parserException = new ParserException("YANG file error : " +
- YangConstructType.getYangConstructType(yangConstruct) + yangLeafRef.getPath() +
- " does not follow valid path syntax");
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
- }
-
- /**
- * Validates the prefixes in the leafref and assigns them to the respective imported name in map.
- *
- * @param yangAtomicPathList list of atomic poth
- * @param yangLeafRef instance YANG leafref
- */
- private static void validatePrefixAndYangNode(List<YangAtomicPath> yangAtomicPathList, YangLeafRef yangLeafRef) {
- Iterator<YangAtomicPath> yangAtomicPathIterator = yangAtomicPathList.listIterator();
- while (yangAtomicPathIterator.hasNext()) {
- YangAtomicPath atomicPath = yangAtomicPathIterator.next();
- String prefix = atomicPath.getNodeIdentifier().getPrefix();
- YangNode parentNodeOfLeafref = yangLeafRef.getParentNodeOfLeafref();
- YangNode moduleOrSubModule = getModuleOrSubmoduleInFileOfTheCurrentNode(parentNodeOfLeafref);
- YangModule moduleNode = null;
- if (moduleOrSubModule instanceof YangModule) {
- moduleNode = (YangModule) moduleOrSubModule;
- }
- if (moduleNode != null) {
- updatePrefixWithTheImportedList(moduleNode, prefix, yangLeafRef);
- }
- }
- }
-
- /**
- * Updates the prefix with the imported list in the module.
- *
- * @param moduleNode root node of the leafref
- * @param prefixInPath prefix in the path
- * @param yangLeafRef instance YANG leafref
- */
- private static void updatePrefixWithTheImportedList(YangModule moduleNode, String prefixInPath, YangLeafRef
- yangLeafRef) {
- if (prefixInPath != null && prefixInPath != EMPTY_STRING && !prefixInPath.equals(moduleNode.getPrefix())) {
- List<YangImport> moduleImportList = moduleNode.getImportList();
- if (moduleImportList != null && !moduleImportList.isEmpty()) {
- Iterator<YangImport> yangImportIterator = moduleImportList.listIterator();
- while (yangImportIterator.hasNext()) {
- YangImport yangImport = yangImportIterator.next();
- if (yangImport.getPrefixId().equals(prefixInPath)) {
- HashMap prefixMap = new HashMap();
- prefixMap.put(prefixInPath, yangImport.getModuleName());
- yangLeafRef.setPrefixAndItsImportedModule(prefixMap);
- }
- }
- }
- } else {
- HashMap prefixMap = new HashMap();
- prefixMap.put(prefixInPath, moduleNode.getName());
- yangLeafRef.setPrefixAndItsImportedModule(prefixMap);
- }
- }
-
- /**
- * Returns module or submodule node from the current node.
- *
- * @param node current node
- * @return root node
- */
- private static YangNode getModuleOrSubmoduleInFileOfTheCurrentNode(YangNode node) {
- while (!(node instanceof YangModule) && !(node instanceof YangSubModule)) {
- if (node == null) {
- throw new ParserException("Internal datamodel error: Datamodel tree is not correct");
- }
- node = node.getParent();
- }
- return node;
- }
-
- /**
- * Validates the unique syntax from the reference path.
- *
- * @param uniquePath path of unique
- * @param prefixOfFile current file's prefix
- * @param ctx yang construct's context to get the line number and character position
- * @return list of absolute path
- */
- private static List<YangAtomicPath> validateUniqueValues(String uniquePath, String prefixOfFile,
- ParserRuleContext ctx) {
- List<YangAtomicPath> atomicPath = new LinkedList<>();
- String[] pathInUnique = uniquePath.split(SLASH_FOR_STRING);
- for (String uniqueValue : pathInUnique) {
- YangAtomicPath yangAtomicPathPath = new YangAtomicPath();
- YangNodeIdentifier nodeIdentifier = getValidNodeIdentifier(uniqueValue, YangConstructType.UNIQUE_DATA, ctx);
- yangAtomicPathPath.setNodeIdentifier(nodeIdentifier);
- atomicPath.add(yangAtomicPathPath);
- if (nodeIdentifier.getPrefix() != null && nodeIdentifier.getPrefix() != prefixOfFile) {
- ParserException parserException = new ParserException("YANG file error : A leaf reference, in unique," +
- " must refer to a leaf in the list");
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
- }
- return atomicPath;
- }
-
- /**
- * Validates unique field from the list.
- *
- * @param yangList instance of YANG list
- * @param ctx yang construct's context to get the line number and character position
- */
- public static void validateUniqueInList(YangList yangList, ParserRuleContext ctx) {
- YangLeaf leaf;
- // Returns the prefix for the file where unique is present.
- String prefixOfTheFile = getPrefixInFileOfTheCurrentNode(yangList);
- List<String> uniques = yangList.getUniqueList();
- if (uniques != null && !uniques.isEmpty()) {
- Iterator<String> uniqueList = uniques.listIterator();
- while (uniqueList.hasNext()) {
- String pathInUnique = uniqueList.next();
- List<YangAtomicPath> atomicPathInUnique = validateUniqueValues(pathInUnique, prefixOfTheFile, ctx);
- YangAtomicPath leafInPath = atomicPathInUnique.get(atomicPathInUnique.size() - 1);
- if (atomicPathInUnique.size() == 1) {
- leaf = getReferenceLeafFromUnique(yangList, leafInPath);
- } else {
- atomicPathInUnique.remove(atomicPathInUnique.size() - 1);
- YangNode holderOfLeaf = getNodeUnderListFromPath(atomicPathInUnique, yangList, ctx);
- leaf = getReferenceLeafFromUnique(holderOfLeaf, leafInPath);
- }
- if (leaf == null) {
- ParserException parserException = new ParserException("YANG file error : A leaf reference, in " +
- "unique," +
- " must refer to a leaf under the list");
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
- }
- }
- }
-
- /**
- * Returns the last node under the unique path.
- *
- * @param uniquePath atomic path list
- * @param node root node from where it starts searching
- * @param ctx yang construct's context to get the line number and character position
- * @return last node in the list
- */
- private static YangNode getNodeUnderListFromPath(List<YangAtomicPath> uniquePath, YangNode node,
- ParserRuleContext ctx) {
- Iterator<YangAtomicPath> nodesInReference = uniquePath.listIterator();
- YangNode potentialReferredNode = node.getChild();
- while (nodesInReference.hasNext()) {
- YangAtomicPath nodeInUnique = nodesInReference.next();
- YangNode referredNode = getReferredNodeFromTheUniqueNodes(nodeInUnique.getNodeIdentifier(),
- potentialReferredNode);
- if (referredNode == null) {
- ParserException parserException = new ParserException("YANG file error : The target node in unique " +
- "reference path is invalid");
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- } else {
- potentialReferredNode = referredNode.getChild();
- }
- }
- return potentialReferredNode;
- }
-
- /**
- * Returns the node that matches with the name of the node in path.
- *
- * @param nodeInUnique node name in path
- * @param potentialReferredNode node under which it has to match
- * @return referred node
- */
- private static YangNode getReferredNodeFromTheUniqueNodes(YangNodeIdentifier nodeInUnique, YangNode
- potentialReferredNode) {
- while (potentialReferredNode != null) {
- // Check if the potential referred node is the actual referred node
- if (potentialReferredNode.getName().equals(nodeInUnique.getName())) {
- return potentialReferredNode;
- }
- potentialReferredNode = potentialReferredNode.getNextSibling();
- }
- return null;
- }
-
- /**
- * Returns the leaf which unique refers.
- *
- * @param nodeForLeaf last node where leaf is referred
- * @param leafInUnique leaf in unique path
- * @return YANG leaf
- */
- private static YangLeaf getReferenceLeafFromUnique(YangNode nodeForLeaf, YangAtomicPath leafInUnique) {
- YangLeavesHolder leavesHolder = (YangLeavesHolder) nodeForLeaf;
- List<YangLeaf> leaves = leavesHolder.getListOfLeaf();
- if (leaves != null && !leaves.isEmpty()) {
- for (YangLeaf leaf : leaves) {
- if (leafInUnique.getNodeIdentifier().getName().equals(leaf.getName())) {
- return leaf;
- }
- }
- }
- return null;
- }
-
- /**
- * Returns the prefix of the current file.
- *
- * @param node node where it needs to find the root node
- * @return prefix of root node
- */
- public static String getPrefixInFileOfTheCurrentNode(YangNode node) {
- String prefixInFile;
- while (!(node instanceof YangReferenceResolver)) {
- node = node.getParent();
- if (node == null) {
- throw new ParserException("Internal datamodel error: Datamodel tree is not correct");
- }
- }
- if (node instanceof YangModule) {
- YangModule yangModule = (YangModule) node;
- prefixInFile = yangModule.getPrefix();
- } else {
- YangSubModule yangSubModule = (YangSubModule) node;
- prefixInFile = yangSubModule.getPrefix();
- }
- return prefixInFile;
- }
-
- /**
- * Validates the relative path.
- *
- * @param completePathString the path string of relative path
- * @param yangConstruct yang construct for creating error message
- * @param ctx yang construct's context to get the line number and character position
- * @param yangLeafRef instance of leafref where the path argument has to be set
- */
- private static void validateRelativePath(String completePathString, YangConstructType yangConstruct,
- ParserRuleContext ctx, YangLeafRef yangLeafRef) {
-
- YangRelativePath relativePath = new YangRelativePath();
- int numberOfAncestors = 0;
- while (completePathString.startsWith(ANCESTOR_ACCESSOR_IN_PATH)) {
- completePathString = completePathString.replaceFirst(ANCESTOR_ACCESSOR_IN_PATH, EMPTY_STRING);
- numberOfAncestors = numberOfAncestors + 1;
- }
- if (completePathString == null || completePathString.length() == 0) {
- ParserException parserException = new ParserException("YANG file error : "
- + YangConstructType.getYangConstructType(yangConstruct) + yangLeafRef.getPath() +
- " does not follow valid path syntax");
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
- relativePath.setAncestorNodeCount(numberOfAncestors);
- List<YangAtomicPath> atomicPath = validateAbsolutePath(SLASH_FOR_STRING + completePathString,
- yangConstruct,
- ctx, yangLeafRef);
- validatePrefixAndYangNode(atomicPath, yangLeafRef);
- relativePath.setAtomicPathList(atomicPath);
- yangLeafRef.setRelativePath(relativePath);
- }
-
- /**
- * Validates the absolute path.
- *
- * @param completePathString the path string of absolute path
- * @param yangConstruct yang construct for creating error message
- * @param ctx yang construct's context to get the line number and character position
- * @param yangLeafRef instance of leafref where the path argument has to be set
- * @return list of object of node in absolute path
- */
- private static List<YangAtomicPath> validateAbsolutePath(String completePathString,
- YangConstructType yangConstruct, ParserRuleContext
- ctx, YangLeafRef yangLeafRef) {
-
- List<YangAtomicPath> absolutePathList = new LinkedList<>();
- YangPathPredicate yangPathPredicate = new YangPathPredicate();
- YangNodeIdentifier yangNodeIdentifier;
-
- while (completePathString != null) {
- String path = completePathString.replaceFirst(SLASH_FOR_STRING, EMPTY_STRING);
- if (path == null || path.length() == 0) {
- ParserException parserException = new ParserException("YANG file error : "
- + YangConstructType.getYangConstructType(yangConstruct) + " " + yangLeafRef.getPath() +
- " does not follow valid path syntax");
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
- String matchedPathPredicate;
- String nodeIdentifier;
- String[] differentiate = new String[2];
- int forNodeIdentifier = path.indexOf(CHAR_OF_SLASH);
- int forPathPredicate = path.indexOf(CHAR_OF_OPEN_SQUARE_BRACKET);
-
- // Checks if path predicate is present for the node.
- if ((forPathPredicate < forNodeIdentifier) && (forPathPredicate != -1)) {
- List<String> pathPredicate = new ArrayList<>();
- matchedPathPredicate = matchForPathPredicate(path);
-
- if (matchedPathPredicate == null || matchedPathPredicate.length() == 0) {
- ParserException parserException = new ParserException("YANG file error : "
- + YangConstructType.getYangConstructType(yangConstruct) + " " + yangLeafRef.getPath() +
- " does not follow valid path syntax");
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
- int indexOfMatchedFirstOpenBrace = path.indexOf(CHAR_OF_OPEN_SQUARE_BRACKET);
- differentiate[0] = path.substring(0, indexOfMatchedFirstOpenBrace);
- differentiate[1] = path.substring(indexOfMatchedFirstOpenBrace);
- pathPredicate.add(matchedPathPredicate);
- nodeIdentifier = differentiate[0];
- // Starts adding all path predicates of a node into the list.
- if (!differentiate[1].isEmpty()) {
- while (differentiate[1].startsWith(OPEN_SQUARE_BRACKET)) {
- matchedPathPredicate = matchForPathPredicate(differentiate[1]);
- if (matchedPathPredicate == null || matchedPathPredicate.length() == 0) {
- ParserException parserException = new ParserException(
- "YANG file error : " + YangConstructType.getYangConstructType(yangConstruct) + " "
- + yangLeafRef.getPath() +
- " does not follow valid path syntax");
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
- pathPredicate.add(matchedPathPredicate);
- differentiate[1] = differentiate[1].substring(matchedPathPredicate.length());
- }
- }
-
- List<YangPathPredicate> pathPredicateList = validatePathPredicate(pathPredicate, yangConstruct, ctx,
- yangPathPredicate, yangLeafRef);
- YangAtomicPath atomicPath = new YangAtomicPath();
- yangNodeIdentifier = getValidNodeIdentifierForLeafref(nodeIdentifier, yangConstruct, ctx, yangLeafRef);
- atomicPath.setNodeIdentifier(yangNodeIdentifier);
- atomicPath.setPathPredicatesList(pathPredicateList);
- absolutePathList.add(atomicPath);
- } else {
- if (path.contains(SLASH_FOR_STRING)) {
- nodeIdentifier = path.substring(0, path.indexOf(CHAR_OF_SLASH));
- differentiate[1] = path.substring(path.indexOf(CHAR_OF_SLASH));
- } else {
- nodeIdentifier = path;
- differentiate[1] = null;
- }
- yangNodeIdentifier = getValidNodeIdentifierForLeafref(nodeIdentifier, yangConstruct, ctx, yangLeafRef);
-
- YangAtomicPath atomicPath = new YangAtomicPath();
- atomicPath.setNodeIdentifier(yangNodeIdentifier);
- atomicPath.setPathPredicatesList(null);
- absolutePathList.add(atomicPath);
- }
- if (differentiate[1] == null || differentiate[1].length() == 0) {
- completePathString = null;
- } else {
- completePathString = differentiate[1];
- }
- }
- return absolutePathList;
- }
-
- /**
- * Validates path predicate in the absolute path's node.
- *
- * @param pathPredicate list of path predicates in the node of absolute path
- * @param yangConstruct yang construct for creating error message
- * @param ctx yang construct's context to get the line number and character position
- * @param yangPathPredicate instance of path predicate where it has to be set
- * @param yangLeafRef instance of leafref where the path argument has to be set
- * @return list of object of path predicates in absolute path's node
- */
- private static List<YangPathPredicate> validatePathPredicate(List<String> pathPredicate,
- YangConstructType yangConstruct, ParserRuleContext
- ctx, YangPathPredicate yangPathPredicate,
- YangLeafRef yangLeafRef) {
-
- Iterator<String> pathPredicateString = pathPredicate.iterator();
- List<String> pathEqualityExpression = new ArrayList<>();
-
- while (pathPredicateString.hasNext()) {
- String pathPredicateForNode = pathPredicateString.next();
- pathPredicateForNode = (pathPredicateForNode.substring(1)).trim();
- pathPredicateForNode = pathPredicateForNode.substring(0,
- pathPredicateForNode.indexOf(CHAR_OF_CLOSE_SQUARE_BRACKET));
- pathEqualityExpression.add(pathPredicateForNode);
- }
- List<YangPathPredicate> validatedPathPredicateList = validatePathEqualityExpression(pathEqualityExpression,
- yangConstruct, ctx, yangPathPredicate, yangLeafRef);
- return validatedPathPredicateList;
- }
-
- /**
- * Validates the path equality expression.
- *
- * @param pathEqualityExpression list of path equality expression in the path predicates of the node
- * @param yangConstruct yang construct for creating error message
- * @param ctx yang construct's context to get the line number and character position
- * @param yangPathPredicate instance of path predicate where it has to be set
- * @param yangLeafRef instance of leafref where the path argument has to be set
- * @return list of object of path predicates in absolute path's node
- */
- private static List<YangPathPredicate> validatePathEqualityExpression(List<String> pathEqualityExpression,
- YangConstructType yangConstruct,
- ParserRuleContext ctx, YangPathPredicate
- yangPathPredicate,
- YangLeafRef yangLeafRef) {
-
- Iterator<String> pathEqualityExpressionString = pathEqualityExpression.iterator();
- List<YangPathPredicate> yangPathPredicateList = new ArrayList<>();
-
- while (pathEqualityExpressionString.hasNext()) {
- String pathEqualityExpressionForNode = pathEqualityExpressionString.next();
- String[] pathEqualityExpressionArray = pathEqualityExpressionForNode.split("[=]");
-
- YangNodeIdentifier yangNodeIdentifierForPredicate;
- YangRelativePath yangRelativePath;
- yangNodeIdentifierForPredicate = getValidNodeIdentifierForLeafref(pathEqualityExpressionArray[0].trim(),
- yangConstruct, ctx, yangLeafRef);
- yangRelativePath = validatePathKeyExpression(pathEqualityExpressionArray[1].trim(), yangConstruct, ctx,
- yangLeafRef);
- yangPathPredicate.setNodeIdentifier(yangNodeIdentifierForPredicate);
- yangPathPredicate.setPathOperator(EQUALTO);
- yangPathPredicate.setRightRelativePath(yangRelativePath);
- yangPathPredicateList.add(yangPathPredicate);
- }
- return yangPathPredicateList;
- }
-
- /**
- * Validate the path key expression.
- *
- * @param rightRelativePath relative path in the path predicate
- * @param yangConstruct yang construct for creating error message
- * @param ctx yang construct's context to get the line number and character position
- * @param yangLeafRef instance of leafref where the path argument has to be set
- * @return object of right relative path in path predicate
- */
- private static YangRelativePath validatePathKeyExpression(String rightRelativePath,
- YangConstructType yangConstruct, ParserRuleContext ctx,
- YangLeafRef yangLeafRef) {
-
- YangRelativePath yangRelativePath = new YangRelativePath();
- String[] relativePath = rightRelativePath.split(SLASH_FOR_STRING);
- List<String> rightAbsolutePath = new ArrayList<>();
- int accessAncestor = 0;
- for (String path : relativePath) {
- if (path.trim().equals(ANCESTOR_ACCESSOR)) {
- accessAncestor = accessAncestor + 1;
- } else {
- rightAbsolutePath.add(path);
- }
- }
- List<YangAtomicPath> atomicPathInRelativePath = validateRelativePathKeyExpression(rightAbsolutePath,
- yangConstruct, ctx, yangLeafRef);
- yangRelativePath.setAtomicPathList(atomicPathInRelativePath);
- yangRelativePath.setAncestorNodeCount(accessAncestor);
- return yangRelativePath;
- }
-
- /**
- * Validates the relative path key expression.
- *
- * @param rightAbsolutePath absolute path nodes present in the relative path
- * @param yangConstruct yang construct for creating error message
- * @param ctx yang construct's context to get the line number and character position
- * @param yangLeafRef instance of leafref where the path argument has to be set
- * @return list of object of absolute path nodes present in the relative path
- */
- private static List<YangAtomicPath> validateRelativePathKeyExpression(List<String> rightAbsolutePath,
- YangConstructType yangConstruct,
- ParserRuleContext ctx, YangLeafRef
- yangLeafRef) {
-
- List<YangAtomicPath> atomicPathList = new ArrayList<>();
- YangNodeIdentifier yangNodeIdentifier;
-
- Iterator<String> nodes = rightAbsolutePath.iterator();
- String currentInvocationFunction = nodes.next();
- currentInvocationFunction = currentInvocationFunction.trim();
- String[] currentFunction = currentInvocationFunction.split("[(]");
-
- if (!(currentFunction[0].trim().equals(CURRENT)) || !(currentFunction[1].trim().equals(CLOSE_PARENTHESIS))) {
- ParserException parserException = new ParserException("YANG file error : "
- + YangConstructType.getYangConstructType(yangConstruct) + " " + yangLeafRef.getPath() +
- " does not follow valid path syntax");
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
-
- while (nodes.hasNext()) {
- YangAtomicPath atomicPath = new YangAtomicPath();
- String node = nodes.next();
- yangNodeIdentifier = getValidNodeIdentifierForLeafref(node.trim(), yangConstruct, ctx, yangLeafRef);
- atomicPath.setNodeIdentifier(yangNodeIdentifier);
- atomicPathList.add(atomicPath);
- }
- return atomicPathList;
- }
-
- /**
- * Validates the match for first path predicate in a given string.
- *
- * @param matchRequiredString string for which match has to be done
- * @return the matched string
- */
- private static String matchForPathPredicate(String matchRequiredString) {
-
- String matchedString = null;
- java.util.regex.Matcher matcher = PATH_PREDICATE_PATTERN.matcher(matchRequiredString);
- if (matcher.find()) {
- matchedString = matcher.group(0);
- }
- return matchedString;
- }
-
- /**
- * Checks and return valid absolute schema node id.
- *
- * @param argumentString string from yang file
- * @param yangConstructType yang construct for creating error message
- * @param ctx yang construct's context to get the line number and character position
- * @return target nodes list of absolute schema node id
- */
- public static List<YangAtomicPath> getValidAbsoluteSchemaNodeId(String argumentString,
- YangConstructType yangConstructType,
- ParserRuleContext ctx) {
-
- List<YangAtomicPath> targetNodes = new ArrayList<>();
- YangNodeIdentifier yangNodeIdentifier;
- String tmpSchemaNodeId = removeQuotesAndHandleConcat(argumentString);
-
- // absolute-schema-nodeid = 1*("/" node-identifier)
- if (!tmpSchemaNodeId.startsWith(SLASH)) {
- ParserException parserException = new ParserException("YANG file error : " +
- YangConstructType.getYangConstructType(yangConstructType) + " name " + argumentString +
- "is not valid");
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
- String[] tmpData = tmpSchemaNodeId.replaceFirst(CARET + SLASH, EMPTY_STRING).split(SLASH);
- for (String nodeIdentifiers : tmpData) {
- yangNodeIdentifier = getValidNodeIdentifier(nodeIdentifiers, yangConstructType, ctx);
- YangAtomicPath yangAbsPath = new YangAtomicPath();
- yangAbsPath.setNodeIdentifier(yangNodeIdentifier);
- targetNodes.add(yangAbsPath);
- }
- return targetNodes;
- }
-
- /**
- * Throws parser exception for unsupported YANG constructs.
- *
- * @param yangConstructType yang construct for creating error message
- * @param ctx yang construct's context to get the line number and character position
- * @param errorInfo error information
- */
- public static void handleUnsupportedYangConstruct(YangConstructType yangConstructType,
- ParserRuleContext ctx, String errorInfo) {
- ParserException parserException = new ParserException(YANG_FILE_ERROR
- + QUOTES + YangConstructType.getYangConstructType(yangConstructType) + QUOTES
- + errorInfo);
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
-
- /**
- * Returns date and makes it in usable format for revision.
- *
- * @param dateInString date argument string from yang file
- * @param ctx yang construct's context to get the line number and character position
- * @return date format for revision
- */
- public static Date getValidDateFromString(String dateInString, ParserRuleContext ctx) {
- String dateArgument = removeQuotesAndHandleConcat(dateInString);
- if (dateArgument == null || !dateArgument.matches(DATE_PATTERN)) {
- ParserException parserException = new ParserException("YANG file error: Input date is not correct");
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
-
- SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
- sdf.setLenient(false);
-
- try {
- //if not valid, it will throw ParseException
- Date date = sdf.parse(dateArgument);
- return date;
- } catch (ParseException e) {
- ParserException parserException = new ParserException("YANG file error: Input date is not correct");
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
- }
-
- /**
- * Checks and return valid prefix.
- *
- * @param inputString string from yang file
- * @param yangConstruct yang construct for creating error message
- * @param ctx yang construct's context to get the line number and character position
- * @return valid prefix
- */
- public static String getValidPrefix(String inputString,
- YangConstructType yangConstruct, ParserRuleContext ctx) {
- String tmpPrefixString = removeQuotesAndHandleConcat(inputString);
- String[] tmpData = tmpPrefixString.split(Pattern.quote(COLON));
- if (tmpData.length == 2) {
- return tmpData[0];
- } else {
- ParserException parserException = new ParserException("YANG file error : " +
- YangConstructType.getYangConstructType(yangConstruct) + " name " + inputString +
- " is not valid.");
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerValidation.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerValidation.java
deleted file mode 100644
index 188e24e..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerValidation.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * 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.parser.impl.parserutils;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.antlr.v4.runtime.ParserRuleContext;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.utils.Parsable;
-import org.onosproject.yangutils.datamodel.utils.YangConstructType;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.getYangConstructType;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
-
-/**
- * Represents a utility to carry out listener validation.
- */
-public final class ListenerValidation {
-
- /**
- * Creates a new listener validation.
- */
- private ListenerValidation() {
- }
-
- /**
- * Checks parsed data stack is not empty.
- *
- * @param listener Listener's object
- * @param errorType error type needs to be set in error message
- * @param yangConstructType type of parsable data in which error occurred
- * @param parsableDataTypeName name of parsable data type in which error
- * occurred
- * @param errorLocation location where error occurred
- */
- public static void checkStackIsNotEmpty(TreeWalkListener listener, ListenerErrorType errorType,
- YangConstructType yangConstructType, String parsableDataTypeName,
- ListenerErrorLocation errorLocation) {
-
- if (listener.getParsedDataStack().empty()) {
- /*
- * If stack is empty it indicates error condition, value of
- * parsableDataTypeName will be null in case there is no name
- * attached to parsable data type.
- */
- String message = constructListenerErrorMessage(errorType, yangConstructType, parsableDataTypeName,
- errorLocation);
- throw new ParserException(message);
- }
- }
-
- /**
- * Checks parsed data stack is empty.
- *
- * @param listener Listener's object
- * @param errorType error type needs to be set in error message
- * @param yangConstructType type of parsable data in which error occurred
- * @param parsableDataTypeName name of parsable data type in which error
- * occurred
- * @param errorLocation location where error occurred
- */
- public static void checkStackIsEmpty(TreeWalkListener listener, ListenerErrorType errorType,
- YangConstructType yangConstructType, String parsableDataTypeName,
- ListenerErrorLocation errorLocation) {
-
- if (!listener.getParsedDataStack().empty()) {
- /*
- * If stack is empty it indicates error condition, value of
- * parsableDataTypeName will be null in case there is no name
- * attached to parsable data type.
- */
- String message = constructListenerErrorMessage(errorType, yangConstructType, parsableDataTypeName,
- errorLocation);
- throw new ParserException(message);
- }
- }
-
- /**
- * Returns parent node config value, if top node does not specify a config
- * statement then default value true is returned.
- *
- * @param listener listener's object
- * @return true/false parent's config value
- */
- public static boolean getParentNodeConfig(TreeWalkListener listener) {
-
- YangNode parentNode;
- Parsable curData = listener.getParsedDataStack().peek();
- if (curData instanceof YangNode) {
- parentNode = ((YangNode) curData).getParent();
- if (parentNode instanceof YangContainer) {
- return ((YangContainer) parentNode).isConfig();
- } else if (parentNode instanceof YangList) {
- return ((YangList) parentNode).isConfig();
- }
- }
- return true;
- }
-
- /**
- * Checks if a rule occurrences is as per the expected YANG grammar's
- * cardinality.
- *
- * @param childContext child's context
- * @param yangChildConstruct child construct for whom cardinality is to be
- * validated
- * @param yangParentConstruct parent construct
- * @param parentName parent name
- * @throws ParserException exception if cardinality check fails
- */
- public static void validateCardinalityMaxOne(List<?> childContext, YangConstructType yangChildConstruct,
- YangConstructType yangParentConstruct, String parentName)
- throws ParserException {
-
- if (!childContext.isEmpty() && childContext.size() != 1) {
- ParserException parserException = new ParserException("YANG file error: \""
- + getYangConstructType(yangChildConstruct) + "\" is defined more than once in \""
- + getYangConstructType(yangParentConstruct) + " " + parentName + "\".");
-
- Iterator<?> context = childContext.iterator();
- parserException.setLine(((ParserRuleContext) context.next()).getStart().getLine());
- parserException.setCharPosition(((ParserRuleContext) context.next()).getStart().getCharPositionInLine());
- throw parserException;
- }
- }
-
- /**
- * Checks if a rule occurrences is exactly 1.
- *
- * @param childContext child's context
- * @param yangChildConstruct child construct for whom cardinality is to be
- * validated
- * @param yangParentConstruct parent construct
- * @param parentName parent name
- * @param parentContext parents's context
- * @throws ParserException exception if cardinality check fails
- */
- public static void validateCardinalityEqualsOne(List<?> childContext, YangConstructType yangChildConstruct,
- YangConstructType yangParentConstruct, String parentName,
- ParserRuleContext parentContext)
- throws ParserException {
-
- if (childContext.isEmpty()) {
- ParserException parserException = new ParserException("YANG file error: Missing \""
- + getYangConstructType(yangChildConstruct) + "\" in \"" + getYangConstructType(yangParentConstruct)
- + " " + parentName + "\".");
- parserException.setLine(parentContext.getStart().getLine());
- parserException.setCharPosition(parentContext.getStart().getCharPositionInLine());
- throw parserException;
- } else if (!childContext.isEmpty() && childContext.size() != 1) {
- Iterator<?> childcontext = childContext.iterator();
- ParserException parserException = new ParserException("YANG file error: \""
- + getYangConstructType(yangChildConstruct) + "\" is present more than once in \""
- + getYangConstructType(yangParentConstruct) + " " + parentName + "\".");
- parserException.setLine(((ParserRuleContext) childcontext.next()).getStart().getLine());
- parserException.setCharPosition(((ParserRuleContext) childcontext.next()).getStart()
- .getCharPositionInLine());
- throw parserException;
- }
- }
-
- /**
- * Checks if a rule occurrences is minimum 1.
- *
- * @param childContext child's context
- * @param yangChildConstruct child construct for whom cardinality is to be
- * validated
- * @param yangParentConstruct parent construct
- * @param parentName parent name
- * @param parentContext parents's context
- * @throws ParserException exception if cardinality check fails
- */
- public static void validateCardinalityNonZero(List<?> childContext, YangConstructType yangChildConstruct,
- YangConstructType yangParentConstruct, String parentName,
- ParserRuleContext parentContext)
- throws ParserException {
-
- if (childContext.isEmpty()) {
- ParserException parserException = new ParserException("YANG file error: Missing \""
- + getYangConstructType(yangChildConstruct) + "\" in \"" + getYangConstructType(yangParentConstruct)
- + " " + parentName + "\".");
-
- parserException.setLine(parentContext.getStart().getLine());
- parserException.setCharPosition(parentContext.getStart().getCharPositionInLine());
- throw parserException;
- }
- }
-
- /**
- * Checks if a either of one construct occurrence.
- *
- * @param child1Context first optional child's context
- * @param yangChild1Construct first child construct for whom cardinality is
- * to be validated
- * @param child2Context second optional child's context
- * @param yangChild2Construct second child construct for whom cardinality is
- * to be validated
- * @param yangParentConstruct parent construct
- * @param parentName parent name
- * @param parentContext parents's context
- * @throws ParserException exception if cardinality check fails
- */
- public static void validateCardinalityEitherOne(List<?> child1Context, YangConstructType yangChild1Construct,
- List<?> child2Context, YangConstructType yangChild2Construct,
- YangConstructType yangParentConstruct, String parentName,
- ParserRuleContext parentContext)
- throws ParserException {
-
- if (child1Context.isEmpty() && child2Context.isEmpty()) {
- ParserException parserException = new ParserException("YANG file error: Either \""
- + getYangConstructType(yangChild1Construct) + "\" or \"" + getYangConstructType(yangChild2Construct)
- + "\" should be present in \"" + getYangConstructType(yangParentConstruct) + " "
- + parentName + "\".");
- parserException.setLine(parentContext.getStart().getLine());
- parserException.setCharPosition(parentContext.getStart().getCharPositionInLine());
- throw parserException;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ParseTreeErrorListener.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ParseTreeErrorListener.java
deleted file mode 100644
index af81d6f..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ParseTreeErrorListener.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.parser.impl.parserutils;
-
-import org.antlr.v4.runtime.BaseErrorListener;
-import org.antlr.v4.runtime.RecognitionException;
-import org.antlr.v4.runtime.Recognizer;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-
-/**
- * Represent the parse tree error listener.
- * By default, ANTLR sends all errors to standard error, this is changed by
- * providing this new implementation of interface ANTLRErrorListener. The
- * interface has a syntaxError() method that applies to both lexer and parser.
- */
-public class ParseTreeErrorListener extends BaseErrorListener {
-
- @Override
- public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine,
- String msg, RecognitionException e) {
-
- ParserException parserException = new ParserException(msg);
- parserException.setLine(line);
- parserException.setCharPosition(charPositionInLine);
- throw parserException;
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/package-info.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/package-info.java
deleted file mode 100644
index 9eafb00..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Provide common utils for parser implementation.
- */
-package org.onosproject.yangutils.parser.impl.parserutils;
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/package-info.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/package-info.java
deleted file mode 100644
index f039e68..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/parser/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Interfaces to process YANG information from ANTLR generated listeners.
- */
-package org.onosproject.yangutils.parser;
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/plugin/manager/YangFileInfo.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/plugin/manager/YangFileInfo.java
deleted file mode 100644
index 4eb22e5..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/plugin/manager/YangFileInfo.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * 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.plugin.manager;
-
-import java.util.Objects;
-
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.utils.ResolvableStatus;
-
-/**
- * Represents YANG file information.
- */
-class YangFileInfo {
-
- /**
- * YANG file name.
- */
- private String yangFileName;
-
- /**
- * YANG file revision.
- */
- private String revision;
-
- /**
- * Data model node after parsing YANG file.
- */
- private YangNode rootNode;
-
- /**
- * Resolution status of YANG file.
- */
- private ResolvableStatus resolvableStatus;
-
- /**
- * Location for serialized files in case of inter-jar dependencies.
- */
- private String serializedFile;
-
- /**
- * Flag to know if the root node require to be translated.
- */
- private boolean isForTranslator = true;
-
- /**
- * Returns data model node for YANG file.
- *
- * @return data model node for YANG file
- */
- public YangNode getRootNode() {
- return rootNode;
- }
-
- /**
- * Sets data model node for YANG file.
- *
- * @param rootNode of the Yang file
- */
- public void setRootNode(YangNode rootNode) {
- this.rootNode = rootNode;
- }
-
- /**
- * Returns YANG file name.
- *
- * @return yangFileName YANG file name
- */
- String getYangFileName() {
- return yangFileName;
- }
-
- /**
- * Sets YANG file name.
- *
- * @param yangFileName YANG file name
- */
- void setYangFileName(String yangFileName) {
- this.yangFileName = yangFileName;
- }
-
- /**
- * Returns the revision of YANG file.
- *
- * @return revision of YANG file
- */
- public String getRevision() {
- return revision;
- }
-
- /**
- * Sets the revision of YANG file.
- *
- * @param revision revision of YANG file
- */
- public void setRevision(String revision) {
- this.revision = revision;
- }
-
- /**
- * Returns the resolution status of YANG file.
- *
- * @return resolution status of YANG file
- */
- public ResolvableStatus getResolvableStatus() {
- return resolvableStatus;
- }
-
- /**
- * Sets the resolution status of YANG file.
- *
- * @param resolvableStatus resolution status of YANG file
- */
- public void setResolvableStatus(ResolvableStatus resolvableStatus) {
- this.resolvableStatus = resolvableStatus;
- }
-
- /**
- * Returns serialized file of datamodel.
- *
- * @return the serialized file of datamodel
- */
- public String getSerializedFile() {
- return serializedFile;
- }
-
- /**
- * Sets serialized file of datamodel.
- *
- * @param serializedFile serialized file of datamodel
- */
- public void setSerializedFile(String serializedFile) {
- this.serializedFile = serializedFile;
- }
-
- /**
- * Returns true if node need to be translated.
- *
- * @return isForTranslator true if node need to be translated
- */
- boolean isForTranslator() {
- return isForTranslator;
- }
-
- /**
- * Sets true if node need to be translated.
- *
- * @param isForTranslator true if node need to be translated
- */
- void setForTranslator(boolean isForTranslator) {
- this.isForTranslator = isForTranslator;
- }
-
- @Override
- public boolean equals(Object obj) {
-
- if (this == obj) {
- return true;
- }
- if (obj instanceof YangFileInfo) {
- final YangFileInfo other = (YangFileInfo) obj;
- return Objects.equals(yangFileName, other.yangFileName);
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(yangFileName);
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/plugin/manager/YangPluginUtils.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/plugin/manager/YangPluginUtils.java
deleted file mode 100644
index e27468b..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/plugin/manager/YangPluginUtils.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * 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.plugin.manager;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-import java.nio.file.Files;
-import java.nio.file.StandardCopyOption;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.model.Dependency;
-import org.apache.maven.model.Resource;
-import org.apache.maven.project.MavenProject;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.utils.DataModelUtils;
-import org.slf4j.Logger;
-import org.sonatype.plexus.build.incremental.BuildContext;
-
-import static org.onosproject.yangutils.utils.UtilConstants.HYPHEN;
-import static org.onosproject.yangutils.utils.UtilConstants.JAR;
-import static org.onosproject.yangutils.utils.UtilConstants.PERIOD;
-import static org.onosproject.yangutils.utils.UtilConstants.SLASH;
-import static org.onosproject.yangutils.utils.UtilConstants.TEMP;
-import static org.onosproject.yangutils.utils.UtilConstants.YANG_RESOURCES;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getPackageDirPathFromJavaJPackage;
-import static org.slf4j.LoggerFactory.getLogger;
-
-/**
- * Represents YANG plugin utilities.
- */
-final class YangPluginUtils {
-
- private static final Logger log = getLogger(YangPluginUtils.class);
-
- private static final String TARGET_RESOURCE_PATH = SLASH + TEMP + SLASH + YANG_RESOURCES + SLASH;
-
- private static final String SERIALIZED_FILE_EXTENSION = ".ser";
-
- private YangPluginUtils() {
- }
-
- /**
- * Adds generated source directory to the compilation root.
- *
- * @param source directory
- * @param project current maven project
- * @param context current build context
- */
- static void addToCompilationRoot(String source, MavenProject project, BuildContext context) {
- project.addCompileSourceRoot(source);
- context.refresh(project.getBasedir());
- log.info("Source directory added to compilation root: " + source);
- }
-
- /**
- * Copies YANG files to the current project's output directory.
- *
- * @param yangFileInfo list of YANG files
- * @param outputDir project's output directory
- * @param project maven project
- * @throws IOException when fails to copy files to destination resource directory
- */
- static void copyYangFilesToTarget(Set<YangFileInfo> yangFileInfo, String outputDir, MavenProject project)
- throws IOException {
-
- List<File> files = getListOfFile(yangFileInfo);
-
- String path = outputDir + TARGET_RESOURCE_PATH;
- File targetDir = new File(path);
- targetDir.mkdirs();
-
- for (File file : files) {
- Files.copy(file.toPath(),
- new File(path + file.getName()).toPath(),
- StandardCopyOption.REPLACE_EXISTING);
- }
- addToProjectResource(outputDir + SLASH + TEMP + SLASH, project);
- }
-
- /**
- * Provides a list of files from list of strings.
- *
- * @param yangFileInfo set of yang file information
- * @return list of files
- */
- private static List<File> getListOfFile(Set<YangFileInfo> yangFileInfo) {
- List<File> files = new ArrayList<>();
- Iterator<YangFileInfo> yangFileIterator = yangFileInfo.iterator();
- while (yangFileIterator.hasNext()) {
- YangFileInfo yangFile = yangFileIterator.next();
- if (yangFile.isForTranslator()) {
- files.add(new File(yangFile.getYangFileName()));
- }
- }
- return files;
- }
-
- /**
- * Serializes data-model.
- *
- * @param directory base directory for serialized files
- * @param fileInfoSet YANG file info set
- * @param project maven project
- * @param operation true if need to add to resource
- * @throws IOException when fails to do IO operations
- */
- static void serializeDataModel(String directory, Set<YangFileInfo> fileInfoSet,
- MavenProject project, boolean operation) throws IOException {
-
- String serFileDirPath = directory + TARGET_RESOURCE_PATH;
- File dir = new File(serFileDirPath);
- dir.mkdirs();
-
- if (operation) {
- addToProjectResource(directory + SLASH + TEMP + SLASH, project);
- }
-
- for (YangFileInfo fileInfo : fileInfoSet) {
-
- String serFileName = serFileDirPath + fileInfo.getRootNode().getName()
- + SERIALIZED_FILE_EXTENSION;
- fileInfo.setSerializedFile(serFileName);
- FileOutputStream fileOutputStream = new FileOutputStream(serFileName);
- ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);
- objectOutputStream.writeObject(fileInfo.getRootNode());
- objectOutputStream.close();
- fileOutputStream.close();
- }
- }
-
- /**
- * Returns list of jar path.
- *
- * @param project maven project
- * @param localRepository local repository
- * @param remoteRepos remote repository
- * @return list of jar paths
- */
- private static List<String> resolveDependencyJarPath(MavenProject project, ArtifactRepository localRepository,
- List<ArtifactRepository> remoteRepos) {
-
- StringBuilder path = new StringBuilder();
- List<String> jarPaths = new ArrayList<>();
- for (Object obj : project.getDependencies()) {
-
- Dependency dependency = (Dependency) obj;
- path.append(localRepository.getBasedir());
- path.append(SLASH);
- path.append(getPackageDirPathFromJavaJPackage(dependency.getGroupId()));
- path.append(SLASH);
- path.append(dependency.getArtifactId());
- path.append(SLASH);
- path.append(dependency.getVersion());
- path.append(SLASH);
- path.append(dependency.getArtifactId() + HYPHEN + dependency.getVersion() + PERIOD + JAR);
- File jarFile = new File(path.toString());
- if (jarFile.exists()) {
- jarPaths.add(path.toString());
- }
- path.delete(0, path.length());
- }
-
- for (ArtifactRepository repo : remoteRepos) {
- // TODO: add resolver for remote repo.
- }
- return jarPaths;
- }
-
- /**
- * Resolves inter jar dependencies.
- *
- * @param project current maven project
- * @param localRepository local maven repository
- * @param remoteRepos list of remote repository
- * @param directory directory for serialized files
- * @return list of resolved datamodel nodes
- * @throws IOException when fails to do IO operations
- */
- static List<YangNode> resolveInterJarDependencies(MavenProject project, ArtifactRepository localRepository,
- List<ArtifactRepository> remoteRepos, String directory)
- throws IOException {
-
- List<String> dependenciesJarPaths = resolveDependencyJarPath(project, localRepository, remoteRepos);
- List<YangNode> resolvedDataModelNodes = new ArrayList<>();
- for (String dependency : dependenciesJarPaths) {
- resolvedDataModelNodes.addAll(DataModelUtils.parseJarFile(dependency, directory));
- }
- return resolvedDataModelNodes;
- }
-
- /* Adds directory to resources of project */
- private static void addToProjectResource(String dir, MavenProject project) {
- Resource rsc = new Resource();
- rsc.setDirectory(dir);
- project.addResource(rsc);
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/plugin/manager/YangUtilManager.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/plugin/manager/YangUtilManager.java
deleted file mode 100644
index d370f01..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/plugin/manager/YangUtilManager.java
+++ /dev/null
@@ -1,401 +0,0 @@
-/*
- * 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.plugin.manager;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugins.annotations.Component;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.project.MavenProject;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangToJavaNamingConflictUtil;
-import org.onosproject.yangutils.linker.YangLinker;
-import org.onosproject.yangutils.linker.exceptions.LinkerException;
-import org.onosproject.yangutils.linker.impl.YangLinkerManager;
-import org.onosproject.yangutils.parser.YangUtilsParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
-import org.sonatype.plexus.build.incremental.BuildContext;
-
-import static org.apache.maven.plugins.annotations.LifecyclePhase.GENERATE_SOURCES;
-import static org.apache.maven.plugins.annotations.ResolutionScope.COMPILE;
-import static org.onosproject.yangutils.plugin.manager.YangPluginUtils.addToCompilationRoot;
-import static org.onosproject.yangutils.plugin.manager.YangPluginUtils.copyYangFilesToTarget;
-import static org.onosproject.yangutils.plugin.manager.YangPluginUtils.resolveInterJarDependencies;
-import static org.onosproject.yangutils.plugin.manager.YangPluginUtils.serializeDataModel;
-import static org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorUtil.generateJavaCode;
-import static org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorUtil.translatorErrorHandler;
-import static org.onosproject.yangutils.utils.UtilConstants.DEFAULT_BASE_PKG;
-import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE;
-import static org.onosproject.yangutils.utils.UtilConstants.SLASH;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getDirectory;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getPackageDirPathFromJavaJPackage;
-
-/**
- * Represents ONOS YANG utility maven plugin.
- * Goal of plugin is yang2java.
- * Execution phase is generate-sources.
- * requiresDependencyResolution at compile time.
- */
-@Mojo(name = "yang2java", defaultPhase = GENERATE_SOURCES, requiresDependencyResolution = COMPILE,
- requiresProject = true)
-public class YangUtilManager
- extends AbstractMojo {
-
- private static final String DEFAULT_PKG = SLASH + getPackageDirPathFromJavaJPackage(DEFAULT_BASE_PKG);
- private YangPluginConfig yangPlugin = new YangPluginConfig();
- private YangNode rootNode;
- // YANG file information set.
- private Set<YangFileInfo> yangFileInfoSet = new HashSet<>();
- private YangUtilsParser yangUtilsParser = new YangUtilsParserManager();
- private YangLinker yangLinker = new YangLinkerManager();
- private YangFileInfo curYangFileInfo = new YangFileInfo();
- private Set<YangNode> yangNodeSet = new HashSet<>();
- /**
- * Source directory for YANG files.
- */
- @Parameter(property = "yangFilesDir", defaultValue = "src/main/yang")
- private String yangFilesDir;
-
- /**
- * Source directory for generated files.
- */
- @Parameter(property = "classFileDir", defaultValue = "target/generated-sources")
- private String classFileDir;
-
- /**
- * Base directory for project.
- */
- @Parameter(property = "basedir", defaultValue = "${basedir}")
- private String baseDir;
-
- /**
- * Output directory.
- */
- @Parameter(property = "project.build.outputDirectory", required = true, defaultValue = "target/classes")
- private String outputDirectory;
-
- /**
- * Current maven project.
- */
- @Parameter(property = "project", required = true, readonly = true, defaultValue = "${project}")
- private MavenProject project;
-
- /**
- * Replacement required for period special character in the identifier.
- */
- @Parameter(property = "replacementForPeriod")
- private String replacementForPeriod;
-
- /**
- * Replacement required for underscore special character in the identifier.
- */
- @Parameter(property = "replacementForUnderscore")
- private String replacementForUnderscore;
-
- /**
- * Replacement required for hyphen special character in the identifier.
- */
- @Parameter(property = "replacementForHyphen")
- private String replacementForHyphen;
-
- /**
- * Prefix which is required for adding with the identifier.
- */
- @Parameter(property = "prefixForIdentifier")
- private String prefixForIdentifier;
-
- /**
- * Build context.
- */
- @Component
- private BuildContext context;
-
- /**
- * Local maven repository.
- */
- @Parameter(readonly = true, defaultValue = "${localRepository}")
- private ArtifactRepository localRepository;
-
- /**
- * Remote maven repositories.
- */
- @Parameter(readonly = true, defaultValue = "${project.remoteArtifactRepositories}")
- private List<ArtifactRepository> remoteRepository;
-
- /**
- * Code generation is for nbi or sbi.
- */
- @Parameter(property = "generateJavaFileForSbi", defaultValue = "nbi")
- private String generateJavaFileForSbi;
-
- @Override
- public void execute()
- throws MojoExecutionException, MojoFailureException {
-
- try {
-
- /*
- * For deleting the generated code in previous build.
- */
- deleteDirectory(getDirectory(baseDir, outputDirectory));
-
- String searchDir = getDirectory(baseDir, yangFilesDir);
- String codeGenDir = getDirectory(baseDir, classFileDir) + SLASH;
-
- // Creates conflict resolver and set values to it.
- YangToJavaNamingConflictUtil conflictResolver = new YangToJavaNamingConflictUtil();
- conflictResolver.setReplacementForPeriod(replacementForPeriod);
- conflictResolver.setReplacementForHyphen(replacementForHyphen);
- conflictResolver.setReplacementForUnderscore(replacementForUnderscore);
- conflictResolver.setPrefixForIdentifier(prefixForIdentifier);
- yangPlugin.setCodeGenDir(codeGenDir);
- yangPlugin.setConflictResolver(conflictResolver);
-
- yangPlugin.setCodeGenerateForsbi(generateJavaFileForSbi.toLowerCase());
- /*
- * Obtain the YANG files at a path mentioned in plugin and creates
- * YANG file information set.
- */
- createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
-
- // Check if there are any file to translate, if not return.
- if (getYangFileInfoSet() == null || getYangFileInfoSet().isEmpty()) {
- // No files to translate
- return;
- }
- // Resolve inter jar dependency.
- resolveInterJarDependency();
-
- // Carry out the parsing for all the YANG files.
- parseYangFileInfoSet();
-
- // Resolve dependencies using linker.
- resolveDependenciesUsingLinker();
-
- // Perform translation to JAVA.
- translateToJava(yangPlugin);
-
- // Serialize data model.
- serializeDataModel(getDirectory(baseDir, outputDirectory), getYangFileInfoSet(), project, true);
-
- addToCompilationRoot(codeGenDir, project, context);
-
- copyYangFilesToTarget(getYangFileInfoSet(), getDirectory(baseDir, outputDirectory), project);
- } catch (IOException | ParserException e) {
- String fileName = "";
- if (getCurYangFileInfo() != null) {
- fileName = getCurYangFileInfo().getYangFileName();
- }
- try {
- translatorErrorHandler(getRootNode(), yangPlugin);
- deleteDirectory(getDirectory(baseDir, classFileDir) + DEFAULT_PKG);
- } catch (IOException ex) {
- throw new MojoExecutionException(
- "Error handler failed to delete files for data model node.");
- }
- throw new MojoExecutionException(
- "Exception occurred due to " + e.getLocalizedMessage() + " in " + fileName
- + " YANG file.");
- }
- }
-
- /**
- * Returns the YANG node set.
- *
- * @return YANG node set
- */
- Set<YangNode> getYangNodeSet() {
- return yangNodeSet;
- }
-
- /**
- * Resolved inter-jar dependencies.
- *
- * @throws IOException when fails to do IO operations
- */
- private void resolveInterJarDependency() throws IOException {
- try {
- List<YangNode> interJarResolvedNodes = resolveInterJarDependencies(project, localRepository,
- remoteRepository, getDirectory(baseDir, outputDirectory));
- for (YangNode node : interJarResolvedNodes) {
- YangFileInfo dependentFileInfo = new YangFileInfo();
- node.setToTranslate(false);
- dependentFileInfo.setRootNode(node);
- dependentFileInfo.setForTranslator(false);
- dependentFileInfo.setYangFileName(node.getName());
- getYangFileInfoSet().add(dependentFileInfo);
- }
- } catch (IOException e) {
- throw new IOException("failed to resolve in inter-jar scenario.");
- }
- }
-
- /**
- * Links all the provided with the YANG file info set.
- *
- * @throws MojoExecutionException a violation in mojo execution
- */
- public void resolveDependenciesUsingLinker()
- throws MojoExecutionException {
- createYangNodeSet();
- try {
- yangLinker.resolveDependencies(getYangNodeSet());
- } catch (LinkerException e) {
- throw new MojoExecutionException(e.getMessage());
- }
-
- }
-
- /**
- * Creates YANG nodes set.
- */
- void createYangNodeSet() {
- for (YangFileInfo yangFileInfo : getYangFileInfoSet()) {
- getYangNodeSet().add(yangFileInfo.getRootNode());
- }
- }
-
- /**
- * Parses all the provided YANG files and generates YANG data model tree.
- *
- * @throws IOException a violation in IO
- */
- public void parseYangFileInfoSet()
- throws IOException {
- for (YangFileInfo yangFileInfo : getYangFileInfoSet()) {
- setCurYangFileInfo(yangFileInfo);
- if (yangFileInfo.isForTranslator()) {
- try {
- YangNode yangNode = yangUtilsParser.getDataModel(yangFileInfo.getYangFileName());
- yangFileInfo.setRootNode(yangNode);
- setRootNode(yangNode);
- } catch (ParserException e) {
- String logInfo = "Error in file: " + e.getFileName();
- if (e.getLineNumber() != 0) {
- logInfo = logInfo + " at line: " + e.getLineNumber() + " at position: "
- + e.getCharPositionInLine();
-
- }
- if (e.getMessage() != null) {
- logInfo = logInfo + NEW_LINE + e.getMessage();
- }
- getLog().info(logInfo);
- throw e;
- }
- }
- }
- }
-
- /**
- * Returns current root YANG node of data-model tree.
- *
- * @return current root YANG node of data-model tree
- */
- private YangNode getRootNode() {
- return rootNode;
- }
-
- /**
- * Sets current root YANG node of data-model tree.
- *
- * @param rootNode current root YANG node of data-model tree
- */
- private void setRootNode(YangNode rootNode) {
- this.rootNode = rootNode;
- }
-
- /**
- * Translates to java code corresponding to the YANG schema.
- *
- * @param yangPlugin YANG plugin config
- * @throws IOException when fails to generate java code file the current node
- */
- public void translateToJava(YangPluginConfig yangPlugin)
- throws IOException {
- List<YangNode> yangNodeSortedList = new LinkedList<>();
- yangNodeSortedList.addAll(getYangNodeSet());
- Collections.sort(yangNodeSortedList);
- for (YangNode node : yangNodeSortedList) {
- if (node.isToTranslate()) {
- generateJavaCode(node, yangPlugin);
- }
- }
- }
-
- /**
- * Creates a YANG file info set.
- *
- * @param yangFileList YANG files list
- */
- public void createYangFileInfoSet(List<String> yangFileList) {
- for (String yangFile : yangFileList) {
- YangFileInfo yangFileInfo = new YangFileInfo();
- yangFileInfo.setYangFileName(yangFile);
- getYangFileInfoSet().add(yangFileInfo);
- }
- }
-
- /**
- * Returns the YANG file info set.
- *
- * @return the YANG file info set
- */
- Set<YangFileInfo> getYangFileInfoSet() {
- return yangFileInfoSet;
- }
-
- /**
- * Sets the YANG file info set.
- *
- * @param yangFileInfoSet the YANG file info set
- */
- void setYangFileInfoSet(Set<YangFileInfo> yangFileInfoSet) {
- this.yangFileInfoSet = yangFileInfoSet;
- }
-
- /**
- * Returns current YANG file's info.
- *
- * @return the yangFileInfo
- */
- private YangFileInfo getCurYangFileInfo() {
- return curYangFileInfo;
- }
-
- /**
- * Sets current YANG file's info.
- *
- * @param yangFileInfo the yangFileInfo to set
- */
- private void setCurYangFileInfo(YangFileInfo yangFileInfo) {
- curYangFileInfo = yangFileInfo;
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/plugin/manager/package-info.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/plugin/manager/package-info.java
deleted file mode 100644
index 745e91c..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/plugin/manager/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * YANG utility maven plugin.
- */
-package org.onosproject.yangutils.plugin.manager;
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/exception/InvalidNodeForTranslatorException.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/exception/InvalidNodeForTranslatorException.java
deleted file mode 100644
index 03b0382..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/exception/InvalidNodeForTranslatorException.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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.translator.exception;
-
-/**
- * Represents custom translator exception for translator's operations.
- */
-public class InvalidNodeForTranslatorException extends RuntimeException {
-
- private static final long serialVersionUID = 20160311L;
- private String fileName;
-
- /**
- * Create a new exception.
- */
- public InvalidNodeForTranslatorException() {
- super();
- }
-
- /**
- * Creates a new exception with given message.
- *
- * @param message the detail of exception in string
- */
- public InvalidNodeForTranslatorException(String message) {
- super(message);
- }
-
- /**
- * Creates a new exception from given message and cause.
- *
- * @param message the detail of exception in string
- * @param cause underlying cause of the error
- */
- public InvalidNodeForTranslatorException(final String message, final Throwable cause) {
- super(message, cause);
- }
-
- /**
- * Creates a new exception from cause.
- *
- * @param cause underlying cause of the error
- */
- public InvalidNodeForTranslatorException(final Throwable cause) {
- super(cause);
- }
-
- /**
- * Returns generated file name for the exception.
- *
- * @return generated file name for the exception
- */
- public String getFileName() {
- return this.fileName;
- }
-
- /**
- * Sets file name in translator exception.
- *
- * @param fileName generated file name
- */
- public void setFileName(String fileName) {
- this.fileName = fileName;
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/exception/TranslatorException.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/exception/TranslatorException.java
deleted file mode 100644
index cf2c07d..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/exception/TranslatorException.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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.translator.exception;
-
-/**
- * Represents custom translator exception for translator's operations.
- */
-public class TranslatorException extends RuntimeException {
-
- private static final long serialVersionUID = 20160311L;
- private String fileName;
-
- /**
- * Create a new translator exception.
- */
- public TranslatorException() {
- super();
- }
-
- /**
- * Creates a new translator exception with given message.
- *
- * @param message the detail of exception in string
- */
- public TranslatorException(String message) {
- super(message);
- }
-
- /**
- * Creates a new translator exception from given message and cause.
- *
- * @param message the detail of exception in string
- * @param cause underlying cause of the error
- */
- public TranslatorException(final String message, final Throwable cause) {
- super(message, cause);
- }
-
- /**
- * Creates a new translator exception from cause.
- *
- * @param cause underlying cause of the error
- */
- public TranslatorException(final Throwable cause) {
- super(cause);
- }
-
- /**
- * Returns generated file name for the exception.
- *
- * @return generated file name for the exception
- */
- public String getFileName() {
- return this.fileName;
- }
-
- /**
- * Sets file name in translator exception.
- *
- * @param fileName generated file name
- */
- public void setFileName(String fileName) {
- this.fileName = fileName;
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/exception/package-info.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/exception/package-info.java
deleted file mode 100644
index b88a8a3..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/exception/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Custom exception for translator.
- */
-package org.onosproject.yangutils.translator.exception;
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/package-info.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/package-info.java
deleted file mode 100644
index 72ba2e4..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Translator to generate class definition corresponding to YANG definition.
- */
-package org.onosproject.yangutils.translator;
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/GeneratedJavaFileType.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/GeneratedJavaFileType.java
deleted file mode 100644
index d05320a..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/GeneratedJavaFileType.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * 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.translator.tojava;
-
-/**
- * Represents type of java files generated.
- */
-public final class GeneratedJavaFileType {
-
- /**
- * Interface file.
- */
- public static final int INTERFACE_MASK = 1;
-
- /**
- * Builder interface file.
- */
- public static final int BUILDER_INTERFACE_MASK = 2;
-
- /**
- * Builder class file.
- */
- public static final int BUILDER_CLASS_MASK = 4;
-
- /**
- * Impl class file.
- */
- public static final int DEFAULT_CLASS_MASK = 8;
-
- /**
- * Interface and class file.
- */
- public static final int GENERATE_INTERFACE_WITH_BUILDER = 8207;
-
- /**
- * Java interface corresponding to rpc.
- */
- public static final int GENERATE_SERVICE_AND_MANAGER = 16;
-
- /**
- * Java class corresponding to YANG enumeration.
- */
- public static final int GENERATE_ENUM_CLASS = 32;
-
- /**
- * Java class corresponding to typedef.
- */
- public static final int GENERATE_TYPEDEF_CLASS = 64;
-
- /**
- * Java class corresponding to union.
- */
- public static final int GENERATE_UNION_CLASS = 128;
-
- /**
- * Java class corresponding to typedef.
- */
- static final int GENERATE_TYPE_CLASS = GENERATE_TYPEDEF_CLASS
- | GENERATE_UNION_CLASS;
-
- /**
- * Event class.
- */
- public static final int GENERATE_EVENT_CLASS = 256;
-
- /**
- * Event listener class.
- */
- public static final int GENERATE_EVENT_LISTENER_INTERFACE = 512;
-
- /**
- * Event listener class.
- */
- public static final int GENERATE_EVENT_SUBJECT_CLASS = 1024;
-
- /**
- * Java classes for events.
- */
- public static final int GENERATE_ALL_EVENT_CLASS_MASK = GENERATE_EVENT_CLASS | GENERATE_EVENT_LISTENER_INTERFACE
- | GENERATE_EVENT_SUBJECT_CLASS;
-
- /**
- * Identity listener class.
- */
- public static final int GENERATE_IDENTITY_CLASS = 2048;
-
- /**
- * Creates an instance of generate java file type.
- */
- private GeneratedJavaFileType() {
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/GeneratedTempFileType.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/GeneratedTempFileType.java
deleted file mode 100644
index 781a6ba..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/GeneratedTempFileType.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * 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.translator.tojava;
-
-/**
- * Represents type of temporary files generated.
- */
-public final class GeneratedTempFileType {
-
- /**
- * Attributes definition temporary file.
- */
- public static final int ATTRIBUTES_MASK = 1;
-
- /**
- * Getter methods for interface.
- */
- public static final int GETTER_FOR_INTERFACE_MASK = 2;
-
- /**
- * Getter methods for class.
- */
- public static final int GETTER_FOR_CLASS_MASK = 4;
-
- /**
- * Setter methods for interface.
- */
- public static final int SETTER_FOR_INTERFACE_MASK = 8;
-
- /**
- * Setter methods for class.
- */
- public static final int SETTER_FOR_CLASS_MASK = 16;
-
- /**
- * Constructor method of class.
- */
- public static final int CONSTRUCTOR_IMPL_MASK = 32;
-
- /**
- * Hash code implementation of class.
- */
- public static final int HASH_CODE_IMPL_MASK = 64;
-
- /**
- * Equals implementation of class.
- */
- public static final int EQUALS_IMPL_MASK = 128;
-
- /**
- * To string implementation of class.
- */
- public static final int TO_STRING_IMPL_MASK = 256;
-
- /**
- * Of string implementation of class.
- */
- public static final int OF_STRING_IMPL_MASK = 512;
-
- /**
- * Constructor for type class like typedef, union.
- */
- public static final int CONSTRUCTOR_FOR_TYPE_MASK = 1024;
-
- /**
- * From string implementation of class.
- */
- public static final int FROM_STRING_IMPL_MASK = 2048;
-
- /**
- * Enum implementation of class.
- */
- public static final int ENUM_IMPL_MASK = 4096;
-
- /**
- * Rpc interface of module / sub module.
- */
- public static final int RPC_INTERFACE_MASK = 8192;
-
- /**
- * Rpc implementation of module / sub module.
- */
- public static final int RPC_IMPL_MASK = 16384;
-
- /**
- * Event enum implementation of class.
- */
- public static final int EVENT_ENUM_MASK = 32768;
-
- /**
- * Event method implementation of class.
- */
- public static final int EVENT_METHOD_MASK = 65536;
-
- /**
- * Event subject attribute implementation of class.
- */
- public static final int EVENT_SUBJECT_ATTRIBUTE_MASK = 131072;
-
- /**
- * Event subject getter implementation of class.
- */
- public static final int EVENT_SUBJECT_GETTER_MASK = 262144;
-
- /**
- * Event subject setter implementation of class.
- */
- public static final int EVENT_SUBJECT_SETTER_MASK = 524288;
-
- /**
- * Add to list method interface for class.
- */
- public static final int ADD_TO_LIST_INTERFACE_MASK = 1048576;
-
- /**
- * Add to list method implementation for class.
- */
- public static final int ADD_TO_LIST_IMPL_MASK = 2097152;
-
- /**
- * Leaf identifier enum attributes for class.
- */
- public static final int LEAF_IDENTIFIER_ENUM_ATTRIBUTES_MASK = 4194304;
-
- /**
- * Creates an instance of generated temp file type.
- */
- private GeneratedTempFileType() {
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaAttributeInfo.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaAttributeInfo.java
deleted file mode 100644
index 254ea4a..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaAttributeInfo.java
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * 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.translator.tojava;
-
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-
-import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGeneratorUtils.isTypeLeafref;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGeneratorUtils.isTypeNameLeafref;
-
-/**
- * Represents the attribute info corresponding to class/interface generated.
- */
-public final class JavaAttributeInfo {
-
- /**
- * The data type info of attribute.
- */
- private YangType<?> attrType;
-
- /**
- * Name of the attribute.
- */
- private String name;
-
- /**
- * If the added attribute is a list of info.
- */
- private boolean isListAttr;
-
- /**
- * If the added attribute has to be accessed in a fully qualified manner.
- */
- private boolean isQualifiedName;
-
- /**
- * The class info will be used to set the attribute type and package info
- * will be use for qualified name.
- */
- private JavaQualifiedTypeInfoTranslator importInfo;
-
- /**
- * If conflict occurs.
- */
- private boolean isIntConflict;
-
- /**
- * If conflict occurs.
- */
- private boolean isLongConflict;
-
- /**
- * Creates a java attribute info object.
- */
- private JavaAttributeInfo() {
- }
-
- /**
- * Creates object of java attribute info.
- *
- * @param attrType YANG type
- * @param name attribute name
- * @param isListAttr is list attribute
- * @param isQualifiedName is qualified name
- */
- public JavaAttributeInfo(YangType<?> attrType, String name, boolean isListAttr, boolean isQualifiedName) {
- this.attrType = attrType;
- this.name = name;
- this.isListAttr = isListAttr;
- this.isQualifiedName = isQualifiedName;
- }
-
- /**
- * Returns the data type info of attribute.
- *
- * @return the data type info of attribute
- */
- public YangType<?> getAttributeType() {
- return attrType;
- }
-
- /**
- * Sets the data type info of attribute.
- *
- * @param type the data type info of attribute
- */
- public void setAttributeType(YangType<?> type) {
- attrType = type;
- }
-
- /**
- * Returns name of the attribute.
- *
- * @return name of the attribute
- */
- public String getAttributeName() {
-
- if (name == null) {
- throw new TranslatorException("Expected java attribute name is null");
- }
- return name;
- }
-
- /**
- * Sets name of the attribute.
- *
- * @param attrName name of the attribute
- */
- public void setAttributeName(String attrName) {
- name = attrName;
- }
-
- /**
- * Returns if the added attribute is a list of info.
- *
- * @return the if the added attribute is a list of info
- */
- public boolean isListAttr() {
- return isListAttr;
- }
-
- /**
- * Sets if the added attribute is a list of info.
- *
- * @param isList if the added attribute is a list of info
- */
- private void setListAttr(boolean isList) {
- isListAttr = isList;
- }
-
- /**
- * Returns if the added attribute has to be accessed in a fully qualified
- * manner.
- *
- * @return the if the added attribute has to be accessed in a fully
- * qualified manner.
- */
- public boolean isQualifiedName() {
- return isQualifiedName;
- }
-
- /**
- * Sets if the added attribute has to be accessed in a fully qualified
- * manner.
- *
- * @param isQualified if the added attribute has to be accessed in a fully
- * qualified manner
- */
- private void setIsQualifiedAccess(boolean isQualified) {
- isQualifiedName = isQualified;
- }
-
- /**
- * Returns the import info for the attribute type. It will be null, if the type
- * is basic built-in java type.
- *
- * @return import info
- */
- public JavaQualifiedTypeInfoTranslator getImportInfo() {
- return importInfo;
- }
-
- /**
- * Sets the import info for the attribute type.
- *
- * @param importInfo import info for the attribute type
- */
- public void setImportInfo(JavaQualifiedTypeInfoTranslator importInfo) {
- this.importInfo = importInfo;
- }
-
- /**
- * Returns true if conflict between int and uInt.
- *
- * @return true if conflict between int and uInt
- */
- public boolean isIntConflict() {
- return isIntConflict;
- }
-
- /**
- * Sets true if conflict between int and uInt.
- *
- * @param intConflict true if conflict between int and uInt
- */
- void setIntConflict(boolean intConflict) {
- isIntConflict = intConflict;
- }
-
- /**
- * Returns true if conflict between long and uLong.
- *
- * @return true if conflict between long and uLong
- */
- public boolean isLongConflict() {
- return isLongConflict;
- }
-
- /**
- * Sets true if conflict between long and uLong.
- *
- * @param longConflict true if conflict between long and uLong
- */
- void setLongConflict(boolean longConflict) {
- isLongConflict = longConflict;
- }
-
- /**
- * Returns java attribute info.
- *
- * @param importInfo java qualified type info
- * @param attributeName attribute name
- * @param attributeType attribute type
- * @param isQualifiedAccess is the attribute a qualified access
- * @param isListAttribute is list attribute
- * @return java attribute info.
- */
- public static JavaAttributeInfo getAttributeInfoForTheData(JavaQualifiedTypeInfoTranslator importInfo,
- String attributeName,
- YangType<?> attributeType, boolean isQualifiedAccess,
- boolean isListAttribute) {
-
- if (attributeType != null) {
- attributeType = isTypeLeafref(attributeType);
- }
- attributeName = isTypeNameLeafref(attributeName, attributeType);
- JavaAttributeInfo newAttr = new JavaAttributeInfo();
- newAttr.setImportInfo(importInfo);
- newAttr.setAttributeName(attributeName);
- newAttr.setAttributeType(attributeType);
- newAttr.setIsQualifiedAccess(isQualifiedAccess);
- newAttr.setListAttr(isListAttribute);
-
- return newAttr;
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaCodeGenerator.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaCodeGenerator.java
deleted file mode 100644
index 9993b9f..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaCodeGenerator.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.translator.tojava;
-
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-
-/**
- * Abstraction of an entity which provides Code generator functionalities.
- */
-public interface JavaCodeGenerator {
-
- /**
- * Traverse the schema of application and generate corresponding code.
- *
- * @param yangPlugin YANG plugin config
- * @throws TranslatorException when fails to translate the data model tree
- */
- void generateCodeEntry(YangPluginConfig yangPlugin)
- throws TranslatorException;
-
- /**
- * Traverse the schema of application and generate corresponding code.
- *
- * @throws TranslatorException when fails to generate java code
- */
- void generateCodeExit()
- throws TranslatorException;
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaCodeGeneratorInfo.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaCodeGeneratorInfo.java
deleted file mode 100644
index 6edd208..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaCodeGeneratorInfo.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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.translator.tojava;
-
-/**
- * Represents YANG java info containing interface for java code generator, java
- * file information, java import data and temp java code fragment files. This
- * interface serves as a generic interface and help to unify the generate code
- * entry function.
- */
-public interface JavaCodeGeneratorInfo
- extends JavaFileInfoContainer, TempJavaCodeFragmentFilesContainer {
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaCodeGeneratorUtil.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaCodeGeneratorUtil.java
deleted file mode 100644
index 77ff157..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaCodeGeneratorUtil.java
+++ /dev/null
@@ -1,406 +0,0 @@
-/*
- * 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.translator.tojava;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.onosproject.yangutils.datamodel.TraversalType;
-import org.onosproject.yangutils.datamodel.YangAugment;
-import org.onosproject.yangutils.datamodel.YangCase;
-import org.onosproject.yangutils.datamodel.YangChoice;
-import org.onosproject.yangutils.datamodel.YangInput;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangOutput;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.translator.exception.InvalidNodeForTranslatorException;
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-
-import static org.onosproject.yangutils.datamodel.TraversalType.CHILD;
-import static org.onosproject.yangutils.datamodel.TraversalType.PARENT;
-import static org.onosproject.yangutils.datamodel.TraversalType.ROOT;
-import static org.onosproject.yangutils.datamodel.TraversalType.SIBILING;
-import static org.onosproject.yangutils.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
-import static org.onosproject.yangutils.translator.tojava.YangDataModelFactory.getYangCaseNode;
-import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.getAugmentClassName;
-import static org.onosproject.yangutils.utils.UtilConstants.CASE;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.searchAndDeleteTempDir;
-
-/**
- * Representation of java code generator based on application schema.
- */
-public final class JavaCodeGeneratorUtil {
-
- /**
- * Current YANG node.
- */
- private static YangNode curNode;
-
- /**
- * Root node.
- */
- private static YangNode rootNode;
-
- /**
- * Creates a java code generator utility object.
- */
- private JavaCodeGeneratorUtil() {
- }
-
- /**
- * Returns current YANG node.
- *
- * @return current YANG node
- */
- public static YangNode getCurNode() {
- return curNode;
- }
-
- /**
- * Sets current YANG node.
- *
- * @param node current YANG node
- */
- public static void setCurNode(YangNode node) {
- curNode = node;
- }
-
- /**
- * Generates Java code files corresponding to the YANG schema.
- *
- * @param rootNode root node of the data model tree
- * @param yangPlugin YANG plugin config
- * @throws TranslatorException when fails to generate java code file the current node
- * @throws IOException when fails to do IO operations
- */
- public static void generateJavaCode(YangNode rootNode, YangPluginConfig yangPlugin)
- throws TranslatorException, IOException {
-
- YangNode codeGenNode = rootNode;
- setRootNode(rootNode);
- TraversalType curTraversal = ROOT;
-
- while (codeGenNode != null) {
- if (codeGenNode instanceof YangAugment) {
- if (((YangAugment) codeGenNode).getAugmentedNode() instanceof YangChoice) {
- addCaseNodeToChoiceTarget((YangAugment) codeGenNode);
- }
- }
- if (curTraversal != PARENT) {
- if (!(codeGenNode instanceof JavaCodeGenerator)) {
- throw new TranslatorException("Unsupported node to generate code");
- }
- setCurNode(codeGenNode);
- try {
- generateCodeEntry(codeGenNode, yangPlugin);
- } catch (InvalidNodeForTranslatorException e) {
- if (codeGenNode.getNextSibling() != null) {
- curTraversal = SIBILING;
- codeGenNode = codeGenNode.getNextSibling();
- } else {
- curTraversal = PARENT;
- codeGenNode = codeGenNode.getParent();
- }
- continue;
- } catch (Exception e) {
- close(codeGenNode, yangPlugin);
- throw new TranslatorException(e.getMessage());
- }
-
- }
- if (curTraversal != PARENT && codeGenNode.getChild() != null) {
- curTraversal = CHILD;
- codeGenNode = codeGenNode.getChild();
- } else if (codeGenNode.getNextSibling() != null) {
- try {
- generateCodeExit(codeGenNode, yangPlugin);
- } catch (Exception e) {
- close(codeGenNode, yangPlugin);
- throw new TranslatorException(e.getMessage());
- }
- curTraversal = SIBILING;
- codeGenNode = codeGenNode.getNextSibling();
- } else {
- try {
- generateCodeExit(codeGenNode, yangPlugin);
- } catch (Exception e) {
- close(codeGenNode, yangPlugin);
- throw new TranslatorException(e.getMessage());
- }
- curTraversal = PARENT;
- codeGenNode = codeGenNode.getParent();
- }
- }
- }
-
- /**
- * Generates the current nodes code snippet.
- *
- * @param codeGenNode current data model node for which the code needs to be generated
- * @param yangPlugin YANG plugin config
- * @throws TranslatorException when fails to generate java code file the current node
- * @throws IOException when fails to do IO operations
- */
- private static void generateCodeEntry(YangNode codeGenNode, YangPluginConfig yangPlugin)
- throws TranslatorException, IOException {
-
- if (codeGenNode instanceof JavaCodeGenerator) {
- ((JavaCodeGenerator) codeGenNode).generateCodeEntry(yangPlugin);
- } else {
- close(codeGenNode, yangPlugin);
- throw new TranslatorException(
- "Generated data model node cannot be translated to target language code");
- }
- }
-
- /**
- * Generates the current nodes code target code from the snippet.
- *
- * @param codeGenNode current data model node for which the code needs to be generated
- * @param pluginConfig plugin configurations
- * @throws TranslatorException when fails to generate java code file the current node
- * @throws IOException when fails to do IO operations
- */
- private static void generateCodeExit(YangNode codeGenNode, YangPluginConfig pluginConfig)
- throws TranslatorException, IOException {
-
- if (codeGenNode instanceof JavaCodeGenerator) {
- ((JavaCodeGenerator) codeGenNode).generateCodeExit();
- } else {
- close(codeGenNode, pluginConfig);
- throw new TranslatorException(
- "Generated data model node cannot be translated to target language code");
- }
- }
-
- /**
- * Free other YANG nodes of data-model tree when error occurs while file generation of current node.
- */
- private static void freeRestResources() {
-
- YangNode freedNode = getCurNode();
- if (getCurNode() != null) {
- YangNode tempNode = freedNode;
- TraversalType curTraversal = ROOT;
-
- while (freedNode != tempNode.getParent()) {
-
- if (curTraversal != PARENT && freedNode.getChild() != null) {
- curTraversal = CHILD;
- freedNode = freedNode.getChild();
- } else if (freedNode.getNextSibling() != null) {
- curTraversal = SIBILING;
- if (freedNode != tempNode) {
- free(freedNode);
- }
- freedNode = freedNode.getNextSibling();
- } else {
- curTraversal = PARENT;
- if (freedNode != tempNode) {
- free(freedNode);
- }
- freedNode = freedNode.getParent();
- }
- }
- }
- }
-
- /**
- * Free the current node.
- *
- * @param node YANG node
- */
- private static void free(YangNode node) {
-
- YangNode parent = node.getParent();
- parent.setChild(null);
-
- if (node.getNextSibling() != null) {
- parent.setChild(node.getNextSibling());
- } else if (node.getPreviousSibling() != null) {
- parent.setChild(node.getPreviousSibling());
- }
- node = null;
- }
-
- /**
- * Delete Java code files corresponding to the YANG schema.
- *
- * @param rootNode root node of data-model tree
- * @param yangPluginConfig plugin configurations
- * @throws IOException when fails to delete java code file the current node
- */
- public static void translatorErrorHandler(YangNode rootNode, YangPluginConfig yangPluginConfig)
- throws IOException {
-
- if (rootNode != null) {
- //Free other resources where translator has failed.
- freeRestResources();
-
- // Start removing all open files.
- YangNode tempNode = rootNode;
- setCurNode(tempNode.getChild());
- TraversalType curTraversal = ROOT;
-
- while (tempNode != null) {
-
- if (curTraversal != PARENT) {
- close(tempNode, yangPluginConfig);
- }
- if (curTraversal != PARENT && tempNode.getChild() != null) {
- curTraversal = CHILD;
- tempNode = tempNode.getChild();
- } else if (tempNode.getNextSibling() != null) {
- curTraversal = SIBILING;
- tempNode = tempNode.getNextSibling();
- } else {
- curTraversal = PARENT;
- tempNode = tempNode.getParent();
- }
- }
-
- freeRestResources();
- }
- }
-
- /**
- * Closes all the current open file handles of node and delete all generated files.
- *
- * @param node current YANG node
- * @param yangPlugin plugin configurations
- * @throws IOException when fails to do IO operations
- */
- private static void close(YangNode node, YangPluginConfig yangPlugin)
- throws IOException {
- if (node instanceof JavaCodeGenerator && ((TempJavaCodeFragmentFilesContainer) node)
- .getTempJavaCodeFragmentFiles() != null) {
- ((TempJavaCodeFragmentFilesContainer) node).getTempJavaCodeFragmentFiles().freeTemporaryResources(true);
- } else {
-
- if (getRootNode() != null) {
- JavaFileInfo javaFileInfo = ((JavaFileInfoContainer) getRootNode()).getJavaFileInfo();
- if (javaFileInfo != null) {
- searchAndDeleteTempDir(javaFileInfo.getBaseCodeGenPath() +
- javaFileInfo.getPackageFilePath());
- } else {
- searchAndDeleteTempDir(yangPlugin.getCodeGenDir());
- }
- }
- }
- }
-
- /**
- * Returns root node.
- *
- * @return root node
- */
- private static YangNode getRootNode() {
- return rootNode;
- }
-
- /**
- * Sets root node.
- *
- * @param rootNode root node
- */
- private static void setRootNode(YangNode rootNode) {
- JavaCodeGeneratorUtil.rootNode = rootNode;
- }
-
- /**
- * Searches child node in data model tree.
- *
- * @param parentNode parent node
- * @param nodeType node type
- * @param nodeName node name
- * @return child node
- */
- public static YangNode searchYangNode(YangNode parentNode, YangNodeType nodeType, String nodeName) {
- YangNode child = parentNode.getChild();
- TraversalType curTraversal = ROOT;
- if (child == null) {
- throw new IllegalArgumentException("Given parent node does not contain any child nodes");
- }
-
- while (child != null) {
- if (curTraversal != PARENT) {
- if (child instanceof YangInput || child instanceof YangOutput) {
- if (child.getNodeType().equals(nodeType)) {
- return child;
- }
- } else if (child.getName().equals(nodeName) && child.getNodeType().equals(nodeType)) {
- return child;
- }
- }
- if (curTraversal != PARENT && child.getChild() != null) {
- curTraversal = CHILD;
- child = child.getChild();
- } else if (child.getNextSibling() != null) {
- curTraversal = SIBILING;
- child = child.getNextSibling();
- } else {
- curTraversal = PARENT;
- child = child.getParent();
- }
- }
- return null;
- }
-
- /**
- * Adds a case node in augment when augmenting a choice node.
- *
- * @param augment augment node
- */
- private static void addCaseNodeToChoiceTarget(YangAugment augment) {
- YangCase javaCase = getYangCaseNode(JAVA_GENERATION);
-
- YangPluginConfig pluginConfig = new YangPluginConfig();
- javaCase.setName(getAugmentClassName(augment, pluginConfig) + getCapitalCase(CASE));
-
- if (augment.getListOfLeaf() != null) {
- augment.getListOfLeaf().forEach(javaCase::addLeaf);
- augment.getListOfLeaf().clear();
- }
- if (augment.getListOfLeafList() != null) {
- augment.getListOfLeafList().forEach(javaCase::addLeafList);
- augment.getListOfLeafList().clear();
- }
- YangNode child = augment.getChild();
- List<YangNode> childNodes = new ArrayList<>();
- while (child != null) {
- child.setParent(javaCase);
- childNodes.add(child);
- child = child.getNextSibling();
- }
- augment.setChild(null);
- try {
- augment.addChild(javaCase);
- for (YangNode node : childNodes) {
- node.setNextSibling(null);
- node.setPreviousSibling(null);
- javaCase.addChild(node);
- }
- } catch (DataModelException e) {
- System.out.print("failed to add child node due to " + javaCase.getName() + " " + e.getLocalizedMessage());
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaFileInfoContainer.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaFileInfoContainer.java
deleted file mode 100644
index 0ab417a..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaFileInfoContainer.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.translator.tojava;
-
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-
-/**
- * Represents data model nodes which are required to generate java classes, need to support
- * java file info.
- */
-public interface JavaFileInfoContainer {
-
- /**
- * Returns the generated java file information.
- *
- * @return generated java file information
- */
- JavaFileInfo getJavaFileInfo();
-
- /**
- * Sets the java file info object.
- *
- * @param javaInfo java file info object
- */
- void setJavaFileInfo(JavaFileInfo javaInfo);
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaImportData.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaImportData.java
deleted file mode 100644
index aa8b53f..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaImportData.java
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * 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.translator.tojava;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import static org.onosproject.yangutils.utils.UtilConstants.ABSTRACT_EVENT;
-import static org.onosproject.yangutils.utils.UtilConstants.BIG_INTEGER;
-import static org.onosproject.yangutils.utils.UtilConstants.BITSET;
-import static org.onosproject.yangutils.utils.UtilConstants.COLLECTION_IMPORTS;
-import static org.onosproject.yangutils.utils.UtilConstants.EMPTY_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.EVENT_LISTENER;
-import static org.onosproject.yangutils.utils.UtilConstants.GOOGLE_MORE_OBJECT_IMPORT_CLASS;
-import static org.onosproject.yangutils.utils.UtilConstants.GOOGLE_MORE_OBJECT_IMPORT_PKG;
-import static org.onosproject.yangutils.utils.UtilConstants.HASH_MAP;
-import static org.onosproject.yangutils.utils.UtilConstants.IMPORT;
-import static org.onosproject.yangutils.utils.UtilConstants.JAVA_LANG;
-import static org.onosproject.yangutils.utils.UtilConstants.JAVA_MATH;
-import static org.onosproject.yangutils.utils.UtilConstants.JAVA_UTIL_OBJECTS_IMPORT_CLASS;
-import static org.onosproject.yangutils.utils.UtilConstants.JAVA_UTIL_OBJECTS_IMPORT_PKG;
-import static org.onosproject.yangutils.utils.UtilConstants.LIST;
-import static org.onosproject.yangutils.utils.UtilConstants.LISTENER_REG;
-import static org.onosproject.yangutils.utils.UtilConstants.LISTENER_SERVICE;
-import static org.onosproject.yangutils.utils.UtilConstants.MAP;
-import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE;
-import static org.onosproject.yangutils.utils.UtilConstants.ONOS_EVENT_PKG;
-import static org.onosproject.yangutils.utils.UtilConstants.PERIOD;
-import static org.onosproject.yangutils.utils.UtilConstants.SEMI_COLAN;
-import static java.util.Collections.sort;
-
-/**
- * Represents that generated Java file can contain imports.
- */
-public class JavaImportData {
-
- /**
- * Flag to denote if any list in imported.
- */
- private boolean isListToImport;
-
- /**
- * Sorted set of import info, to be used to maintain the set of classes to
- * be imported in the generated class.
- */
- private SortedSet<JavaQualifiedTypeInfoTranslator> importSet;
-
- /**
- * Creates java import data object.
- */
- public JavaImportData() {
- setImportSet(new TreeSet<>());
- }
-
- /**
- * Returns if the list needs to be imported.
- *
- * @return true if any of the attribute needs to be maintained as a list
- */
- private boolean getIfListImported() {
- return isListToImport;
- }
-
- /**
- * Sets the status of importing list.
- *
- * @param isList status to mention list is bing imported
- */
- void setIfListImported(boolean isList) {
- isListToImport = isList;
- }
-
- /**
- * Returns the set containing the imported class/interface info.
- *
- * @return the set containing the imported class/interface info
- */
- public SortedSet<JavaQualifiedTypeInfoTranslator> getImportSet() {
- return importSet;
- }
-
- /**
- * Assigns the set containing the imported class/interface info.
- *
- * @param importSet the set containing the imported class/interface info
- */
- private void setImportSet(SortedSet<JavaQualifiedTypeInfoTranslator> importSet) {
- this.importSet = importSet;
- }
-
- /**
- * Adds an imported class/interface info if it is not already part of the
- * collection.
- * <p>
- * If already part of the collection, check if the packages are same, if so
- * then return true, to denote it is already in the import collection, and
- * it can be accessed without qualified access. If the packages do not
- * match, then do not add to the import collection, and return false to
- * denote, it is not added to import collection and needs to be accessed in
- * a qualified manner.
- *
- * @param newImportInfo class/interface info being imported
- * @param className name of the call being generated
- * @param classPkg generated class package
- * @return qualified access status of the import node being added
- */
- public boolean addImportInfo(JavaQualifiedTypeInfoTranslator newImportInfo,
- String className, String classPkg) {
-
- if (newImportInfo.getClassInfo().contentEquals(className)) {
- /*
- * if the current class name is same as the attribute class name,
- * then the attribute must be accessed in a qualified manner.
- */
- return true;
- } else if (newImportInfo.getPkgInfo() == null) {
- /*
- * If the package info is null, then it is not a candidate for import / qualified access
- */
- return false;
- }
-
- /*
- * If the attribute type is having the package info, it is contender
- * for import list and also need to check if it needs to be a
- * qualified access.
- */
- if (newImportInfo.getPkgInfo().contentEquals(classPkg)) {
- /*
- * Package of the referred attribute and the generated class is same, so no need import
- * or qualified access.
- */
- return false;
- }
-
- for (JavaQualifiedTypeInfoTranslator curImportInfo : getImportSet()) {
- if (curImportInfo.getClassInfo()
- .contentEquals(newImportInfo.getClassInfo())) {
- return !curImportInfo.getPkgInfo()
- .contentEquals(newImportInfo.getPkgInfo());
- }
- }
-
- /*
- * import is added, so it is a member for non qualified access
- */
- getImportSet().add(newImportInfo);
- return false;
- }
-
- /**
- * Returns import for class.
- *
- * @return imports for class
- */
- public List<String> getImports() {
-
- String importString;
- List<String> imports = new ArrayList<>();
-
- for (JavaQualifiedTypeInfoTranslator importInfo : getImportSet()) {
- if (!importInfo.getPkgInfo().equals(EMPTY_STRING) && importInfo.getClassInfo() != null
- && !importInfo.getPkgInfo().equals(JAVA_LANG)) {
- importString = IMPORT + importInfo.getPkgInfo() + PERIOD + importInfo.getClassInfo() + SEMI_COLAN
- + NEW_LINE;
-
- imports.add(importString);
- }
- }
-
- if (getIfListImported()) {
- imports.add(getImportForList());
- }
-
- sort(imports);
- return imports;
- }
-
- /**
- * Returns import for hash and equals method.
- *
- * @return import for hash and equals method
- */
- String getImportForHashAndEquals() {
- return IMPORT + JAVA_UTIL_OBJECTS_IMPORT_PKG + PERIOD + JAVA_UTIL_OBJECTS_IMPORT_CLASS;
- }
-
- /**
- * Returns import for to string method.
- *
- * @return import for to string method
- */
- String getImportForToString() {
- return IMPORT + GOOGLE_MORE_OBJECT_IMPORT_PKG + PERIOD + GOOGLE_MORE_OBJECT_IMPORT_CLASS;
- }
-
- /**
- * Returns import for to bitset method.
- *
- * @return import for to bitset method
- */
- String getImportForToBitSet() {
- return IMPORT + JAVA_UTIL_OBJECTS_IMPORT_PKG + PERIOD + BITSET + SEMI_COLAN + NEW_LINE;
- }
-
- /**
- * Returns import for list attribute.
- *
- * @return import for list attribute
- */
- String getImportForList() {
- return IMPORT + COLLECTION_IMPORTS + PERIOD + LIST + SEMI_COLAN + NEW_LINE;
- }
-
- /**
- * Returns import string for ListenerService class.
- *
- * @return import string for ListenerService class
- */
- public String getListenerServiceImport() {
- return IMPORT + ONOS_EVENT_PKG + PERIOD + LISTENER_SERVICE + SEMI_COLAN + NEW_LINE;
- }
-
- /**
- * Returns import string for ListenerRegistry class.
- *
- * @return import string for ListenerRegistry class
- */
- public String getListenerRegistryImport() {
- return IMPORT + ONOS_EVENT_PKG + PERIOD + LISTENER_REG + SEMI_COLAN + NEW_LINE;
- }
-
- /**
- * Returns import string for AbstractEvent class.
- *
- * @return import string for AbstractEvent class
- */
- String getAbstractEventsImport() {
- return IMPORT + ONOS_EVENT_PKG + PERIOD + ABSTRACT_EVENT + SEMI_COLAN + NEW_LINE;
- }
-
- /**
- * Returns import string for EventListener class.
- *
- * @return import string for EventListener class
- */
- String getEventListenerImport() {
- return IMPORT + ONOS_EVENT_PKG + PERIOD + EVENT_LISTENER + SEMI_COLAN + NEW_LINE;
- }
-
- /**
- * Returns import string for map class.
- *
- * @return import string for map class
- */
- String getMapImport() {
- return IMPORT + COLLECTION_IMPORTS + PERIOD + MAP + SEMI_COLAN + NEW_LINE;
- }
-
- /**
- * Returns import string for hash map class.
- *
- * @return import string for hash map class
- */
- String getHashMapImport() {
- return IMPORT + COLLECTION_IMPORTS + PERIOD + HASH_MAP + SEMI_COLAN + NEW_LINE;
- }
-
- /**
- * Returns import for big integer.
- *
- * @return import for big integer
- */
- public String getBigIntegerImport() {
- return IMPORT + JAVA_MATH + PERIOD +
- BIG_INTEGER + SEMI_COLAN + NEW_LINE;
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaQualifiedTypeInfoContainer.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaQualifiedTypeInfoContainer.java
deleted file mode 100644
index 7791773..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaQualifiedTypeInfoContainer.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2016 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.translator.tojava;
-
-/**
- * Maintain the java qualified access details for an attribute or a class.
- */
-public interface JavaQualifiedTypeInfoContainer {
-
- /**
- * Obtain the java qualified details.
- *
- * @return java qualified type details
- */
- JavaQualifiedTypeInfoTranslator getJavaQualifiedInfo();
-
- /**
- * Assign the qualified type info.
- *
- * @param typeInfo qualified type information
- */
- void setJavaQualifiedInfo(JavaQualifiedTypeInfoTranslator typeInfo);
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaQualifiedTypeInfoTranslator.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaQualifiedTypeInfoTranslator.java
deleted file mode 100644
index 5c675c6..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaQualifiedTypeInfoTranslator.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * 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.translator.tojava;
-
-import java.io.Serializable;
-import java.util.Objects;
-
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaQualifiedTypeInfo;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangToJavaNamingConflictUtil;
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.javamodel.AttributesJavaDataType;
-import org.onosproject.yangutils.translator.tojava.javamodel.JavaLeafInfoContainer;
-
-import com.google.common.base.MoreObjects;
-
-import static org.onosproject.yangutils.translator.tojava.javamodel.AttributesJavaDataType.getJavaImportClass;
-import static org.onosproject.yangutils.translator.tojava.javamodel.AttributesJavaDataType.getJavaImportPackage;
-
-/**
- * Represents the information about individual imports in the generated file.
- */
-public class JavaQualifiedTypeInfoTranslator extends JavaQualifiedTypeInfo
- implements Comparable<JavaQualifiedTypeInfoTranslator>, Serializable {
- private static final long serialVersionUID = 806201634L;
-
- /**
- * Creates a java qualified type info object.
- */
- public JavaQualifiedTypeInfoTranslator() {
- }
-
- /**
- * Returns the imported package info.
- *
- * @return the imported package info
- */
- public String getPkgInfo() {
- return pkgInfo;
- }
-
- /**
- * Sets the imported package info.
- *
- * @param pkgInfo the imported package info
- */
- public void setPkgInfo(String pkgInfo) {
- this.pkgInfo = pkgInfo;
- }
-
- /**
- * Returns the imported class/interface info.
- *
- * @return the imported class/interface info
- */
- public String getClassInfo() {
- return classInfo;
- }
-
- /**
- * Sets the imported class/interface info.
- *
- * @param classInfo the imported class/interface info
- */
- public void setClassInfo(String classInfo) {
- this.classInfo = classInfo;
- }
-
- /**
- * Updates the leaf's java information.
- *
- * @param leaf leaf whose java information is being updated
- */
- public static void updateLeavesJavaQualifiedInfo(JavaLeafInfoContainer leaf) {
-
- JavaQualifiedTypeInfoTranslator importInfo = leaf.getJavaQualifiedInfo();
-
- if (leaf.getDataType() == null) {
- throw new TranslatorException("missing data type of leaf " + leaf.getName());
- }
-
- /*
- * Current leaves holder is adding a leaf info as a attribute to the
- * current class.
- */
- String className = getJavaImportClass(leaf.getDataType(), leaf.isLeafList(),
- leaf.getConflictResolveConfig());
- if (className != null) {
- /*
- * Corresponding to the attribute type a class needs to be imported,
- * since it can be a derived type or a usage of wrapper classes.
- */
- importInfo.setClassInfo(className);
- String classPkg = getJavaImportPackage(leaf.getDataType(),
- leaf.isLeafList(), leaf.getConflictResolveConfig());
- if (classPkg == null) {
- throw new TranslatorException("import package cannot be null when the class is used");
- }
- importInfo.setPkgInfo(classPkg);
- } else {
- /*
- * The attribute does not need a class to be imported, for example
- * built in java types.
- */
- String dataTypeName = AttributesJavaDataType.getJavaDataType(leaf.getDataType());
- if (dataTypeName == null) {
- throw new TranslatorException("not supported data type");
- }
- importInfo.setClassInfo(dataTypeName);
- }
- }
-
- /**
- * Returns the import info for an attribute, which needs to be used for code
- * generation for import or for qualified access.
- *
- * @param curNode current data model node for which the java file is being
- * generated
- * @param attributeName name of the attribute being added, it will used in
- * import info for child class
- * @return return the import info for this attribute
- */
- public static JavaQualifiedTypeInfoTranslator getQualifiedTypeInfoOfCurNode(YangNode curNode,
- String attributeName) {
-
- JavaQualifiedTypeInfoTranslator importInfo = new JavaQualifiedTypeInfoTranslator();
-
- if (!(curNode instanceof JavaFileInfoContainer)) {
- throw new TranslatorException("missing java file information to get the package details "
- + "of attribute corresponding to child node");
- }
-
- importInfo.setClassInfo(attributeName);
- importInfo.setPkgInfo(((JavaFileInfoContainer) curNode)
- .getJavaFileInfo().getPackage());
-
- return importInfo;
- }
-
- /**
- * Returns the java qualified type information for the wrapper classes.
- *
- * @param referredTypesAttrInfo attribute of referred type
- * @param conflictResolver plugin configurations
- * @return return the import info for this attribute
- */
- static JavaQualifiedTypeInfoTranslator getQualifiedInfoOfFromString(JavaAttributeInfo referredTypesAttrInfo,
- YangToJavaNamingConflictUtil conflictResolver) {
-
- /*
- * Get the java qualified type information for the wrapper classes and
- * set it in new java attribute information.
- */
- JavaQualifiedTypeInfoTranslator qualifiedInfoOfFromString = new JavaQualifiedTypeInfoTranslator();
-
- qualifiedInfoOfFromString.setClassInfo(
- getJavaImportClass(referredTypesAttrInfo.getAttributeType(), true, conflictResolver));
- qualifiedInfoOfFromString.setPkgInfo(
- getJavaImportPackage(referredTypesAttrInfo.getAttributeType(), true, conflictResolver));
- return qualifiedInfoOfFromString;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(pkgInfo, classInfo);
- }
-
- @Override
- public boolean equals(Object obj) {
-
- if (this == obj) {
- return true;
- }
- if (obj instanceof JavaQualifiedTypeInfoTranslator) {
- JavaQualifiedTypeInfoTranslator other = (JavaQualifiedTypeInfoTranslator) obj;
- return Objects.equals(pkgInfo, other.pkgInfo) &&
- Objects.equals(classInfo, other.classInfo);
- }
- return false;
- }
-
- /**
- * Checks if the import info matches.
- *
- * @param importInfo matched import
- * @return if equal or not
- */
- public boolean exactMatch(JavaQualifiedTypeInfoTranslator importInfo) {
- return equals(importInfo)
- && Objects.equals(pkgInfo, importInfo.getPkgInfo())
- && Objects.equals(classInfo, importInfo.getClassInfo());
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(getClass())
- .add("pkgInfo", pkgInfo)
- .add("classInfo", classInfo).toString();
- }
-
- /**
- * Checks that there is no 2 objects with the same class name.
- *
- * @param other compared import info.
- */
- @Override
- public int compareTo(JavaQualifiedTypeInfoTranslator other) {
- return getClassInfo().compareTo(other.getClassInfo());
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaBeanFragmentFiles.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaBeanFragmentFiles.java
deleted file mode 100644
index 347877e..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaBeanFragmentFiles.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * 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.translator.tojava;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.CONSTRUCTOR_IMPL_MASK;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getConstructor;
-import static org.onosproject.yangutils.utils.io.impl.FileSystemUtil.closeFile;
-
-/**
- * Represents implementation of java bean code fragments temporary implementations.
- * Maintains the temp files required specific for bean java snippet generation.
- */
-public class TempJavaBeanFragmentFiles
- extends TempJavaFragmentFiles {
-
- /**
- * File name for constructor.
- */
- private static final String CONSTRUCTOR_FILE_NAME = "Constructor";
-
- /**
- * Temporary file handle for constructor of class.
- */
- private File constructorImplTempFileHandle;
-
- /**
- * Creates an instance of temporary java code fragment.
- *
- * @param javaFileInfo generated java file info
- * @throws IOException when fails to create new file handle
- */
- TempJavaBeanFragmentFiles(JavaFileInfo javaFileInfo)
- throws IOException {
-
- super(javaFileInfo);
-
- /*
- * Initialize getterImpl, attributes, constructor, hash code, equals and
- * to strings when generation file type matches to impl class mask.
- */
- addGeneratedTempFile(CONSTRUCTOR_IMPL_MASK);
-
- setConstructorImplTempFileHandle(getTemporaryFileHandle(CONSTRUCTOR_FILE_NAME));
- }
-
- /**
- * Returns constructor's temporary file handle.
- *
- * @return temporary file handle
- */
- public File getConstructorImplTempFileHandle() {
- return constructorImplTempFileHandle;
- }
-
- /**
- * Sets to constructor's temporary file handle.
- *
- * @param constructor file handle for to constructor
- */
- private void setConstructorImplTempFileHandle(File constructor) {
- constructorImplTempFileHandle = constructor;
- }
-
- /**
- * Adds constructor for class.
- *
- * @param attr attribute info
- * @throws IOException when fails to append to temporary file
- */
- private void addConstructor(JavaAttributeInfo attr, YangPluginConfig pluginConfig)
- throws IOException {
- appendToFile(getConstructorImplTempFileHandle(), getConstructor(attr,
- getGeneratedJavaFiles(), pluginConfig));
- }
-
- /**
- * Adds the new attribute info to the target generated temporary files.
- *
- * @param newAttrInfo the attribute info that needs to be added to temporary
- * files
- * @throws IOException IO operation fail
- */
- @Override
- void addJavaSnippetInfoToApplicableTempFiles(JavaAttributeInfo newAttrInfo, YangPluginConfig pluginConfig)
- throws IOException {
- super.addJavaSnippetInfoToApplicableTempFiles(newAttrInfo, pluginConfig);
- addConstructor(newAttrInfo, pluginConfig);
- }
-
- /**
- * Removes all temporary file handles.
- *
- * @param isErrorOccurred flag to tell translator that error has occurred while code generation
- * @throws IOException when failed to delete the temporary files
- */
- @Override
- public void freeTemporaryResources(boolean isErrorOccurred)
- throws IOException {
-
- /*
- * Close constructor temporary file handle and delete the file.
- */
- closeFile(getConstructorImplTempFileHandle(), true);
-
- super.freeTemporaryResources(isErrorOccurred);
- }
-
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaCodeFragmentFiles.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaCodeFragmentFiles.java
deleted file mode 100644
index 7a0ea11..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaCodeFragmentFiles.java
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- * 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.translator.tojava;
-
-import java.io.IOException;
-
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangTypeHolder;
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_ALL_EVENT_CLASS_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_ENUM_CLASS;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_SERVICE_AND_MANAGER;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_TYPE_CLASS;
-import static org.onosproject.yangutils.utils.UtilConstants.BUILDER;
-
-/**
- * Represents implementation of java code fragments temporary implementations.
- * Contains fragment file object of different types of java file.
- * Uses required object(s) to generate the target java file(s).
- */
-public class TempJavaCodeFragmentFiles {
-
- /**
- * Has the temporary files required for bean generated classes.
- */
- private TempJavaBeanFragmentFiles beanTempFiles;
-
- /**
- * Has the temporary files required for bean generated classes.
- */
- private TempJavaTypeFragmentFiles typeTempFiles;
-
- /**
- * Has the temporary files required for service generated classes.
- */
- private TempJavaServiceFragmentFiles serviceTempFiles;
-
- /**
- * Has the temporary files required for enumeration generated classes.
- */
- private TempJavaEnumerationFragmentFiles enumerationTempFiles;
-
- /**
- * Has the temporary files required for enumeration generated classes.
- */
- private TempJavaEventFragmentFiles tempJavaEventFragmentFiles;
-
- /**
- * Creates an instance of temporary java code fragment.
- *
- * @param javaFileInfo generated java file info
- * @throws IOException when fails to create new file handle
- */
- public TempJavaCodeFragmentFiles(JavaFileInfo javaFileInfo)
- throws IOException {
-
- if ((javaFileInfo.getGeneratedFileTypes() & GENERATE_INTERFACE_WITH_BUILDER) != 0) {
- setBeanTempFiles(new TempJavaBeanFragmentFiles(javaFileInfo));
- }
-
- if ((javaFileInfo.getGeneratedFileTypes() & GENERATE_TYPE_CLASS) != 0) {
- setTypeTempFiles(new TempJavaTypeFragmentFiles(javaFileInfo));
- }
-
- if ((javaFileInfo.getGeneratedFileTypes() & GENERATE_ENUM_CLASS) != 0) {
- setEnumerationTempFiles(new TempJavaEnumerationFragmentFiles(javaFileInfo));
- }
-
- if ((javaFileInfo.getGeneratedFileTypes() & GENERATE_SERVICE_AND_MANAGER) != 0) {
- setServiceTempFiles(new TempJavaServiceFragmentFiles(javaFileInfo));
- }
-
- if ((javaFileInfo.getGeneratedFileTypes() & GENERATE_ALL_EVENT_CLASS_MASK) != 0) {
- setEventFragmentFiles(new TempJavaEventFragmentFiles(javaFileInfo));
- }
-
- }
-
- /**
- * Retrieves the temp file handle for bean file generation.
- *
- * @return temp file handle for bean file generation
- */
- public TempJavaBeanFragmentFiles getBeanTempFiles() {
- return beanTempFiles;
- }
-
- /**
- * Sets temp file handle for bean file generation.
- *
- * @param beanTempFiles temp file handle for bean file generation
- */
- private void setBeanTempFiles(TempJavaBeanFragmentFiles beanTempFiles) {
- this.beanTempFiles = beanTempFiles;
- }
-
- /**
- * Retrieves the temp file handle for data type file generation.
- *
- * @return temp file handle for data type file generation
- */
- public TempJavaTypeFragmentFiles getTypeTempFiles() {
- return typeTempFiles;
- }
-
- /**
- * Sets temp file handle for data type file generation.
- *
- * @param typeTempFiles temp file handle for data type file generation
- */
- private void setTypeTempFiles(TempJavaTypeFragmentFiles typeTempFiles) {
- this.typeTempFiles = typeTempFiles;
- }
-
- /**
- * Retrieves the temp file handle for service file generation.
- *
- * @return temp file handle for service file generation
- */
- public TempJavaServiceFragmentFiles getServiceTempFiles() {
- return serviceTempFiles;
- }
-
- /**
- * Sets temp file handle for service file generation.
- *
- * @param serviceTempFiles temp file handle for service file generation
- */
- private void setServiceTempFiles(TempJavaServiceFragmentFiles serviceTempFiles) {
- this.serviceTempFiles = serviceTempFiles;
- }
-
- /**
- * Retrieves the temp file handle for enumeration file generation.
- *
- * @return temp file handle for enumeration file generation
- */
- public TempJavaEnumerationFragmentFiles getEnumerationTempFiles() {
- return enumerationTempFiles;
- }
-
- /**
- * Sets temp file handle for enumeration file generation.
- *
- * @param enumerationTempFiles temp file handle for enumeration file generation
- */
- private void setEnumerationTempFiles(
- TempJavaEnumerationFragmentFiles enumerationTempFiles) {
- this.enumerationTempFiles = enumerationTempFiles;
- }
-
- /**
- * Retrieves the temp file handle for event file generation.
- *
- * @return temp file handle for enumeration file generation
- */
- public TempJavaEventFragmentFiles getEventFragmentFiles() {
- return tempJavaEventFragmentFiles;
- }
-
- /**
- * Sets temp file handle for event file generation.
- *
- * @param tempJavaEventFragmentFiles temp file handle for event file generation
- */
- private void setEventFragmentFiles(TempJavaEventFragmentFiles tempJavaEventFragmentFiles) {
- this.tempJavaEventFragmentFiles = tempJavaEventFragmentFiles;
- }
-
-
- /**
- * Constructs java code exit.
- *
- * @param fileType generated file type
- * @param curNode current YANG node
- * @throws IOException when fails to generate java files
- */
- public void generateJavaFile(int fileType, YangNode curNode)
- throws IOException {
-
- if ((fileType & GENERATE_INTERFACE_WITH_BUILDER) != 0) {
- getBeanTempFiles().generateJavaFile(fileType, curNode);
- }
-
- /*
- * Creates user defined data type class file.
- */
- if ((fileType & GENERATE_TYPE_CLASS) != 0) {
- getTypeTempFiles().generateJavaFile(fileType, curNode);
- }
-
- /*
- * Creates service and manager class file.
- */
- if (fileType == GENERATE_SERVICE_AND_MANAGER) {
- getServiceTempFiles().generateJavaFile(GENERATE_SERVICE_AND_MANAGER, curNode);
- }
-
- /*
- * Creates event, event listener and event subject files.
- */
- if (fileType == GENERATE_ALL_EVENT_CLASS_MASK) {
- getEventFragmentFiles().generateJavaFile(GENERATE_ALL_EVENT_CLASS_MASK, curNode);
- }
-
- /*
- * Creates enumeration class file.
- */
- if (fileType == GENERATE_ENUM_CLASS) {
- getEnumerationTempFiles().generateJavaFile(GENERATE_ENUM_CLASS, curNode);
- }
- }
-
- /**
- * Add all the type in the current data model node as part of the
- * generated temporary file.
- *
- * @param yangTypeHolder YANG java data model node which has type info, eg union / typedef
- * @param pluginConfig plugin configurations for naming convention
- * @throws IOException IO operation fail
- */
- void addTypeInfoToTempFiles(YangTypeHolder yangTypeHolder, YangPluginConfig pluginConfig)
- throws IOException {
- getTypeTempFiles()
- .addTypeInfoToTempFiles(yangTypeHolder, pluginConfig);
- }
-
- /**
- * Adds build method for interface.
- *
- * @param pluginConfig plugin configurations
- * @return build method for interface
- * @throws IOException when fails to append to temporary file
- */
- public String addBuildMethodForInterface(YangPluginConfig pluginConfig)
- throws IOException {
- if (getBeanTempFiles() != null) {
- return getBeanTempFiles().addBuildMethodForInterface(pluginConfig);
- }
- throw new TranslatorException("build method only supported for bean class");
- }
-
- /**
- * Adds default constructor for class.
- *
- * @param modifier modifier for constructor.
- * @param toAppend string which need to be appended with the class name
- * @param pluginConfig plugin configurations
- * @param curNode YANG node
- * @return default constructor for class
- * @throws IOException when fails to append to file
- */
- public String addDefaultConstructor(String modifier, String toAppend, YangPluginConfig pluginConfig,
- YangNode curNode)
- throws IOException {
- boolean isSuffix = false;
- if (toAppend.equals(BUILDER)) {
- isSuffix = true;
- }
- if (getTypeTempFiles() != null) {
- return getTypeTempFiles()
- .addDefaultConstructor(modifier, toAppend, pluginConfig, isSuffix);
- }
-
- if (getBeanTempFiles() != null) {
- return getBeanTempFiles().addDefaultConstructor(modifier, toAppend, pluginConfig, isSuffix);
- }
-
- throw new TranslatorException("default constructor should not be added");
- }
-
- /**
- * Adds build method's implementation for class.
- *
- * @param curNode YANG node
- * @return build method implementation for class
- * @throws IOException when fails to append to temporary file
- */
- public String addBuildMethodImpl(YangNode curNode)
- throws IOException {
- if (getBeanTempFiles() != null) {
- return getBeanTempFiles().addBuildMethodImpl();
- }
-
- throw new TranslatorException("build should not be added");
- }
-
- /**
- * Removes all temporary file handles.
- *
- * @param isErrorOccurred when translator fails to generate java files we need to close
- * all open file handles include temporary files and java files.
- * @throws IOException when failed to delete the temporary files
- */
- void freeTemporaryResources(boolean isErrorOccurred)
- throws IOException {
-
- if (getBeanTempFiles() != null) {
- getBeanTempFiles().freeTemporaryResources(isErrorOccurred);
- }
-
- if (getTypeTempFiles() != null) {
- getTypeTempFiles().freeTemporaryResources(isErrorOccurred);
- }
-
- if (getEnumerationTempFiles() != null) {
- getEnumerationTempFiles().freeTemporaryResources(isErrorOccurred);
- }
-
- if (getServiceTempFiles() != null) {
- getServiceTempFiles().freeTemporaryResources(isErrorOccurred);
- }
-
- if (getEventFragmentFiles() != null) {
- getEventFragmentFiles().freeTemporaryResources(isErrorOccurred);
- }
-
- }
-
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaCodeFragmentFilesContainer.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaCodeFragmentFilesContainer.java
deleted file mode 100644
index 1bbf349..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaCodeFragmentFilesContainer.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.translator.tojava;
-
-/**
- * Represents Has temporary file handle.
- */
-public interface TempJavaCodeFragmentFilesContainer {
-
- /**
- * Returns the temporary file handle.
- *
- * @return temporary file handle
- */
- TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles();
-
- /**
- * Sets temporary file handle.
- *
- * @param fileHandle temporary file handle
- */
- void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle);
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaEnumerationFragmentFiles.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaEnumerationFragmentFiles.java
deleted file mode 100644
index da252d1..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaEnumerationFragmentFiles.java
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
- * 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.translator.tojava;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.onosproject.yangutils.datamodel.YangEnum;
-import org.onosproject.yangutils.datamodel.YangEnumeration;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaTypeTranslator;
-
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.INT32;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.ENUM_IMPL_MASK;
-import static org.onosproject.yangutils.translator.tojava.JavaAttributeInfo.getAttributeInfoForTheData;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaCodeSnippetGen.generateEnumAttributeString;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGenerator.generateEnumClassFile;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.createPackage;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getEnumJavaAttribute;
-import static org.onosproject.yangutils.utils.UtilConstants.EMPTY_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.INT;
-import static org.onosproject.yangutils.utils.UtilConstants.REGEX_FOR_FIRST_DIGIT;
-import static org.onosproject.yangutils.utils.UtilConstants.YANG_AUTO_PREFIX;
-import static org.onosproject.yangutils.utils.io.impl.FileSystemUtil.closeFile;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getPrefixForIdentifier;
-
-/**
- * Represents implementation of java code fragments temporary implementations. Maintains the temp files required
- * specific for enumeration java snippet generation.
- */
-public class TempJavaEnumerationFragmentFiles extends TempJavaFragmentFiles {
-
- /**
- * File name for temporary enum class.
- */
- private static final String ENUM_CLASS_TEMP_FILE_NAME = "EnumClass";
-
- /**
- * File name for enum class file name suffix.
- */
- private static final String ENUM_CLASS_FILE_NAME_SUFFIX = EMPTY_STRING;
-
- /**
- * Current enum's value.
- */
- private int enumValue;
-
- /**
- * Contains data of enumSet.
- */
- private Map<String, Integer> enumStringMap = new HashMap<>();
-
- /**
- * Contains data of enumSet.
- */
- private List<String> enumStringList;
-
- /**
- * Temporary file handle for enum class file.
- */
- private File enumClassTempFileHandle;
-
- /**
- * Java file handle for enum class.
- */
- private File enumClassJavaFileHandle;
-
- /**
- * Creates an instance of temporary java code fragment.
- *
- * @param javaFileInfo generated java file info
- * @throws IOException when fails to create new file handle
- */
- TempJavaEnumerationFragmentFiles(JavaFileInfo javaFileInfo)
- throws IOException {
-
- super(javaFileInfo);
- setEnumSetJavaMap(new HashMap<>());
- setEnumStringList(new ArrayList<>());
- /*
- * Initialize enum when generation file type matches to enum class mask.
- */
- addGeneratedTempFile(ENUM_IMPL_MASK);
- setEnumClassTempFileHandle(getTemporaryFileHandle(ENUM_CLASS_TEMP_FILE_NAME));
- }
-
- /**
- * Returns enum class java file handle.
- *
- * @return enum class java file handle
- */
- private File getEnumClassJavaFileHandle() {
- return enumClassJavaFileHandle;
- }
-
- /**
- * Sets enum class java file handle.
- *
- * @param enumClassJavaFileHandle enum class java file handle
- */
- private void setEnumClassJavaFileHandle(File enumClassJavaFileHandle) {
- this.enumClassJavaFileHandle = enumClassJavaFileHandle;
- }
-
- /**
- * Returns enum's value.
- *
- * @return enum's value
- */
- private int getEnumValue() {
- return enumValue;
- }
-
- /**
- * Sets enum's value.
- *
- * @param enumValue enum's value
- */
- private void setEnumValue(int enumValue) {
- this.enumValue = enumValue;
- }
-
- /**
- * Returns enum set java map.
- *
- * @return the enum set java map
- */
- public Map<String, Integer> getEnumSetJavaMap() {
- return enumStringMap;
- }
-
- /**
- * Sets enum set java map.
- *
- * @param map the enum set java map to set
- */
- private void setEnumSetJavaMap(Map<String, Integer> map) {
- this.enumStringMap = map;
- }
-
- /**
- * Returns temporary file handle for enum class file.
- *
- * @return temporary file handle for enum class file
- */
- public File getEnumClassTempFileHandle() {
- return enumClassTempFileHandle;
- }
-
- /**
- * Sets temporary file handle for enum class file.
- *
- * @param enumClassTempFileHandle temporary file handle for enum class file
- */
- private void setEnumClassTempFileHandle(File enumClassTempFileHandle) {
- this.enumClassTempFileHandle = enumClassTempFileHandle;
- }
-
- /**
- * Adds enum class attributes to temporary file.
- *
- * @param curEnumName current YANG enum
- * @throws IOException when fails to do IO operations.
- */
- private void addAttributesForEnumClass(String curEnumName, YangPluginConfig pluginConfig) throws IOException {
- appendToFile(getEnumClassTempFileHandle(),
- generateEnumAttributeString(curEnumName, getEnumValue(), pluginConfig));
- }
-
- /**
- * Adds enum attributes to temporary files.
- *
- * @param curNode current YANG node
- * @param pluginConfig plugin configurations
- * @throws IOException when fails to do IO operations
- */
- void addEnumAttributeToTempFiles(YangNode curNode, YangPluginConfig pluginConfig) throws IOException {
-
- super.addJavaSnippetInfoToApplicableTempFiles(getJavaAttributeForEnum(pluginConfig), pluginConfig);
- if (curNode instanceof YangEnumeration) {
- YangEnumeration enumeration = (YangEnumeration) curNode;
- for (YangEnum curEnum : enumeration.getEnumSet()) {
- String enumName = curEnum.getNamedValue();
- String prefixForIdentifier;
- if (enumName.matches(REGEX_FOR_FIRST_DIGIT)) {
- prefixForIdentifier = getPrefixForIdentifier(pluginConfig.getConflictResolver());
- if (prefixForIdentifier != null) {
- curEnum.setNamedValue(prefixForIdentifier + enumName);
- } else {
- curEnum.setNamedValue(YANG_AUTO_PREFIX + enumName);
- }
- }
- setEnumValue(curEnum.getValue());
- addToEnumStringList(curEnum.getNamedValue());
- addToEnumSetJavaMap(curEnum.getNamedValue(), curEnum.getValue());
- addJavaSnippetInfoToApplicableTempFiles(curEnum.getNamedValue(), pluginConfig);
- }
- } else {
- throw new TranslatorException("current node should be of enumeration type.");
- }
- }
-
- /**
- * Returns java attribute for enum class.
- *
- * @param pluginConfig plugin configurations
- * @return java attribute
- */
- public JavaAttributeInfo getJavaAttributeForEnum(YangPluginConfig pluginConfig) {
- YangJavaTypeTranslator<?> javaType = new YangJavaTypeTranslator<>();
- javaType.setDataType(INT32);
- javaType.setDataTypeName(INT);
- javaType.updateJavaQualifiedInfo(pluginConfig.getConflictResolver());
- return getAttributeInfoForTheData(
- javaType.getJavaQualifiedInfo(),
- javaType.getDataTypeName(), javaType,
- getIsQualifiedAccessOrAddToImportList(javaType.getJavaQualifiedInfo()),
- false);
- }
-
- /**
- * Adds current enum name to java list.
- *
- * @param curEnumName current enum name
- */
- private void addToEnumSetJavaMap(String curEnumName, int value) {
- getEnumSetJavaMap().put(getEnumJavaAttribute(curEnumName).toUpperCase(), value);
- }
-
- /**
- * Adds the new attribute info to the target generated temporary files.
- *
- * @param curEnumName the attribute name that needs to be added to temporary files
- * @throws IOException IO operation fail
- */
- private void addJavaSnippetInfoToApplicableTempFiles(String curEnumName, YangPluginConfig pluginConfig)
- throws IOException {
- addAttributesForEnumClass(getEnumJavaAttribute(curEnumName), pluginConfig);
- }
-
- /**
- * Constructs java code exit.
- *
- * @param fileType generated file type
- * @param curNode current YANG node
- * @throws IOException when fails to generate java files
- */
- @Override
- public void generateJavaFile(int fileType, YangNode curNode) throws IOException {
- createPackage(curNode);
- setEnumClassJavaFileHandle(getJavaFileHandle(getJavaClassName(ENUM_CLASS_FILE_NAME_SUFFIX)));
- setEnumClassJavaFileHandle(generateEnumClassFile(getEnumClassJavaFileHandle(), curNode));
- freeTemporaryResources(false);
- }
-
- /**
- * Removes all temporary file handles.
- *
- * @param isErrorOccurred flag to tell translator that error has occurred while file generation
- * @throws IOException when failed to delete the temporary files
- */
- @Override
- public void freeTemporaryResources(boolean isErrorOccurred) throws IOException {
- closeFile(getEnumClassJavaFileHandle(), isErrorOccurred);
- closeFile(getEnumClassTempFileHandle(), true);
- super.freeTemporaryResources(isErrorOccurred);
- }
-
- /**
- * Adds to enum string list.
- *
- * @param curEnumValue current enum value
- */
- private void addToEnumStringList(String curEnumValue) {
- getEnumStringList().add(getEnumJavaAttribute(curEnumValue).toUpperCase());
- }
-
- /**
- * Returns enum string list.
- *
- * @return the enumStringList
- */
- public List<String> getEnumStringList() {
- return enumStringList;
- }
-
- /**
- * Sets enum string list.
- *
- * @param enumStringList the enumStringList to set
- */
- private void setEnumStringList(List<String> enumStringList) {
- this.enumStringList = enumStringList;
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaEventFragmentFiles.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaEventFragmentFiles.java
deleted file mode 100644
index f0be0aa..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaEventFragmentFiles.java
+++ /dev/null
@@ -1,528 +0,0 @@
-/*
- * 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.translator.tojava;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.translator.tojava.utils.JavaExtendsListHolder;
-
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_SUBJECT_CLASS;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.EVENT_ENUM_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.EVENT_METHOD_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.EVENT_SUBJECT_ATTRIBUTE_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.EVENT_SUBJECT_GETTER_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.EVENT_SUBJECT_SETTER_MASK;
-import static org.onosproject.yangutils.translator.tojava.JavaAttributeInfo.getAttributeInfoForTheData;
-import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator.getQualifiedTypeInfoOfCurNode;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGenerator.generateEventFile;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGenerator.generateEventListenerFile;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGenerator.generateEventSubjectFile;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGeneratorUtils.getFileObject;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getEnumJavaAttribute;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getGetterForClass;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getSetterForClass;
-import static org.onosproject.yangutils.utils.UtilConstants.COMMA;
-import static org.onosproject.yangutils.utils.UtilConstants.EVENT_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.FOUR_SPACE_INDENTATION;
-import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE;
-import static org.onosproject.yangutils.utils.UtilConstants.SLASH;
-import static org.onosproject.yangutils.utils.io.impl.FileSystemUtil.closeFile;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.ENUM_ATTRIBUTE;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.GETTER_METHOD;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.MANAGER_SETTER_METHOD;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.getJavaDoc;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getAbsolutePackagePath;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCamelCase;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getSmallCase;
-
-/**
- * Represent temporary java fragments for event files.
- */
-public class TempJavaEventFragmentFiles
- extends TempJavaFragmentFiles {
- /**
- * File name for generated class file for special type like union, typedef suffix.
- */
- private static final String EVENT_SUBJECT_NAME_SUFFIX = "EventSubject";
-
- /**
- * File name for event enum temp file.
- */
- private static final String EVENT_ENUM_FILE_NAME = "EventEnum";
-
- /**
- * File name for event method temp file.
- */
- private static final String EVENT_METHOD_FILE_NAME = "EventMethod";
-
- /**
- * File name for event subject attribute temp file.
- */
- private static final String EVENT_SUBJECT_ATTRIBUTE_FILE_NAME = "EventSubjectAttribute";
-
- /**
- * File name for event subject getter temp file.
- */
- private static final String EVENT_SUBJECT_GETTER_FILE_NAME = "EventSubjectGetter";
-
- /**
- * File name for event subject setter temp file.
- */
- private static final String EVENT_SUBJECT_SETTER_FILE_NAME = "EventSubjectSetter";
-
- /**
- * File name for generated class file for special type like union, typedef suffix.
- */
- private static final String EVENT_FILE_NAME_SUFFIX = "Event";
-
- /**
- * File name for generated class file for special type like union, typedef suffix.
- */
- private static final String EVENT_LISTENER_FILE_NAME_SUFFIX = "EventListener";
-
- private static final String JAVA_FILE_EXTENSION = ".java";
-
- /**
- * Java file handle for event subject file.
- */
- private File eventSubjectJavaFileHandle;
-
- /**
- * Java file handle for event listener file.
- */
- private File eventListenerJavaFileHandle;
-
- /**
- * Java file handle for event file.
- */
- private File eventJavaFileHandle;
-
- /**
- * Java file handle for event enum impl file.
- */
- private File eventEnumTempFileHandle;
-
- /**
- * Java file handle for event method impl file.
- */
- private File eventMethodTempFileHandle;
-
- /**
- * Java file handle for event subject attribute file.
- */
- private File eventSubjectAttributeTempFileHandle;
-
- /**
- * Java file handle for event subject getter impl file.
- */
- private File eventSubjectGetterTempFileHandle;
-
- /**
- * Java file handle for event subject setter impl file.
- */
- private File eventSubjectSetterTempFileHandle;
-
- /**
- * Creates an instance of temporary java code fragment.
- *
- * @param javaFileInfo generated file information
- * @throws IOException when fails to create new file handle
- */
- TempJavaEventFragmentFiles(JavaFileInfo javaFileInfo)
- throws IOException {
- setJavaExtendsListHolder(new JavaExtendsListHolder());
- setJavaImportData(new JavaImportData());
- setJavaFileInfo(javaFileInfo);
- setAbsoluteDirPath(getAbsolutePackagePath(getJavaFileInfo().getBaseCodeGenPath(),
- getJavaFileInfo().getPackageFilePath()));
-
- addGeneratedTempFile(EVENT_ENUM_MASK);
- addGeneratedTempFile(EVENT_METHOD_MASK);
- addGeneratedTempFile(EVENT_SUBJECT_ATTRIBUTE_MASK);
- addGeneratedTempFile(EVENT_SUBJECT_GETTER_MASK);
- addGeneratedTempFile(EVENT_SUBJECT_SETTER_MASK);
-
- setEventEnumTempFileHandle(getTemporaryFileHandle(EVENT_ENUM_FILE_NAME));
- setEventMethodTempFileHandle(getTemporaryFileHandle(EVENT_METHOD_FILE_NAME));
- setEventSubjectAttributeTempFileHandle(getTemporaryFileHandle(EVENT_SUBJECT_ATTRIBUTE_FILE_NAME));
- setEventSubjectGetterTempFileHandle(getTemporaryFileHandle(EVENT_SUBJECT_GETTER_FILE_NAME));
- setEventSubjectSetterTempFileHandle(getTemporaryFileHandle(EVENT_SUBJECT_SETTER_FILE_NAME));
- }
-
- /*Adds event method contents to event file.*/
- private static String getEventFileContents(String eventClassname, String classname) {
- return "\n" +
- " /**\n" +
- " * Creates " + classname + " event with type and subject.\n" +
- " *\n" +
- " * @param type event type\n" +
- " * @param subject subject " + classname + "\n" +
- " */\n" +
- " public " + eventClassname + "(Type type, " + getCapitalCase(classname) + " subject) {\n" +
- " super(type, subject);\n" +
- " }\n" +
- "\n" +
- " /**\n" +
- " * Creates " + classname + " event with type, subject and time.\n" +
- " *\n" +
- " * @param type event type\n" +
- " * @param subject subject " + classname + "\n" +
- " * @param time time of event\n" +
- " */\n" +
- " public " + eventClassname + "(Type type, " + getCapitalCase(classname)
- + " subject, long time) {\n" +
- " super(type, subject, time);\n" +
- " }\n" +
- "\n";
- }
-
- /**
- * Returns event's java file handle.
- *
- * @return java file handle
- */
- private File getEventJavaFileHandle() {
- return eventJavaFileHandle;
- }
-
- /**
- * Sets event's java file handle.
- *
- * @param eventJavaFileHandle file handle for event
- */
- private void setEventJavaFileHandle(File eventJavaFileHandle) {
- this.eventJavaFileHandle = eventJavaFileHandle;
- }
-
- /**
- * Returns event listeners's java file handle.
- *
- * @return java file handle
- */
- private File getEventListenerJavaFileHandle() {
- return eventListenerJavaFileHandle;
- }
-
- /**
- * Sets event's java file handle.
- *
- * @param eventListenerJavaFileHandle file handle for event
- */
- private void setEventListenerJavaFileHandle(File eventListenerJavaFileHandle) {
- this.eventListenerJavaFileHandle = eventListenerJavaFileHandle;
- }
-
- /**
- * Returns event subject's java file handle.
- *
- * @return java file handle
- */
- private File getEventSubjectJavaFileHandle() {
- return eventSubjectJavaFileHandle;
- }
-
- /**
- * Sets event's subject java file handle.
- *
- * @param eventSubjectJavaFileHandle file handle for event's subject
- */
- private void setEventSubjectJavaFileHandle(File eventSubjectJavaFileHandle) {
- this.eventSubjectJavaFileHandle = eventSubjectJavaFileHandle;
- }
-
- public void generateJavaFile(int fileType, YangNode curNode) throws IOException {
- generateEventJavaFile(curNode);
- generateEventListenerJavaFile(curNode);
- generateEventSubjectJavaFile(curNode);
-
- // Close all the file handles.
- freeTemporaryResources(false);
- }
-
- /**
- * Constructs java code exit.
- *
- * @param curNode current YANG node
- * @throws IOException when fails to generate java files
- */
- private void generateEventJavaFile(YangNode curNode)
- throws IOException {
-
- List<String> imports = new ArrayList<>();
-
- imports.add(getJavaImportData().getAbstractEventsImport());
- String curNodeInfo = getCapitalCase(((JavaFileInfoContainer) curNode).getJavaFileInfo().getJavaName());
- String nodeName = curNodeInfo + EVENT_STRING;
-
- addEnumMethod(nodeName, curNodeInfo + EVENT_SUBJECT_NAME_SUFFIX);
-
- //Creates event interface file.
- setEventJavaFileHandle(getJavaFileHandle(curNode, curNodeInfo + EVENT_FILE_NAME_SUFFIX));
- generateEventFile(getEventJavaFileHandle(), curNode, imports);
-
- }
-
- /**
- * Constructs java code exit.
- *
- * @param curNode current YANG node
- * @throws IOException when fails to generate java files
- */
- private void generateEventListenerJavaFile(YangNode curNode)
- throws IOException {
-
- List<String> imports = new ArrayList<>();
-
- imports.add(getJavaImportData().getEventListenerImport());
- String curNodeInfo = getCapitalCase(((JavaFileInfoContainer) curNode)
- .getJavaFileInfo().getJavaName());
-
- // Creates event listener interface file.
- setEventListenerJavaFileHandle(
- getJavaFileHandle(curNode, curNodeInfo + EVENT_LISTENER_FILE_NAME_SUFFIX));
- generateEventListenerFile(getEventListenerJavaFileHandle(), curNode, imports);
-
- }
-
- /**
- * Constructs java code exit.
- *
- * @param curNode current YANG node
- * @throws IOException when fails to generate java files
- */
- private void generateEventSubjectJavaFile(YangNode curNode)
- throws IOException {
-
- String curNodeInfo = getCapitalCase(((JavaFileInfoContainer) curNode)
- .getJavaFileInfo().getJavaName());
-
- //Creates event interface file.
- setEventSubjectJavaFileHandle(getJavaFileHandle(curNode, curNodeInfo +
- EVENT_SUBJECT_NAME_SUFFIX));
- generateEventSubjectFile(getEventSubjectJavaFileHandle(), curNode);
-
- }
-
- /**
- * Returns event enum temp file.
- *
- * @return event enum temp file
- */
- public File getEventEnumTempFileHandle() {
- return eventEnumTempFileHandle;
- }
-
- /**
- * Sets event enum temp file.
- *
- * @param eventEnumTempFileHandle event enum temp file
- */
- private void setEventEnumTempFileHandle(File eventEnumTempFileHandle) {
- this.eventEnumTempFileHandle = eventEnumTempFileHandle;
- }
-
- /**
- * Returns event method temp file.
- *
- * @return event method temp file
- */
- public File getEventMethodTempFileHandle() {
- return eventMethodTempFileHandle;
- }
-
- /**
- * Sets event method temp file.
- *
- * @param eventMethodTempFileHandle event method temp file
- */
- private void setEventMethodTempFileHandle(File eventMethodTempFileHandle) {
- this.eventMethodTempFileHandle = eventMethodTempFileHandle;
- }
-
- /**
- * Returns event subject attribute temp file.
- *
- * @return event subject attribute temp file
- */
- public File getEventSubjectAttributeTempFileHandle() {
- return eventSubjectAttributeTempFileHandle;
- }
-
- /**
- * Sets event subject attribute temp file.
- *
- * @param eventSubjectAttributeTempFileHandle event subject attribute temp file
- */
- private void setEventSubjectAttributeTempFileHandle(File eventSubjectAttributeTempFileHandle) {
- this.eventSubjectAttributeTempFileHandle = eventSubjectAttributeTempFileHandle;
- }
-
- /**
- * Returns event subject getter temp file.
- *
- * @return event subject getter temp file
- */
- public File getEventSubjectGetterTempFileHandle() {
- return eventSubjectGetterTempFileHandle;
- }
-
- /**
- * Sets event subject getter temp file.
- *
- * @param eventSubjectGetterTempFileHandle event subject getter temp file
- */
- private void setEventSubjectGetterTempFileHandle(File eventSubjectGetterTempFileHandle) {
- this.eventSubjectGetterTempFileHandle = eventSubjectGetterTempFileHandle;
- }
-
- /**
- * Returns event subject setter temp file.
- *
- * @return event subject setter temp file
- */
- public File getEventSubjectSetterTempFileHandle() {
- return eventSubjectSetterTempFileHandle;
- }
-
- /**
- * Sets event subject setter temp file.
- *
- * @param eventSubjectSetterTempFileHandle event subject setter temp file
- */
- private void setEventSubjectSetterTempFileHandle(File eventSubjectSetterTempFileHandle) {
- this.eventSubjectSetterTempFileHandle = eventSubjectSetterTempFileHandle;
- }
-
- /**
- * Adds java snippet for events to event subject file.
- *
- * @param curNode current node
- * @param pluginConfig plugin configurations
- * @throws IOException when fails to do IO operations
- */
- void addJavaSnippetOfEvent(YangNode curNode, YangPluginConfig pluginConfig)
- throws IOException {
-
- String currentInfo = getCapitalCase(getCamelCase(curNode.getName(),
- pluginConfig.getConflictResolver()));
- String notificationName = curNode.getName();
-
- JavaQualifiedTypeInfoTranslator qualifiedTypeInfo = getQualifiedTypeInfoOfCurNode(curNode,
- getCapitalCase(currentInfo));
-
- JavaAttributeInfo javaAttributeInfo = getAttributeInfoForTheData(qualifiedTypeInfo, getSmallCase(currentInfo),
- null, false, false);
-
- /*Adds java info for event in respective temp files.*/
- addEventEnum(notificationName, pluginConfig);
- addEventSubjectAttribute(javaAttributeInfo, pluginConfig);
- addEventSubjectGetter(javaAttributeInfo, pluginConfig);
- addEventSubjectSetter(javaAttributeInfo, pluginConfig, currentInfo);
- }
-
- /*Adds event to enum temp file.*/
- private void addEventEnum(String notificationName, YangPluginConfig pluginConfig)
- throws IOException {
- appendToFile(getEventEnumTempFileHandle(),
- getJavaDoc(ENUM_ATTRIBUTE, notificationName, false, pluginConfig) + FOUR_SPACE_INDENTATION
- + getEnumJavaAttribute(notificationName).toUpperCase() + COMMA + NEW_LINE);
- }
-
- /*Adds event method in event class*/
- private void addEnumMethod(String eventClassname, String className)
- throws IOException {
- appendToFile(getEventMethodTempFileHandle(), getEventFileContents(eventClassname, className));
- }
-
- /*Adds events to event subject file.*/
- private void addEventSubjectAttribute(JavaAttributeInfo attr, YangPluginConfig pluginConfig)
- throws IOException {
- appendToFile(getEventSubjectAttributeTempFileHandle(),
- FOUR_SPACE_INDENTATION + parseAttribute(attr, pluginConfig));
- }
-
- /*Adds getter method for event in event subject class.*/
- private void addEventSubjectGetter(JavaAttributeInfo attr, YangPluginConfig pluginConfig)
- throws IOException {
- appendToFile(getEventSubjectGetterTempFileHandle(),
- getJavaDoc(GETTER_METHOD, getCapitalCase(attr.getAttributeName()), false, pluginConfig)
- + getGetterForClass(attr, GENERATE_EVENT_SUBJECT_CLASS) + NEW_LINE);
- }
-
- /*Adds setter method for event in event subject class.*/
- private void addEventSubjectSetter(JavaAttributeInfo attr, YangPluginConfig pluginConfig, String className)
- throws IOException {
- appendToFile(getEventSubjectSetterTempFileHandle(),
- getJavaDoc(MANAGER_SETTER_METHOD, getCapitalCase(attr.getAttributeName()), false, pluginConfig)
- + getSetterForClass(attr, className, GENERATE_EVENT_SUBJECT_CLASS) + NEW_LINE);
- }
-
- /**
- * Returns a temporary file handle for the event's file type.
- *
- * @param name file name
- * @return temporary file handle
- * @throws IOException when fails to create new file handle
- */
- private File getJavaFileHandle(YangNode curNode, String name)
- throws IOException {
-
- JavaFileInfo parentInfo = ((JavaFileInfoContainer) curNode).getJavaFileInfo();
- return getFileObject(getDirPath(parentInfo), name, JAVA_FILE_EXTENSION,
- parentInfo);
- }
-
- /**
- * Returns the directory path.
- *
- * @return directory path
- */
- private String getDirPath(JavaFileInfo parentInfo) {
- return (parentInfo.getPackageFilePath() + SLASH + parentInfo.getJavaName()).toLowerCase();
- }
-
- /**
- * Removes all temporary file handles.
- *
- * @param isErrorOccurred flag to tell translator that error has occurred while file generation
- * @throws IOException when failed to delete the temporary files
- */
- @Override
- public void freeTemporaryResources(boolean isErrorOccurred)
- throws IOException {
-
- closeFile(getEventJavaFileHandle(), isErrorOccurred);
- closeFile(getEventListenerJavaFileHandle(), isErrorOccurred);
- closeFile(getEventSubjectJavaFileHandle(), isErrorOccurred);
-
- closeFile(getEventEnumTempFileHandle(), true);
- closeFile(getEventSubjectAttributeTempFileHandle(), true);
- closeFile(getEventMethodTempFileHandle(), true);
- closeFile(getEventSubjectGetterTempFileHandle(), true);
- closeFile(getEventSubjectSetterTempFileHandle(), true);
-
- super.freeTemporaryResources(isErrorOccurred);
-
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaFragmentFiles.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaFragmentFiles.java
deleted file mode 100644
index d5701ed..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaFragmentFiles.java
+++ /dev/null
@@ -1,1811 +0,0 @@
-/*
- * 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.translator.tojava;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-
-import org.onosproject.yangutils.datamodel.YangAugmentableNode;
-import org.onosproject.yangutils.datamodel.YangCase;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangLeafList;
-import org.onosproject.yangutils.datamodel.YangLeavesHolder;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.javamodel.JavaLeafInfoContainer;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaGroupingTranslator;
-import org.onosproject.yangutils.translator.tojava.utils.JavaExtendsListHolder;
-
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.getParentNodeInGenCode;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.BUILDER_CLASS_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.BUILDER_INTERFACE_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.DEFAULT_CLASS_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_ENUM_CLASS;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_SERVICE_AND_MANAGER;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_TYPE_CLASS;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.INTERFACE_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.ADD_TO_LIST_IMPL_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.ADD_TO_LIST_INTERFACE_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.ATTRIBUTES_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.EQUALS_IMPL_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.FROM_STRING_IMPL_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.GETTER_FOR_CLASS_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.GETTER_FOR_INTERFACE_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.HASH_CODE_IMPL_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.LEAF_IDENTIFIER_ENUM_ATTRIBUTES_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.SETTER_FOR_CLASS_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.SETTER_FOR_INTERFACE_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.TO_STRING_IMPL_MASK;
-import static org.onosproject.yangutils.translator.tojava.JavaAttributeInfo.getAttributeInfoForTheData;
-import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator.getQualifiedInfoOfFromString;
-import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator.getQualifiedTypeInfoOfCurNode;
-import static org.onosproject.yangutils.translator.tojava.javamodel.AttributesJavaDataType.updateJavaFileInfo;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaCodeSnippetGen.generateEnumAttributeString;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaCodeSnippetGen.getJavaAttributeDefinition;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaCodeSnippetGen.getJavaClassDefClose;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaCodeSnippetGen.sortImports;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGenerator.generateBuilderClassFile;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGenerator.generateBuilderInterfaceFile;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGenerator.generateDefaultClassFile;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGenerator.generateInterfaceFile;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGeneratorUtils.getFileObject;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.createPackage;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getAddToListMethodImpl;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getAddToListMethodInterface;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getBuildString;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getDefaultConstructorString;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getEqualsMethod;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getFromStringMethod;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getGetterForClass;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getGetterString;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getHashCodeMethod;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getOverRideString;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getSetterForClass;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getSetterString;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getToStringMethod;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.parseBuilderInterfaceBuildMethodString;
-import static org.onosproject.yangutils.utils.UtilConstants.ARRAY_LIST_IMPORT;
-import static org.onosproject.yangutils.utils.UtilConstants.BUILDER;
-import static org.onosproject.yangutils.utils.UtilConstants.DEFAULT;
-import static org.onosproject.yangutils.utils.UtilConstants.EMPTY_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.FOUR_SPACE_INDENTATION;
-import static org.onosproject.yangutils.utils.UtilConstants.IMPORT;
-import static org.onosproject.yangutils.utils.UtilConstants.INTERFACE;
-import static org.onosproject.yangutils.utils.UtilConstants.INVOCATION_TARGET_EXCEPTION_IMPORT;
-import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE;
-import static org.onosproject.yangutils.utils.UtilConstants.OP_PARAM;
-import static org.onosproject.yangutils.utils.UtilConstants.PERIOD;
-import static org.onosproject.yangutils.utils.UtilConstants.PRIVATE;
-import static org.onosproject.yangutils.utils.UtilConstants.PROTECTED;
-import static org.onosproject.yangutils.utils.UtilConstants.SEMI_COLAN;
-import static org.onosproject.yangutils.utils.UtilConstants.SERVICE;
-import static org.onosproject.yangutils.utils.UtilConstants.SLASH;
-import static org.onosproject.yangutils.utils.io.impl.FileSystemUtil.closeFile;
-import static org.onosproject.yangutils.utils.io.impl.FileSystemUtil.readAppendFile;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.ADD_TO_LIST;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.GETTER_METHOD;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.getJavaDoc;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getAbsolutePackagePath;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCamelCase;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getPackageDirPathFromJavaJPackage;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.insertDataIntoJavaFile;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.mergeJavaFiles;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.validateLineLength;
-
-/**
- * Represents implementation of java code fragments temporary implementations. Manages the common temp file required for
- * Java file(s) generated.
- */
-public class TempJavaFragmentFiles {
-
- /**
- * File type extension for java classes.
- */
- private static final String JAVA_FILE_EXTENSION = ".java";
-
- /**
- * File type extension for temporary classes.
- */
- private static final String TEMP_FILE_EXTENSION = ".tmp";
-
- /**
- * Folder suffix for temporary files folder.
- */
- private static final String TEMP_FOLDER_NAME_SUFFIX = "-Temp";
-
- /**
- * File name for getter method.
- */
- private static final String GETTER_METHOD_FILE_NAME = "GetterMethod";
-
- /**
- * File name for setter method.
- */
- private static final String SETTER_METHOD_FILE_NAME = "SetterMethod";
-
- /**
- * File name for getter method implementation.
- */
- private static final String GETTER_METHOD_IMPL_FILE_NAME = "GetterMethodImpl";
-
- /**
- * File name for setter method implementation.
- */
- private static final String SETTER_METHOD_IMPL_FILE_NAME = "SetterMethodImpl";
-
- /**
- * File name for attributes.
- */
- private static final String ATTRIBUTE_FILE_NAME = "Attributes";
-
- /**
- * File name for to string method.
- */
- private static final String TO_STRING_METHOD_FILE_NAME = "ToString";
-
- /**
- * File name for hash code method.
- */
- private static final String HASH_CODE_METHOD_FILE_NAME = "HashCode";
-
- /**
- * File name for equals method.
- */
- private static final String EQUALS_METHOD_FILE_NAME = "Equals";
-
- /**
- * File name for from string method.
- */
- private static final String FROM_STRING_METHOD_FILE_NAME = "FromString";
-
- /**
- * File name for from add to list interface method.
- */
- private static final String ADD_TO_LIST_INTERFACE_METHOD_FILE_NAME = "addToList";
-
- /**
- * File name for from add to list impl method.
- */
- private static final String ADD_TO_LIST_IMPL_METHOD_FILE_NAME = "addToListImpl";
-
- /**
- * File name for from leaf identifier attributes.
- */
- private static final String LEAF_IDENTIFIER_ATTRIBUTES_FILE_NAME = "leafIdentifierAtr";
-
- /**
- * File name for interface java file name suffix.
- */
- private static final String INTERFACE_FILE_NAME_SUFFIX = EMPTY_STRING;
-
- /**
- * File name for builder interface file name suffix.
- */
- private static final String BUILDER_INTERFACE_FILE_NAME_SUFFIX = BUILDER + INTERFACE;
-
- /**
- * File name for builder class file name suffix.
- */
- private static final String BUILDER_CLASS_FILE_NAME_SUFFIX = BUILDER;
-
- /**
- * Information about the java files being generated.
- */
- private JavaFileInfo javaFileInfo;
-
- /**
- * Imported class info.
- */
- private JavaImportData javaImportData;
-
- /**
- * The variable which guides the types of temporary files generated using the temporary generated file types mask.
- */
- private int generatedTempFiles;
-
- /**
- * Absolute path where the target java file needs to be generated.
- */
- private String absoluteDirPath;
-
- /**
- * Contains all the interface(s)/class name which will be extended by generated files.
- */
- private JavaExtendsListHolder javaExtendsListHolder;
-
- /**
- * Java file handle for interface file.
- */
- private File interfaceJavaFileHandle;
-
- /**
- * Java file handle for builder interface file.
- */
- private File builderInterfaceJavaFileHandle;
-
- /**
- * Java file handle for builder class file.
- */
- private File builderClassJavaFileHandle;
-
- /**
- * Java file handle for impl class file.
- */
- private File implClassJavaFileHandle;
-
- /**
- * Temporary file handle for attribute.
- */
- private File attributesTempFileHandle;
-
- /**
- * Temporary file handle for getter of interface.
- */
- private File getterInterfaceTempFileHandle;
-
- /**
- * Temporary file handle for setter of interface.
- */
- private File setterInterfaceTempFileHandle;
-
- /**
- * Temporary file handle for getter of class.
- */
- private File getterImplTempFileHandle;
-
- /**
- * Temporary file handle for setter of class.
- */
- private File setterImplTempFileHandle;
-
- /**
- * Temporary file handle for hash code method of class.
- */
- private File hashCodeImplTempFileHandle;
-
- /**
- * Temporary file handle for equals method of class.
- */
- private File equalsImplTempFileHandle;
-
- /**
- * Temporary file handle for to string method of class.
- */
- private File toStringImplTempFileHandle;
-
- /**
- * Temporary file handle for from string method of class.
- */
- private File fromStringImplTempFileHandle;
-
- /**
- * Temporary file handle for add to list interface method of class.
- */
- private File addToListInterfaceTempFileHandle;
-
- /**
- * Temporary file handle for add to list impl method of class.
- */
- private File addToListImplTempFileHandle;
-
- /**
- * Temporary file handle for leaf id attributes of enum.
- */
- private File leafIdAttributeTempFileHandle;
-
- /**
- * Import info for case.
- */
- private JavaQualifiedTypeInfoTranslator caseImportInfo;
-
- /**
- * Leaf count.
- */
- private int leafCount = 0;
-
- /**
- * If current node is root node.
- */
- private boolean isRooNode;
-
- /**
- * Is attribute added.
- */
- private boolean isAttributePresent;
-
- TempJavaFragmentFiles() {
- }
-
- /**
- * Creates an instance of temporary java code fragment.
- *
- * @param javaFileInfo generated java file information
- * @throws IOException when fails to create new file handle
- */
- TempJavaFragmentFiles(JavaFileInfo javaFileInfo)
- throws IOException {
- setJavaExtendsListHolder(new JavaExtendsListHolder());
- setJavaImportData(new JavaImportData());
- setJavaFileInfo(javaFileInfo);
- setAbsoluteDirPath(getAbsolutePackagePath(getJavaFileInfo().getBaseCodeGenPath(),
- getJavaFileInfo().getPackageFilePath()));
-
- /*
- * Initialize getter when generation file type matches to interface
- * mask.
- */
- if ((getGeneratedJavaFiles() & INTERFACE_MASK) != 0) {
- addGeneratedTempFile(GETTER_FOR_INTERFACE_MASK);
- addGeneratedTempFile(ADD_TO_LIST_INTERFACE_MASK);
- addGeneratedTempFile(LEAF_IDENTIFIER_ENUM_ATTRIBUTES_MASK);
- }
-
- /*
- * Initialize getter and setter when generation file type matches to
- * builder interface mask.
- */
- if ((getGeneratedJavaFiles() & BUILDER_INTERFACE_MASK) != 0) {
- addGeneratedTempFile(GETTER_FOR_INTERFACE_MASK);
- addGeneratedTempFile(SETTER_FOR_INTERFACE_MASK);
- }
-
- /*
- * Initialize getterImpl, setterImpl and attributes when generation file
- * type matches to builder class mask.
- */
- if ((getGeneratedJavaFiles() & BUILDER_CLASS_MASK) != 0) {
- addGeneratedTempFile(ATTRIBUTES_MASK);
- addGeneratedTempFile(GETTER_FOR_CLASS_MASK);
- addGeneratedTempFile(SETTER_FOR_CLASS_MASK);
- }
-
- /*
- * Initialize getterImpl, attributes, constructor, hash code, equals and
- * to strings when generation file type matches to impl class mask.
- */
- if ((getGeneratedJavaFiles() & DEFAULT_CLASS_MASK) != 0) {
- addGeneratedTempFile(ATTRIBUTES_MASK);
- addGeneratedTempFile(GETTER_FOR_CLASS_MASK);
- addGeneratedTempFile(HASH_CODE_IMPL_MASK);
- addGeneratedTempFile(EQUALS_IMPL_MASK);
- addGeneratedTempFile(TO_STRING_IMPL_MASK);
- addGeneratedTempFile(ADD_TO_LIST_IMPL_MASK);
- }
-
- /*
- * Initialize temp files to generate type class.
- */
- if ((getGeneratedJavaFiles() & GENERATE_TYPE_CLASS) != 0) {
- addGeneratedTempFile(ATTRIBUTES_MASK);
- addGeneratedTempFile(GETTER_FOR_CLASS_MASK);
- addGeneratedTempFile(HASH_CODE_IMPL_MASK);
- addGeneratedTempFile(EQUALS_IMPL_MASK);
- addGeneratedTempFile(TO_STRING_IMPL_MASK);
- addGeneratedTempFile(FROM_STRING_IMPL_MASK);
- }
-
- /*
- * Initialize temp files to generate enum class.
- */
- if ((getGeneratedJavaFiles() & GENERATE_ENUM_CLASS) != 0) {
- addGeneratedTempFile(FROM_STRING_IMPL_MASK);
- }
-
- /*
- * Set temporary file handles.
- */
- if ((getGeneratedTempFiles() & ATTRIBUTES_MASK) != 0) {
- setAttributesTempFileHandle(getTemporaryFileHandle(ATTRIBUTE_FILE_NAME));
- }
- if ((getGeneratedTempFiles() & GETTER_FOR_INTERFACE_MASK) != 0) {
- setGetterInterfaceTempFileHandle(getTemporaryFileHandle(GETTER_METHOD_FILE_NAME));
- }
- if ((getGeneratedTempFiles() & SETTER_FOR_INTERFACE_MASK) != 0) {
- setSetterInterfaceTempFileHandle(getTemporaryFileHandle(SETTER_METHOD_FILE_NAME));
- }
- if ((getGeneratedTempFiles() & GETTER_FOR_CLASS_MASK) != 0) {
- setGetterImplTempFileHandle(getTemporaryFileHandle(GETTER_METHOD_IMPL_FILE_NAME));
- }
- if ((getGeneratedTempFiles() & SETTER_FOR_CLASS_MASK) != 0) {
- setSetterImplTempFileHandle(getTemporaryFileHandle(SETTER_METHOD_IMPL_FILE_NAME));
- }
- if ((getGeneratedTempFiles() & HASH_CODE_IMPL_MASK) != 0) {
- setHashCodeImplTempFileHandle(getTemporaryFileHandle(HASH_CODE_METHOD_FILE_NAME));
- }
- if ((getGeneratedTempFiles() & EQUALS_IMPL_MASK) != 0) {
- setEqualsImplTempFileHandle(getTemporaryFileHandle(EQUALS_METHOD_FILE_NAME));
- }
- if ((getGeneratedTempFiles() & TO_STRING_IMPL_MASK) != 0) {
- setToStringImplTempFileHandle(getTemporaryFileHandle(TO_STRING_METHOD_FILE_NAME));
- }
- if ((getGeneratedTempFiles() & FROM_STRING_IMPL_MASK) != 0) {
- setFromStringImplTempFileHandle(getTemporaryFileHandle(FROM_STRING_METHOD_FILE_NAME));
- }
- if ((getGeneratedTempFiles() & ADD_TO_LIST_INTERFACE_MASK) != 0) {
- setAddToListInterfaceTempFileHandle(getTemporaryFileHandle(ADD_TO_LIST_INTERFACE_METHOD_FILE_NAME));
- }
- if ((getGeneratedTempFiles() & ADD_TO_LIST_IMPL_MASK) != 0) {
- setAddToListImplTempFileHandle(getTemporaryFileHandle(ADD_TO_LIST_IMPL_METHOD_FILE_NAME));
- }
- if ((getGeneratedTempFiles() & LEAF_IDENTIFIER_ENUM_ATTRIBUTES_MASK) != 0) {
- setLeafIdAttributeTempFileHandle(getTemporaryFileHandle(LEAF_IDENTIFIER_ATTRIBUTES_FILE_NAME));
- }
- }
-
- /**
- * Adds current node info as and attribute to the parent generated file.
- *
- * @param curNode current node which needs to be added as an attribute in the parent generated code
- * @param isList is list construct
- * @param pluginConfig plugin configurations
- * @throws IOException IO operation exception
- */
- static void addCurNodeInfoInParentTempFile(YangNode curNode,
- boolean isList, YangPluginConfig pluginConfig)
- throws IOException {
- YangNode parent = getParentNodeInGenCode(curNode);
- if (!(parent instanceof JavaCodeGenerator)) {
- throw new TranslatorException("missing parent node to contain current node info in generated file");
- }
-
- if (parent instanceof YangJavaGroupingTranslator) {
- /*
- * In case of grouping, there is no need to add the information, it
- * will be taken care in uses
- */
- return;
- }
- TempJavaBeanFragmentFiles tempJavaBeanFragmentFiles = ((JavaCodeGeneratorInfo) parent)
- .getTempJavaCodeFragmentFiles().getBeanTempFiles();
-
- JavaAttributeInfo javaAttributeInfo = getCurNodeAsAttributeInTarget(curNode,
- parent, isList, tempJavaBeanFragmentFiles);
- tempJavaBeanFragmentFiles.addJavaSnippetInfoToApplicableTempFiles(javaAttributeInfo, pluginConfig);
- }
-
- /**
- * Creates an attribute info object corresponding to a data model node and return it.
- *
- * @param curNode current data model node for which the java code generation is being handled
- * @param targetNode target node in which the current node is an attribute
- * @param isListNode is the current added attribute needs to be a list
- * @param tempJavaFragmentFiles temp java fragment files
- * @return AttributeInfo attribute details required to add in temporary files
- */
- public static JavaAttributeInfo getCurNodeAsAttributeInTarget(YangNode curNode,
- YangNode targetNode, boolean isListNode,
- TempJavaFragmentFiles tempJavaFragmentFiles) {
- String curNodeName = ((JavaFileInfoContainer) curNode).getJavaFileInfo().getJavaName();
- if (curNodeName == null) {
- updateJavaFileInfo(curNode, null);
- curNodeName = ((JavaFileInfoContainer) curNode).getJavaFileInfo().getJavaName();
- }
-
- /*
- * Get the import info corresponding to the attribute for import in
- * generated java files or qualified access
- */
- JavaQualifiedTypeInfoTranslator qualifiedTypeInfo = getQualifiedTypeInfoOfCurNode(curNode,
- getCapitalCase(curNodeName));
- if (!(targetNode instanceof TempJavaCodeFragmentFilesContainer)) {
- throw new TranslatorException("Parent node does not have file info");
- }
- JavaImportData parentImportData = tempJavaFragmentFiles.getJavaImportData();
- JavaFileInfo fileInfo = ((JavaFileInfoContainer) targetNode).getJavaFileInfo();
-
- boolean isQualified;
- if ((tempJavaFragmentFiles instanceof TempJavaServiceFragmentFiles)
- && (qualifiedTypeInfo.getClassInfo().contentEquals(SERVICE))
- || qualifiedTypeInfo.getClassInfo().contentEquals(getCapitalCase(fileInfo.getJavaName() + SERVICE))) {
-
- isQualified = true;
- } else {
- String className;
- if (tempJavaFragmentFiles instanceof TempJavaServiceFragmentFiles) {
- className = getCapitalCase(fileInfo.getJavaName()) + SERVICE;
- } else {
- className = getCapitalCase(fileInfo.getJavaName());
- }
-
- isQualified = parentImportData.addImportInfo(qualifiedTypeInfo,
- className, fileInfo.getPackage());
- }
-
- if (isListNode) {
- parentImportData.setIfListImported(true);
- }
-
- return getAttributeInfoForTheData(qualifiedTypeInfo, curNodeName, null, isQualified, isListNode);
- }
-
- /**
- * Returns java attribute for leaf.
- *
- * @param tempJavaFragmentFiles temporary generated file
- * @param leaf YANG leaf
- * @param yangPluginConfig plugin configurations
- * @return java attribute for leaf
- */
- public static JavaAttributeInfo getJavaAttributeOfLeaf(TempJavaFragmentFiles tempJavaFragmentFiles, YangLeaf leaf,
- YangPluginConfig yangPluginConfig) {
- JavaLeafInfoContainer javaLeaf = (JavaLeafInfoContainer) leaf;
- javaLeaf.setConflictResolveConfig(yangPluginConfig.getConflictResolver());
- javaLeaf.updateJavaQualifiedInfo();
- return getAttributeInfoForTheData(
- javaLeaf.getJavaQualifiedInfo(),
- javaLeaf.getJavaName(yangPluginConfig.getConflictResolver()),
- javaLeaf.getDataType(),
- tempJavaFragmentFiles.getIsQualifiedAccessOrAddToImportList(javaLeaf.getJavaQualifiedInfo()),
- false);
- }
-
- /**
- * Returns java attribute for leaf-list.
- *
- * @param tempJavaFragmentFiles temporary generated file
- * @param leafList YANG leaf-list
- * @param yangPluginConfig plugin configurations
- * @return java attribute for leaf-list
- */
- public static JavaAttributeInfo getJavaAttributeOfLeafList(TempJavaFragmentFiles tempJavaFragmentFiles,
- YangLeafList leafList,
- YangPluginConfig yangPluginConfig) {
- JavaLeafInfoContainer javaLeaf = (JavaLeafInfoContainer) leafList;
- javaLeaf.setConflictResolveConfig(yangPluginConfig.getConflictResolver());
- javaLeaf.updateJavaQualifiedInfo();
- tempJavaFragmentFiles.getJavaImportData().setIfListImported(true);
- return getAttributeInfoForTheData(
- javaLeaf.getJavaQualifiedInfo(),
- javaLeaf.getJavaName(yangPluginConfig.getConflictResolver()),
- javaLeaf.getDataType(),
- tempJavaFragmentFiles.getIsQualifiedAccessOrAddToImportList(javaLeaf.getJavaQualifiedInfo()),
- true);
- }
-
- /*
- * Retrieves the absolute path where the file needs to be generated.
- *
- * @return absolute path where the file needs to be generated
- */
- private String getAbsoluteDirPath() {
- return absoluteDirPath;
- }
-
- /**
- * Sets absolute path where the file needs to be generated.
- *
- * @param absoluteDirPath absolute path where the file needs to be generated.
- */
- void setAbsoluteDirPath(String absoluteDirPath) {
- this.absoluteDirPath = absoluteDirPath;
- }
-
- /**
- * Retrieves the generated java file information.
- *
- * @return generated java file information
- */
- public JavaFileInfo getJavaFileInfo() {
- return javaFileInfo;
- }
-
- /**
- * Sets the generated java file information.
- *
- * @param javaFileInfo generated java file information
- */
- public void setJavaFileInfo(JavaFileInfo javaFileInfo) {
- this.javaFileInfo = javaFileInfo;
- }
-
- /**
- * Retrieves the generated temp files.
- *
- * @return generated temp files
- */
- int getGeneratedTempFiles() {
- return generatedTempFiles;
- }
-
- /**
- * Sets generated file files.
- *
- * @param fileType generated file type
- */
- private void setGeneratedTempFiles(int fileType) {
- generatedTempFiles = fileType;
- }
-
- /**
- * Adds to generated temporary files.
- *
- * @param generatedTempFile generated file
- */
- void addGeneratedTempFile(int generatedTempFile) {
- generatedTempFiles |= generatedTempFile;
- setGeneratedTempFiles(generatedTempFiles);
- }
-
- /**
- * Retrieves the generated Java files.
- *
- * @return generated Java files
- */
- int getGeneratedJavaFiles() {
- return getJavaFileInfo().getGeneratedFileTypes();
- }
-
- /**
- * Retrieves the mapped Java class name.
- *
- * @return mapped Java class name
- */
- String getGeneratedJavaClassName() {
- return getCapitalCase(getJavaFileInfo().getJavaName());
- }
-
- /**
- * Retrieves the import data for the generated Java file.
- *
- * @return import data for the generated Java file
- */
- public JavaImportData getJavaImportData() {
- return javaImportData;
- }
-
- /**
- * Sets import data for the generated Java file.
- *
- * @param javaImportData import data for the generated Java file
- */
- void setJavaImportData(JavaImportData javaImportData) {
- this.javaImportData = javaImportData;
- }
-
- /**
- * Retrieves the status of any attributes added.
- *
- * @return status of any attributes added
- */
- boolean isAttributePresent() {
- return isAttributePresent;
- }
-
- /**
- * Sets status of any attributes added.
- *
- * @param attributePresent status of any attributes added
- */
- private void setAttributePresent(boolean attributePresent) {
- isAttributePresent = attributePresent;
- }
-
- /**
- * Returns getter methods's temporary file handle.
- *
- * @return temporary file handle
- */
- public File getGetterInterfaceTempFileHandle() {
- return getterInterfaceTempFileHandle;
- }
-
- /**
- * Sets to getter method's temporary file handle.
- *
- * @param getterForInterface file handle for to getter method
- */
- private void setGetterInterfaceTempFileHandle(File getterForInterface) {
- getterInterfaceTempFileHandle = getterForInterface;
- }
-
- /**
- * Returns setter method's temporary file handle.
- *
- * @return temporary file handle
- */
- public File getSetterInterfaceTempFileHandle() {
- return setterInterfaceTempFileHandle;
- }
-
- /**
- * Sets to setter method's temporary file handle.
- *
- * @param setterForInterface file handle for to setter method
- */
- private void setSetterInterfaceTempFileHandle(File setterForInterface) {
- setterInterfaceTempFileHandle = setterForInterface;
- }
-
- /**
- * Returns setter method's impl's temporary file handle.
- *
- * @return temporary file handle
- */
- public File getSetterImplTempFileHandle() {
- return setterImplTempFileHandle;
- }
-
- /**
- * Sets to setter method's impl's temporary file handle.
- *
- * @param setterImpl file handle for to setter method's implementation class
- */
- private void setSetterImplTempFileHandle(File setterImpl) {
- setterImplTempFileHandle = setterImpl;
- }
-
- /**
- * Returns from string method's temporary file handle.
- *
- * @return from string method's temporary file handle
- */
- public File getFromStringImplTempFileHandle() {
- return fromStringImplTempFileHandle;
- }
-
- /**
- * Sets from string method's temporary file handle.
- *
- * @param fromStringImplTempFileHandle from string method's temporary file handle
- */
- private void setFromStringImplTempFileHandle(File fromStringImplTempFileHandle) {
- this.fromStringImplTempFileHandle = fromStringImplTempFileHandle;
- }
-
- /**
- * Returns java file handle for interface file.
- *
- * @return java file handle for interface file
- */
- private File getInterfaceJavaFileHandle() {
- return interfaceJavaFileHandle;
- }
-
- /**
- * Sets the java file handle for interface file.
- *
- * @param interfaceJavaFileHandle java file handle
- */
- private void setInterfaceJavaFileHandle(File interfaceJavaFileHandle) {
- this.interfaceJavaFileHandle = interfaceJavaFileHandle;
- }
-
- /**
- * Returns java file handle for builder interface file.
- *
- * @return java file handle for builder interface file
- */
- private File getBuilderInterfaceJavaFileHandle() {
- return builderInterfaceJavaFileHandle;
- }
-
- /**
- * Sets the java file handle for builder interface file.
- *
- * @param builderInterfaceJavaFileHandle java file handle
- */
- private void setBuilderInterfaceJavaFileHandle(File builderInterfaceJavaFileHandle) {
- this.builderInterfaceJavaFileHandle = builderInterfaceJavaFileHandle;
- }
-
- /**
- * Returns java file handle for builder class file.
- *
- * @return java file handle for builder class file
- */
- private File getBuilderClassJavaFileHandle() {
- return builderClassJavaFileHandle;
- }
-
- /**
- * Sets the java file handle for builder class file.
- *
- * @param builderClassJavaFileHandle java file handle
- */
- private void setBuilderClassJavaFileHandle(File builderClassJavaFileHandle) {
- this.builderClassJavaFileHandle = builderClassJavaFileHandle;
- }
-
- /**
- * Returns java file handle for impl class file.
- *
- * @return java file handle for impl class file
- */
- private File getImplClassJavaFileHandle() {
- return implClassJavaFileHandle;
- }
-
- /**
- * Sets the java file handle for impl class file.
- *
- * @param implClassJavaFileHandle java file handle
- */
- private void setImplClassJavaFileHandle(File implClassJavaFileHandle) {
- this.implClassJavaFileHandle = implClassJavaFileHandle;
- }
-
- /**
- * Returns attribute's temporary file handle.
- *
- * @return temporary file handle
- */
- public File getAttributesTempFileHandle() {
- return attributesTempFileHandle;
- }
-
- /**
- * Sets attribute's temporary file handle.
- *
- * @param attributeForClass file handle for attribute
- */
- private void setAttributesTempFileHandle(File attributeForClass) {
- attributesTempFileHandle = attributeForClass;
- }
-
- /**
- * Returns getter method's impl's temporary file handle.
- *
- * @return temporary file handle
- */
- public File getGetterImplTempFileHandle() {
- return getterImplTempFileHandle;
- }
-
- /**
- * Sets to getter method's impl's temporary file handle.
- *
- * @param getterImpl file handle for to getter method's impl
- */
- private void setGetterImplTempFileHandle(File getterImpl) {
- getterImplTempFileHandle = getterImpl;
- }
-
- /**
- * Returns hash code method's temporary file handle.
- *
- * @return temporary file handle
- */
- public File getHashCodeImplTempFileHandle() {
- return hashCodeImplTempFileHandle;
- }
-
- /**
- * Sets hash code method's temporary file handle.
- *
- * @param hashCodeMethod file handle for hash code method
- */
- private void setHashCodeImplTempFileHandle(File hashCodeMethod) {
- hashCodeImplTempFileHandle = hashCodeMethod;
- }
-
- /**
- * Returns equals method's temporary file handle.
- *
- * @return temporary file handle
- */
- public File getEqualsImplTempFileHandle() {
- return equalsImplTempFileHandle;
- }
-
- /**
- * Sets equals method's temporary file handle.
- *
- * @param equalsMethod file handle for to equals method
- */
- private void setEqualsImplTempFileHandle(File equalsMethod) {
- equalsImplTempFileHandle = equalsMethod;
- }
-
- /**
- * Returns to string method's temporary file handle.
- *
- * @return temporary file handle
- */
- public File getToStringImplTempFileHandle() {
- return toStringImplTempFileHandle;
- }
-
- /**
- * Sets to string method's temporary file handle.
- *
- * @param toStringMethod file handle for to string method
- */
- private void setToStringImplTempFileHandle(File toStringMethod) {
- toStringImplTempFileHandle = toStringMethod;
- }
-
- /**
- * Returns java extends list holder.
- *
- * @return java extends list holder
- */
- public JavaExtendsListHolder getJavaExtendsListHolder() {
- return javaExtendsListHolder;
- }
-
- /**
- * Sets java extends list holder.
- *
- * @param javaExtendsListHolder java extends list holder
- */
- void setJavaExtendsListHolder(JavaExtendsListHolder javaExtendsListHolder) {
- this.javaExtendsListHolder = javaExtendsListHolder;
- }
-
- /**
- * Adds attribute for class.
- *
- * @param attr attribute info
- * @param yangPluginConfig plugin configurations
- * @throws IOException when fails to append to temporary file
- */
- private void addAttribute(JavaAttributeInfo attr, YangPluginConfig yangPluginConfig)
- throws IOException {
- appendToFile(getAttributesTempFileHandle(), parseAttribute(attr, yangPluginConfig)
- + FOUR_SPACE_INDENTATION);
- }
-
- /**
- * Adds getter for interface.
- *
- * @param attr attribute info
- * @param pluginConfig plugin configurations
- * @throws IOException when fails to append to temporary file
- */
- private void addGetterForInterface(JavaAttributeInfo attr, YangPluginConfig pluginConfig)
- throws IOException {
- appendToFile(getGetterInterfaceTempFileHandle(),
- getGetterString(attr, getGeneratedJavaFiles(), pluginConfig) + NEW_LINE);
- }
-
- /**
- * Adds setter for interface.
- *
- * @param attr attribute info
- * @param pluginConfig plugin configurations
- * @throws IOException when fails to append to temporary file
- */
- private void addSetterForInterface(JavaAttributeInfo attr, YangPluginConfig pluginConfig)
- throws IOException {
- appendToFile(getSetterInterfaceTempFileHandle(),
- getSetterString(attr, getGeneratedJavaClassName(), getGeneratedJavaFiles(), pluginConfig)
- + NEW_LINE);
- }
-
- /**
- * Adds setter's implementation for class.
- *
- * @param attr attribute info
- * @throws IOException when fails to append to temporary file
- */
- private void addSetterImpl(JavaAttributeInfo attr)
- throws IOException {
- if (isRooNode()) {
- appendToFile(getSetterImplTempFileHandle(),
- getSetterForClass(attr, getGeneratedJavaClassName(), getGeneratedJavaFiles())
- + NEW_LINE);
- } else {
- appendToFile(getSetterImplTempFileHandle(), getOverRideString() +
- getSetterForClass(attr, getGeneratedJavaClassName(), getGeneratedJavaFiles())
- + NEW_LINE);
- }
- }
-
- /**
- * Adds getter method's impl for class.
- *
- * @param attr attribute info
- * @param pluginConfig plugin configurations
- * @throws IOException when fails to append to temporary file
- */
- void addGetterImpl(JavaAttributeInfo attr, YangPluginConfig pluginConfig)
- throws IOException {
- if ((getGeneratedJavaFiles() & BUILDER_CLASS_MASK) != 0
- || (getGeneratedJavaFiles() & GENERATE_SERVICE_AND_MANAGER) != 0) {
- if (!isRooNode()) {
- appendToFile(getGetterImplTempFileHandle(), getOverRideString() + getGetterForClass(attr,
- getGeneratedJavaFiles()) + NEW_LINE);
- } else {
- appendToFile(getGetterImplTempFileHandle(), getGetterForClass(attr,
- getGeneratedJavaFiles()) + NEW_LINE);
- }
- } else {
- appendToFile(getGetterImplTempFileHandle(),
- getJavaDoc(GETTER_METHOD, getCapitalCase(attr.getAttributeName()), false, pluginConfig)
- + getGetterForClass(attr, getGeneratedJavaFiles()) + NEW_LINE);
- }
- }
-
- /**
- * Adds add to list interface method.
- *
- * @param attr attribute
- * @param pluginConfig plugin configurations
- * @throws IOException when fails to do IO operations
- */
- private void addAddToListInterface(JavaAttributeInfo attr, YangPluginConfig pluginConfig) throws IOException {
- appendToFile(getAddToListInterfaceTempFileHandle(),
- getJavaDoc(ADD_TO_LIST, getCapitalCase(attr.getAttributeName()), false, pluginConfig)
- + getAddToListMethodInterface(attr) + NEW_LINE);
- }
-
- /**
- * Adds add to list interface method.
- *
- * @param attr attribute
- * @throws IOException when fails to do IO operations
- */
- private void addAddToListImpl(JavaAttributeInfo attr) throws IOException {
- appendToFile(getAddToListImplTempFileHandle(),
- getAddToListMethodImpl(attr) + NEW_LINE);
- }
-
- /**
- * Adds leaf identifier enum attributes.
- *
- * @param attr attribute
- * @param value value
- * @param yangPluginConfig plugin config
- * @throws IOException when fails to do IO operations
- */
- private void addLeafIdAttributes(JavaAttributeInfo attr, int value, YangPluginConfig yangPluginConfig)
- throws IOException {
- appendToFile(getLeafIdAttributeTempFileHandle(),
- FOUR_SPACE_INDENTATION + generateEnumAttributeString(attr.getAttributeName(),
- value, yangPluginConfig));
- }
-
- /**
- * Adds build method for interface.
- *
- * @param pluginConfig plugin configurations
- * @return build method for interface
- * @throws IOException when fails to append to temporary file
- */
- String addBuildMethodForInterface(YangPluginConfig pluginConfig)
- throws IOException {
- return parseBuilderInterfaceBuildMethodString(getGeneratedJavaClassName(), pluginConfig);
- }
-
- /**
- * Adds build method's implementation for class.
- *
- * @return build method implementation for class
- * @throws IOException when fails to append to temporary file
- */
- String addBuildMethodImpl()
- throws IOException {
- return getBuildString(getGeneratedJavaClassName(), isRooNode()) + NEW_LINE;
- }
-
- /**
- * Adds default constructor for class.
- *
- * @param modifier modifier for constructor.
- * @param toAppend string which need to be appended with the class name
- * @param pluginConfig plugin configurations
- * @param isSuffix is value need to be appended as suffix
- * @return default constructor for class
- * @throws IOException when fails to append to file
- */
- String addDefaultConstructor(String modifier, String toAppend, YangPluginConfig pluginConfig, boolean isSuffix)
- throws IOException {
- String name = getGeneratedJavaClassName();
- if (isRooNode() && !toAppend.equals(BUILDER)) {
- name = name + OP_PARAM;
- return NEW_LINE
- + getDefaultConstructorString(name, modifier,
- pluginConfig);
- }
- if (isSuffix) {
- return NEW_LINE +
- getDefaultConstructorString(name + toAppend, modifier, pluginConfig);
- }
- String appended;
- if (toAppend.equals(DEFAULT)) {
- appended = getCapitalCase(toAppend);
- } else {
- appended = toAppend;
- }
- return NEW_LINE
- + getDefaultConstructorString(appended + name, modifier,
- pluginConfig);
- }
-
- /**
- * Adds hash code method for class.
- *
- * @param attr attribute info
- * @throws IOException when fails to append to temporary file
- */
- private void addHashCodeMethod(JavaAttributeInfo attr)
- throws IOException {
- appendToFile(getHashCodeImplTempFileHandle(), getHashCodeMethod(attr) + NEW_LINE);
- }
-
- /**
- * Adds equals method for class.
- *
- * @param attr attribute info
- * @throws IOException when fails to append to temporary file
- */
- private void addEqualsMethod(JavaAttributeInfo attr)
- throws IOException {
- appendToFile(getEqualsImplTempFileHandle(), getEqualsMethod(attr) + NEW_LINE);
- }
-
- /**
- * Adds ToString method for class.
- *
- * @param attr attribute info
- * @throws IOException when fails to append to temporary file
- */
- private void addToStringMethod(JavaAttributeInfo attr)
- throws IOException {
- appendToFile(getToStringImplTempFileHandle(), getToStringMethod(attr) + NEW_LINE);
- }
-
- /**
- * Adds from string method for union class.
- *
- * @param javaAttributeInfo type attribute info
- * @param fromStringAttributeInfo from string attribute info
- * @throws IOException when fails to append to temporary file
- */
- void addFromStringMethod(JavaAttributeInfo javaAttributeInfo,
- JavaAttributeInfo fromStringAttributeInfo)
- throws IOException {
- appendToFile(getFromStringImplTempFileHandle(), getFromStringMethod(javaAttributeInfo,
- fromStringAttributeInfo) + NEW_LINE);
- }
-
- /**
- * Returns a temporary file handle for the specific file type.
- *
- * @param fileName file name
- * @return temporary file handle
- * @throws IOException when fails to create new file handle
- */
- File getTemporaryFileHandle(String fileName)
- throws IOException {
- String path = getTempDirPath(getAbsoluteDirPath());
- File dir = new File(path);
- boolean isCreated;
- if (!dir.exists()) {
- isCreated = dir.mkdirs();
- if (!isCreated) {
- throw new IOException("failed to create temporary directory for " + fileName);
- }
- }
- File file = new File(path + fileName + TEMP_FILE_EXTENSION);
- if (!file.exists()) {
- isCreated = file.createNewFile();
- if (!isCreated) {
- throw new IOException("failed to create temporary file for " + fileName);
- }
- } else {
- throw new IOException(fileName + " is reused due to YANG naming");
- }
- return file;
- }
-
- /**
- * Returns a temporary file handle for the specific file type.
- *
- * @param fileName file name
- * @return temporary file handle
- * @throws IOException when fails to create new file handle
- */
- File getJavaFileHandle(String fileName)
- throws IOException {
- return getFileObject(getDirPath(), fileName, JAVA_FILE_EXTENSION, getJavaFileInfo());
- }
-
- /**
- * Returns data from the temporary files.
- *
- * @param file temporary file handle
- * @param absolutePath absolute path
- * @return stored data from temporary files
- * @throws IOException when failed to get data from the given file
- */
- public String getTemporaryDataFromFileHandle(File file, String absolutePath)
- throws IOException {
-
- String path = getTempDirPath(absolutePath);
- if (new File(path + file.getName()).exists()) {
- return readAppendFile(path + file.getName(), EMPTY_STRING);
- } else {
- throw new IOException("Unable to get data from the given "
- + file.getName() + " file for " + getGeneratedJavaClassName() + PERIOD);
- }
- }
-
- /**
- * Returns temporary directory path.
- *
- * @param absolutePath absolute path
- * @return directory path
- */
- private String getTempDirPath(String absolutePath) {
- return getPackageDirPathFromJavaJPackage(absolutePath) + SLASH + getGeneratedJavaClassName()
- + TEMP_FOLDER_NAME_SUFFIX + SLASH;
- }
-
- /**
- * Parses attribute to get the attribute string.
- *
- * @param attr attribute info
- * @param pluginConfig plugin configurations
- * @return attribute string
- */
- String parseAttribute(JavaAttributeInfo attr, YangPluginConfig pluginConfig) {
- /*
- * TODO: check if this utility needs to be called or move to the caller
- */
- String attributeName = getCamelCase(attr.getAttributeName(), pluginConfig.getConflictResolver());
- String attributeAccessType = PRIVATE;
- if ((javaFileInfo.getGeneratedFileTypes() & GENERATE_INTERFACE_WITH_BUILDER) != 0) {
- attributeAccessType = PROTECTED;
- }
- if (attr.isQualifiedName()) {
- return getJavaAttributeDefinition(attr.getImportInfo().getPkgInfo(),
- attr.getImportInfo().getClassInfo(),
- attributeName, attr.isListAttr(), attributeAccessType);
- } else {
- return getJavaAttributeDefinition(null, attr.getImportInfo().getClassInfo(), attributeName,
- attr.isListAttr(), attributeAccessType);
- }
- }
-
- /**
- * Appends content to temporary file.
- *
- * @param file temporary file
- * @param data data to be appended
- * @throws IOException when fails to append to file
- */
- void appendToFile(File file, String data)
- throws IOException {
- try {
- insertDataIntoJavaFile(file, data);
- } catch (IOException ex) {
- throw new IOException("failed to write in temp file.");
- }
- }
-
- /**
- * Adds parent's info to current node import list.
- *
- * @param curNode current node for which import list needs to be updated
- * @param pluginConfig plugin configurations
- */
- void addParentInfoInCurNodeTempFile(YangNode curNode, YangPluginConfig pluginConfig) {
- caseImportInfo = new JavaQualifiedTypeInfoTranslator();
- YangNode parent = getParentNodeInGenCode(curNode);
- if (!(parent instanceof JavaCodeGenerator)) {
- throw new TranslatorException("missing parent node to contain current node info in generated file");
- }
- if (!(curNode instanceof JavaFileInfoContainer)) {
- throw new TranslatorException("missing java file information to get the package details "
- + "of attribute corresponding to child node");
- }
- caseImportInfo.setClassInfo(getCapitalCase(getCamelCase(parent.getName(),
- pluginConfig.getConflictResolver())));
- caseImportInfo.setPkgInfo(((JavaFileInfoContainer) parent).getJavaFileInfo().getPackage());
-
- JavaFileInfo fileInfo = ((JavaFileInfoContainer) curNode).getJavaFileInfo();
-
- ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
- .getBeanTempFiles().getJavaImportData().addImportInfo(caseImportInfo,
- getCapitalCase(fileInfo.getJavaName()), fileInfo.getPackage());
- }
-
- /**
- * Adds leaf attributes in generated files.
- *
- * @param listOfLeaves list of YANG leaf
- * @param yangPluginConfig plugin config
- * @param curNode current node
- * @throws IOException IO operation fail
- */
- private void addLeavesInfoToTempFiles(List<YangLeaf> listOfLeaves,
- YangPluginConfig yangPluginConfig, YangNode curNode)
- throws IOException {
- if (listOfLeaves != null) {
- for (YangLeaf leaf : listOfLeaves) {
- if (!(leaf instanceof JavaLeafInfoContainer)) {
- throw new TranslatorException("Leaf does not have java information");
- }
- if (curNode instanceof YangModule || curNode instanceof YangSubModule) {
- TempJavaBeanFragmentFiles tempJavaBeanFragmentFiles = ((JavaCodeGeneratorInfo) curNode)
- .getTempJavaCodeFragmentFiles().getBeanTempFiles();
- addJavaSnippetInfoToApplicableTempFiles(getJavaAttributeOfLeaf(tempJavaBeanFragmentFiles, leaf,
- yangPluginConfig), yangPluginConfig);
- } else {
- addJavaSnippetInfoToApplicableTempFiles(getJavaAttributeOfLeaf(this, leaf, yangPluginConfig),
- yangPluginConfig);
- }
- }
- }
- }
-
- /**
- * Adds leaf list's attributes in generated files.
- *
- * @param listOfLeafList list of YANG leaves
- * @param yangPluginConfig plugin config
- * @param curNode current node
- * @throws IOException IO operation fail
- */
- private void addLeafListInfoToTempFiles(List<YangLeafList> listOfLeafList, YangPluginConfig yangPluginConfig,
- YangNode curNode) throws IOException {
- if (listOfLeafList != null) {
- for (YangLeafList leafList : listOfLeafList) {
- if (!(leafList instanceof JavaLeafInfoContainer)) {
- throw new TranslatorException("Leaf-list does not have java information");
- }
- if (curNode instanceof YangModule || curNode instanceof YangSubModule) {
- TempJavaBeanFragmentFiles tempJavaBeanFragmentFiles = ((JavaCodeGeneratorInfo) curNode)
- .getTempJavaCodeFragmentFiles().getBeanTempFiles();
- addJavaSnippetInfoToApplicableTempFiles(getJavaAttributeOfLeafList(tempJavaBeanFragmentFiles,
- leafList, yangPluginConfig), yangPluginConfig);
- } else {
- addJavaSnippetInfoToApplicableTempFiles(getJavaAttributeOfLeafList(this,
- leafList, yangPluginConfig), yangPluginConfig);
- }
- }
- }
- }
-
- /**
- * Adds all the leaves in the current data model node as part of the generated temporary file.
- *
- * @param curNode current node
- * @param yangPluginConfig plugin config
- * @throws IOException IO operation fail
- */
- void addCurNodeLeavesInfoToTempFiles(YangNode curNode,
- YangPluginConfig yangPluginConfig)
- throws IOException {
- if (!(curNode instanceof YangLeavesHolder)) {
- throw new TranslatorException("Data model node does not have any leaves");
- }
- YangLeavesHolder leavesHolder = (YangLeavesHolder) curNode;
- addLeavesInfoToTempFiles(leavesHolder.getListOfLeaf(), yangPluginConfig, curNode);
- addLeafListInfoToTempFiles(leavesHolder.getListOfLeafList(), yangPluginConfig, curNode);
- }
-
- /**
- * Adds the new attribute info to the target generated temporary files.
- *
- * @param newAttrInfo the attribute info that needs to be added to temporary files
- * @param pluginConfig plugin configurations
- * @throws IOException IO operation fail
- */
- void addJavaSnippetInfoToApplicableTempFiles(JavaAttributeInfo newAttrInfo, YangPluginConfig pluginConfig)
- throws IOException {
- setAttributePresent(true);
- if ((getGeneratedTempFiles() & ATTRIBUTES_MASK) != 0) {
- addAttribute(newAttrInfo, pluginConfig);
- }
-
- if ((getGeneratedTempFiles() & GETTER_FOR_INTERFACE_MASK) != 0) {
- addGetterForInterface(newAttrInfo, pluginConfig);
- }
-
- if ((getGeneratedTempFiles() & SETTER_FOR_INTERFACE_MASK) != 0) {
- addSetterForInterface(newAttrInfo, pluginConfig);
- }
-
- if ((getGeneratedTempFiles() & SETTER_FOR_CLASS_MASK) != 0) {
- addSetterImpl(newAttrInfo);
- }
-
- if ((getGeneratedTempFiles() & HASH_CODE_IMPL_MASK) != 0) {
- addHashCodeMethod(newAttrInfo);
- }
- if ((getGeneratedTempFiles() & EQUALS_IMPL_MASK) != 0) {
- addEqualsMethod(newAttrInfo);
- }
- if ((getGeneratedTempFiles() & TO_STRING_IMPL_MASK) != 0) {
- addToStringMethod(newAttrInfo);
- }
- if ((getGeneratedTempFiles() & ADD_TO_LIST_IMPL_MASK) != 0 && newAttrInfo.isListAttr()) {
- addAddToListImpl(newAttrInfo);
- }
- if ((getGeneratedTempFiles() & ADD_TO_LIST_INTERFACE_MASK) != 0 && newAttrInfo.isListAttr()) {
- addAddToListInterface(newAttrInfo, pluginConfig);
- }
- if ((getGeneratedTempFiles() & LEAF_IDENTIFIER_ENUM_ATTRIBUTES_MASK) != 0 && !newAttrInfo.isListAttr()
- && newAttrInfo.getAttributeType() != null) {
- leafCount++;
- addLeafIdAttributes(newAttrInfo, leafCount, pluginConfig);
- }
-
- if (!newAttrInfo.isIntConflict() &&
- !newAttrInfo.isLongConflict()) {
- if ((getGeneratedTempFiles() & GETTER_FOR_CLASS_MASK) != 0) {
- addGetterImpl(newAttrInfo, pluginConfig);
- }
-
- if ((getGeneratedTempFiles() & FROM_STRING_IMPL_MASK) != 0) {
- JavaQualifiedTypeInfoTranslator qualifiedInfoOfFromString = getQualifiedInfoOfFromString(newAttrInfo,
- pluginConfig.getConflictResolver());
- /*
- * Create a new java attribute info with qualified information of
- * wrapper classes.
- */
- JavaAttributeInfo fromStringAttributeInfo = getAttributeInfoForTheData(qualifiedInfoOfFromString,
- newAttrInfo.getAttributeName(),
- newAttrInfo.getAttributeType(),
- getIsQualifiedAccessOrAddToImportList(qualifiedInfoOfFromString), false);
-
- addFromStringMethod(newAttrInfo, fromStringAttributeInfo);
- }
- }
- }
-
- /**
- * Returns java class name.
- *
- * @param suffix for the class name based on the file type
- * @return java class name
- */
- String getJavaClassName(String suffix) {
- return getCapitalCase(getJavaFileInfo().getJavaName()) + suffix;
- }
-
- /**
- * Returns java class name.
- *
- * @param node YANG node
- * @return java class name
- */
- private String getImplClassName(YangNode node) {
- if (node instanceof YangModule || node instanceof YangSubModule) {
- return getCapitalCase(getJavaFileInfo().getJavaName()) + OP_PARAM;
- }
- return getCapitalCase(DEFAULT) + getCapitalCase(getJavaFileInfo().getJavaName());
- }
-
- /**
- * Returns the directory path.
- *
- * @return directory path
- */
- private String getDirPath() {
- return getJavaFileInfo().getPackageFilePath();
- }
-
- /**
- * Constructs java code exit.
- *
- * @param fileType generated file type
- * @param curNode current YANG node
- * @throws IOException when fails to generate java files
- */
- public void generateJavaFile(int fileType, YangNode curNode)
- throws IOException {
- List<String> imports = ((JavaCodeGeneratorInfo) curNode).getTempJavaCodeFragmentFiles().getBeanTempFiles()
- .getJavaImportData().getImports();
- if (curNode instanceof YangAugmentableNode) {
- addImportsForAugmentableClass(imports, true, true);
- }
- createPackage(curNode);
-
- /*
- * Generate java code.
- */
- if ((fileType & INTERFACE_MASK) != 0 || (fileType &
- BUILDER_INTERFACE_MASK) != 0) {
-
- /*
- * Create interface file.
- */
- setInterfaceJavaFileHandle(getJavaFileHandle(getJavaClassName(INTERFACE_FILE_NAME_SUFFIX)));
- setInterfaceJavaFileHandle(
- generateInterfaceFile(getInterfaceJavaFileHandle(), imports, curNode, isAttributePresent()));
- if (!(curNode instanceof YangModule) && !(curNode instanceof YangSubModule)) {
- /*
- * Create builder interface file.
- */
- if ((fileType & BUILDER_INTERFACE_MASK) != 0) {
- setBuilderInterfaceJavaFileHandle(
- getJavaFileHandle(getJavaClassName(BUILDER_INTERFACE_FILE_NAME_SUFFIX)));
- setBuilderInterfaceJavaFileHandle(
- generateBuilderInterfaceFile(getBuilderInterfaceJavaFileHandle(), curNode,
- isAttributePresent()));
- /*
- * Append builder interface file to interface file and close it.
- */
- mergeJavaFiles(getBuilderInterfaceJavaFileHandle(), getInterfaceJavaFileHandle());
- validateLineLength(getInterfaceJavaFileHandle());
- }
- }
- insertDataIntoJavaFile(getInterfaceJavaFileHandle(), getJavaClassDefClose());
-
- if (curNode instanceof YangCase) {
- removeCaseImport(imports);
- }
- if (curNode instanceof YangAugmentableNode) {
- addImportsForAugmentableClass(imports, false, true);
- }
- }
- if ((fileType & BUILDER_CLASS_MASK) != 0 || (fileType & DEFAULT_CLASS_MASK) != 0) {
- if (isAttributePresent()) {
- addImportsToStringAndHasCodeMethods(imports, true);
- addArrayListImport(imports);
- }
- addBitsetImport(imports);
- if (curNode instanceof YangAugmentableNode) {
- addImportsForAugmentableClass(imports, true, false);
- }
- sortImports(imports);
- /*
- * Create impl class file.
- */
- setImplClassJavaFileHandle(getJavaFileHandle(getImplClassName(curNode)));
- setImplClassJavaFileHandle(
- generateDefaultClassFile(getImplClassJavaFileHandle(), curNode, isAttributePresent(), imports));
-
- /*
- * Create builder class file.
- */
- if ((fileType & BUILDER_CLASS_MASK) != 0) {
- setBuilderClassJavaFileHandle(getJavaFileHandle(getJavaClassName(BUILDER_CLASS_FILE_NAME_SUFFIX)));
- setBuilderClassJavaFileHandle(
- generateBuilderClassFile(getBuilderClassJavaFileHandle(), curNode,
- isAttributePresent()));
- /*
- * Append impl class to builder class and close it.
- */
- mergeJavaFiles(getBuilderClassJavaFileHandle(), getImplClassJavaFileHandle());
- validateLineLength(getImplClassJavaFileHandle());
- }
- insertDataIntoJavaFile(getImplClassJavaFileHandle(), getJavaClassDefClose());
-
- }
- /*
- * Close all the file handles.
- */
- freeTemporaryResources(false);
- }
-
- /*Adds import for array list.*/
- private void addArrayListImport(List<String> imports) {
- if (imports.contains(getJavaImportData().getImportForList())) {
- imports.add(ARRAY_LIST_IMPORT);
- }
- }
-
- /*Adds import for bitset list.*/
- private void addBitsetImport(List<String> imports) {
- imports.add(getJavaImportData().getImportForToBitSet());
- }
-
- /**
- * Adds imports for ToString and HashCodeMethod.
- *
- * @param imports import list
- * @param operation add or remove
- */
- void addImportsToStringAndHasCodeMethods(List<String> imports, boolean operation) {
- if (operation) {
- imports.add(getJavaImportData().getImportForHashAndEquals());
- imports.add(getJavaImportData().getImportForToString());
- } else {
- imports.remove(getJavaImportData().getImportForHashAndEquals());
- imports.remove(getJavaImportData().getImportForToString());
- }
- }
-
- /**
- * Adds import for map and hash map.
- *
- * @param imports import list
- * @param operations true for adding and false for deletion
- * @param isInterfaceFile if need to add in interface file
- */
- private void addImportsForAugmentableClass(List<String> imports, boolean operations, boolean isInterfaceFile) {
- if (operations) {
- if (!isInterfaceFile) {
- imports.add(getJavaImportData().getHashMapImport());
- }
- imports.add(getJavaImportData().getMapImport());
- addInvocationExceptionImport(imports);
- } else {
- if (!isInterfaceFile) {
- imports.remove(getJavaImportData().getHashMapImport());
- }
- imports.remove(getJavaImportData().getMapImport());
- }
- sortImports(imports);
- }
-
- /**
- * Removes case import info from import list.
- *
- * @param imports list of imports
- * @return import for class
- */
- private List<String> removeCaseImport(List<String> imports) {
- if (imports != null && caseImportInfo != null) {
- String caseImport = IMPORT + caseImportInfo.getPkgInfo() + PERIOD + caseImportInfo.getClassInfo() +
- SEMI_COLAN + NEW_LINE;
- imports.remove(caseImport);
- }
- return imports;
- }
-
- /**
- * Adds invocation exception import.
- *
- * @param imports list of imports
- */
- private void addInvocationExceptionImport(List<String> imports) {
- imports.add(INVOCATION_TARGET_EXCEPTION_IMPORT);
- }
-
- /**
- * Removes all temporary file handles.
- *
- * @param isErrorOccurred flag to tell translator that error has occurred while file generation
- * @throws IOException when failed to delete the temporary files
- */
- public void freeTemporaryResources(boolean isErrorOccurred)
- throws IOException {
- /*
- * Close all java file handles and when error occurs delete the files.
- */
- if ((getGeneratedJavaFiles() & INTERFACE_MASK) != 0) {
- closeFile(getInterfaceJavaFileHandle(), isErrorOccurred);
- }
- if ((getGeneratedJavaFiles() & BUILDER_CLASS_MASK) != 0) {
- closeFile(getBuilderClassJavaFileHandle(), true);
- }
- if ((getGeneratedJavaFiles() & BUILDER_INTERFACE_MASK) != 0) {
- closeFile(getBuilderInterfaceJavaFileHandle(), true);
- }
- if ((getGeneratedJavaFiles() & DEFAULT_CLASS_MASK) != 0) {
- closeFile(getImplClassJavaFileHandle(), isErrorOccurred);
- }
-
- /*
- * Close all temporary file handles and delete the files.
- */
- if ((getGeneratedTempFiles() & GETTER_FOR_CLASS_MASK) != 0) {
- closeFile(getGetterImplTempFileHandle(), true);
- }
- if ((getGeneratedTempFiles() & ATTRIBUTES_MASK) != 0) {
- closeFile(getAttributesTempFileHandle(), true);
- }
- if ((getGeneratedTempFiles() & HASH_CODE_IMPL_MASK) != 0) {
- closeFile(getHashCodeImplTempFileHandle(), true);
- }
- if ((getGeneratedTempFiles() & TO_STRING_IMPL_MASK) != 0) {
- closeFile(getToStringImplTempFileHandle(), true);
- }
- if ((getGeneratedTempFiles() & EQUALS_IMPL_MASK) != 0) {
- closeFile(getEqualsImplTempFileHandle(), true);
- }
- if ((getGeneratedTempFiles() & FROM_STRING_IMPL_MASK) != 0) {
- closeFile(getFromStringImplTempFileHandle(), true);
- }
- if ((getGeneratedTempFiles() & ADD_TO_LIST_IMPL_MASK) != 0) {
- closeFile(getAddToListImplTempFileHandle(), true);
- }
- if ((getGeneratedTempFiles() & ADD_TO_LIST_INTERFACE_MASK) != 0) {
- closeFile(getAddToListInterfaceTempFileHandle(), true);
- }
- if ((getGeneratedTempFiles() & LEAF_IDENTIFIER_ENUM_ATTRIBUTES_MASK) != 0) {
- closeFile(getLeafIdAttributeTempFileHandle(), true);
- }
- }
-
- /**
- * Returns if the attribute needs to be accessed in a qualified manner or not, if it needs to be imported, then the
- * same needs to be done.
- *
- * @param importInfo import info for the current attribute being added
- * @return status of the qualified access to the attribute
- */
- boolean getIsQualifiedAccessOrAddToImportList(
- JavaQualifiedTypeInfoTranslator importInfo) {
-
- return getJavaImportData().addImportInfo(importInfo, getGeneratedJavaClassName(),
- getJavaFileInfo().getPackage());
- }
-
- /**
- * Returns temp file handle for add to list interface.
- *
- * @return temp file handle for add to list interface
- */
- public File getAddToListInterfaceTempFileHandle() {
- return addToListInterfaceTempFileHandle;
- }
-
- /**
- * Sets temp file handle for add to list interface.
- *
- * @param addToListInterfaceTempFileHandle temp file handle for add to list interface
- */
- private void setAddToListInterfaceTempFileHandle(File addToListInterfaceTempFileHandle) {
- this.addToListInterfaceTempFileHandle = addToListInterfaceTempFileHandle;
- }
-
- /**
- * Returns temp file handle for add to list impl.
- *
- * @return temp file handle for add to list impl
- */
- public File getAddToListImplTempFileHandle() {
- return addToListImplTempFileHandle;
- }
-
- /**
- * Sets temp file handle for add to list impl.
- *
- * @param addToListImplTempFileHandle temp file handle for add to list impl
- */
- private void setAddToListImplTempFileHandle(File addToListImplTempFileHandle) {
- this.addToListImplTempFileHandle = addToListImplTempFileHandle;
- }
-
- /**
- * Returns temp file handle for leaf identifier attributes.
- *
- * @return temp file handle for leaf identifier attributes
- */
- public File getLeafIdAttributeTempFileHandle() {
- return leafIdAttributeTempFileHandle;
- }
-
- /**
- * Sets temp file handle for leaf identifier attributes.
- *
- * @param leafIdAttributeTempFileHandle temp file handle for leaf identifier attributes.
- */
- private void setLeafIdAttributeTempFileHandle(File leafIdAttributeTempFileHandle) {
- this.leafIdAttributeTempFileHandle = leafIdAttributeTempFileHandle;
- }
-
- /**
- * Returns if root node is set.
- *
- * @return true if root node
- */
- private boolean isRooNode() {
- return isRooNode;
- }
-
- /**
- * Sets true if root node.
- *
- * @param rooNode true if root node
- */
- public void setRooNode(boolean rooNode) {
- isRooNode = rooNode;
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaServiceFragmentFiles.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaServiceFragmentFiles.java
deleted file mode 100644
index baa427f..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaServiceFragmentFiles.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * 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.translator.tojava;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModuleTranslator;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaSubModuleTranslator;
-import org.onosproject.yangutils.translator.tojava.utils.JavaExtendsListHolder;
-
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.RPC_IMPL_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.RPC_INTERFACE_MASK;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaCodeSnippetGen.addListenersImport;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGenerator.generateServiceInterfaceFile;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGeneratorUtils.addResolvedAugmentedDataNodeImports;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.createPackage;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getRpcManagerMethod;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getRpcServiceMethod;
-import static org.onosproject.yangutils.utils.UtilConstants.EMPTY_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.LISTENER_SERVICE;
-import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE;
-import static org.onosproject.yangutils.utils.UtilConstants.RPC_INPUT_VAR_NAME;
-import static org.onosproject.yangutils.utils.UtilConstants.VOID;
-import static org.onosproject.yangutils.utils.io.impl.FileSystemUtil.closeFile;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.generateJavaDocForRpc;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getAbsolutePackagePath;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase;
-
-/**
- * Represents implementation of java service code fragments temporary implementations. Maintains the temp files required
- * specific for service and manager java snippet generation.
- */
-public class TempJavaServiceFragmentFiles
- extends TempJavaFragmentFiles {
-
- /**
- * File name for rpc method.
- */
- private static final String RPC_INTERFACE_FILE_NAME = "Rpc";
-
- /**
- * File name for rpc implementation method.
- */
- private static final String RPC_IMPL_FILE_NAME = "RpcImpl";
-
- /**
- * File name for generated class file for service suffix.
- */
- private static final String SERVICE_FILE_NAME_SUFFIX = "Service";
-
- /**
- * Temporary file handle for rpc interface.
- */
- private File rpcInterfaceTempFileHandle;
-
- /**
- * Temporary file handle for rpc manager impl.
- */
- private File rpcImplTempFileHandle;
-
- /**
- * Java file handle for rpc interface file.
- */
- private File serviceInterfaceJavaFileHandle;
-
- /**
- * Creates an instance of temporary java code fragment.
- *
- * @param javaFileInfo generated file information
- * @throws IOException when fails to create new file handle
- */
- TempJavaServiceFragmentFiles(JavaFileInfo javaFileInfo)
- throws IOException {
- setJavaExtendsListHolder(new JavaExtendsListHolder());
- setJavaImportData(new JavaImportData());
- setJavaFileInfo(javaFileInfo);
- setAbsoluteDirPath(getAbsolutePackagePath(getJavaFileInfo().getBaseCodeGenPath(),
- getJavaFileInfo().getPackageFilePath()));
- addGeneratedTempFile(RPC_INTERFACE_MASK);
- addGeneratedTempFile(RPC_IMPL_MASK);
-
- setRpcInterfaceTempFileHandle(getTemporaryFileHandle(RPC_INTERFACE_FILE_NAME));
- setRpcImplTempFileHandle(getTemporaryFileHandle(RPC_IMPL_FILE_NAME));
- }
-
- /**
- * Returns rpc method's java file handle.
- *
- * @return java file handle
- */
- private File getServiceInterfaceJavaFileHandle() {
- return serviceInterfaceJavaFileHandle;
- }
-
- /**
- * Sets rpc method's java file handle.
- *
- * @param serviceInterfaceJavaFileHandle file handle for to rpc method
- */
- private void setServiceInterfaceJavaFileHandle(File serviceInterfaceJavaFileHandle) {
- this.serviceInterfaceJavaFileHandle = serviceInterfaceJavaFileHandle;
- }
-
- /**
- * Returns rpc method's temporary file handle.
- *
- * @return temporary file handle
- */
- public File getRpcInterfaceTempFileHandle() {
- return rpcInterfaceTempFileHandle;
- }
-
- /**
- * Sets rpc method's temporary file handle.
- *
- * @param rpcInterfaceTempFileHandle file handle for to rpc method
- */
- private void setRpcInterfaceTempFileHandle(File rpcInterfaceTempFileHandle) {
- this.rpcInterfaceTempFileHandle = rpcInterfaceTempFileHandle;
- }
-
- /**
- * Retrieves the manager impl temp file.
- *
- * @return the manager impl temp file
- */
- public File getRpcImplTempFileHandle() {
- return rpcImplTempFileHandle;
- }
-
- /**
- * Sets the manager impl temp file.
- *
- * @param rpcImplTempFileHandle the manager impl temp file
- */
- private void setRpcImplTempFileHandle(File rpcImplTempFileHandle) {
- this.rpcImplTempFileHandle = rpcImplTempFileHandle;
- }
-
- /**
- * Constructs java code exit.
- *
- * @param fileType generated file type
- * @param curNode current YANG node
- * @throws IOException when fails to generate java files
- */
- @Override
- public void generateJavaFile(int fileType, YangNode curNode)
- throws IOException {
-
- addResolvedAugmentedDataNodeImports(curNode);
- List<String> imports = ((JavaCodeGeneratorInfo) curNode).getTempJavaCodeFragmentFiles().getServiceTempFiles()
- .getJavaImportData().getImports();
- createPackage(curNode);
- boolean isNotification = false;
- if (curNode instanceof YangJavaModuleTranslator) {
- if (!((YangJavaModuleTranslator) curNode).getNotificationNodes().isEmpty()) {
- isNotification = true;
- }
- } else if (curNode instanceof YangJavaSubModuleTranslator) {
- if (!((YangJavaSubModuleTranslator) curNode).getNotificationNodes().isEmpty()) {
- isNotification = true;
- }
- }
-
- if (isNotification) {
- addListenersImport(curNode, imports, true, LISTENER_SERVICE);
- }
-
- setServiceInterfaceJavaFileHandle(getJavaFileHandle(getJavaClassName(SERVICE_FILE_NAME_SUFFIX)));
- generateServiceInterfaceFile(getServiceInterfaceJavaFileHandle(), curNode, imports);
-
- // Close all the file handles.
- freeTemporaryResources(false);
- }
-
- /**
- * Adds rpc string information to applicable temp file.
- *
- * @param javaAttributeInfoOfInput RPCs input node attribute info
- * @param javaAttributeInfoOfOutput RPCs output node attribute info
- * @param rpcName name of the rpc function
- * @param pluginConfig plugin configurations
- * @throws IOException IO operation fail
- */
- private void addRpcString(JavaAttributeInfo javaAttributeInfoOfInput,
- JavaAttributeInfo javaAttributeInfoOfOutput, YangPluginConfig pluginConfig,
- String rpcName)
- throws IOException {
- String rpcInput = EMPTY_STRING;
- String rpcOutput = VOID;
- String rpcInputJavaDoc = EMPTY_STRING;
- if (javaAttributeInfoOfInput != null) {
- rpcInput = getCapitalCase(javaAttributeInfoOfInput.getAttributeName());
- }
- if (javaAttributeInfoOfOutput != null) {
- rpcOutput = getCapitalCase(javaAttributeInfoOfOutput.getAttributeName());
- }
- if (!rpcInput.equals(EMPTY_STRING)) {
- rpcInputJavaDoc = RPC_INPUT_VAR_NAME;
- }
- appendToFile(getRpcInterfaceTempFileHandle(),
- generateJavaDocForRpc(rpcName, rpcInputJavaDoc, rpcOutput, pluginConfig)
- + getRpcServiceMethod(rpcName, rpcInput, rpcOutput, pluginConfig) + NEW_LINE);
- appendToFile(getRpcImplTempFileHandle(),
- getRpcManagerMethod(rpcName, rpcInput, rpcOutput, pluginConfig) + NEW_LINE);
- }
-
- /**
- * Adds the JAVA rpc snippet information.
- *
- * @param javaAttributeInfoOfInput RPCs input node attribute info
- * @param javaAttributeInfoOfOutput RPCs output node attribute info
- * @param pluginConfig plugin configurations
- * @param rpcName name of the rpc function
- * @throws IOException IO operation fail
- */
- public void addJavaSnippetInfoToApplicableTempFiles(JavaAttributeInfo javaAttributeInfoOfInput,
- JavaAttributeInfo javaAttributeInfoOfOutput,
- YangPluginConfig pluginConfig, String rpcName)
- throws IOException {
- addRpcString(javaAttributeInfoOfInput, javaAttributeInfoOfOutput, pluginConfig, rpcName);
- }
-
- /**
- * Removes all temporary file handles.
- *
- * @param isErrorOccurred flag to tell translator that error has occurred while file generation
- * @throws IOException when failed to delete the temporary files
- */
- @Override
- public void freeTemporaryResources(boolean isErrorOccurred)
- throws IOException {
-
- closeFile(getServiceInterfaceJavaFileHandle(), isErrorOccurred);
-
- closeFile(getRpcInterfaceTempFileHandle(), true);
- closeFile(getRpcImplTempFileHandle(), true);
- closeFile(getGetterInterfaceTempFileHandle(), true);
- closeFile(getSetterInterfaceTempFileHandle(), true);
- closeFile(getSetterImplTempFileHandle(), true);
-
- super.freeTemporaryResources(isErrorOccurred);
-
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaTypeFragmentFiles.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaTypeFragmentFiles.java
deleted file mode 100644
index 13da55c..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaTypeFragmentFiles.java
+++ /dev/null
@@ -1,761 +0,0 @@
-/*
- * 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.translator.tojava;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.datamodel.YangTypeHolder;
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaTypeTranslator;
-
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.INT32;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.INT64;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.UINT16;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.UINT32;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_TYPEDEF_CLASS;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_UNION_CLASS;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.CONSTRUCTOR_FOR_TYPE_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.FROM_STRING_IMPL_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.OF_STRING_IMPL_MASK;
-import static org.onosproject.yangutils.translator.tojava.JavaAttributeInfo.getAttributeInfoForTheData;
-import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator.getQualifiedInfoOfFromString;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGenerator.generateTypeDefClassFile;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGenerator.generateUnionClassFile;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.createPackage;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getOfMethodStringAndJavaDoc;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getTypeConstructorStringAndJavaDoc;
-import static org.onosproject.yangutils.translator.tojava.utils.ValidatorTypeForUnionTypes.INT_TYPE_CONFLICT;
-import static org.onosproject.yangutils.translator.tojava.utils.ValidatorTypeForUnionTypes.LONG_TYPE_CONFLICT;
-import static org.onosproject.yangutils.utils.UtilConstants.EMPTY_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE;
-import static org.onosproject.yangutils.utils.io.impl.FileSystemUtil.closeFile;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCamelCase;
-
-/**
- * Represents implementation of java data type code fragments temporary implementations. Maintains the temp files
- * required specific for user defined data type java snippet generation.
- */
-public class TempJavaTypeFragmentFiles
- extends TempJavaFragmentFiles {
-
- /**
- * File name for of string method.
- */
- private static final String OF_STRING_METHOD_FILE_NAME = "OfString";
-
- /**
- * File name for construction for special type like union, typedef.
- */
- private static final String CONSTRUCTOR_FOR_TYPE_FILE_NAME = "ConstructorForType";
-
- /**
- * File name for typedef class file name suffix.
- */
- private static final String TYPEDEF_CLASS_FILE_NAME_SUFFIX = EMPTY_STRING;
-
- /**
- * File name for generated class file for special type like union, typedef suffix.
- */
- private static final String UNION_TYPE_CLASS_FILE_NAME_SUFFIX = EMPTY_STRING;
-
- /**
- * Integer index in type list.
- */
- private int intIndex = 0;
-
- /**
- * UInt index in type list.
- */
- private int uIntIndex = 0;
-
- /**
- * long index in type list.
- */
- private int longIndex = 0;
-
- /**
- * ULong index in type list.
- */
- private int uLongIndex = 0;
-
- /**
- * Temporary file handle for of string method of class.
- */
- private File ofStringImplTempFileHandle;
-
- /**
- * Temporary file handle for constructor for type class.
- */
- private File constructorForTypeTempFileHandle;
-
- /**
- * Java file handle for typedef class file.
- */
- private File typedefClassJavaFileHandle;
-
- /**
- * Java file handle for type class like union, typedef file.
- */
- private File typeClassJavaFileHandle;
-
- /**
- * Java attribute for int.
- */
- private JavaAttributeInfo intAttribute;
-
- /**
- * Java attribute for long.
- */
- private JavaAttributeInfo longAttribute;
-
- /**
- * Java attribute for uInt.
- */
- private JavaAttributeInfo uIntAttribute;
-
- /**
- * Java attribute for uLong.
- */
- private JavaAttributeInfo uLongAttribute;
-
- /**
- * Creates an instance of temporary java code fragment.
- *
- * @param javaFileInfo generated java file info
- * @throws IOException when fails to create new file handle
- */
- TempJavaTypeFragmentFiles(JavaFileInfo javaFileInfo)
- throws IOException {
-
- super(javaFileInfo);
-
- /*
- * Initialize getterImpl, attributes, hash code, equals and to strings
- * when generation file type matches to typeDef class mask.
- */
- addGeneratedTempFile(OF_STRING_IMPL_MASK);
- addGeneratedTempFile(CONSTRUCTOR_FOR_TYPE_MASK);
- addGeneratedTempFile(FROM_STRING_IMPL_MASK);
-
- setOfStringImplTempFileHandle(getTemporaryFileHandle(OF_STRING_METHOD_FILE_NAME));
- setConstructorForTypeTempFileHandle(getTemporaryFileHandle(CONSTRUCTOR_FOR_TYPE_FILE_NAME));
-
- }
-
- /**
- * Returns type class constructor method's temporary file handle.
- *
- * @return type class constructor method's temporary file handle
- */
-
- public File getConstructorForTypeTempFileHandle() {
- return constructorForTypeTempFileHandle;
- }
-
- /**
- * Sets type class constructor method's temporary file handle.
- *
- * @param constructorForTypeTempFileHandle type class constructor method's temporary file handle
- */
- private void setConstructorForTypeTempFileHandle(File constructorForTypeTempFileHandle) {
- this.constructorForTypeTempFileHandle = constructorForTypeTempFileHandle;
- }
-
- /**
- * Returns java file handle for typedef class file.
- *
- * @return java file handle for typedef class file
- */
- private File getTypedefClassJavaFileHandle() {
- return typedefClassJavaFileHandle;
- }
-
- /**
- * Sets the java file handle for typedef class file.
- *
- * @param typedefClassJavaFileHandle java file handle
- */
- private void setTypedefClassJavaFileHandle(File typedefClassJavaFileHandle) {
- this.typedefClassJavaFileHandle = typedefClassJavaFileHandle;
- }
-
- /**
- * Returns java file handle for type class file.
- *
- * @return java file handle for type class file
- */
- private File getTypeClassJavaFileHandle() {
- return typeClassJavaFileHandle;
- }
-
- /**
- * Sets the java file handle for type class file.
- *
- * @param typeClassJavaFileHandle type file handle
- */
- private void setTypeClassJavaFileHandle(File typeClassJavaFileHandle) {
- this.typeClassJavaFileHandle = typeClassJavaFileHandle;
- }
-
- /**
- * Returns of string method's temporary file handle.
- *
- * @return of string method's temporary file handle
- */
-
- public File getOfStringImplTempFileHandle() {
- return ofStringImplTempFileHandle;
- }
-
- /**
- * Set of string method's temporary file handle.
- *
- * @param ofStringImplTempFileHandle of string method's temporary file handle
- */
- private void setOfStringImplTempFileHandle(File ofStringImplTempFileHandle) {
- this.ofStringImplTempFileHandle = ofStringImplTempFileHandle;
- }
-
- /**
- * Adds all the type in the current data model node as part of the generated temporary file.
- *
- * @param yangTypeHolder YANG java data model node which has type info, eg union / typedef
- * @param pluginConfig plugin configurations for naming conventions
- * @throws IOException IO operation fail
- */
- void addTypeInfoToTempFiles(YangTypeHolder yangTypeHolder, YangPluginConfig pluginConfig)
- throws IOException {
-
- List<YangType<?>> typeList = yangTypeHolder.getTypeList();
- if (typeList != null) {
- for (YangType<?> yangType : typeList) {
- if (!(yangType instanceof YangJavaTypeTranslator)) {
- throw new TranslatorException("Type does not have Java info");
- }
- JavaAttributeInfo javaAttributeInfo = getAttributeForType(yangType, pluginConfig);
- addJavaSnippetInfoToApplicableTempFiles(javaAttributeInfo,
- pluginConfig, typeList);
- }
- addTypeConstructor(pluginConfig);
- addMethodsInConflictCase(pluginConfig);
- }
- }
-
- /**
- * Returns java attribute.
- *
- * @param yangType YANG type
- * @param pluginConfig plugin configurations
- * @return java attribute
- */
- private JavaAttributeInfo getAttributeForType(YangType yangType, YangPluginConfig pluginConfig) {
- YangJavaTypeTranslator<?> javaType = (YangJavaTypeTranslator<?>) yangType;
- javaType.updateJavaQualifiedInfo(pluginConfig.getConflictResolver());
- String typeName = javaType.getDataTypeName();
- typeName = getCamelCase(typeName, pluginConfig.getConflictResolver());
- return getAttributeInfoForTheData(
- javaType.getJavaQualifiedInfo(),
- typeName, javaType,
- getIsQualifiedAccessOrAddToImportList(javaType.getJavaQualifiedInfo()),
- false);
- }
-
- /**
- * Adds the new attribute info to the target generated temporary files for union class.
- *
- * @param javaAttributeInfo the attribute info that needs to be added to temporary files
- * @param pluginConfig plugin configurations
- * @param typeList type list
- * @throws IOException IO operation fail
- */
- private void addJavaSnippetInfoToApplicableTempFiles(JavaAttributeInfo javaAttributeInfo,
- YangPluginConfig pluginConfig, List<YangType<?>> typeList)
- throws IOException {
-
- YangDataTypes attrType = javaAttributeInfo.getAttributeType().getDataType();
-
- if (attrType == INT32 || attrType == UINT16) {
- boolean isIntConflict = validateForConflictingIntTypes(typeList);
- javaAttributeInfo.setIntConflict(isIntConflict);
- updateAttributeCondition(javaAttributeInfo);
- if (!isIntConflict) {
- addMethodsWhenNoConflictingTypes(javaAttributeInfo, pluginConfig);
- }
- } else if (attrType == INT64 || attrType == UINT32) {
- boolean isLongConflict = validateForConflictingLongTypes(typeList);
- javaAttributeInfo.setLongConflict(isLongConflict);
- updateAttributeCondition(javaAttributeInfo);
- if (!isLongConflict) {
- addMethodsWhenNoConflictingTypes(javaAttributeInfo, pluginConfig);
- }
- } else {
- addMethodsWhenNoConflictingTypes(javaAttributeInfo, pluginConfig);
- }
- super.addJavaSnippetInfoToApplicableTempFiles(javaAttributeInfo, pluginConfig);
-
- }
-
- /**
- * Adds of method and constructor when there is no conflicting types.
- *
- * @param javaAttributeInfo java attribute info
- * @param pluginConfig plugin configurations
- * @throws IOException when fails to do IO operations
- */
- private void addMethodsWhenNoConflictingTypes(JavaAttributeInfo javaAttributeInfo,
- YangPluginConfig pluginConfig) throws IOException {
- if ((getGeneratedTempFiles() & OF_STRING_IMPL_MASK) != 0) {
- addOfStringMethod(javaAttributeInfo, pluginConfig);
- }
-
- if ((getGeneratedTempFiles() & CONSTRUCTOR_FOR_TYPE_MASK) != 0) {
- addTypeConstructor(javaAttributeInfo, pluginConfig);
- }
- }
-
- /**
- * Adds of, getter and from string method in conflict cases.
- *
- * @param pluginConfig plugin configurations
- * @throws IOException when fails to do IO operations
- */
- private void addMethodsInConflictCase(YangPluginConfig pluginConfig) throws IOException {
- JavaAttributeInfo attr = getIntAttribute();
- if (attr != null) {
- attr = getUIntAttribute();
- }
- if (attr != null) {
- if (attr.isIntConflict()) {
- if (getIntIndex() < getUIntIndex()) {
- appendToFile(getOfStringImplTempFileHandle(), getOfMethodStringAndJavaDoc(getIntAttribute(),
- getGeneratedJavaClassName(), pluginConfig)
- + NEW_LINE);
- addGetterImpl(getIntAttribute(), pluginConfig);
- addFromStringMethod(getIntAttribute(), pluginConfig);
- } else {
- appendToFile(getOfStringImplTempFileHandle(), getOfMethodStringAndJavaDoc(getUIntAttribute(),
- getGeneratedJavaClassName(), pluginConfig)
- + NEW_LINE);
- addGetterImpl(getUIntAttribute(), pluginConfig);
- addFromStringMethod(getUIntAttribute(), pluginConfig);
- }
- }
- }
- attr = getLongAttribute();
- if (attr != null) {
- attr = getULongAttribute();
- }
- if (attr != null) {
- if (attr.isLongConflict()) {
- if (getLongIndex() < getULongIndex()) {
- appendToFile(getOfStringImplTempFileHandle(), getOfMethodStringAndJavaDoc(getLongAttribute(),
- getGeneratedJavaClassName(), pluginConfig)
- + NEW_LINE);
- addGetterImpl(getLongAttribute(), pluginConfig);
- addFromStringMethod(getLongAttribute(), pluginConfig);
- } else {
- appendToFile(getOfStringImplTempFileHandle(), getOfMethodStringAndJavaDoc(getULongAttribute(),
- getGeneratedJavaClassName(), pluginConfig)
- + NEW_LINE);
- addGetterImpl(getULongAttribute(), pluginConfig);
- addFromStringMethod(getULongAttribute(), pluginConfig);
- }
- }
- }
- }
-
- /**
- * Adds from string method for conflict case.
- *
- * @param newAttrInfo new attribute
- * @param pluginConfig plugin configurations
- * @throws IOException when fails to do IO operations
- */
- private void addFromStringMethod(JavaAttributeInfo newAttrInfo, YangPluginConfig pluginConfig) throws IOException {
-
- JavaQualifiedTypeInfoTranslator qualifiedInfoOfFromString = getQualifiedInfoOfFromString(newAttrInfo,
- pluginConfig.getConflictResolver());
- /*
- * Create a new java attribute info with qualified information of
- * wrapper classes.
- */
- JavaAttributeInfo fromStringAttributeInfo = getAttributeInfoForTheData(qualifiedInfoOfFromString,
- newAttrInfo.getAttributeName(),
- newAttrInfo.getAttributeType(),
- getIsQualifiedAccessOrAddToImportList(qualifiedInfoOfFromString), false);
-
- addFromStringMethod(newAttrInfo, fromStringAttributeInfo);
- }
-
- /**
- * Adds type constructor.
- *
- * @param attr attribute info
- * @param pluginConfig plugin configurations
- * @throws IOException when fails to append to temporary file
- */
- private void addTypeConstructor(JavaAttributeInfo attr, YangPluginConfig pluginConfig)
- throws IOException {
- appendToFile(getConstructorForTypeTempFileHandle(), getTypeConstructorStringAndJavaDoc(attr,
- getGeneratedJavaClassName(), pluginConfig) + NEW_LINE);
- }
-
- /**
- * Adds type constructor.
- *
- * @param pluginConfig plugin configurations
- * @throws IOException when fails to append to temporary file
- */
- private void addTypeConstructor(YangPluginConfig pluginConfig)
- throws IOException {
- JavaAttributeInfo attr = getIntAttribute();
- if (attr != null) {
- attr = getUIntAttribute();
- }
- if (attr != null) {
- if (attr.isIntConflict()) {
- appendToFile(getConstructorForTypeTempFileHandle(), getTypeConstructorStringAndJavaDoc(
- getIntAttribute(),
- getUIntAttribute(), getGeneratedJavaClassName(), pluginConfig, INT_TYPE_CONFLICT,
- getIntIndex()
- < getUIntIndex()) + NEW_LINE);
- }
- }
- attr = getLongAttribute();
- if (attr != null) {
- attr = getULongAttribute();
- }
- if (attr != null) {
- if (attr.isLongConflict()) {
- appendToFile(getConstructorForTypeTempFileHandle(), getTypeConstructorStringAndJavaDoc(
- getLongAttribute(),
- getULongAttribute(), getGeneratedJavaClassName(), pluginConfig, LONG_TYPE_CONFLICT,
- getLongIndex()
- < getULongIndex()) + NEW_LINE);
- }
- }
- }
-
- /**
- * Adds of string for type.
- *
- * @param attr attribute info
- * @param pluginConfig plugin configurations
- * @throws IOException when fails to append to temporary file
- */
- private void addOfStringMethod(JavaAttributeInfo attr, YangPluginConfig pluginConfig)
- throws IOException {
- appendToFile(getOfStringImplTempFileHandle(), getOfMethodStringAndJavaDoc(attr,
- getGeneratedJavaClassName(), pluginConfig)
- + NEW_LINE);
- }
-
- /**
- * Removes all temporary file handles.
- *
- * @param isErrorOccurred flag to tell translator that error has occurred while file generation
- * @throws IOException when failed to delete the temporary files
- */
- @Override
- public void freeTemporaryResources(boolean isErrorOccurred)
- throws IOException {
-
- if ((getGeneratedJavaFiles() & GENERATE_TYPEDEF_CLASS) != 0) {
- closeFile(getTypedefClassJavaFileHandle(), isErrorOccurred);
- }
-
- if ((getGeneratedJavaFiles() & GENERATE_UNION_CLASS) != 0) {
- closeFile(getTypeClassJavaFileHandle(), isErrorOccurred);
- }
-
- if ((getGeneratedTempFiles() & CONSTRUCTOR_FOR_TYPE_MASK) != 0) {
- closeFile(getConstructorForTypeTempFileHandle(), true);
- }
- if ((getGeneratedTempFiles() & OF_STRING_IMPL_MASK) != 0) {
- closeFile(getOfStringImplTempFileHandle(), true);
- }
- if ((getGeneratedTempFiles() & FROM_STRING_IMPL_MASK) != 0) {
- closeFile(getFromStringImplTempFileHandle(), true);
- }
-
- super.freeTemporaryResources(isErrorOccurred);
-
- }
-
- /**
- * Constructs java code exit.
- *
- * @param fileType generated file type
- * @param curNode current YANG node
- * @throws IOException when fails to generate java files
- */
- @Override
- public void generateJavaFile(int fileType, YangNode curNode)
- throws IOException {
- List<String> imports = new ArrayList<>();
- if (isAttributePresent()) {
- imports = getJavaImportData().getImports();
- }
-
- createPackage(curNode);
-
- /*
- * Creates type def class file.
- */
- if ((fileType & GENERATE_TYPEDEF_CLASS) != 0) {
- addImportsToStringAndHasCodeMethods(imports, true);
- setTypedefClassJavaFileHandle(getJavaFileHandle(getJavaClassName(TYPEDEF_CLASS_FILE_NAME_SUFFIX)));
- generateTypeDefClassFile(getTypedefClassJavaFileHandle(), curNode, imports);
- }
- /*
- * Creates type class file.
- */
- if ((fileType & GENERATE_UNION_CLASS) != 0) {
- addImportsToStringAndHasCodeMethods(imports, true);
- setTypeClassJavaFileHandle(getJavaFileHandle(getJavaClassName(UNION_TYPE_CLASS_FILE_NAME_SUFFIX)));
- generateUnionClassFile(getTypeClassJavaFileHandle(), curNode, imports);
- }
-
- /*
- * Close all the file handles.
- */
- freeTemporaryResources(false);
- }
-
- /**
- * Returns int type index from type list.
- *
- * @return int type index from type list
- */
- public int getIntIndex() {
- return intIndex;
- }
-
- /**
- * Sets int type index from type list.
- *
- * @param intIndex int type index from type list.
- */
- private void setIntIndex(int intIndex) {
- this.intIndex = intIndex;
- }
-
- /**
- * Returns uInt type index from type list.
- *
- * @return uInt type index from type list
- */
- public int getUIntIndex() {
- return uIntIndex;
- }
-
- /**
- * Sets uInt type index from type list.
- *
- * @param uIntIndex uInt type index from type list.
- */
- private void setUIntIndex(int uIntIndex) {
- this.uIntIndex = uIntIndex;
- }
-
- /**
- * Returns long type index from type list.
- *
- * @return long type index from type list
- */
- public int getLongIndex() {
- return longIndex;
- }
-
- /**
- * Sets long type index from type list.
- *
- * @param longIndex long type index from type list.
- */
- private void setLongIndex(int longIndex) {
- this.longIndex = longIndex;
- }
-
- /**
- * Returns uLong type index from type list.
- *
- * @return uLong type index from type list
- */
- public int getULongIndex() {
- return uLongIndex;
- }
-
- /**
- * Sets uLong type index from type list.
- *
- * @param uLongIndex uLong type index from type list.
- */
- private void setULongIndex(int uLongIndex) {
- this.uLongIndex = uLongIndex;
- }
-
- /**
- * Validates conflict for int and uInt.
- *
- * @param typeList type list
- * @return true if conflict is there
- */
- private boolean validateForConflictingIntTypes(List<YangType<?>> typeList) {
- boolean isIntPresent = false;
- boolean isUIntPresent = false;
- for (YangType type : typeList) {
- if (type.getDataType().equals(INT32)) {
- setIntIndex(typeList.indexOf(type));
- isIntPresent = true;
- }
- if (type.getDataType().equals(UINT16)) {
- setUIntIndex(typeList.indexOf(type));
- isUIntPresent = true;
- }
- }
-
- return isIntPresent && isUIntPresent;
- }
-
- /**
- * Validates conflict for long and uLong.
- *
- * @param typeList type list
- * @return true if conflict is there
- */
- private boolean validateForConflictingLongTypes(List<YangType<?>> typeList) {
- boolean isLongPresent = false;
- boolean isULongPresent = false;
- for (YangType type : typeList) {
- if (type.getDataType().equals(INT64)) {
- setLongIndex(typeList.indexOf(type));
- isLongPresent = true;
- }
- if (type.getDataType().equals(UINT32)) {
- setULongIndex(typeList.indexOf(type));
- isULongPresent = true;
- }
- }
-
- return isLongPresent && isULongPresent;
- }
-
- /**
- * Updates attribute info in case of conflicts.
- *
- * @param javaAttributeInfo java attribute info
- */
- private void updateAttributeCondition(JavaAttributeInfo javaAttributeInfo) {
-
- if (javaAttributeInfo.isIntConflict()) {
- if (javaAttributeInfo.getAttributeType().getDataType() == UINT16) {
- setUIntAttribute(javaAttributeInfo);
- } else if (javaAttributeInfo.getAttributeType().getDataType() == INT32) {
- setIntAttribute(javaAttributeInfo);
- }
-
- }
- if (javaAttributeInfo.isLongConflict()) {
- if (javaAttributeInfo.getAttributeType().getDataType() == UINT32) {
- setULongAttribute(javaAttributeInfo);
- } else if (javaAttributeInfo.getAttributeType().getDataType() == INT64) {
- setLongAttribute(javaAttributeInfo);
- }
-
- }
- }
-
- /**
- * Returns attribute for int.
- *
- * @return attribute for int
- */
- public JavaAttributeInfo getIntAttribute() {
- return intAttribute;
- }
-
- /**
- * Sets attribute for int.
- *
- * @param intAttribute attribute for int
- */
- private void setIntAttribute(JavaAttributeInfo intAttribute) {
- this.intAttribute = intAttribute;
- }
-
- /**
- * Returns attribute for long.
- *
- * @return attribute for long
- */
- public JavaAttributeInfo getLongAttribute() {
- return longAttribute;
- }
-
- /**
- * Sets attribute for long.
- *
- * @param longAttribute attribute for long
- */
- private void setLongAttribute(JavaAttributeInfo longAttribute) {
- this.longAttribute = longAttribute;
- }
-
- /**
- * Returns attribute for uInt.
- *
- * @return attribute for uInt
- */
- public JavaAttributeInfo getUIntAttribute() {
- return uIntAttribute;
- }
-
- /**
- * Sets attribute for uInt.
- *
- * @param uIntAttribute attribute for uInt
- */
- private void setUIntAttribute(JavaAttributeInfo uIntAttribute) {
- this.uIntAttribute = uIntAttribute;
- }
-
- /**
- * Returns attribute for uLong.
- *
- * @return attribute for uLong
- */
- public JavaAttributeInfo getULongAttribute() {
- return uLongAttribute;
- }
-
- /**
- * Sets attribute for uLong.
- *
- * @param uLongAttribute attribute for uLong
- */
- private void setULongAttribute(JavaAttributeInfo uLongAttribute) {
- this.uLongAttribute = uLongAttribute;
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TraversalType.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TraversalType.java
deleted file mode 100644
index 35f529a..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TraversalType.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.translator.tojava;
-
-/**
- * Represents data model tree traversal types.
- */
-public enum TraversalType {
-
- /**
- * Start of traversal at the tree root.
- */
- ROOT,
-
- /**
- * Child node traversal.
- */
- CHILD,
-
- /**
- * Sibling node traversal.
- */
- SIBLING,
-
- /**
- * Parent node traversal.
- */
- PARENT
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/YangDataModelFactory.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/YangDataModelFactory.java
deleted file mode 100644
index 9af1352..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/YangDataModelFactory.java
+++ /dev/null
@@ -1,429 +0,0 @@
-/*
- * 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.translator.tojava;
-
-import org.onosproject.yangutils.datamodel.YangAugment;
-import org.onosproject.yangutils.datamodel.YangCase;
-import org.onosproject.yangutils.datamodel.YangChoice;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangGrouping;
-import org.onosproject.yangutils.datamodel.YangIdentity;
-import org.onosproject.yangutils.datamodel.YangInput;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangLeafList;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNotification;
-import org.onosproject.yangutils.datamodel.YangOutput;
-import org.onosproject.yangutils.datamodel.YangRpc;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.datamodel.YangTypeDef;
-import org.onosproject.yangutils.datamodel.YangUnion;
-import org.onosproject.yangutils.datamodel.YangUses;
-import org.onosproject.yangutils.datamodel.utils.GeneratedLanguage;
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaChoiceTranslator;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaContainerTranslator;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaEnumerationTranslator;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaListTranslator;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModuleTranslator;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaNotificationTranslator;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaOutputTranslator;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaRpcTranslator;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaSubModuleTranslator;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaTypeTranslator;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaTypeDefTranslator;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaUnionTranslator;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaUsesTranslator;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaAugmentTranslator;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaCaseTranslator;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaGroupingTranslator;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaIdentityTranslator;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaInputTranslator;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaLeafTranslator;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaLeafListTranslator;
-
-/**
- * Represents factory to create data model objects based on the target file type.
- */
-public final class YangDataModelFactory {
-
- /**
- * Creates a YANG data model factory object.
- */
- private YangDataModelFactory() {
- }
-
- /**
- * Based on the target language generate the inherited data model node.
- *
- * @param targetLanguage target language in which YANG mapping needs to be
- * generated
- * @return the corresponding inherited node based on the target language
- */
- public static YangModule getYangModuleNode(GeneratedLanguage targetLanguage) {
- switch (targetLanguage) {
- case JAVA_GENERATION: {
- return new YangJavaModuleTranslator();
- }
- default: {
- throw new TranslatorException("Only YANG to Java is supported.");
- }
- }
- }
-
- /**
- * Returns based on the target language generate the inherited data model node.
- *
- * @param targetLanguage target language in which YANG mapping needs to be
- * generated
- * @return the corresponding inherited node based on the target language
- */
- public static YangAugment getYangAugmentNode(GeneratedLanguage targetLanguage) {
- switch (targetLanguage) {
- case JAVA_GENERATION: {
- return new YangJavaAugmentTranslator();
- }
- default: {
- throw new TranslatorException("Only YANG to Java is supported.");
- }
- }
- }
-
- /**
- * Returns based on the target language generate the inherited data model node.
- *
- * @param targetLanguage target language in which YANG mapping needs to be
- * generated
- * @return the corresponding inherited node based on the target language
- */
- public static YangCase getYangCaseNode(GeneratedLanguage targetLanguage) {
- switch (targetLanguage) {
- case JAVA_GENERATION: {
- return new YangJavaCaseTranslator();
- }
- default: {
- throw new TranslatorException("Only YANG to Java is supported.");
- }
- }
- }
-
- /**
- * Returns based on the target language generate the inherited data model node.
- *
- * @param targetLanguage target language in which YANG mapping needs to be
- * generated
- * @return the corresponding inherited node based on the target language
- */
- public static YangChoice getYangChoiceNode(GeneratedLanguage targetLanguage) {
- switch (targetLanguage) {
- case JAVA_GENERATION: {
- return new YangJavaChoiceTranslator();
- }
- default: {
- throw new TranslatorException("Only YANG to Java is supported.");
- }
- }
- }
-
- /**
- * Returns based on the target language generate the inherited data model node.
- *
- * @param targetLanguage target language in which YANG mapping needs to be
- * generated
- * @return the corresponding inherited node based on the target language
- */
- public static YangContainer getYangContainerNode(GeneratedLanguage targetLanguage) {
- switch (targetLanguage) {
- case JAVA_GENERATION: {
- return new YangJavaContainerTranslator();
- }
- default: {
- throw new TranslatorException("Only YANG to Java is supported.");
- }
- }
- }
-
- /**
- * Returns based on the target language generate the inherited data model node.
- *
- * @param targetLanguage target language in which YANG mapping needs to be
- * generated
- * @return the corresponding inherited node based on the target language
- */
- public static YangIdentity getYangIdentityNode(GeneratedLanguage targetLanguage) {
- switch (targetLanguage) {
- case JAVA_GENERATION: {
- return new YangJavaIdentityTranslator();
- }
- default: {
- throw new TranslatorException("Only YANG to Java is supported.");
- }
- }
- }
-
- /**
- * Returns based on the target language generate the inherited data model node.
- *
- * @param targetLanguage target language in which YANG mapping needs to be
- * generated
- * @return the corresponding inherited node based on the target language
- */
- public static YangGrouping getYangGroupingNode(GeneratedLanguage targetLanguage) {
- switch (targetLanguage) {
- case JAVA_GENERATION: {
- return new YangJavaGroupingTranslator();
- }
- default: {
- throw new TranslatorException("Only YANG to Java is supported.");
- }
- }
- }
-
- /**
- * Returns based on the target language generate the inherited data model node.
- *
- * @param targetLanguage target language in which YANG mapping needs to be
- * generated
- * @return the corresponding inherited node based on the target language
- */
- public static YangList getYangListNode(GeneratedLanguage targetLanguage) {
- switch (targetLanguage) {
- case JAVA_GENERATION: {
- return new YangJavaListTranslator();
- }
- default: {
- throw new TranslatorException("Only YANG to Java is supported.");
- }
- }
- }
-
- /**
- * Returns based on the target language generate the inherited data model node.
- *
- * @param targetLanguage target language in which YANG mapping needs to be
- * generated
- * @return the corresponding inherited node based on the target language
- */
- public static YangSubModule getYangSubModuleNode(GeneratedLanguage targetLanguage) {
- switch (targetLanguage) {
- case JAVA_GENERATION: {
- return new YangJavaSubModuleTranslator();
- }
- default: {
- throw new TranslatorException("Only YANG to Java is supported.");
- }
- }
- }
-
- /**
- * Returns based on the target language generate the inherited data model node.
- *
- * @param targetLanguage target language in which YANG mapping needs to be
- * generated
- * @return the corresponding inherited node based on the target language
- */
- public static YangTypeDef getYangTypeDefNode(GeneratedLanguage targetLanguage) {
- switch (targetLanguage) {
- case JAVA_GENERATION: {
- return new YangJavaTypeDefTranslator();
- }
- default: {
- throw new TranslatorException("Only YANG to Java is supported.");
- }
- }
- }
-
- /**
- * Returns based on the target language generate the inherited data model node.
- *
- * @param targetLanguage target language in which YANG mapping needs to be
- * generated
- * @return the corresponding inherited node based on the target language
- */
- public static YangUnion getYangUnionNode(GeneratedLanguage targetLanguage) {
- switch (targetLanguage) {
- case JAVA_GENERATION: {
- return new YangJavaUnionTranslator();
- }
- default: {
- throw new TranslatorException("Only YANG to Java is supported.");
- }
- }
- }
-
- /**
- * Returns based on the target language generate the inherited data model node.
- *
- * @param targetLanguage target language in which YANG mapping needs to be
- * generated
- * @return the corresponding inherited node based on the target language
- */
- public static YangUses getYangUsesNode(GeneratedLanguage targetLanguage) {
- switch (targetLanguage) {
- case JAVA_GENERATION: {
- return new YangJavaUsesTranslator();
- }
- default: {
- throw new TranslatorException("Only YANG to Java is supported.");
- }
- }
- }
-
- /**
- * Returns based on the target language generate the inherited data model node.
- *
- * @param targetLanguage target language in which YANG mapping needs to be
- * generated
- * @return the corresponding inherited node based on the target language
- */
- public static YangNotification getYangNotificationNode(GeneratedLanguage targetLanguage) {
- switch (targetLanguage) {
- case JAVA_GENERATION: {
- return new YangJavaNotificationTranslator();
- }
- default: {
- throw new TranslatorException("Only YANG to Java is supported.");
- }
- }
- }
-
- /**
- * Returns based on the target language generate the inherited data model node.
- *
- * @param targetLanguage target language in which YANG mapping needs to be
- * generated
- * @return the corresponding inherited node based on the target language
- */
- public static YangLeaf getYangLeaf(GeneratedLanguage targetLanguage) {
- switch (targetLanguage) {
- case JAVA_GENERATION: {
- return new YangJavaLeafTranslator();
- }
- default: {
- throw new RuntimeException("Only YANG to Java is supported.");
- }
- }
- }
-
- /**
- * Returns based on the target language generate the inherited data model node.
- *
- * @param targetLanguage target language in which YANG mapping needs to be
- * generated
- * @return the corresponding inherited node based on the target language
- */
- public static YangLeafList getYangLeafList(GeneratedLanguage targetLanguage) {
- switch (targetLanguage) {
- case JAVA_GENERATION: {
- return new YangJavaLeafListTranslator();
- }
- default: {
- throw new RuntimeException("Only YANG to Java is supported.");
- }
- }
- }
-
- /**
- * Returns based on the target language generate the inherited data model node.
- *
- * @param targetLanguage target language in which YANG mapping needs to be
- * generated
- * @return the corresponding inherited node based on the target language
- */
- public static YangRpc getYangRpcNode(GeneratedLanguage targetLanguage) {
- switch (targetLanguage) {
- case JAVA_GENERATION: {
- return new YangJavaRpcTranslator();
- }
- default: {
- throw new TranslatorException("Only YANG to Java is supported.");
- }
- }
- }
-
- /**
- * Returns based on the target language generate the inherited data model node.
- *
- * @param targetLanguage target language in which YANG mapping needs to be
- * generated
- * @return the corresponding inherited node based on the target language
- */
- public static YangInput getYangInputNode(GeneratedLanguage targetLanguage) {
- switch (targetLanguage) {
- case JAVA_GENERATION: {
- return new YangJavaInputTranslator();
- }
- default: {
- throw new TranslatorException("Only YANG to Java is supported.");
- }
- }
- }
-
- /**
- * Returns based on the target language generate the inherited data model node.
- *
- * @param targetLanguage target language in which YANG mapping needs to be
- * generated
- * @return the corresponding inherited node based on the target language
- */
- public static YangOutput getYangOutputNode(GeneratedLanguage targetLanguage) {
- switch (targetLanguage) {
- case JAVA_GENERATION: {
- return new YangJavaOutputTranslator();
- }
- default: {
- throw new TranslatorException("Only YANG to Java is supported.");
- }
- }
- }
-
- /**
- * Returns based on the target language generate the inherited data model node.
- *
- * @param targetLanguage target language in which YANG mapping needs to be
- * generated
- * @return the corresponding inherited node based on the target language
- */
- public static YangJavaEnumerationTranslator getYangEnumerationNode(GeneratedLanguage targetLanguage) {
- switch (targetLanguage) {
- case JAVA_GENERATION: {
- return new YangJavaEnumerationTranslator();
- }
- default: {
- throw new TranslatorException("Only YANG to Java is supported.");
- }
- }
- }
- /**
- * Returns based on the target language generate the inherited data model node.
- *
- * @param targetLanguage target language in which YANG mapping needs to be
- * generated
- * @return the corresponding inherited node based on the target language
- */
- public static YangType getYangType(GeneratedLanguage targetLanguage) {
- switch (targetLanguage) {
- case JAVA_GENERATION: {
- return new YangJavaTypeTranslator();
- }
- default: {
- throw new RuntimeException("Only YANG to Java is supported.");
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/YangJavaModelUtils.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/YangJavaModelUtils.java
deleted file mode 100644
index 0826c80..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/YangJavaModelUtils.java
+++ /dev/null
@@ -1,502 +0,0 @@
-/*
- * 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.translator.tojava;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.onosproject.yangutils.datamodel.RpcNotificationContainer;
-import org.onosproject.yangutils.datamodel.YangAtomicPath;
-import org.onosproject.yangutils.datamodel.YangAugment;
-import org.onosproject.yangutils.datamodel.YangCase;
-import org.onosproject.yangutils.datamodel.YangChoice;
-import org.onosproject.yangutils.datamodel.YangLeavesHolder;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeIdentifier;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.datamodel.YangTranslatorOperatorNode;
-import org.onosproject.yangutils.datamodel.YangTypeHolder;
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.datamodel.utils.DataModelUtils;
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaAugmentTranslator;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaEnumerationTranslator;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModuleTranslator;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaSubModuleTranslator;
-
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.isRpcChildNodePresent;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_SERVICE_AND_MANAGER;
-import static org.onosproject.yangutils.translator.tojava.TempJavaFragmentFiles.addCurNodeInfoInParentTempFile;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getRootPackage;
-import static org.onosproject.yangutils.utils.UtilConstants.AUGMENTED;
-import static org.onosproject.yangutils.utils.UtilConstants.PERIOD;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCamelCase;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getPackageDirPathFromJavaJPackage;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.trimAtLast;
-
-/**
- * Represents utility class for YANG java model.
- */
-public final class YangJavaModelUtils {
-
- /**
- * Creates an instance of YANG java model utility.
- */
- private YangJavaModelUtils() {
- }
-
- /**
- * Updates YANG java file package information.
- *
- * @param javaCodeGeneratorInfo YANG java file info node
- * @param yangPluginConfig YANG plugin config
- * @throws IOException IO operations fails
- */
- public static void updatePackageInfo(JavaCodeGeneratorInfo javaCodeGeneratorInfo,
- YangPluginConfig yangPluginConfig)
- throws IOException {
- if (javaCodeGeneratorInfo instanceof YangJavaAugmentTranslator) {
- updatePackageForAugmentInfo(javaCodeGeneratorInfo, yangPluginConfig);
- } else {
- javaCodeGeneratorInfo.getJavaFileInfo()
- .setJavaName(getCamelCase(((YangNode) javaCodeGeneratorInfo).getName(),
- yangPluginConfig.getConflictResolver()));
- javaCodeGeneratorInfo.getJavaFileInfo().setPackage(getCurNodePackage((YangNode) javaCodeGeneratorInfo));
- }
- javaCodeGeneratorInfo.getJavaFileInfo().setPackageFilePath(
- getPackageDirPathFromJavaJPackage(javaCodeGeneratorInfo.getJavaFileInfo().getPackage()));
-
- javaCodeGeneratorInfo.getJavaFileInfo().setBaseCodeGenPath(yangPluginConfig.getCodeGenDir());
- javaCodeGeneratorInfo.getJavaFileInfo().setPluginConfig(yangPluginConfig);
-
- }
-
- /**
- * Updates YANG java file package information.
- *
- * @param javaCodeGeneratorInfo YANG java file info node
- * @param yangPluginConfig YANG plugin config
- * @throws IOException IO operations fails
- */
- private static void updatePackageForAugmentInfo(JavaCodeGeneratorInfo javaCodeGeneratorInfo,
- YangPluginConfig yangPluginConfig)
- throws IOException {
- javaCodeGeneratorInfo.getJavaFileInfo()
- .setJavaName(getAugmentClassName((YangJavaAugmentTranslator) javaCodeGeneratorInfo,
- yangPluginConfig));
- javaCodeGeneratorInfo.getJavaFileInfo().setPackage(
- getAugmentsNodePackage((YangNode) javaCodeGeneratorInfo, yangPluginConfig));
- javaCodeGeneratorInfo.getJavaFileInfo().setPackageFilePath(
- getPackageDirPathFromJavaJPackage(javaCodeGeneratorInfo.getJavaFileInfo().getPackage()));
- javaCodeGeneratorInfo.getJavaFileInfo().setBaseCodeGenPath(yangPluginConfig.getCodeGenDir());
- javaCodeGeneratorInfo.getJavaFileInfo().setPluginConfig(yangPluginConfig);
- }
-
- /**
- * Returns package for augment node.
- *
- * @param yangNode augment node
- * @param yangPluginConfig plugin configurations
- * @return package for augment node
- */
- private static String getAugmentsNodePackage(YangNode yangNode, YangPluginConfig yangPluginConfig) {
- YangAugment augment = (YangAugment) yangNode;
- StringBuilder augmentPkg = new StringBuilder();
- augmentPkg.append(getCurNodePackage(augment));
-
- String pkg = PERIOD;
- for (YangAtomicPath atomicPath : augment.getTargetNode()) {
- pkg = pkg + getCamelCase(atomicPath.getNodeIdentifier().getName(), yangPluginConfig.getConflictResolver())
- + PERIOD;
- }
- pkg = trimAtLast(pkg, PERIOD);
- augmentPkg.append(pkg.toLowerCase());
- return augmentPkg.toString();
- }
-
- /**
- * Updates YANG java file package information for specified package.
- *
- * @param javaCodeGeneratorInfo YANG java file info node
- * @param yangPlugin YANG plugin config
- * @throws IOException IO operations fails
- */
- private static void updatePackageInfo(JavaCodeGeneratorInfo javaCodeGeneratorInfo, YangPluginConfig yangPlugin,
- String pkg) throws IOException {
- javaCodeGeneratorInfo.getJavaFileInfo()
- .setJavaName(getCamelCase(((YangNode) javaCodeGeneratorInfo).getName(),
- yangPlugin.getConflictResolver()));
- javaCodeGeneratorInfo.getJavaFileInfo().setPackage(pkg);
- javaCodeGeneratorInfo.getJavaFileInfo().setPackageFilePath(
- getPackageDirPathFromJavaJPackage(javaCodeGeneratorInfo.getJavaFileInfo().getPackage()));
- javaCodeGeneratorInfo.getJavaFileInfo().setBaseCodeGenPath(yangPlugin.getCodeGenDir());
- javaCodeGeneratorInfo.getJavaFileInfo().setPluginConfig(yangPlugin);
- }
-
- /**
- * Updates temporary java code fragment files.
- *
- * @param javaCodeGeneratorInfo YANG java file info node
- * @throws IOException IO operations fails
- */
- private static void createTempFragmentFile(JavaCodeGeneratorInfo javaCodeGeneratorInfo)
- throws IOException {
- javaCodeGeneratorInfo.setTempJavaCodeFragmentFiles(
- new TempJavaCodeFragmentFiles(javaCodeGeneratorInfo.getJavaFileInfo()));
- }
-
- /**
- * Updates leaf information in temporary java code fragment files.
- *
- * @param javaCodeGeneratorInfo YANG java file info node
- * @throws IOException IO operations fails
- */
- private static void updateTempFragmentFiles(JavaCodeGeneratorInfo javaCodeGeneratorInfo,
- YangPluginConfig yangPluginConfig)
- throws IOException {
-
- if (javaCodeGeneratorInfo instanceof YangModule
- || javaCodeGeneratorInfo instanceof YangSubModule) {
- javaCodeGeneratorInfo.getTempJavaCodeFragmentFiles().getBeanTempFiles().setRooNode(true);
- }
-
- if (javaCodeGeneratorInfo instanceof RpcNotificationContainer) {
- /*
- * Module / sub module node code generation.
- */
- javaCodeGeneratorInfo.getTempJavaCodeFragmentFiles()
- .getServiceTempFiles().addCurNodeLeavesInfoToTempFiles(
- (YangNode) javaCodeGeneratorInfo, yangPluginConfig);
- if (javaCodeGeneratorInfo instanceof YangJavaModuleTranslator) {
- if (!((YangJavaModuleTranslator) javaCodeGeneratorInfo).getNotificationNodes().isEmpty()) {
- updateNotificationNodeInfo(javaCodeGeneratorInfo, yangPluginConfig);
- }
- } else if (javaCodeGeneratorInfo instanceof YangJavaSubModuleTranslator) {
- if (!((YangJavaSubModuleTranslator) javaCodeGeneratorInfo).getNotificationNodes().isEmpty()) {
- updateNotificationNodeInfo(javaCodeGeneratorInfo, yangPluginConfig);
- }
- }
-
- }
- if (javaCodeGeneratorInfo instanceof YangLeavesHolder) {
- /*
- * Container
- * Case
- * Grouping
- * Input
- * List
- * Notification
- * Output
- */
- javaCodeGeneratorInfo.getTempJavaCodeFragmentFiles()
- .getBeanTempFiles().addCurNodeLeavesInfoToTempFiles(
- (YangNode) javaCodeGeneratorInfo, yangPluginConfig);
- } else if (javaCodeGeneratorInfo instanceof YangTypeHolder) {
- /*
- * Typedef
- * Union
- */
- javaCodeGeneratorInfo.getTempJavaCodeFragmentFiles()
- .addTypeInfoToTempFiles((YangTypeHolder) javaCodeGeneratorInfo, yangPluginConfig);
- } else if (javaCodeGeneratorInfo instanceof YangJavaEnumerationTranslator) {
- /*
- * Enumeration
- */
- javaCodeGeneratorInfo.getTempJavaCodeFragmentFiles().getEnumerationTempFiles()
- .addEnumAttributeToTempFiles((YangNode) javaCodeGeneratorInfo, yangPluginConfig);
-
- } else if (javaCodeGeneratorInfo instanceof YangChoice) {
- /*Do nothing, only the interface needs to be generated*/
- } else {
- throw new TranslatorException("Unsupported Node Translation");
- }
- }
-
- /**
- * Process generate code entry of YANG node.
- *
- * @param javaCodeGeneratorInfo YANG java file info node
- * @param yangPluginConfig plugin configurations
- * @throws IOException IO operations fails
- */
- private static void generateTempFiles(JavaCodeGeneratorInfo javaCodeGeneratorInfo,
- YangPluginConfig yangPluginConfig)
- throws IOException {
- if (!(javaCodeGeneratorInfo instanceof YangNode)) {
- throw new TranslatorException("translation is not supported for the node");
- }
- createTempFragmentFile(javaCodeGeneratorInfo);
- updateTempFragmentFiles(javaCodeGeneratorInfo, yangPluginConfig);
-
- }
-
- /**
- * Updates notification node info in service temporary file.
- *
- * @param javaCodeGeneratorInfo java code generator info
- * @param yangPluginConfig plugin configurations
- * @throws IOException when fails to do IO operations
- */
- private static void updateNotificationNodeInfo(JavaCodeGeneratorInfo javaCodeGeneratorInfo,
- YangPluginConfig yangPluginConfig)
- throws IOException {
- if (javaCodeGeneratorInfo instanceof YangJavaModuleTranslator) {
- for (YangNode notification : ((YangJavaModuleTranslator) javaCodeGeneratorInfo).getNotificationNodes()) {
- javaCodeGeneratorInfo.getTempJavaCodeFragmentFiles()
- .getEventFragmentFiles()
- .addJavaSnippetOfEvent(notification, yangPluginConfig);
- }
- }
- if (javaCodeGeneratorInfo instanceof YangJavaSubModuleTranslator) {
- for (YangNode notification : ((YangJavaSubModuleTranslator) javaCodeGeneratorInfo)
- .getNotificationNodes()) {
- javaCodeGeneratorInfo.getTempJavaCodeFragmentFiles()
- .getEventFragmentFiles()
- .addJavaSnippetOfEvent(notification, yangPluginConfig);
- }
- }
- }
-
- /**
- * Generates code for the current ata model node and adds itself as an attribute in the parent.
- *
- * @param javaCodeGeneratorInfo YANG java file info node
- * @param yangPlugin YANG plugin config
- * @param isMultiInstance flag to indicate whether it's a list
- * @throws IOException IO operations fails
- */
- public static void generateCodeAndUpdateInParent(JavaCodeGeneratorInfo javaCodeGeneratorInfo,
- YangPluginConfig yangPlugin, boolean isMultiInstance)
- throws IOException {
- if (!(javaCodeGeneratorInfo instanceof YangNode)) {
- throw new TranslatorException("Invalid node for translation");
- }
-
- /*
- * Generate the Java files corresponding to the current node.
- */
- generateCodeOfAugmentableNode(javaCodeGeneratorInfo, yangPlugin);
-
- /*
- * Update the current nodes info in its parent nodes generated files.
- */
- addCurNodeInfoInParentTempFile((YangNode) javaCodeGeneratorInfo, isMultiInstance, yangPlugin);
- }
-
- /**
- * Generates code for the current data model node and adds support for it to be augmented.
- *
- * @param javaCodeGeneratorInfo YANG java file info node
- * @param yangPlugin YANG plugin config
- * @throws IOException IO operations fails
- */
- public static void generateCodeOfAugmentableNode(JavaCodeGeneratorInfo javaCodeGeneratorInfo,
- YangPluginConfig yangPlugin)
- throws IOException {
- if (!(javaCodeGeneratorInfo instanceof YangNode)) {
- throw new TranslatorException("invalid node for translation");
- }
-
- generateCodeOfNode(javaCodeGeneratorInfo, yangPlugin);
- TempJavaCodeFragmentFiles tempJavaCodeFragmentFiles = javaCodeGeneratorInfo.getTempJavaCodeFragmentFiles();
-
- if (javaCodeGeneratorInfo instanceof YangCase) {
- YangNode parent = ((YangCase) javaCodeGeneratorInfo).getParent();
- if (parent instanceof YangAugment) {
- parent = ((YangAugment) parent).getAugmentedNode();
- }
- JavaQualifiedTypeInfoTranslator parentsInfo = new JavaQualifiedTypeInfoTranslator();
- JavaFileInfo parentInfo = ((JavaFileInfoContainer) parent).getJavaFileInfo();
- String parentName;
- String parentPkg;
- if (parentInfo.getPackage() != null) {
- parentName = getCapitalCase(((JavaFileInfoContainer) parent).getJavaFileInfo().getJavaName());
- parentPkg = ((JavaFileInfoContainer) parent).getJavaFileInfo().getPackage();
- } else {
- parentName = getCapitalCase(getCamelCase(parent.getName(), yangPlugin.getConflictResolver()));
- parentPkg = getNodesPackage(parent, yangPlugin);
- }
- parentsInfo.setClassInfo(parentName);
- parentsInfo.setPkgInfo(parentPkg);
- javaCodeGeneratorInfo.getTempJavaCodeFragmentFiles().getBeanTempFiles().getJavaExtendsListHolder()
- .addToExtendsList(parentsInfo, (YangNode) javaCodeGeneratorInfo,
- tempJavaCodeFragmentFiles.getBeanTempFiles());
-
- javaCodeGeneratorInfo.getTempJavaCodeFragmentFiles().getBeanTempFiles()
- .addParentInfoInCurNodeTempFile((YangNode) javaCodeGeneratorInfo, yangPlugin);
-
- }
- }
-
- /**
- * Generates code for the current data model node.
- *
- * @param javaCodeGeneratorInfo YANG java file info node
- * @param yangPluginConfig YANG plugin config
- * @throws IOException IO operations fails
- */
- public static void generateCodeOfNode(JavaCodeGeneratorInfo javaCodeGeneratorInfo,
- YangPluginConfig yangPluginConfig)
- throws IOException {
- if (!(javaCodeGeneratorInfo instanceof YangNode)) {
- throw new TranslatorException("invalid node for translation");
- }
- updatePackageInfo(javaCodeGeneratorInfo, yangPluginConfig);
- generateTempFiles(javaCodeGeneratorInfo, yangPluginConfig);
- }
-
- /**
- * Generates code for the root module/sub-module node.
- *
- * @param javaCodeGeneratorInfo YANG java file info node
- * @param yangPluginConfig YANG plugin config
- * @param rootPkg package of the root node
- * @throws IOException IO operations fails
- */
- public static void generateCodeOfRootNode(JavaCodeGeneratorInfo javaCodeGeneratorInfo,
- YangPluginConfig yangPluginConfig, String rootPkg)
- throws IOException {
- if (!(javaCodeGeneratorInfo instanceof YangNode)) {
- throw new TranslatorException("invalid node for translation");
- }
- updatePackageInfo(javaCodeGeneratorInfo, yangPluginConfig, rootPkg);
-
- if (isRpcChildNodePresent((YangNode) javaCodeGeneratorInfo)) {
- javaCodeGeneratorInfo.getJavaFileInfo().addGeneratedFileTypes(GENERATE_SERVICE_AND_MANAGER);
- }
-
- generateTempFiles(javaCodeGeneratorInfo, yangPluginConfig);
- }
-
- /**
- * Returns the node package string.
- *
- * @param curNode current java node whose package string needs to be set
- * @return returns the root package string
- */
- public static String getCurNodePackage(YangNode curNode) {
-
- String pkg;
- if (!(curNode instanceof JavaFileInfoContainer)
- || curNode.getParent() == null) {
- throw new TranslatorException("missing parent node to get current node's package");
- }
-
- YangNode parentNode = DataModelUtils.getParentNodeInGenCode(curNode);
- if (!(parentNode instanceof JavaFileInfoContainer)) {
- throw new TranslatorException("missing parent java node to get current node's package");
- }
- JavaFileInfo parentJavaFileHandle = ((JavaFileInfoContainer) parentNode).getJavaFileInfo();
- pkg = parentJavaFileHandle.getPackage() + PERIOD + parentJavaFileHandle.getJavaName();
- return pkg.toLowerCase();
- }
-
- /**
- * Returns true if root node contains any data node.
- *
- * @param node root YANG node
- * @return true if root node contains any data node
- */
- public static boolean isRootNodesCodeGenRequired(YangNode node) {
-
- List<YangNode> childNodes = new ArrayList<>();
- YangNode tempNode = node.getChild();
- while (tempNode != null) {
- childNodes.add(tempNode);
- tempNode = tempNode.getNextSibling();
- }
-
- if (childNodes.size() == 0) {
- YangLeavesHolder leavesHolder = (YangLeavesHolder) node;
- return !leavesHolder.getListOfLeaf().isEmpty() || !leavesHolder.getListOfLeafList().isEmpty();
- } else if (childNodes.size() == 1) {
- return !(childNodes.get(0) instanceof YangTranslatorOperatorNode);
- }
- List<Boolean> booleanData = new ArrayList<>();
- for (YangNode child : childNodes) {
- if (child instanceof YangTranslatorOperatorNode) {
- booleanData.add(false);
- } else {
- booleanData.add(true);
- }
- }
- return booleanData.contains(true);
- }
-
- /**
- * Returns nodes package.
- *
- * @param node YANG node
- * @param yangPluginConfig plugin config
- * @return java package
- */
- public static String getNodesPackage(YangNode node, YangPluginConfig yangPluginConfig) {
-
- List<String> clsInfo = new ArrayList<>();
- while (node.getParent() != null) {
- if (node instanceof YangJavaAugmentTranslator) {
- clsInfo.add(getAugmentClassName((YangAugment) node, yangPluginConfig));
- } else {
- clsInfo.add(getCamelCase(node.getName(), yangPluginConfig.getConflictResolver()));
- }
- node = node.getParent();
- }
-
- StringBuilder pkg = new StringBuilder();
- if (node instanceof YangJavaModuleTranslator) {
- YangJavaModuleTranslator module = (YangJavaModuleTranslator) node;
- pkg.append(getRootPackage(module.getVersion(), module.getNameSpace().getUri(), module
- .getRevision().getRevDate(), yangPluginConfig.getConflictResolver()));
- } else if (node instanceof YangJavaSubModuleTranslator) {
- YangJavaSubModuleTranslator subModule = (YangJavaSubModuleTranslator) node;
- pkg.append(getRootPackage(subModule.getVersion(),
- subModule.getNameSpaceFromModule(subModule.getBelongsTo()),
- subModule.getRevision().getRevDate(), yangPluginConfig.getConflictResolver()));
- }
- String concat = "";
- for (int i = 1; i <= clsInfo.size(); i++) {
- concat = concat + "." + clsInfo.get(clsInfo.size() - i);
- }
- pkg.append(concat);
- return pkg.toString().toLowerCase();
-
- }
-
- /**
- * Returns augment class name.
- *
- * @param augment YANG augment
- * @param yangPluginConfig plugin configurations
- * @return augment class name
- */
- public static String getAugmentClassName(YangAugment augment, YangPluginConfig yangPluginConfig) {
- YangNodeIdentifier yangNodeIdentifier = augment.getTargetNode().get(augment.getTargetNode().size() - 1)
- .getNodeIdentifier();
- String name = getCapitalCase(getCamelCase(yangNodeIdentifier.getName(), yangPluginConfig
- .getConflictResolver()));
- if (yangNodeIdentifier.getPrefix() != null) {
- return AUGMENTED + getCapitalCase(yangNodeIdentifier.getPrefix()) + name;
- } else {
- return AUGMENTED + name;
- }
- }
-
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/AttributesJavaDataType.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/AttributesJavaDataType.java
deleted file mode 100644
index ef2ca3d..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/AttributesJavaDataType.java
+++ /dev/null
@@ -1,478 +0,0 @@
-/*
- * 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.translator.tojava.javamodel;
-
-import java.util.Stack;
-
-import org.onosproject.yangutils.datamodel.YangDerivedInfo;
-import org.onosproject.yangutils.datamodel.YangEnumeration;
-import org.onosproject.yangutils.datamodel.YangIdentity;
-import org.onosproject.yangutils.datamodel.YangIdentityRef;
-import org.onosproject.yangutils.datamodel.YangLeafRef;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.datamodel.YangUnion;
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangToJavaNamingConflictUtil;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfoContainer;
-
-import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.getCurNodePackage;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getRootPackage;
-import static org.onosproject.yangutils.utils.UtilConstants.BIG_DECIMAL;
-import static org.onosproject.yangutils.utils.UtilConstants.BIG_INTEGER;
-import static org.onosproject.yangutils.utils.UtilConstants.BIT_SET;
-import static org.onosproject.yangutils.utils.UtilConstants.BOOLEAN_DATA_TYPE;
-import static org.onosproject.yangutils.utils.UtilConstants.BOOLEAN_WRAPPER;
-import static org.onosproject.yangutils.utils.UtilConstants.BYTE;
-import static org.onosproject.yangutils.utils.UtilConstants.BYTE_WRAPPER;
-import static org.onosproject.yangutils.utils.UtilConstants.COLLECTION_IMPORTS;
-import static org.onosproject.yangutils.utils.UtilConstants.INT;
-import static org.onosproject.yangutils.utils.UtilConstants.INTEGER_WRAPPER;
-import static org.onosproject.yangutils.utils.UtilConstants.JAVA_LANG;
-import static org.onosproject.yangutils.utils.UtilConstants.JAVA_MATH;
-import static org.onosproject.yangutils.utils.UtilConstants.LONG;
-import static org.onosproject.yangutils.utils.UtilConstants.LONG_WRAPPER;
-import static org.onosproject.yangutils.utils.UtilConstants.PERIOD;
-import static org.onosproject.yangutils.utils.UtilConstants.SHORT;
-import static org.onosproject.yangutils.utils.UtilConstants.SHORT_WRAPPER;
-import static org.onosproject.yangutils.utils.UtilConstants.SQUARE_BRACKETS;
-import static org.onosproject.yangutils.utils.UtilConstants.STRING_DATA_TYPE;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCamelCase;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getPackageDirPathFromJavaJPackage;
-
-/**
- * Represents java data types info corresponding to YANG type.
- */
-public final class AttributesJavaDataType {
-
- /**
- * Creates an instance of attribute java data type.
- */
- private AttributesJavaDataType() {
- }
-
- /**
- * Returns java type.
- *
- * @param yangType YANG type
- * @return java type
- */
- public static String getJavaDataType(YangType<?> yangType) {
-
- YangDataTypes type = yangType.getDataType();
-
- switch (type) {
- case INT8:
- return BYTE;
- case INT16:
- return SHORT;
- case INT32:
- return INT;
- case INT64:
- return LONG;
- case UINT8:
- return SHORT;
- case UINT16:
- return INT;
- case UINT32:
- return LONG;
- case UINT64:
- return BIG_INTEGER;
- case BITS:
- return BIT_SET;
- case BINARY:
- return BYTE + SQUARE_BRACKETS;
- case DECIMAL64:
- return BIG_DECIMAL;
- case STRING:
- return STRING_DATA_TYPE;
- case BOOLEAN:
- return BOOLEAN_DATA_TYPE;
- case INSTANCE_IDENTIFIER:
- return STRING_DATA_TYPE;
- case LEAFREF:
- return getJavaDataType(getReferredTypeFromLeafref(yangType));
- default:
- throw new TranslatorException("given data type is not supported.");
- }
- }
-
- /**
- * Returns java import class.
- *
- * @param yangType YANG type
- * @param isListAttr if the attribute need to be a list
- * @param pluginConfig plugin configurations
- * @return java import class
- */
- public static String getJavaImportClass(YangType<?> yangType, boolean isListAttr,
- YangToJavaNamingConflictUtil pluginConfig) {
-
- YangDataTypes type = yangType.getDataType();
-
- if (isListAttr) {
- switch (type) {
- case INT8:
- return BYTE_WRAPPER;
- case INT16:
- return SHORT_WRAPPER;
- case INT32:
- return INTEGER_WRAPPER;
- case INT64:
- return LONG_WRAPPER;
- case UINT8:
- return SHORT_WRAPPER;
- case UINT16:
- return INTEGER_WRAPPER;
- case UINT32:
- return LONG_WRAPPER;
- case UINT64:
- return BIG_INTEGER;
- case DECIMAL64:
- return BIG_DECIMAL;
- case STRING:
- return STRING_DATA_TYPE;
- case BOOLEAN:
- return BOOLEAN_WRAPPER;
- case ENUMERATION:
- return getCapitalCase(
- getCamelCase(((YangJavaEnumerationTranslator) yangType.getDataTypeExtendedInfo()).getName(),
- pluginConfig));
- case BITS:
- return BIT_SET;
- case BINARY:
- return BYTE + SQUARE_BRACKETS;
- case LEAFREF:
- YangType<?> referredType = getReferredTypeFromLeafref(yangType);
- return getJavaImportClass(referredType, true, pluginConfig);
- case IDENTITYREF:
- YangIdentityRef identityRef = (YangIdentityRef) yangType.getDataTypeExtendedInfo();
- YangIdentity identity = identityRef.getReferredIdentity();
- return getCapitalCase(getCamelCase(identity.
- getName(), pluginConfig));
- case EMPTY:
- return BOOLEAN_WRAPPER;
- case UNION:
- return getCapitalCase(getCamelCase(((YangJavaUnionTranslator) yangType
- .getDataTypeExtendedInfo()).getName(), pluginConfig));
- case INSTANCE_IDENTIFIER:
- return STRING_DATA_TYPE;
- case DERIVED:
- return getCapitalCase(
- getCamelCase(yangType.getDataTypeName(), pluginConfig));
- default:
- throw new TranslatorException("given data type is not supported.");
- }
- } else {
- switch (type) {
- case UINT64:
- return BIG_INTEGER;
- case STRING:
- return STRING_DATA_TYPE;
- case ENUMERATION:
- return getCapitalCase(
- getCamelCase(((YangJavaEnumerationTranslator) yangType.getDataTypeExtendedInfo()).getName(),
- pluginConfig));
- case BITS:
- return BIT_SET;
- case DECIMAL64:
- return BIG_DECIMAL;
- case LEAFREF:
- YangType<?> referredType = getReferredTypeFromLeafref(yangType);
- return getJavaImportClass(referredType, false, pluginConfig);
- case IDENTITYREF:
- YangIdentityRef identityRef = (YangIdentityRef) yangType.getDataTypeExtendedInfo();
- YangIdentity identity = identityRef.getReferredIdentity();
- return getCapitalCase(getCamelCase(identity.getName(), pluginConfig));
- case EMPTY:
- return BOOLEAN_DATA_TYPE;
- case UNION:
- return getCapitalCase(getCamelCase(((YangJavaUnionTranslator) yangType
- .getDataTypeExtendedInfo()).getName(), pluginConfig));
- case INSTANCE_IDENTIFIER:
- return STRING_DATA_TYPE;
- case DERIVED:
- return getCapitalCase(
- getCamelCase(yangType.getDataTypeName(), pluginConfig));
- default:
- return null;
- }
- }
- }
-
- /**
- * Returns java import package.
- *
- * @param yangType YANG type
- * @param isListAttr if the attribute is of list type
- * @param conflictResolver object of YANG to java naming conflict util
- * @return java import package
- */
- public static String getJavaImportPackage(YangType<?> yangType, boolean isListAttr,
- YangToJavaNamingConflictUtil conflictResolver) {
-
- YangDataTypes type = yangType.getDataType();
-
- if (isListAttr) {
- switch (type) {
- case INT8:
- case INT16:
- case INT32:
- case INT64:
- case UINT8:
- case UINT16:
- case UINT32:
- case BINARY:
- case STRING:
- case BOOLEAN:
- case EMPTY:
- return JAVA_LANG;
- case UINT64:
- case DECIMAL64:
- return JAVA_MATH;
- case ENUMERATION:
- return getEnumsPackage(yangType, conflictResolver);
- case BITS:
- return COLLECTION_IMPORTS;
- case LEAFREF:
- YangType<?> referredType = getReferredTypeFromLeafref(yangType);
- return getJavaImportPackage(referredType, true, conflictResolver);
- case IDENTITYREF:
- return getIdentityRefPackage(yangType, conflictResolver);
- case UNION:
- return getUnionPackage(yangType, conflictResolver);
- case INSTANCE_IDENTIFIER:
- return JAVA_LANG;
- case DERIVED:
- return getTypeDefsPackage(yangType, conflictResolver);
- default:
- throw new TranslatorException("given data type is not supported.");
- }
- } else {
- switch (type) {
- case UINT64:
- case DECIMAL64:
- return JAVA_MATH;
- case EMPTY:
- case STRING:
- return JAVA_LANG;
- case ENUMERATION:
- return getEnumsPackage(yangType, conflictResolver);
- case BITS:
- return COLLECTION_IMPORTS;
- case LEAFREF:
- YangType<?> referredType = getReferredTypeFromLeafref(yangType);
- return getJavaImportPackage(referredType, false, conflictResolver);
- case IDENTITYREF:
- return getIdentityRefPackage(yangType, conflictResolver);
- case UNION:
- return getUnionPackage(yangType, conflictResolver);
- case INSTANCE_IDENTIFIER:
- return JAVA_LANG;
- case DERIVED:
- return getTypeDefsPackage(yangType, conflictResolver);
- default:
- return null;
- }
- }
- }
-
- /**
- * Returns java package for typedef node.
- *
- * @param type YANG type
- * @param conflictResolver object of YANG to java naming conflict util
- * @return java package for typedef node
- */
- private static String getTypeDefsPackage(YangType<?> type, YangToJavaNamingConflictUtil conflictResolver) {
- Object var = type.getDataTypeExtendedInfo();
- if (!(var instanceof YangDerivedInfo)) {
- throw new TranslatorException("type should have been derived.");
- }
-
- if (!(((YangDerivedInfo<?>) var).getReferredTypeDef() != null)) {
- throw new TranslatorException("derived info is not an instance of typedef.");
- }
-
- YangJavaTypeDefTranslator typedef = (YangJavaTypeDefTranslator) ((YangDerivedInfo<?>) var).getReferredTypeDef();
- if (typedef.getJavaFileInfo().getPackage() == null) {
- return getPackageFromParent(typedef.getParent(), conflictResolver);
- }
- return typedef.getJavaFileInfo().getPackage();
- }
-
- /**
- * Returns java package for union node.
- *
- * @param type YANG type
- * @param conflictResolver object of YANG to java naming conflict util
- * @return java package for union node
- */
- private static String getUnionPackage(YangType<?> type, YangToJavaNamingConflictUtil conflictResolver) {
-
- if (!(type.getDataTypeExtendedInfo() instanceof YangUnion)) {
- throw new TranslatorException("type should have been union.");
- }
-
- YangJavaUnionTranslator union = (YangJavaUnionTranslator) type.getDataTypeExtendedInfo();
- if (union.getJavaFileInfo().getPackage() == null) {
- return getPackageFromParent(union.getParent(), conflictResolver);
- }
- return union.getJavaFileInfo().getPackage();
- }
-
- /**
- * Returns YANG enumeration's java package.
- *
- * @param type YANG type
- * @param conflictResolver object of YANG to java naming conflict util
- * @return YANG enumeration's java package
- */
- private static String getEnumsPackage(YangType<?> type, YangToJavaNamingConflictUtil conflictResolver) {
-
- if (!(type.getDataTypeExtendedInfo() instanceof YangEnumeration)) {
- throw new TranslatorException("type should have been enumeration.");
- }
- YangJavaEnumerationTranslator enumeration = (YangJavaEnumerationTranslator) type.getDataTypeExtendedInfo();
- if (enumeration.getJavaFileInfo().getPackage() == null) {
- return getPackageFromParent(enumeration.getParent(), conflictResolver);
- }
- return enumeration.getJavaFileInfo().getPackage();
- }
-
- /**
- * Returns YANG identity's java package.
- *
- * @param type YANG type
- * @param conflictResolver object of YANG to java naming conflict util
- * @return YANG identity's java package
- */
- private static String getIdentityRefPackage(YangType<?> type, YangToJavaNamingConflictUtil conflictResolver) {
-
- if (!(type.getDataTypeExtendedInfo() instanceof YangIdentityRef)) {
- throw new TranslatorException("type should have been identityref.");
- }
- YangIdentityRef identityRef = (YangIdentityRef) type.getDataTypeExtendedInfo();
- YangJavaIdentityTranslator identity = (YangJavaIdentityTranslator) (identityRef.getReferredIdentity());
- if (identity.getJavaFileInfo().getPackage() == null) {
- return getPackageFromParent(identity.getParent(), conflictResolver);
- }
- return identity.getJavaFileInfo().getPackage();
- }
-
- /**
- * Returns package from parent node.
- *
- * @param parent parent YANG node
- * @param conflictResolver object of YANG to java naming conflict util
- * @return java package from parent node
- */
- private static String getPackageFromParent(YangNode parent,
- YangToJavaNamingConflictUtil conflictResolver) {
- if (!(parent instanceof JavaFileInfoContainer)) {
- throw new TranslatorException("invalid child node is being processed.");
- }
- JavaFileInfo parentInfo = ((JavaFileInfoContainer) parent).getJavaFileInfo();
- if (parentInfo.getPackage() == null) {
- updateJavaFileInfo(parent, conflictResolver);
- }
- return parentInfo.getPackage() + PERIOD + parentInfo.getJavaName().toLowerCase();
- }
-
- /**
- * Update the referred data model nodes java file info, this will be called,
- * when the linked node is yet to translate. Then resolve until the parent hierarchy.
- *
- * @param yangNode node whose java info needs to be updated
- * @param conflictResolver yang plugin config
- */
- public static void updateJavaFileInfo(YangNode yangNode,
- YangToJavaNamingConflictUtil conflictResolver) {
- Stack<YangNode> nodesToUpdatePackage = new Stack<>();
-
- /*
- * Add the nodes to be updated for package info in a stack.
- */
- while (yangNode != null
- && ((JavaFileInfoContainer) yangNode)
- .getJavaFileInfo().getPackage() == null) {
- nodesToUpdatePackage.push(yangNode);
- yangNode = yangNode.getParent();
- }
-
- /*
- * If the package is not updated till root node, then root package needs to
- * be updated.
- */
- if (yangNode == null) {
- yangNode = nodesToUpdatePackage.pop();
- String pkg;
- if (yangNode instanceof YangJavaModuleTranslator) {
- YangJavaModuleTranslator module = (YangJavaModuleTranslator) yangNode;
- pkg = getRootPackage(module.getVersion(), module.getNameSpace().getUri(), module
- .getRevision().getRevDate(), conflictResolver);
- } else if (yangNode instanceof YangJavaSubModuleTranslator) {
- YangJavaSubModuleTranslator submodule = (YangJavaSubModuleTranslator) yangNode;
- pkg = getRootPackage(submodule.getVersion(),
- submodule.getNameSpaceFromModule(submodule.getBelongsTo()),
- submodule.getRevision().getRevDate(), conflictResolver);
- } else {
- throw new TranslatorException("Invalid root node of data model tree");
- }
-
- ((JavaCodeGeneratorInfo) yangNode).getJavaFileInfo()
- .setJavaName(getCamelCase(yangNode.getName(), conflictResolver));
- ((JavaCodeGeneratorInfo) yangNode).getJavaFileInfo()
- .setPackage(pkg);
- ((JavaCodeGeneratorInfo) yangNode).getJavaFileInfo()
- .setPackageFilePath(getPackageDirPathFromJavaJPackage(
- ((JavaCodeGeneratorInfo) yangNode).getJavaFileInfo()
- .getPackage()));
- }
-
- /*
- * Parent of the node in stack is updated with java info,
- * all the nodes can be popped and updated
- */
- while (nodesToUpdatePackage.size() != 0) {
- yangNode = nodesToUpdatePackage.pop();
- ((JavaCodeGeneratorInfo) yangNode).getJavaFileInfo()
- .setJavaName(getCamelCase(yangNode.getName(), conflictResolver));
- ((JavaCodeGeneratorInfo) yangNode).getJavaFileInfo()
- .setPackage(getCurNodePackage(yangNode));
- ((JavaCodeGeneratorInfo) yangNode).getJavaFileInfo()
- .setPackageFilePath(getPackageDirPathFromJavaJPackage(
- ((JavaCodeGeneratorInfo) yangNode).getJavaFileInfo()
- .getPackage()));
- }
- }
-
- /**
- * Returns the referred type from leaf/leaf-list.
- *
- * @param type current type in leaf
- * @return type from the leafref
- */
- private static YangType<?> getReferredTypeFromLeafref(YangType type) {
- YangLeafRef<?> leafRefInfo = (YangLeafRef<?>) type.getDataTypeExtendedInfo();
- return leafRefInfo.getEffectiveDataType();
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/JavaLeafInfoContainer.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/JavaLeafInfoContainer.java
deleted file mode 100644
index c164827..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/JavaLeafInfoContainer.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.translator.tojava.javamodel;
-
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangToJavaNamingConflictUtil;
-import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoContainer;
-
-/**
- * Represent java based identification of the YANG leaves.
- */
-public interface JavaLeafInfoContainer
- extends JavaQualifiedTypeInfoContainer {
- /**
- * Retrieves the data type of the leaf.
- *
- * @return data type of the leaf
- */
- YangType<?> getDataType();
-
- /**
- * Retrieves the name of the leaf.
- *
- * @return name of the leaf
- */
- String getName();
-
- /**
- * Retrieves the java name of the leaf.
- *
- * @param conflictResolveConfig user config to resolve conflicts
- * @return name of the leaf
- */
- String getJavaName(YangToJavaNamingConflictUtil conflictResolveConfig);
-
- /**
- * Identifies if object is a leaf-list.
- *
- * @return true if leaf-list false otherwise
- */
- boolean isLeafList();
-
- /**
- * updates the qualified info.
- */
- void updateJavaQualifiedInfo();
-
- /**
- * Returns java naming conflict resolver.
- *
- * @return java naming conflict resolver
- */
- YangToJavaNamingConflictUtil getConflictResolveConfig();
-
- /**
- * Sets java naming conflict resolver.
- *
- * @param conflictResolveConfig java naming conflict resolver
- */
- void setConflictResolveConfig(YangToJavaNamingConflictUtil conflictResolveConfig);
-
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/JavaQualifiedTypeResolver.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/JavaQualifiedTypeResolver.java
deleted file mode 100644
index 95fb9bb..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/JavaQualifiedTypeResolver.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.translator.tojava.javamodel;
-
-import org.onosproject.yangutils.datamodel.javadatamodel.YangToJavaNamingConflictUtil;
-import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoContainer;
-
-/**
- * Represent java based identification of the YANG leaves.
- */
-interface JavaQualifiedTypeResolver
- extends JavaQualifiedTypeInfoContainer {
-
- /**
- * updates the qualified access details of the type.
- *
- * @param conflictResolver plugin configurations
- */
- void updateJavaQualifiedInfo(YangToJavaNamingConflictUtil conflictResolver);
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaAugmentTranslator.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaAugmentTranslator.java
deleted file mode 100644
index 04caec5..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaAugmentTranslator.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * 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.translator.tojava.javamodel;
-
-import java.io.IOException;
-
-import org.onosproject.yangutils.datamodel.YangChoice;
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaAugment;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
-
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
-import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeOfAugmentableNode;
-
-/**
- * Represents augment information extended to support java code generation.
- */
-public class YangJavaAugmentTranslator
- extends YangJavaAugment
- implements JavaCodeGeneratorInfo, JavaCodeGenerator {
-
- private static final long serialVersionUID = 806201632L;
-
- /**
- * File handle to maintain temporary java code fragments as per the code snippet types.
- */
- private transient TempJavaCodeFragmentFiles tempFileHandle;
-
- /**
- * Creates a YANG java augment object.
- */
- public YangJavaAugmentTranslator() {
- super();
- setJavaFileInfo(new JavaFileInfo());
- getJavaFileInfo().setGeneratedFileTypes(GENERATE_INTERFACE_WITH_BUILDER);
- }
-
- /**
- * Returns the generated java file information.
- *
- * @return generated java file information
- */
- @Override
- public JavaFileInfo getJavaFileInfo() {
-
- if (javaFileInfo == null) {
- throw new TranslatorException("Missing java info in java datamodel node");
- }
- return javaFileInfo;
- }
-
- /**
- * Sets the java file info object.
- *
- * @param javaInfo java file info object
- */
- @Override
- public void setJavaFileInfo(JavaFileInfo javaInfo) {
- javaFileInfo = javaInfo;
- }
-
- /**
- * Returns the temporary file handle.
- *
- * @return temporary file handle
- */
- @Override
- public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
- return tempFileHandle;
- }
-
- /**
- * Sets temporary file handle.
- *
- * @param fileHandle temporary file handle
- */
- @Override
- public void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle) {
- tempFileHandle = fileHandle;
- }
-
- /**
- * Prepare the information for java code generation corresponding to YANG augment info.
- *
- * @param yangPlugin YANG plugin config
- * @throws TranslatorException translator operation fail
- */
- @Override
- public void generateCodeEntry(YangPluginConfig yangPlugin) throws TranslatorException {
- try {
- generateCodeOfAugmentableNode(this, yangPlugin);
- } catch (IOException e) {
- throw new TranslatorException("Failed to generate code for augmentable node " + getName());
- }
- }
-
- /**
- * Create a java file using the YANG augment info.
- *
- * @throws TranslatorException when failed to do translator operations
- */
- @Override
- public void generateCodeExit() throws TranslatorException {
- try {
- if (validateAugmentNode()) {
- getTempJavaCodeFragmentFiles().generateJavaFile(GENERATE_INTERFACE_WITH_BUILDER, this);
- }
- } catch (IOException e) {
- throw new TranslatorException("Failed to generate code for augmentable node " + getName());
- }
- }
-
- /**
- * Returns true if augment does not have choice as target node.
- *
- * @return true if augment does not have choice as target node
- */
- private boolean validateAugmentNode() {
- return !(getAugmentedNode() instanceof YangChoice);
- }
-
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaCaseTranslator.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaCaseTranslator.java
deleted file mode 100644
index 4e73389..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaCaseTranslator.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * 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.translator.tojava.javamodel;
-
-import java.io.IOException;
-
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaCase;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
-
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
-import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeOfAugmentableNode;
-
-/**
- * Represents case information extended to support java code generation.
- */
-public class YangJavaCaseTranslator
- extends YangJavaCase
- implements JavaCodeGeneratorInfo, JavaCodeGenerator {
-
- private static final long serialVersionUID = 806201631L;
-
- /**
- * File handle to maintain temporary java code fragments as per the code
- * snippet types.
- */
- private transient TempJavaCodeFragmentFiles tempFileHandle;
-
- /**
- * Creates YANG java case object.
- */
- public YangJavaCaseTranslator() {
- super();
- setJavaFileInfo(new JavaFileInfo());
- getJavaFileInfo().setGeneratedFileTypes(GENERATE_INTERFACE_WITH_BUILDER);
- }
-
- /**
- * Returns the generated java file information.
- *
- * @return generated java file information
- */
- @Override
- public JavaFileInfo getJavaFileInfo() {
- if (javaFileInfo == null) {
- throw new TranslatorException("Missing java info in java datamodel node");
- }
- return javaFileInfo;
- }
-
- /**
- * Sets the java file info object.
- *
- * @param javaInfo java file info object
- */
- @Override
- public void setJavaFileInfo(JavaFileInfo javaInfo) {
- javaFileInfo = javaInfo;
- }
-
- /**
- * Returns the temporary file handle.
- *
- * @return temporary file handle
- */
- @Override
- public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
- return tempFileHandle;
- }
-
- /**
- * Sets temporary file handle.
- *
- * @param fileHandle temporary file handle
- */
- @Override
- public void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle) {
- tempFileHandle = fileHandle;
- }
-
- /**
- * Prepare the information for java code generation corresponding to YANG
- * case info.
- *
- * @param yangPlugin YANG plugin config
- * @throws TranslatorException translator operation fail
- */
- @Override
- public void generateCodeEntry(YangPluginConfig yangPlugin) throws TranslatorException {
- try {
- generateCodeOfAugmentableNode(this, yangPlugin);
- } catch (IOException e) {
- throw new TranslatorException(
- "Failed to prepare generate code entry for case node " + getName());
- }
- }
-
- /**
- * Creates a java file using the YANG case info.
- */
- @Override
- public void generateCodeExit() throws TranslatorException {
- try {
- getTempJavaCodeFragmentFiles().generateJavaFile(GENERATE_INTERFACE_WITH_BUILDER, this);
- } catch (IOException e) {
- throw new TranslatorException("Failed to generate code for case node " + getName());
- }
- }
-
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaChoiceTranslator.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaChoiceTranslator.java
deleted file mode 100644
index fca0eb2..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaChoiceTranslator.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * 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.translator.tojava.javamodel;
-
-import java.io.IOException;
-
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaChoice;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
-
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.INTERFACE_MASK;
-import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeAndUpdateInParent;
-
-/**
- * Represents choice information extended to support java code generation.
- */
-public class YangJavaChoiceTranslator
- extends YangJavaChoice
- implements JavaCodeGeneratorInfo, JavaCodeGenerator {
-
- private static final long serialVersionUID = 806201631L;
-
- /**
- * File handle to maintain temporary java code fragments as per the code
- * snippet types.
- */
- private transient TempJavaCodeFragmentFiles tempFileHandle;
-
- /**
- * Creates YANG java choice object.
- */
- public YangJavaChoiceTranslator() {
- super();
- setJavaFileInfo(new JavaFileInfo());
- getJavaFileInfo().setGeneratedFileTypes(INTERFACE_MASK);
- }
-
- /**
- * Returns the generated java file information.
- *
- * @return generated java file information
- */
- @Override
- public JavaFileInfo getJavaFileInfo() {
- if (javaFileInfo == null) {
- throw new TranslatorException("Missing java info in java datamodel node");
- }
- return javaFileInfo;
- }
-
- /**
- * Sets the java file info object.
- *
- * @param javaInfo java file info object
- */
- @Override
- public void setJavaFileInfo(JavaFileInfo javaInfo) {
- javaFileInfo = javaInfo;
- }
-
- /**
- * Returns the temporary file handle.
- *
- * @return temporary file handle
- */
- @Override
- public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
- return tempFileHandle;
- }
-
- /**
- * Sets temporary file handle.
- *
- * @param fileHandle temporary file handle
- */
- @Override
- public void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle) {
- tempFileHandle = fileHandle;
- }
-
- /**
- * Prepare the information for java code generation corresponding to YANG
- * choice info.
- *
- * @param yangPlugin YANG plugin config
- * @throws TranslatorException translator operation fail
- */
- @Override
- public void generateCodeEntry(YangPluginConfig yangPlugin) throws TranslatorException {
- try {
- generateCodeAndUpdateInParent(this, yangPlugin, false);
- } catch (IOException e) {
- throw new TranslatorException(
- "Failed to prepare generate code entry for choice node " + getName());
- }
- }
-
- /**
- * Creates a java file using the YANG choice info.
- */
- @Override
- public void generateCodeExit() throws TranslatorException {
- try {
- getTempJavaCodeFragmentFiles().generateJavaFile(INTERFACE_MASK, this);
- } catch (IOException e) {
- throw new TranslatorException("Failed to generate code for choice node " + getName());
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaContainerTranslator.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaContainerTranslator.java
deleted file mode 100644
index 2b560a8..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaContainerTranslator.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * 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.translator.tojava.javamodel;
-
-import java.io.IOException;
-
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaContainer;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
-
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
-import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeAndUpdateInParent;
-
-/**
- * Represents container information extended to support java code generation.
- */
-public class YangJavaContainerTranslator
- extends YangJavaContainer
- implements JavaCodeGeneratorInfo, JavaCodeGenerator {
-
- private static final long serialVersionUID = 806201630L;
-
- /**
- * File handle to maintain temporary java code fragments as per the code
- * snippet types.
- */
- private transient TempJavaCodeFragmentFiles tempFileHandle;
-
- /**
- * Creates YANG java container object.
- */
- public YangJavaContainerTranslator() {
- super();
- setJavaFileInfo(new JavaFileInfo());
- getJavaFileInfo().setGeneratedFileTypes(GENERATE_INTERFACE_WITH_BUILDER);
- }
-
- /**
- * Returns the generated java file information.
- *
- * @return generated java file information
- */
- @Override
- public JavaFileInfo getJavaFileInfo() {
- if (javaFileInfo == null) {
- throw new TranslatorException("Missing java info in java datamodel node");
- }
- return javaFileInfo;
- }
-
- /**
- * Sets the java file info object.
- *
- * @param javaInfo java file info object
- */
- @Override
- public void setJavaFileInfo(JavaFileInfo javaInfo) {
- javaFileInfo = javaInfo;
- }
-
- /**
- * Returns the temporary file handle.
- *
- * @return temporary file handle
- */
- @Override
- public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
- return tempFileHandle;
- }
-
- /**
- * Sets temporary file handle.
- *
- * @param fileHandle temporary file handle
- */
- @Override
- public void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle) {
- tempFileHandle = fileHandle;
- }
-
- /**
- * Prepare the information for java code generation corresponding to YANG
- * container info.
- *
- * @param yangPlugin YANG plugin config
- * @throws TranslatorException translator operation fail
- */
- @Override
- public void generateCodeEntry(YangPluginConfig yangPlugin) throws TranslatorException {
- try {
- generateCodeAndUpdateInParent(this, yangPlugin, false);
- } catch (IOException e) {
- throw new TranslatorException(
- "Failed to prepare generate code entry for container node " + getName());
- }
- }
-
- /**
- * Create a java file using the YANG container info.
- *
- * @throws TranslatorException translator operation fail
- */
- @Override
- public void generateCodeExit() throws TranslatorException {
- try {
- getTempJavaCodeFragmentFiles().generateJavaFile(GENERATE_INTERFACE_WITH_BUILDER, this);
- } catch (IOException e) {
- throw new TranslatorException("Failed to generate code for container node " + getName());
- }
- }
-
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaEnumerationTranslator.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaEnumerationTranslator.java
deleted file mode 100644
index f0589f7..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaEnumerationTranslator.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * 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.translator.tojava.javamodel;
-
-import java.io.IOException;
-
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaEnumeration;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
-
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_ENUM_CLASS;
-import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeOfNode;
-
-/**
- * Represents YANG java enumeration information extended to support java code generation.
- */
-public class YangJavaEnumerationTranslator
- extends YangJavaEnumeration
- implements JavaCodeGenerator, JavaCodeGeneratorInfo {
-
- private static final long serialVersionUID = 806201629L;
-
- /**
- * File handle to maintain temporary java code fragments as per the code
- * snippet types.
- */
- private transient TempJavaCodeFragmentFiles tempFileHandle;
-
- /**
- * Creates YANG java enumeration object.
- */
- public YangJavaEnumerationTranslator() {
- super();
- setJavaFileInfo(new JavaFileInfo());
- getJavaFileInfo().setGeneratedFileTypes(GENERATE_ENUM_CLASS);
- }
-
- /**
- * Returns the generated java file information.
- *
- * @return generated java file information
- */
- @Override
- public JavaFileInfo getJavaFileInfo() {
-
- if (javaFileInfo == null) {
- throw new TranslatorException("Missing java info in java datamodel node");
- }
- return javaFileInfo;
- }
-
- /**
- * Sets the java file info object.
- *
- * @param javaInfo java file info object
- */
- @Override
- public void setJavaFileInfo(JavaFileInfo javaInfo) {
- javaFileInfo = javaInfo;
- }
-
- /**
- * Returns the temporary file handle.
- *
- * @return temporary file handle
- */
- @Override
- public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
- return tempFileHandle;
- }
-
- /**
- * Sets temporary file handle.
- *
- * @param fileHandle temporary file handle
- */
- @Override
- public void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle) {
- tempFileHandle = fileHandle;
- }
-
- /**
- * Prepare the information for java code generation corresponding to YANG
- * enumeration info.
- *
- * @param yangPlugin YANG plugin config
- * @throws TranslatorException translator operations fails
- */
- @Override
- public void generateCodeEntry(YangPluginConfig yangPlugin) throws TranslatorException {
- try {
- generateCodeOfNode(this, yangPlugin);
- } catch (IOException e) {
- throw new TranslatorException(
- "Failed to prepare generate code entry for enumeration node " + getName());
- }
- }
-
- /**
- * Creates a java file using the YANG enumeration info.
- *
- * @throws TranslatorException translator operation fail
- */
- @Override
- public void generateCodeExit() throws TranslatorException {
- try {
- getTempJavaCodeFragmentFiles().generateJavaFile(GENERATE_ENUM_CLASS, this);
- } catch (IOException e) {
- throw new TranslatorException("Failed to generate code for enumeration node " + getName());
- }
- }
-
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaGroupingTranslator.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaGroupingTranslator.java
deleted file mode 100644
index 90ff371..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaGroupingTranslator.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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.translator.tojava.javamodel;
-
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaGrouping;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.translator.exception.InvalidNodeForTranslatorException;
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
-import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
-
-/**
- * Represents grouping information extended to support java code generation.
- */
-public class YangJavaGroupingTranslator
- extends YangJavaGrouping
- implements JavaCodeGeneratorInfo, JavaCodeGenerator {
-
- private static final long serialVersionUID = 806201628L;
-
- /**
- * File handle to maintain temporary java code fragments as per the code
- * snippet types.
- */
- private transient TempJavaCodeFragmentFiles tempFileHandle;
-
- /**
- * Creates YANG Java grouping object.
- */
- public YangJavaGroupingTranslator() {
- super();
- setJavaFileInfo(new JavaFileInfo());
- }
-
- /**
- * Returns the generated java file information.
- *
- * @return generated java file information
- */
- @Override
- public JavaFileInfo getJavaFileInfo() {
- if (javaFileInfo == null) {
- throw new TranslatorException("Missing java info in java datamodel node");
- }
- return javaFileInfo;
- }
-
- /**
- * Sets the java file info object.
- *
- * @param javaInfo java file info object
- */
- @Override
- public void setJavaFileInfo(JavaFileInfo javaInfo) {
- javaFileInfo = javaInfo;
- }
-
- /**
- * Returns the temporary file handle.
- *
- * @return temporary file handle
- */
- @Override
- public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
- return tempFileHandle;
- }
-
- /**
- * Sets temporary file handle.
- *
- * @param fileHandle temporary file handle
- */
- @Override
- public void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle) {
- tempFileHandle = fileHandle;
- }
-
-
- @Override
- public void generateCodeEntry(YangPluginConfig yangPlugin)
- throws TranslatorException {
- throw new InvalidNodeForTranslatorException();
- }
-
- @Override
- public void generateCodeExit()
- throws TranslatorException {
- /*
- * Do nothing.
- */
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaIdentityTranslator.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaIdentityTranslator.java
deleted file mode 100644
index f3a4ce2..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaIdentityTranslator.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * 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.translator.tojava.javamodel;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaIdentity;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.JavaImportData;
-import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator;
-import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
-
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_IDENTITY_CLASS;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
-import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.updatePackageInfo;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGeneratorUtils.getFileObject;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGeneratorUtils.initiateJavaFileGeneration;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.createPackage;
-import static org.onosproject.yangutils.utils.io.impl.FileSystemUtil.closeFile;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase;
-
-/**
- * Represents input information extended to support java code generation.
- */
-public class YangJavaIdentityTranslator extends YangJavaIdentity
- implements JavaCodeGeneratorInfo, JavaCodeGenerator {
-
- //File type extension for java classes.
- private static final String JAVA_FILE_EXTENSION = ".java";
-
- //Contains the information of the imported.
- private transient JavaImportData importData;
-
- /**
- * File handle to maintain temporary java code fragments as per the code
- * snippet types.
- */
- private transient TempJavaCodeFragmentFiles tempFileHandle;
-
- /**
- * Creates YANG java container object.
- */
- public YangJavaIdentityTranslator() {
- setJavaFileInfo(new JavaFileInfo());
- getJavaFileInfo().setGeneratedFileTypes(GENERATE_INTERFACE_WITH_BUILDER);
- importData = new JavaImportData();
- }
-
- /**
- * Returns the generated java file information.
- *
- * @return generated java file information
- */
- @Override
- public JavaFileInfo getJavaFileInfo() {
- if (javaFileInfo == null) {
- throw new TranslatorException("Missing java info in java datamodel node");
- }
- return javaFileInfo;
- }
-
- /**
- * Sets the java file info object.
- *
- * @param javaInfo java file info object
- */
- @Override
- public void setJavaFileInfo(JavaFileInfo javaInfo) {
- javaFileInfo = javaInfo;
- }
-
- /**
- * Returns the temporary file handle.
- *
- * @return temporary file handle
- */
- @Override
- public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
- return tempFileHandle;
- }
-
- /**
- * Sets temporary file handle.
- *
- * @param fileHandle temporary file handle
- */
- @Override
- public void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle) {
- tempFileHandle = fileHandle;
- }
-
- /**
- * Prepare the information for java code generation corresponding to YANG
- * container info.
- *
- * @param yangPlugin YANG plugin config
- * @throws TranslatorException translator operation fail
- */
- @Override
- public void generateCodeEntry(YangPluginConfig yangPlugin) throws TranslatorException {
- try {
-
- updatePackageInfo(this, yangPlugin);
- JavaQualifiedTypeInfoTranslator basePkgInfo = new JavaQualifiedTypeInfoTranslator();
- String className = getCapitalCase(getJavaFileInfo().getJavaName());
- String path = getJavaFileInfo().getPackageFilePath();
- createPackage(this);
- List<String> imports = null;
- boolean isQualified;
-
- if (getBaseNode() != null && getBaseNode().getReferredIdentity() != null) {
- if (!(getBaseNode().getReferredIdentity() instanceof YangJavaIdentityTranslator)) {
- throw new TranslatorException("Failed to prepare generate code entry for base node");
- }
- YangJavaIdentityTranslator baseIdentity = (YangJavaIdentityTranslator) getBaseNode()
- .getReferredIdentity();
- String baseClassName = getCapitalCase(baseIdentity.getJavaFileInfo().getJavaName());
- String basePkg = baseIdentity.getJavaFileInfo().getPackage();
- basePkgInfo.setClassInfo(baseClassName);
- basePkgInfo.setPkgInfo(basePkg);
- isQualified = importData.addImportInfo(basePkgInfo, className, getJavaFileInfo().getPackage());
- if (!isQualified) {
- imports = importData.getImports();
- }
- }
-
- File file = getFileObject(path, className, JAVA_FILE_EXTENSION, getJavaFileInfo());
-
- initiateJavaFileGeneration(file, GENERATE_IDENTITY_CLASS, imports, this, className);
- closeFile(file, false);
- } catch (IOException e) {
- throw new TranslatorException(
- "Failed to prepare generate code entry for identity node " + this.getName());
- }
- }
-
- /**
- * Create a java file using the YANG container info.
- *
- * @throws TranslatorException translator operation fail
- */
- @Override
- public void generateCodeExit() throws TranslatorException {
- /* Do nothing, file is already generated in entry*/
- }
-}
-
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaInputTranslator.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaInputTranslator.java
deleted file mode 100644
index de730bc..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaInputTranslator.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * 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.translator.tojava.javamodel;
-
-import java.io.IOException;
-
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaInput;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
-
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
-import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeOfAugmentableNode;
-
-/**
- * Represents input information extended to support java code generation.
- */
-public class YangJavaInputTranslator
- extends YangJavaInput
- implements JavaCodeGeneratorInfo, JavaCodeGenerator {
-
- private static final long serialVersionUID = 806201627L;
-
- /**
- * File handle to maintain temporary java code fragments as per the code
- * snippet types.
- */
- private transient TempJavaCodeFragmentFiles tempFileHandle;
-
- /**
- * Creates an instance of java input.
- */
- public YangJavaInputTranslator() {
- super();
- setJavaFileInfo(new JavaFileInfo());
- getJavaFileInfo().setGeneratedFileTypes(GENERATE_INTERFACE_WITH_BUILDER);
- }
-
- /**
- * Returns the generated java file information.
- *
- * @return generated java file information
- */
- @Override
- public JavaFileInfo getJavaFileInfo() {
- if (javaFileInfo == null) {
- throw new TranslatorException("missing java info in java datamodel node");
- }
- return javaFileInfo;
- }
-
- /**
- * Sets the java file info object.
- *
- * @param javaInfo java file info object
- */
- @Override
- public void setJavaFileInfo(JavaFileInfo javaInfo) {
- javaFileInfo = javaInfo;
- }
-
- /**
- * Returns the temporary file handle.
- *
- * @return temporary file handle
- */
- @Override
- public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
- return tempFileHandle;
- }
-
- /**
- * Sets temporary file handle.
- *
- * @param fileHandle temporary file handle
- */
- @Override
- public void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle) {
- tempFileHandle = fileHandle;
- }
-
- /**
- * Prepare the information for java code generation corresponding to YANG
- * input info.
- *
- * @param yangPlugin YANG plugin config
- * @throws TranslatorException translator operation fail
- */
- @Override
- public void generateCodeEntry(YangPluginConfig yangPlugin) throws TranslatorException {
- try {
- generateCodeOfAugmentableNode(this, yangPlugin);
- } catch (IOException e) {
- throw new TranslatorException(
- "Failed to prepare generate code entry for input node " + getName());
- }
- }
-
- /**
- * Creates a java file using the YANG input info.
- *
- * @throws TranslatorException translator operation fail
- */
- @Override
- public void generateCodeExit() throws TranslatorException {
- try {
- getTempJavaCodeFragmentFiles().generateJavaFile(GENERATE_INTERFACE_WITH_BUILDER, this);
- } catch (IOException e) {
- throw new TranslatorException("Failed to generate code for input node " + getName());
- }
- }
-
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaLeafListTranslator.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaLeafListTranslator.java
deleted file mode 100644
index 149d260..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaLeafListTranslator.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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.translator.tojava.javamodel;
-
-import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaLeafList;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangToJavaNamingConflictUtil;
-import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator;
-
-import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator.updateLeavesJavaQualifiedInfo;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCamelCase;
-
-/**
- * Represents java information corresponding to the YANG leaf-list.
- */
-public class YangJavaLeafListTranslator
- extends YangJavaLeafList
- implements JavaLeafInfoContainer {
-
- private static final long serialVersionUID = 806201638L;
-
- private transient YangToJavaNamingConflictUtil conflictResolveConfig;
-
- /**
- * Returns a new YANG leaf object with java qualified access details.
- */
- public YangJavaLeafListTranslator() {
- super();
- setJavaQualifiedInfo(new JavaQualifiedTypeInfoTranslator());
- }
-
- @Override
- public String getJavaName(YangToJavaNamingConflictUtil conflictResolveConfig) {
- return getCamelCase(getName(), conflictResolveConfig);
- }
-
- @Override
- public boolean isLeafList() {
- return true;
- }
-
- @Override
- public void updateJavaQualifiedInfo() {
- updateLeavesJavaQualifiedInfo(this);
- }
-
- @Override
- public JavaQualifiedTypeInfoTranslator getJavaQualifiedInfo() {
- return (JavaQualifiedTypeInfoTranslator) javaQualifiedTypeInfo;
- }
-
- @Override
- public void setJavaQualifiedInfo(JavaQualifiedTypeInfoTranslator typeInfo) {
- javaQualifiedTypeInfo = typeInfo;
- }
-
- /**
- * Returns java naming conflict resolve configurations.
- *
- * @return java naming conflict resolve configurations
- */
- @Override
- public YangToJavaNamingConflictUtil getConflictResolveConfig() {
- return conflictResolveConfig;
- }
-
- /**
- * Sets java naming conflict resolve configurations.
- *
- * @param conflictResolveConfig java naming conflict resolve configurations
- */
- @Override
- public void setConflictResolveConfig(YangToJavaNamingConflictUtil conflictResolveConfig) {
- this.conflictResolveConfig = conflictResolveConfig;
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaLeafTranslator.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaLeafTranslator.java
deleted file mode 100644
index 5bd98c9..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaLeafTranslator.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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.translator.tojava.javamodel;
-
-import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaLeaf;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangToJavaNamingConflictUtil;
-import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator;
-
-import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator.updateLeavesJavaQualifiedInfo;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCamelCase;
-
-/**
- * Represents java information corresponding to the YANG leaf.
- */
-public class YangJavaLeafTranslator
- extends YangJavaLeaf
- implements JavaLeafInfoContainer {
-
- private static final long serialVersionUID = 806201636L;
-
- private transient YangToJavaNamingConflictUtil conflictResolveConfig;
-
- /**
- * Returns a new YANG leaf object with java qualified access details.
- */
- public YangJavaLeafTranslator() {
- super();
- setJavaQualifiedInfo(new JavaQualifiedTypeInfoTranslator());
- }
-
- @Override
- public JavaQualifiedTypeInfoTranslator getJavaQualifiedInfo() {
- return (JavaQualifiedTypeInfoTranslator) javaQualifiedTypeInfo;
- }
-
- @Override
- public void setJavaQualifiedInfo(JavaQualifiedTypeInfoTranslator typeInfo) {
- javaQualifiedTypeInfo = typeInfo;
-
- }
-
- @Override
- public String getJavaName(YangToJavaNamingConflictUtil conflictResolveConfig) {
- return getCamelCase(getName(), conflictResolveConfig);
- }
-
- @Override
- public boolean isLeafList() {
- return false;
- }
-
- @Override
- public void updateJavaQualifiedInfo() {
- updateLeavesJavaQualifiedInfo(this);
- }
-
- /**
- * Returns java naming conflict resolve configurations.
- *
- * @return java naming conflict resolve configurations
- */
- @Override
- public YangToJavaNamingConflictUtil getConflictResolveConfig() {
- return conflictResolveConfig;
- }
-
- /**
- * Sets java naming conflict resolve configurations.
- *
- * @param conflictResolveConfig java naming conflict resolve configurations
- */
- @Override
- public void setConflictResolveConfig(YangToJavaNamingConflictUtil conflictResolveConfig) {
- this.conflictResolveConfig = conflictResolveConfig;
- }
-
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaListTranslator.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaListTranslator.java
deleted file mode 100644
index c8f3759..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaListTranslator.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * 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.translator.tojava.javamodel;
-
-import java.io.IOException;
-
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaList;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
-
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
-import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeAndUpdateInParent;
-
-/**
- * Represents YANG list information extended to support java code generation.
- */
-public class YangJavaListTranslator
- extends YangJavaList
- implements JavaCodeGeneratorInfo, JavaCodeGenerator {
-
- private static final long serialVersionUID = 806201626L;
-
- /**
- * File handle to maintain temporary java code fragments as per the code
- * snippet types.
- */
- private transient TempJavaCodeFragmentFiles tempFileHandle;
-
- /**
- * Creates YANG java list object.
- */
- public YangJavaListTranslator() {
- super();
- setJavaFileInfo(new JavaFileInfo());
- getJavaFileInfo().setGeneratedFileTypes(GENERATE_INTERFACE_WITH_BUILDER);
- }
-
- /**
- * Returns the generated java file information.
- *
- * @return generated java file information
- */
- @Override
- public JavaFileInfo getJavaFileInfo() {
- if (javaFileInfo == null) {
- throw new TranslatorException("Missing java info in java datamodel node");
- }
- return javaFileInfo;
- }
-
- /**
- * Sets the java file info object.
- *
- * @param javaInfo java file info object
- */
- @Override
- public void setJavaFileInfo(JavaFileInfo javaInfo) {
- javaFileInfo = javaInfo;
- }
-
- /**
- * Returns the temporary file handle.
- *
- * @return temporary file handle
- */
- @Override
- public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
- return tempFileHandle;
- }
-
- /**
- * Sets temporary file handle.
- *
- * @param fileHandle temporary file handle
- */
- @Override
- public void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle) {
- tempFileHandle = fileHandle;
- }
-
- /**
- * Prepare the information for java code generation corresponding to YANG
- * list info.
- *
- * @param yangPlugin YANG plugin config
- * @throws TranslatorException translator operation fail
- */
- @Override
- public void generateCodeEntry(YangPluginConfig yangPlugin) throws TranslatorException {
- try {
- generateCodeAndUpdateInParent(this, yangPlugin, true);
- } catch (IOException e) {
- throw new TranslatorException(
- "Failed to prepare generate code entry for list node " + getName());
- }
- }
-
- /**
- * Creates a java file using the YANG list info.
- *
- * @throws TranslatorException translator operation fail
- */
- @Override
- public void generateCodeExit() throws TranslatorException {
- try {
- getTempJavaCodeFragmentFiles().generateJavaFile(GENERATE_INTERFACE_WITH_BUILDER, this);
- } catch (IOException e) {
- throw new TranslatorException("Failed to generate code for list node " + getName());
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaModuleTranslator.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaModuleTranslator.java
deleted file mode 100644
index b185588..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaModuleTranslator.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * 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.translator.tojava.javamodel;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNotification;
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaModule;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
-
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_ALL_EVENT_CLASS_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_SERVICE_AND_MANAGER;
-import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeOfRootNode;
-import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.isRootNodesCodeGenRequired;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getRootPackage;
-import static org.onosproject.yangutils.utils.UtilConstants.SBI;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.searchAndDeleteTempDir;
-
-/**
- * Represents module information extended to support java code generation.
- */
-public class YangJavaModuleTranslator
- extends YangJavaModule
- implements JavaCodeGeneratorInfo, JavaCodeGenerator {
-
- private static final long serialVersionUID = 806201625L;
-
- /**
- * File handle to maintain temporary java code fragments as per the code snippet types.
- */
- private transient TempJavaCodeFragmentFiles tempFileHandle;
-
- /**
- * List of notifications nodes.
- */
- private transient List<YangNode> notificationNodes;
-
- /**
- * Creates a YANG node of module type.
- */
- public YangJavaModuleTranslator() {
- super();
- setJavaFileInfo(new JavaFileInfo());
- setNotificationNodes(new ArrayList<>());
- getJavaFileInfo().setGeneratedFileTypes(GENERATE_SERVICE_AND_MANAGER | GENERATE_INTERFACE_WITH_BUILDER);
-
- }
-
- /**
- * Returns the generated java file information.
- *
- * @return generated java file information
- */
- @Override
- public JavaFileInfo getJavaFileInfo() {
- if (javaFileInfo == null) {
- throw new TranslatorException("Missing java info in java datamodel node");
- }
- return javaFileInfo;
- }
-
- /**
- * Sets the java file info object.
- *
- * @param javaInfo java file info object
- */
- @Override
- public void setJavaFileInfo(JavaFileInfo javaInfo) {
- javaFileInfo = javaInfo;
- }
-
- /**
- * Returns the temporary file handle.
- *
- * @return temporary file handle
- */
- @Override
- public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
- return tempFileHandle;
- }
-
- /**
- * Sets temporary file handle.
- *
- * @param fileHandle temporary file handle
- */
- @Override
- public void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle) {
- tempFileHandle = fileHandle;
- }
-
- /**
- * Generates java code for module.
- *
- * @param yangPlugin YANG plugin config
- * @throws TranslatorException when fails to generate the source files
- */
- @Override
- public void generateCodeEntry(YangPluginConfig yangPlugin) throws TranslatorException {
- String modulePkg = getRootPackage(getVersion(), getNameSpace().getUri(), getRevision().getRevDate(),
- yangPlugin.getConflictResolver());
-
- if (isNotificationChildNodePresent(this)) {
- getJavaFileInfo().setGeneratedFileTypes(getJavaFileInfo().getGeneratedFileTypes()
- | GENERATE_ALL_EVENT_CLASS_MASK);
- }
- try {
- generateCodeOfRootNode(this, yangPlugin, modulePkg);
- } catch (IOException e) {
- throw new TranslatorException(
- "Failed to prepare generate code entry for module node " + getName());
- }
- }
-
- /**
- * Creates a java file using the YANG module info.
- */
- @Override
- public void generateCodeExit() throws TranslatorException {
- /*
- * As part of the notification support the following files needs to be generated.
- * 1) Subject of the notification(event), this is simple interface with builder class.
- * 2) Event class extending "AbstractEvent" and defining event type enum.
- * 3) Event listener interface extending "EventListener".
- * 4) Event subject class.
- *
- * The manager class needs to extend the "ListenerRegistry".
- */
- try {
- if ((getJavaFileInfo().getGeneratedFileTypes() & GENERATE_ALL_EVENT_CLASS_MASK) != 0) {
- getTempJavaCodeFragmentFiles().generateJavaFile(GENERATE_ALL_EVENT_CLASS_MASK, this);
- }
-
- if (isRootNodesCodeGenRequired(this)) {
- getTempJavaCodeFragmentFiles()
- .generateJavaFile(GENERATE_INTERFACE_WITH_BUILDER, this);
- if ((getJavaFileInfo().getPluginConfig().getCodeGenerateForsbi() == null)
- || (!getJavaFileInfo().getPluginConfig().getCodeGenerateForsbi().equals(SBI))) {
- getTempJavaCodeFragmentFiles().generateJavaFile(GENERATE_SERVICE_AND_MANAGER, this);
- }
- }
-
- searchAndDeleteTempDir(getJavaFileInfo().getBaseCodeGenPath() +
- getJavaFileInfo().getPackageFilePath());
- searchAndDeleteTempDir(getJavaFileInfo().getPluginConfig().getCodeGenDir() +
- getJavaFileInfo().getPackageFilePath());
- } catch (IOException e) {
- throw new TranslatorException("Failed to generate code for module node " + getName());
- }
- }
-
- /**
- * Returns notifications node list.
- *
- * @return notification nodes
- */
- public List<YangNode> getNotificationNodes() {
- return notificationNodes;
- }
-
- /**
- * Sets notifications list.
- *
- * @param notificationNodes notification list
- */
- private void setNotificationNodes(List<YangNode> notificationNodes) {
- this.notificationNodes = notificationNodes;
- }
-
- /**
- * Adds to notification node list.
- *
- * @param curNode notification node
- */
- private void addToNotificationList(YangNode curNode) {
- getNotificationNodes().add(curNode);
- }
-
- /**
- * Checks if there is any notification node present.
- *
- * @param rootNode root node of the data model
- * @return status of notification's existence
- */
- private boolean isNotificationChildNodePresent(YangNode rootNode) {
- YangNode childNode = rootNode.getChild();
-
- while (childNode != null) {
- if (childNode instanceof YangNotification) {
- addToNotificationList(childNode);
- }
- childNode = childNode.getNextSibling();
- }
-
- return !getNotificationNodes().isEmpty();
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaNotificationTranslator.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaNotificationTranslator.java
deleted file mode 100644
index 5b62021..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaNotificationTranslator.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * 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.translator.tojava.javamodel;
-
-import java.io.IOException;
-
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaNotification;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfoContainer;
-import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator;
-import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
-import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFilesContainer;
-import org.onosproject.yangutils.translator.tojava.TempJavaServiceFragmentFiles;
-import org.onosproject.yangutils.translator.tojava.utils.JavaExtendsListHolder;
-
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
-import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeOfAugmentableNode;
-import static org.onosproject.yangutils.utils.UtilConstants.EVENT_LISTENER_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.EVENT_STRING;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase;
-
-/**
- * Represents notification information extended to support java code generation.
- */
-public class YangJavaNotificationTranslator
- extends YangJavaNotification
- implements JavaCodeGenerator, JavaCodeGeneratorInfo {
-
- private static final long serialVersionUID = 806201624L;
-
- /**
- * File handle to maintain temporary java code fragments as per the code
- * snippet types.
- */
- private transient TempJavaCodeFragmentFiles tempFileHandle;
-
- /**
- * Creates an instance of java Notification.
- */
- public YangJavaNotificationTranslator() {
- super();
- setJavaFileInfo(new JavaFileInfo());
- getJavaFileInfo().setGeneratedFileTypes(GENERATE_INTERFACE_WITH_BUILDER);
- }
-
- /**
- * Returns the generated java file information.
- *
- * @return generated java file information
- */
- @Override
- public JavaFileInfo getJavaFileInfo() {
-
- if (javaFileInfo == null) {
- throw new TranslatorException("Missing java info in java datamodel node");
- }
- return javaFileInfo;
- }
-
- /**
- * Sets the java file info object.
- *
- * @param javaInfo java file info object
- */
- @Override
- public void setJavaFileInfo(JavaFileInfo javaInfo) {
- javaFileInfo = javaInfo;
- }
-
- /**
- * Returns the temporary file handle.
- *
- * @return temporary file handle
- */
- @Override
- public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
- return tempFileHandle;
- }
-
- /**
- * Sets temporary file handle.
- *
- * @param fileHandle temporary file handle
- */
- @Override
- public void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle) {
- tempFileHandle = fileHandle;
- }
-
- /**
- * Prepare the information for java code generation corresponding to YANG
- * notification info.
- *
- * @param yangPlugin YANG plugin config
- * @throws TranslatorException translator operation fail
- */
- @Override
- public void generateCodeEntry(YangPluginConfig yangPlugin) throws TranslatorException {
-
- /*
- * As part of the notification support the following files needs to be generated.
- * 1) Subject of the notification(event), this is simple interface with builder class.
- * 2) Event class extending "AbstractEvent" and defining event type enum.
- * 3) Event listener interface extending "EventListener".
- *
- * The manager class needs to extend the ListenerRegistry.
- */
-
- // Generate subject of the notification(event), this is simple interface
- // with builder class.
- try {
- generateCodeOfAugmentableNode(this, yangPlugin);
- addNotificationToExtendsList();
- } catch (IOException e) {
- throw new TranslatorException(
- "Failed to prepare generate code entry for notification node " + getName());
- }
- }
-
- /*Adds current notification info to the extends list so its parents service*/
- private void addNotificationToExtendsList() {
- YangNode parent = getParent();
- TempJavaServiceFragmentFiles tempJavaServiceFragmentFiles = ((TempJavaCodeFragmentFilesContainer) parent)
- .getTempJavaCodeFragmentFiles()
- .getServiceTempFiles();
- JavaExtendsListHolder holder = tempJavaServiceFragmentFiles.getJavaExtendsListHolder();
- JavaQualifiedTypeInfoTranslator event = new JavaQualifiedTypeInfoTranslator();
-
- String parentInfo = getCapitalCase(((JavaFileInfoContainer) parent)
- .getJavaFileInfo().getJavaName());
- event.setClassInfo(parentInfo + EVENT_STRING);
- event.setPkgInfo(getJavaFileInfo().getPackage());
- holder.addToExtendsList(event, parent, tempJavaServiceFragmentFiles);
-
- JavaQualifiedTypeInfoTranslator eventListener = new JavaQualifiedTypeInfoTranslator();
-
- eventListener.setClassInfo(parentInfo + EVENT_LISTENER_STRING);
- eventListener.setPkgInfo(getJavaFileInfo().getPackage());
- holder.addToExtendsList(eventListener, parent, tempJavaServiceFragmentFiles);
-
- }
-
- /**
- * Creates a java file using the YANG notification info.
- */
- @Override
- public void generateCodeExit() throws TranslatorException {
- try {
- getTempJavaCodeFragmentFiles().generateJavaFile(GENERATE_INTERFACE_WITH_BUILDER, this);
- } catch (IOException e) {
- throw new TranslatorException("Failed to generate code for notification node " + getName());
- }
-
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaOutputTranslator.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaOutputTranslator.java
deleted file mode 100644
index b9bc576..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaOutputTranslator.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * 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.translator.tojava.javamodel;
-
-import java.io.IOException;
-
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaOutput;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
-
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
-import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeOfAugmentableNode;
-
-/**
- * Represents output information extended to support java code generation.
- */
-public class YangJavaOutputTranslator
- extends YangJavaOutput
- implements JavaCodeGeneratorInfo, JavaCodeGenerator {
-
- private static final long serialVersionUID = 806201623L;
-
- /**
- * File handle to maintain temporary java code fragments as per the code
- * snippet types.
- */
- private transient TempJavaCodeFragmentFiles tempFileHandle;
-
- /**
- * Creates an instance of java output.
- */
- public YangJavaOutputTranslator() {
- super();
- setJavaFileInfo(new JavaFileInfo());
- getJavaFileInfo().setGeneratedFileTypes(GENERATE_INTERFACE_WITH_BUILDER);
- }
-
- /**
- * Returns the generated java file information.
- *
- * @return generated java file information
- */
- @Override
- public JavaFileInfo getJavaFileInfo() {
- if (javaFileInfo == null) {
- throw new TranslatorException("missing java info in java datamodel node");
- }
- return javaFileInfo;
- }
-
- /**
- * Sets the java file info object.
- *
- * @param javaInfo java file info object
- */
- @Override
- public void setJavaFileInfo(JavaFileInfo javaInfo) {
- javaFileInfo = javaInfo;
- }
-
- /**
- * Returns the temporary file handle.
- *
- * @return temporary file handle
- */
- @Override
- public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
- return tempFileHandle;
- }
-
- /**
- * Sets temporary file handle.
- *
- * @param fileHandle temporary file handle
- */
- @Override
- public void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle) {
- tempFileHandle = fileHandle;
- }
-
- /**
- * Prepare the information for java code generation corresponding to YANG
- * output info.
- *
- * @param yangPlugin YANG plugin config
- * @throws TranslatorException translator operation fail
- */
- @Override
- public void generateCodeEntry(YangPluginConfig yangPlugin) throws TranslatorException {
- try {
- generateCodeOfAugmentableNode(this, yangPlugin);
- } catch (IOException e) {
- throw new TranslatorException(
- "Failed to prepare generate code entry for output node " + getName());
- }
-
- }
-
- /**
- * Creates a java file using the YANG output info.
- *
- * @throws TranslatorException translator operation fail
- */
- @Override
- public void generateCodeExit() throws TranslatorException {
- try {
- getTempJavaCodeFragmentFiles().generateJavaFile(GENERATE_INTERFACE_WITH_BUILDER, this);
- } catch (IOException e) {
- throw new TranslatorException(
- "Failed to prepare generate code exit for output node " + getName());
- }
- }
-
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaRpcTranslator.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaRpcTranslator.java
deleted file mode 100644
index 2b768e2..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaRpcTranslator.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * 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.translator.tojava.javamodel;
-
-import java.io.IOException;
-
-import org.onosproject.yangutils.datamodel.RpcNotificationContainer;
-import org.onosproject.yangutils.datamodel.YangInput;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangOutput;
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaRpc;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.JavaAttributeInfo;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfoContainer;
-import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
-import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFilesContainer;
-import org.onosproject.yangutils.translator.tojava.TempJavaFragmentFiles;
-
-import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator.getQualifiedTypeInfoOfCurNode;
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.getParentNodeInGenCode;
-import static org.onosproject.yangutils.translator.tojava.JavaAttributeInfo.getAttributeInfoForTheData;
-import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.updatePackageInfo;
-import static org.onosproject.yangutils.utils.UtilConstants.SERVICE;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase;
-
-/**
- * Represents rpc information extended to support java code generation.
- */
-public class YangJavaRpcTranslator
- extends YangJavaRpc
- implements JavaCodeGenerator, JavaCodeGeneratorInfo {
-
- private static final long serialVersionUID = 806201622L;
-
- /**
- * Temporary file for code generation.
- */
- private transient TempJavaCodeFragmentFiles tempJavaCodeFragmentFiles;
-
- /**
- * Creates an instance of YANG java rpc.
- */
- public YangJavaRpcTranslator() {
- super();
- setJavaFileInfo(new JavaFileInfo());
- }
-
- /**
- * Returns the generated java file information.
- *
- * @return generated java file information
- */
- @Override
- public JavaFileInfo getJavaFileInfo() {
-
- if (javaFileInfo == null) {
- throw new TranslatorException("missing java info in java datamodel node");
- }
- return javaFileInfo;
- }
-
- /**
- * Sets the java file info object.
- *
- * @param javaInfo java file info object
- */
- @Override
- public void setJavaFileInfo(JavaFileInfo javaInfo) {
- javaFileInfo = javaInfo;
- }
-
- @Override
- public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
- return tempJavaCodeFragmentFiles;
- }
-
- @Override
- public void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle) {
- tempJavaCodeFragmentFiles = fileHandle;
- }
-
- /**
- * Prepares the information for java code generation corresponding to YANG
- * RPC info.
- *
- * @param yangPlugin YANG plugin config
- * @throws TranslatorException translator operations fails
- */
- @Override
- public void generateCodeEntry(YangPluginConfig yangPlugin)
- throws TranslatorException {
-
- // Add package information for rpc and create corresponding folder.
- try {
- updatePackageInfo(this, yangPlugin);
- } catch (IOException e) {
- throw new TranslatorException("Failed to prepare generate code entry for RPC node " + getName());
- }
- }
-
- /**
- * Creates a java file using the YANG RPC info.
- *
- * @throws TranslatorException translator operations fails
- */
- @Override
- public void generateCodeExit()
- throws TranslatorException {
- // Get the parent module/sub-module.
- YangNode parent = getParentNodeInGenCode(this);
-
- // Parent should be holder of rpc or notification.
- if (!(parent instanceof RpcNotificationContainer)) {
- throw new TranslatorException("parent node of rpc can only be module or sub-module");
- }
-
- /*
- * Create attribute info for input and output of rpc and add it to the
- * parent import list.
- */
-
- JavaAttributeInfo javaAttributeInfoOfInput = null;
- JavaAttributeInfo javaAttributeInfoOfOutput = null;
-
- // Get the child input and output node and obtain create java attribute
- // info.
- YangNode yangNode = getChild();
- while (yangNode != null) {
- if (yangNode instanceof YangInput) {
- javaAttributeInfoOfInput = getChildNodeAsAttributeInParentService(yangNode, this);
-
- } else if (yangNode instanceof YangOutput) {
- javaAttributeInfoOfOutput = getChildNodeAsAttributeInParentService(yangNode, this);
- } else {
- throw new TranslatorException("RPC should contain only input/output child nodes.");
- }
- yangNode = yangNode.getNextSibling();
- }
-
- if (!(parent instanceof TempJavaCodeFragmentFilesContainer)) {
- throw new TranslatorException("missing parent temp file handle");
- }
-
- /*
- * Add the rpc information to the parent's service temp file.
- */
- try {
-
- ((TempJavaCodeFragmentFilesContainer) parent).getTempJavaCodeFragmentFiles().getServiceTempFiles()
- .addJavaSnippetInfoToApplicableTempFiles(javaAttributeInfoOfInput, javaAttributeInfoOfOutput,
- ((JavaFileInfoContainer) parent).getJavaFileInfo().getPluginConfig(), getName());
-
- } catch (IOException e) {
- throw new TranslatorException("Failed to generate code for RPC node " + getName());
- }
- // No file will be generated during RPC exit.
- }
-
- /**
- * Creates an attribute info object corresponding to a data model node and
- * return it.
- *
- * @param childNode child data model node(input / output) for which the java code generation
- * is being handled
- * @param currentNode parent node (module / sub-module) in which the child node is an attribute
- * @return AttributeInfo attribute details required to add in temporary
- * files
- */
- private JavaAttributeInfo getChildNodeAsAttributeInParentService(
- YangNode childNode, YangNode currentNode) {
-
- YangNode parentNode = getParentNodeInGenCode(currentNode);
-
- String childNodeName = ((JavaFileInfoContainer) childNode).getJavaFileInfo().getJavaName();
- /*
- * Get the import info corresponding to the attribute for import in
- * generated java files or qualified access
- */
- JavaQualifiedTypeInfoTranslator qualifiedTypeInfo = getQualifiedTypeInfoOfCurNode(childNode,
- getCapitalCase(childNodeName));
- if (!(parentNode instanceof TempJavaCodeFragmentFilesContainer)) {
- throw new TranslatorException("Parent node does not have file info");
- }
-
- TempJavaFragmentFiles tempJavaFragmentFiles;
- tempJavaFragmentFiles = ((TempJavaCodeFragmentFilesContainer) parentNode)
- .getTempJavaCodeFragmentFiles()
- .getServiceTempFiles();
-
- if (tempJavaFragmentFiles == null) {
- throw new TranslatorException("Parent node does not have service file info");
- }
- boolean isQualified = addImportToService(qualifiedTypeInfo);
- return getAttributeInfoForTheData(qualifiedTypeInfo, childNodeName, null, isQualified, false);
- }
-
- /**
- * Adds to service class import list.
- *
- * @param importInfo import info
- * @return true or false
- */
- private boolean addImportToService(JavaQualifiedTypeInfoTranslator importInfo) {
- JavaFileInfo fileInfo = ((JavaFileInfoContainer) getParent()).getJavaFileInfo();
-
- if (importInfo.getClassInfo().contentEquals(SERVICE)
- || importInfo.getClassInfo().contentEquals(getCapitalCase(fileInfo.getJavaName() + SERVICE))) {
- return true;
- }
-
- String className;
- className = getCapitalCase(fileInfo.getJavaName()) + "Service";
-
- return ((TempJavaCodeFragmentFilesContainer) getParent()).getTempJavaCodeFragmentFiles()
- .getServiceTempFiles().getJavaImportData().addImportInfo(importInfo,
- className, fileInfo.getPackage());
- }
-
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaSubModuleTranslator.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaSubModuleTranslator.java
deleted file mode 100644
index 10aab93..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaSubModuleTranslator.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * 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.translator.tojava.javamodel;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.onosproject.yangutils.datamodel.YangBelongsTo;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNotification;
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaSubModule;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
-
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_ALL_EVENT_CLASS_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_SERVICE_AND_MANAGER;
-import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeOfRootNode;
-import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.isRootNodesCodeGenRequired;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getRootPackage;
-import static org.onosproject.yangutils.utils.UtilConstants.SBI;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.searchAndDeleteTempDir;
-
-/**
- * Represents sub module information extended to support java code generation.
- */
-public class YangJavaSubModuleTranslator
- extends YangJavaSubModule
- implements JavaCodeGeneratorInfo, JavaCodeGenerator {
-
- private static final long serialVersionUID = 806201621L;
-
- /**
- * File handle to maintain temporary java code fragments as per the code snippet types.
- */
- private transient TempJavaCodeFragmentFiles tempFileHandle;
-
- /**
- * List of notifications nodes.
- */
- private transient List<YangNode> notificationNodes = new ArrayList<>();
-
- /**
- * Creates YANG java sub module object.
- */
- public YangJavaSubModuleTranslator() {
- super();
- setJavaFileInfo(new JavaFileInfo());
- int genType = GENERATE_SERVICE_AND_MANAGER | GENERATE_INTERFACE_WITH_BUILDER;
- if (isNotificationChildNodePresent(this)) {
- genType = GENERATE_SERVICE_AND_MANAGER | GENERATE_ALL_EVENT_CLASS_MASK;
- }
- getJavaFileInfo().setGeneratedFileTypes(genType);
- }
-
- /**
- * Returns the generated java file information.
- *
- * @return generated java file information
- */
- @Override
- public JavaFileInfo getJavaFileInfo() {
- if (javaFileInfo == null) {
- throw new TranslatorException("Missing java info in java datamodel node");
- }
- return javaFileInfo;
- }
-
- /**
- * Sets the java file info object.
- *
- * @param javaInfo java file info object
- */
- @Override
- public void setJavaFileInfo(JavaFileInfo javaInfo) {
- javaFileInfo = javaInfo;
- }
-
- /**
- * Returns the temporary file handle.
- *
- * @return temporary file handle
- */
- @Override
- public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
- return tempFileHandle;
- }
-
- /**
- * Sets temporary file handle.
- *
- * @param fileHandle temporary file handle
- */
- @Override
- public void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle) {
- tempFileHandle = fileHandle;
- }
-
- /**
- * Returns the name space of the module to which the sub module belongs to.
- *
- * @param belongsToInfo Information of the module to which the sub module belongs
- * @return the name space string of the module.
- */
- public String getNameSpaceFromModule(YangBelongsTo belongsToInfo) {
- return ((YangModule) belongsToInfo.getModuleNode()).getNameSpace().getUri();
- }
-
- /**
- * Prepares the information for java code generation corresponding to YANG submodule info.
- *
- * @param yangPlugin YANG plugin config
- * @throws TranslatorException when fails to translate
- */
- @Override
- public void generateCodeEntry(YangPluginConfig yangPlugin) throws TranslatorException {
- String subModulePkg = getRootPackage(getVersion(), getNameSpaceFromModule(getBelongsTo()),
- getRevision().getRevDate(), yangPlugin.getConflictResolver());
-
- if (isNotificationChildNodePresent(this)) {
- getJavaFileInfo().setGeneratedFileTypes(getJavaFileInfo().getGeneratedFileTypes()
- | GENERATE_ALL_EVENT_CLASS_MASK);
- }
- try {
- generateCodeOfRootNode(this, yangPlugin, subModulePkg);
- } catch (IOException e) {
- throw new TranslatorException(
- "failed to prepare generate code entry for submodule node " + getName());
- }
-
- }
-
- /**
- * Creates a java file using the YANG submodule info.
- */
- @Override
- public void generateCodeExit() throws TranslatorException {
- /**
- * As part of the notification support the following files needs to be generated.
- * 1) Subject of the notification(event), this is simple interface with builder class.
- * 2) Event class extending "AbstractEvent" and defining event type enum.
- * 3) Event listener interface extending "EventListener".
- * 4) Event subject class.
- *
- * The manager class needs to extend the "ListenerRegistry".
- */
- try {
- if ((getJavaFileInfo().getGeneratedFileTypes() & GENERATE_ALL_EVENT_CLASS_MASK) != 0) {
- getTempJavaCodeFragmentFiles().generateJavaFile(GENERATE_ALL_EVENT_CLASS_MASK, this);
- }
- if (isRootNodesCodeGenRequired(this)) {
- getTempJavaCodeFragmentFiles()
- .generateJavaFile(GENERATE_INTERFACE_WITH_BUILDER, this);
- if ((getJavaFileInfo().getPluginConfig().getCodeGenerateForsbi() == null)
- || (!getJavaFileInfo().getPluginConfig().getCodeGenerateForsbi().equals(SBI))) {
- getTempJavaCodeFragmentFiles().generateJavaFile(GENERATE_SERVICE_AND_MANAGER, this);
- }
- }
-
- searchAndDeleteTempDir(getJavaFileInfo().getBaseCodeGenPath() +
- getJavaFileInfo().getPackageFilePath());
- searchAndDeleteTempDir(getJavaFileInfo().getPluginConfig().getCodeGenDir() +
- getJavaFileInfo().getPackageFilePath());
- } catch (IOException e) {
- throw new TranslatorException("Failed to generate code for submodule node " + getName());
- }
- }
-
- /**
- * Returns notifications node list.
- *
- * @return notification nodes
- */
- public List<YangNode> getNotificationNodes() {
- return notificationNodes;
- }
-
- /**
- * Adds to notification node list.
- *
- * @param curNode notification node
- */
- private void addToNotificationList(YangNode curNode) {
- getNotificationNodes().add(curNode);
- }
-
- /**
- * Checks if there is any notification node present.
- *
- * @param rootNode root node of the data model
- * @return status of notification's existence
- */
- private boolean isNotificationChildNodePresent(YangNode rootNode) {
- YangNode childNode = rootNode.getChild();
-
- while (childNode != null) {
- if (childNode instanceof YangNotification) {
- addToNotificationList(childNode);
- }
- childNode = childNode.getNextSibling();
- }
-
- return !getNotificationNodes().isEmpty();
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaTypeDefTranslator.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaTypeDefTranslator.java
deleted file mode 100644
index c742e7c..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaTypeDefTranslator.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * 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.translator.tojava.javamodel;
-
-import java.io.IOException;
-
-import org.onosproject.yangutils.datamodel.YangDerivedInfo;
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaTypeDef;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.translator.exception.InvalidNodeForTranslatorException;
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
-
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.DERIVED;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.LEAFREF;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_TYPEDEF_CLASS;
-import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeOfNode;
-
-/**
- * Represents type define information extended to support java code generation.
- */
-public class YangJavaTypeDefTranslator
- extends YangJavaTypeDef
- implements JavaCodeGeneratorInfo, JavaCodeGenerator {
-
- private static final long serialVersionUID = 806201620L;
-
- /**
- * File handle to maintain temporary java code fragments as per the code
- * snippet types.
- */
- private transient TempJavaCodeFragmentFiles tempFileHandle;
-
- /**
- * Creates a YANG java typedef object.
- */
- public YangJavaTypeDefTranslator() {
- super();
- setJavaFileInfo(new JavaFileInfo());
- getJavaFileInfo().setGeneratedFileTypes(GENERATE_TYPEDEF_CLASS);
- }
-
- /**
- * Returns the generated java file information.
- *
- * @return generated java file information
- */
- @Override
- public JavaFileInfo getJavaFileInfo() {
-
- if (javaFileInfo == null) {
- throw new TranslatorException("Missing java info in java datamodel node");
- }
- return javaFileInfo;
- }
-
- /**
- * Sets the java file info object.
- *
- * @param javaInfo java file info object
- */
- @Override
- public void setJavaFileInfo(JavaFileInfo javaInfo) {
- javaFileInfo = javaInfo;
- }
-
- /**
- * Returns the temporary file handle.
- *
- * @return temporary file handle
- */
- @Override
- public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
- return tempFileHandle;
- }
-
- /**
- * Sets temporary file handle.
- *
- * @param fileHandle temporary file handle
- */
- @Override
- public void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle) {
- tempFileHandle = fileHandle;
- }
-
- /**
- * Prepare the information for java code generation corresponding to YANG
- * typedef info.
- *
- * @param yangPlugin YANG plugin config
- * @throws TranslatorException when fails to translate
- */
- @Override
- public void generateCodeEntry(YangPluginConfig yangPlugin) throws TranslatorException {
- YangType typeInTypeDef = this.getTypeDefBaseType();
- if (typeInTypeDef.getDataType() == DERIVED) {
- YangDerivedInfo derivedInfo = (YangDerivedInfo) typeInTypeDef.getDataTypeExtendedInfo();
- if (derivedInfo.getEffectiveBuiltInType() == LEAFREF) {
- throw new InvalidNodeForTranslatorException();
- }
- } else if (typeInTypeDef.getDataType() == LEAFREF) {
- throw new InvalidNodeForTranslatorException();
- }
- try {
- generateCodeOfNode(this, yangPlugin);
- } catch (IOException e) {
- throw new TranslatorException(
- "Failed to prepare generate code entry for typedef node " + getName());
- }
-
- }
-
- /**
- * Create a java file using the YANG typedef info.
- *
- * @throws TranslatorException when fails to translate
- */
- @Override
- public void generateCodeExit() throws TranslatorException {
- try {
- getTempJavaCodeFragmentFiles().generateJavaFile(GENERATE_TYPEDEF_CLASS, this);
- } catch (IOException e) {
- throw new TranslatorException("Failed to generate code for typedef node " + getName());
- }
- }
-
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaTypeTranslator.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaTypeTranslator.java
deleted file mode 100644
index 5e8321d..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaTypeTranslator.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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.translator.tojava.javamodel;
-
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangToJavaNamingConflictUtil;
-
-import static org.onosproject.yangutils.translator.tojava.javamodel.AttributesJavaDataType.getJavaDataType;
-import static org.onosproject.yangutils.translator.tojava.javamodel.AttributesJavaDataType.getJavaImportClass;
-import static org.onosproject.yangutils.translator.tojava.javamodel.AttributesJavaDataType.getJavaImportPackage;
-
-/**
- * Represents java information corresponding to the YANG type.
- *
- * @param <T> generic parameter for YANG java type
- */
-public class YangJavaTypeTranslator<T>
- extends YangType<T>
- implements JavaQualifiedTypeResolver {
-
- private JavaQualifiedTypeInfoTranslator javaQualifiedAccess;
-
- /**
- * Create a YANG leaf object with java qualified access details.
- */
- public YangJavaTypeTranslator() {
- super();
- setJavaQualifiedInfo(new JavaQualifiedTypeInfoTranslator());
- }
-
- @Override
- public void updateJavaQualifiedInfo(YangToJavaNamingConflictUtil conflictResolver) {
- JavaQualifiedTypeInfoTranslator importInfo = getJavaQualifiedInfo();
-
- /*
- * Type is added as an attribute in the class.
- */
- String className = getJavaImportClass(this, false, conflictResolver);
- if (className != null) {
- /*
- * Corresponding to the attribute type a class needs to be imported,
- * since it can be a derived type or a usage of wrapper classes.
- */
- importInfo.setClassInfo(className);
- String classPkg = getJavaImportPackage(this,
- false, conflictResolver);
- if (classPkg == null) {
- throw new TranslatorException("import package cannot be null when the class is used");
- }
- importInfo.setPkgInfo(classPkg);
- } else {
- /*
- * The attribute does not need a class to be imported, for example
- * built in java types.
- */
- String dataTypeName = getJavaDataType(this);
- if (dataTypeName == null) {
- throw new TranslatorException("not supported data type");
- }
- importInfo.setClassInfo(dataTypeName);
- }
- setJavaQualifiedInfo(importInfo);
- }
-
- @Override
- public JavaQualifiedTypeInfoTranslator getJavaQualifiedInfo() {
- return javaQualifiedAccess;
- }
-
- @Override
- public void setJavaQualifiedInfo(JavaQualifiedTypeInfoTranslator typeInfo) {
- javaQualifiedAccess = typeInfo;
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaUnionTranslator.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaUnionTranslator.java
deleted file mode 100644
index 926bcb9..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaUnionTranslator.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * 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.translator.tojava.javamodel;
-
-import java.io.IOException;
-
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaUnion;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
-
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_UNION_CLASS;
-import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeOfNode;
-
-/**
- * Represents union information extended to support java code generation.
- */
-public class YangJavaUnionTranslator
- extends YangJavaUnion
- implements JavaCodeGeneratorInfo, JavaCodeGenerator {
-
- private static final long serialVersionUID = 806201619L;
-
- /**
- * File handle to maintain temporary java code fragments as per the code
- * snippet types.
- */
- private transient TempJavaCodeFragmentFiles tempFileHandle;
-
- /**
- * Creates an instance of YANG java union.
- */
- public YangJavaUnionTranslator() {
- super();
- setJavaFileInfo(new JavaFileInfo());
- getJavaFileInfo().setGeneratedFileTypes(GENERATE_UNION_CLASS);
- }
-
- /**
- * Returns the generated java file information.
- *
- * @return generated java file information
- */
- @Override
- public JavaFileInfo getJavaFileInfo() {
- if (javaFileInfo == null) {
- throw new RuntimeException("Missing java info in java datamodel node");
- }
- return javaFileInfo;
- }
-
- /**
- * Sets the java file info object.
- *
- * @param javaInfo java file info object
- */
- @Override
- public void setJavaFileInfo(JavaFileInfo javaInfo) {
- javaFileInfo = javaInfo;
- }
-
- /**
- * Returns the temporary file handle.
- *
- * @return temporary file handle
- */
- @Override
- public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
- return tempFileHandle;
- }
-
- /**
- * Sets temporary file handle.
- *
- * @param fileHandle temporary file handle
- */
- @Override
- public void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle) {
- tempFileHandle = fileHandle;
- }
-
- /**
- * Prepare the information for java code generation corresponding to YANG
- * union info.
- *
- * @param yangPlugin YANG plugin config
- * @throws TranslatorException when fails to translate
- */
- @Override
- public void generateCodeEntry(YangPluginConfig yangPlugin) throws TranslatorException {
- try {
- generateCodeOfNode(this, yangPlugin);
- } catch (IOException e) {
- throw new TranslatorException(
- "Failed to prepare generate code entry for union node " + getName());
- }
-
- }
-
- /**
- * Creates a java file using the YANG union info.
- *
- * @throws TranslatorException when fails to translate
- */
- @Override
- public void generateCodeExit() throws TranslatorException {
- try {
- getTempJavaCodeFragmentFiles().generateJavaFile(GENERATE_UNION_CLASS, this);
- } catch (IOException e) {
- throw new TranslatorException("Failed to generate code for union node " + getName());
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaUsesTranslator.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaUsesTranslator.java
deleted file mode 100644
index a3af41e..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaUsesTranslator.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * 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.translator.tojava.javamodel;
-
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaUses;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.translator.exception.InvalidNodeForTranslatorException;
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
-import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
-
-/**
- * Represents uses information extended to support java code generation.
- */
-public class YangJavaUsesTranslator
- extends YangJavaUses
- implements JavaCodeGeneratorInfo, JavaCodeGenerator {
-
- private static final long serialVersionUID = 806201618L;
-
- /**
- * File handle to maintain temporary java code fragments as per the code
- * snippet types.
- */
- private transient TempJavaCodeFragmentFiles tempFileHandle;
-
- /**
- * Creates YANG java uses object.
- */
- public YangJavaUsesTranslator() {
- super();
- setJavaFileInfo(new JavaFileInfo());
- }
-
- /**
- * Returns the generated java file information.
- *
- * @return generated java file information
- */
- @Override
- public JavaFileInfo getJavaFileInfo() {
- if (javaFileInfo == null) {
- throw new TranslatorException("Missing java info in java datamodel node");
- }
- return javaFileInfo;
- }
-
- /**
- * Sets the java file info object.
- *
- * @param javaInfo java file info object
- */
- @Override
- public void setJavaFileInfo(JavaFileInfo javaInfo) {
- javaFileInfo = javaInfo;
- }
-
- /**
- * Returns the temporary file handle.
- *
- * @return temporary file handle
- */
- @Override
- public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
- return tempFileHandle;
- }
-
- /**
- * Sets temporary file handle.
- *
- * @param fileHandle temporary file handle
- */
- @Override
- public void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle) {
- tempFileHandle = fileHandle;
- }
-
- @Override
- public void generateCodeEntry(YangPluginConfig yangPlugin)
- throws TranslatorException {
- throw new InvalidNodeForTranslatorException();
- }
-
- @Override
- public void generateCodeExit()
- throws TranslatorException {
- /*
- * Do nothing.
- */
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/package-info.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/package-info.java
deleted file mode 100644
index 3257922..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Maintains application's schema mapped to java classes / interfaces.
- */
-package org.onosproject.yangutils.translator.tojava.javamodel;
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/package-info.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/package-info.java
deleted file mode 100644
index 1aac09e..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Generates java class definition from data model.
- */
-package org.onosproject.yangutils.translator.tojava;
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/ClassDefinitionGenerator.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/ClassDefinitionGenerator.java
deleted file mode 100644
index 2b52cc9..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/ClassDefinitionGenerator.java
+++ /dev/null
@@ -1,417 +0,0 @@
-/*
- * 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.translator.tojava.utils;
-
-import org.onosproject.yangutils.datamodel.YangAugment;
-import org.onosproject.yangutils.datamodel.YangCase;
-import org.onosproject.yangutils.datamodel.YangIdentity;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNotification;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfoContainer;
-import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator;
-import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFilesContainer;
-
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.BUILDER_CLASS_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.BUILDER_INTERFACE_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.DEFAULT_CLASS_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_ENUM_CLASS;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_CLASS;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_LISTENER_INTERFACE;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_SUBJECT_CLASS;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_IDENTITY_CLASS;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_SERVICE_AND_MANAGER;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_TYPEDEF_CLASS;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_UNION_CLASS;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.INTERFACE_MASK;
-import static org.onosproject.yangutils.utils.UtilConstants.ABSTRACT;
-import static org.onosproject.yangutils.utils.UtilConstants.BUILDER;
-import static org.onosproject.yangutils.utils.UtilConstants.CLASS;
-import static org.onosproject.yangutils.utils.UtilConstants.COMMA;
-import static org.onosproject.yangutils.utils.UtilConstants.DEFAULT;
-import static org.onosproject.yangutils.utils.UtilConstants.DIAMOND_CLOSE_BRACKET;
-import static org.onosproject.yangutils.utils.UtilConstants.DIAMOND_OPEN_BRACKET;
-import static org.onosproject.yangutils.utils.UtilConstants.EIGHT_SPACE_INDENTATION;
-import static org.onosproject.yangutils.utils.UtilConstants.ENUM;
-import static org.onosproject.yangutils.utils.UtilConstants.EVENT_LISTENER_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.EVENT_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.EXTEND;
-import static org.onosproject.yangutils.utils.UtilConstants.FINAL;
-import static org.onosproject.yangutils.utils.UtilConstants.IMPLEMENTS;
-import static org.onosproject.yangutils.utils.UtilConstants.INTERFACE;
-import static org.onosproject.yangutils.utils.UtilConstants.LISTENER_REG;
-import static org.onosproject.yangutils.utils.UtilConstants.LISTENER_SERVICE;
-import static org.onosproject.yangutils.utils.UtilConstants.MANAGER;
-import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE;
-import static org.onosproject.yangutils.utils.UtilConstants.OPEN_CURLY_BRACKET;
-import static org.onosproject.yangutils.utils.UtilConstants.OP_PARAM;
-import static org.onosproject.yangutils.utils.UtilConstants.PERIOD;
-import static org.onosproject.yangutils.utils.UtilConstants.PUBLIC;
-import static org.onosproject.yangutils.utils.UtilConstants.REGEX_FOR_ANY_STRING_ENDING_WITH_SERVICE;
-import static org.onosproject.yangutils.utils.UtilConstants.SERVICE;
-import static org.onosproject.yangutils.utils.UtilConstants.SPACE;
-import static org.onosproject.yangutils.utils.UtilConstants.STATIC;
-import static org.onosproject.yangutils.utils.UtilConstants.SUBJECT;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.trimAtLast;
-
-/**
- * Represents generator for class definition of generated files.
- */
-final class ClassDefinitionGenerator {
-
- /**
- * Creates an instance of class definition generator.
- */
- private ClassDefinitionGenerator() {
- }
-
- /**
- * Based on the file type and the YANG name of the file, generate the class / interface definition start.
- *
- * @param genFileTypes generated file type
- * @param yangName class name
- * @return class definition
- */
- static String generateClassDefinition(int genFileTypes, String yangName) {
-
- /*
- * Based on the file type and the YANG name of the file, generate the
- * class / interface definition start.
- */
- switch (genFileTypes) {
- case GENERATE_TYPEDEF_CLASS:
- case GENERATE_UNION_CLASS:
- return getTypeClassDefinition(yangName);
- case GENERATE_ENUM_CLASS:
- return getEnumClassDefinition(yangName);
- default:
- return null;
- }
- }
-
- /**
- * Based on the file type and the YANG name of the file, generate the class / interface definition start.
- *
- * @param genFileTypes generated file type
- * @param yangName class name
- * @param curNode current YANG node
- * @return class definition
- */
- static String generateClassDefinition(int genFileTypes, String yangName, YangNode curNode) {
-
- /*
- * Based on the file type and the YANG name of the file, generate the
- * class / interface definition start.
- */
- switch (genFileTypes) {
- case INTERFACE_MASK:
- return getInterfaceDefinition(yangName, curNode);
- case BUILDER_CLASS_MASK:
- return getBuilderClassDefinition(yangName, curNode);
- case DEFAULT_CLASS_MASK:
- return getImplClassDefinition(yangName, curNode);
- case BUILDER_INTERFACE_MASK:
- return getBuilderInterfaceDefinition(yangName, curNode);
- case GENERATE_SERVICE_AND_MANAGER:
- return getRpcInterfaceDefinition(yangName, curNode);
- case GENERATE_EVENT_CLASS:
- String eventName = yangName + SUBJECT;
- return getEventDefinition(yangName, eventName);
- case GENERATE_EVENT_LISTENER_INTERFACE:
- return getEventListenerDefinition(yangName);
- case GENERATE_EVENT_SUBJECT_CLASS:
- return getClassDefinition(yangName);
- case GENERATE_IDENTITY_CLASS:
- return getIdentityClassDefinition(yangName, curNode);
- default:
- return null;
- }
- }
-
- /**
- * Returns enum file class definition.
- *
- * @param yangName class name
- * @return enum file class definition
- */
- private static String getEnumClassDefinition(String yangName) {
- return PUBLIC + SPACE + ENUM + SPACE + yangName + SPACE + OPEN_CURLY_BRACKET + NEW_LINE;
- }
-
- /**
- * Returns interface file class definition.
- *
- * @param yangName file name
- * @return definition
- */
- private static String getInterfaceDefinition(String yangName, YangNode curNode) {
-
- String clsDef = getClassDefinitionForWhenExtended(curNode, yangName, INTERFACE_MASK);
- if (clsDef != null) {
- return clsDef;
- }
- return PUBLIC + SPACE + INTERFACE + SPACE + yangName + SPACE + OPEN_CURLY_BRACKET + NEW_LINE;
- }
-
- /**
- * Returns builder interface file class definition.
- *
- * @param yangName java class name, corresponding to which the builder class is being generated
- * @return definition
- */
- private static String getBuilderInterfaceDefinition(String yangName, YangNode curNode) {
- if (!(curNode instanceof YangCase) && !(curNode instanceof YangAugment)) {
- String clsDef = getClassDefinitionForWhenExtended(curNode, yangName, BUILDER_INTERFACE_MASK);
- if (clsDef != null) {
- return clsDef;
- }
- }
- return INTERFACE + SPACE + yangName + BUILDER + SPACE + OPEN_CURLY_BRACKET + NEW_LINE + NEW_LINE;
- }
-
- /**
- * Returns builder file class definition.
- *
- * @param yangName file name
- * @return definition
- */
- private static String getBuilderClassDefinition(String yangName, YangNode curNode) {
- if (!(curNode instanceof YangCase)) {
- String clsDef = getClassDefinitionForWhenExtended(curNode, yangName, BUILDER_CLASS_MASK);
- if (clsDef != null) {
- return clsDef;
- }
- }
- if (curNode instanceof YangModule || curNode instanceof YangSubModule) {
- return PUBLIC + SPACE + STATIC + SPACE + CLASS + SPACE + yangName + BUILDER + SPACE
- + OPEN_CURLY_BRACKET + NEW_LINE;
- }
- return PUBLIC + SPACE + STATIC + SPACE + CLASS + SPACE + yangName + BUILDER + SPACE + IMPLEMENTS + SPACE +
- yangName + PERIOD + yangName + BUILDER + SPACE + OPEN_CURLY_BRACKET + NEW_LINE;
- }
-
- /**
- * Returns impl file class definition.
- *
- * @param yangName file name
- * @return definition
- */
- private static String getImplClassDefinition(String yangName, YangNode curNode) {
- if (!(curNode instanceof YangCase)) {
- String clsDef = getClassDefinitionForWhenExtended(curNode, yangName, DEFAULT_CLASS_MASK);
- if (clsDef != null) {
- return clsDef;
- }
- }
- if (curNode instanceof YangModule || curNode instanceof YangSubModule) {
- return PUBLIC + SPACE + CLASS + SPACE + yangName + OP_PARAM + SPACE + IMPLEMENTS + SPACE
- + yangName + SPACE + OPEN_CURLY_BRACKET + NEW_LINE;
- }
- return PUBLIC + SPACE + CLASS + SPACE + getCapitalCase(DEFAULT) + yangName + SPACE + IMPLEMENTS + SPACE
- + yangName + SPACE + OPEN_CURLY_BRACKET + NEW_LINE;
- }
-
- /**
- * Returns impl file class definition.
- *
- * @param yangName file name
- * @return definition
- */
- private static String getClassDefinition(String yangName) {
- return PUBLIC + SPACE + CLASS + SPACE + yangName + SPACE + OPEN_CURLY_BRACKET + NEW_LINE;
- }
-
- /**
- * Returns implementation file identity class definition.
- *
- * @param yangName file name
- * @return identity class definition
- */
- private static String getIdentityClassDefinition(String yangName, YangNode curNode) {
- if (!(curNode instanceof YangIdentity)) {
- throw new TranslatorException("Expected java identity instance node");
- }
- YangIdentity identity = (YangIdentity) curNode;
- if (identity.getBaseNode() != null) {
- YangIdentity baseIdentity = identity.getBaseNode().getReferredIdentity();
- if (baseIdentity == null) {
- throw new TranslatorException("Expected java identity instance node");
- }
-
- JavaFileInfo fileInfo = ((JavaFileInfoContainer) baseIdentity).getJavaFileInfo();
- return PUBLIC + SPACE + ABSTRACT + SPACE + CLASS + SPACE + yangName + SPACE + EXTEND + SPACE
- + getCapitalCase(fileInfo.getJavaName()) + SPACE +
- OPEN_CURLY_BRACKET + NEW_LINE;
- }
-
- return PUBLIC + SPACE + ABSTRACT + SPACE + CLASS + SPACE + yangName + SPACE + OPEN_CURLY_BRACKET + NEW_LINE;
- }
-
- /**
- * Returns type file class definition.
- *
- * @param yangName file name
- * @return definition
- */
- private static String getTypeClassDefinition(String yangName) {
- return PUBLIC + SPACE + FINAL + SPACE + CLASS + SPACE + yangName + SPACE + OPEN_CURLY_BRACKET + NEW_LINE;
- }
-
- /**
- * Returns RPC file interface definition.
- *
- * @param yangName file name
- * @param curNode current YANG node
- * @return definition
- */
- private static String getRpcInterfaceDefinition(String yangName, YangNode curNode) {
- JavaExtendsListHolder holder = ((TempJavaCodeFragmentFilesContainer) curNode)
- .getTempJavaCodeFragmentFiles().getServiceTempFiles().getJavaExtendsListHolder();
- if (holder.getExtendsList() != null && !holder.getExtendsList().isEmpty()) {
- curNode = curNode.getChild();
- while (curNode != null) {
- if (curNode instanceof YangNotification) {
- return getRpcInterfaceDefinitionWhenItExtends(yangName);
- }
- curNode = curNode.getNextSibling();
- }
- }
- if (yangName.matches(REGEX_FOR_ANY_STRING_ENDING_WITH_SERVICE)) {
- return PUBLIC + SPACE + INTERFACE + SPACE + yangName + SPACE + OPEN_CURLY_BRACKET + NEW_LINE;
- }
- return PUBLIC + SPACE + CLASS + SPACE + yangName + SPACE + IMPLEMENTS + SPACE
- + yangName.substring(0, yangName.length() - 7) + SERVICE + SPACE + OPEN_CURLY_BRACKET + NEW_LINE;
- }
-
- /* Provides class definition when RPC interface needs to extends any event.*/
- private static String getRpcInterfaceDefinitionWhenItExtends(String yangName) {
-
- if (yangName.matches(REGEX_FOR_ANY_STRING_ENDING_WITH_SERVICE)) {
- String[] strArray = yangName.split(SERVICE);
- return PUBLIC + SPACE + INTERFACE + SPACE + yangName + NEW_LINE + EIGHT_SPACE_INDENTATION
- + EXTEND + SPACE + LISTENER_SERVICE + DIAMOND_OPEN_BRACKET + strArray[0] + EVENT_STRING + COMMA
- + SPACE + strArray[0] + EVENT_LISTENER_STRING + DIAMOND_CLOSE_BRACKET + SPACE
- + OPEN_CURLY_BRACKET + NEW_LINE;
- }
- yangName = yangName.substring(0, yangName.length() - 7);
- return PUBLIC + SPACE + CLASS + SPACE + yangName + MANAGER + NEW_LINE + EIGHT_SPACE_INDENTATION
- + EXTEND + SPACE + LISTENER_REG + DIAMOND_OPEN_BRACKET + yangName + EVENT_STRING + COMMA + SPACE
- + yangName + EVENT_LISTENER_STRING + DIAMOND_CLOSE_BRACKET + NEW_LINE
- + EIGHT_SPACE_INDENTATION + IMPLEMENTS + SPACE + yangName + SERVICE + SPACE + OPEN_CURLY_BRACKET
- + NEW_LINE;
- }
-
- /**
- * Returns event class definition.
- *
- * @param javaName file name
- * @return definition
- */
- private static String getEventDefinition(String javaName, String eventName) {
- return PUBLIC + SPACE + CLASS + SPACE + javaName + SPACE + "extends AbstractEvent<"
- + javaName + ".Type, " + eventName + ">" + SPACE + OPEN_CURLY_BRACKET + NEW_LINE;
- }
-
- /**
- * Returns event listener interface definition.
- *
- * @param javaName file name
- * @return definition
- */
- private static String getEventListenerDefinition(String javaName) {
- String interfaceDef = PUBLIC + SPACE + INTERFACE + SPACE + javaName + SPACE + "extends EventListener<"
- + javaName;
- if (interfaceDef.length() < 8) {
- throw new RuntimeException("Event listener interface name is error");
- }
- interfaceDef = interfaceDef.substring(0, interfaceDef.length() - 8);
- interfaceDef = interfaceDef + ">" + SPACE + OPEN_CURLY_BRACKET + NEW_LINE;
-
- return interfaceDef;
- }
-
- /**
- * Returns class definition when class is extending another class.
- *
- * @param curNode current node
- * @param yangName name
- * @param genFileTypes gen file type
- * @return class definition
- */
- private static String getClassDefinitionForWhenExtended(YangNode curNode, String yangName, int genFileTypes) {
- JavaExtendsListHolder holder = ((TempJavaCodeFragmentFilesContainer) curNode)
- .getTempJavaCodeFragmentFiles().getBeanTempFiles().getJavaExtendsListHolder();
-
- if (holder.getExtendsList() != null && !holder.getExtendsList().isEmpty()) {
- String def = PUBLIC + SPACE;
- switch (genFileTypes) {
- case INTERFACE_MASK:
- def = def + INTERFACE + SPACE + yangName + SPACE + EXTEND + SPACE;
- def = getDefinitionString(def, holder);
- return def + SPACE + OPEN_CURLY_BRACKET + NEW_LINE;
- case BUILDER_INTERFACE_MASK:
- String builderDef = INTERFACE + SPACE + yangName + BUILDER + SPACE + EXTEND + SPACE;
- builderDef = getDefinitionString(builderDef, holder);
- return builderDef + SPACE + OPEN_CURLY_BRACKET + NEW_LINE;
- case BUILDER_CLASS_MASK:
- def = def + STATIC + SPACE + CLASS + SPACE + yangName + BUILDER + SPACE + EXTEND + SPACE;
- def = getDefinitionString(def, holder);
- if (curNode instanceof YangSubModule || curNode instanceof YangModule) {
- return def + SPACE + OPEN_CURLY_BRACKET + NEW_LINE;
- }
- return def + SPACE + IMPLEMENTS + SPACE + yangName + PERIOD
- + yangName + BUILDER + SPACE + OPEN_CURLY_BRACKET + NEW_LINE;
-
- case DEFAULT_CLASS_MASK:
- if (curNode instanceof YangSubModule || curNode instanceof YangModule) {
- def = def + CLASS + SPACE + yangName + OP_PARAM + SPACE + EXTEND + SPACE;
- } else {
- def = def + CLASS + SPACE + getCapitalCase(DEFAULT) + yangName + SPACE + EXTEND + SPACE;
- }
- def = getDefinitionString(def, holder);
- return def + SPACE + IMPLEMENTS + SPACE
- + yangName + SPACE + OPEN_CURLY_BRACKET + NEW_LINE;
- default:
- return null;
- }
- }
- return null;
- }
-
- /**
- * Returns updated class definition.
- *
- * @param def current definition
- * @param holder extend list holder
- * @return updated class definition
- */
- private static String getDefinitionString(String def, JavaExtendsListHolder holder) {
- for (JavaQualifiedTypeInfoTranslator info : holder.getExtendsList()) {
- if (!holder.getExtendedClassStore().get(info)) {
- def = def + info.getClassInfo() + COMMA + SPACE;
- } else {
- def = def + info.getPkgInfo() + PERIOD + info.getClassInfo() + COMMA + SPACE;
- }
- }
- return trimAtLast(def, COMMA);
- }
-
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaCodeSnippetGen.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaCodeSnippetGen.java
deleted file mode 100644
index 01fb650..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaCodeSnippetGen.java
+++ /dev/null
@@ -1,355 +0,0 @@
-/*
- * 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.translator.tojava.utils;
-
-import java.util.List;
-
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator;
-import org.onosproject.yangutils.translator.tojava.TempJavaServiceFragmentFiles;
-
-import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getEnumJavaAttribute;
-import static org.onosproject.yangutils.utils.UtilConstants.ARRAY_LIST;
-import static org.onosproject.yangutils.utils.UtilConstants.CLASS_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.CLOSE_CURLY_BRACKET;
-import static org.onosproject.yangutils.utils.UtilConstants.CLOSE_PARENTHESIS;
-import static org.onosproject.yangutils.utils.UtilConstants.COMMA;
-import static org.onosproject.yangutils.utils.UtilConstants.DIAMOND_CLOSE_BRACKET;
-import static org.onosproject.yangutils.utils.UtilConstants.DIAMOND_OPEN_BRACKET;
-import static org.onosproject.yangutils.utils.UtilConstants.EIGHT_SPACE_INDENTATION;
-import static org.onosproject.yangutils.utils.UtilConstants.ENUM;
-import static org.onosproject.yangutils.utils.UtilConstants.EQUAL;
-import static org.onosproject.yangutils.utils.UtilConstants.FOUR_SPACE_INDENTATION;
-import static org.onosproject.yangutils.utils.UtilConstants.HASH_MAP;
-import static org.onosproject.yangutils.utils.UtilConstants.IMPORT;
-import static org.onosproject.yangutils.utils.UtilConstants.INT;
-import static org.onosproject.yangutils.utils.UtilConstants.INT_MAX_RANGE_ATTR;
-import static org.onosproject.yangutils.utils.UtilConstants.INT_MIN_RANGE_ATTR;
-import static org.onosproject.yangutils.utils.UtilConstants.LIST;
-import static org.onosproject.yangutils.utils.UtilConstants.LISTENER_SERVICE;
-import static org.onosproject.yangutils.utils.UtilConstants.LONG_MAX_RANGE_ATTR;
-import static org.onosproject.yangutils.utils.UtilConstants.LONG_MIN_RANGE_ATTR;
-import static org.onosproject.yangutils.utils.UtilConstants.MAP;
-import static org.onosproject.yangutils.utils.UtilConstants.NEW;
-import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE;
-import static org.onosproject.yangutils.utils.UtilConstants.OBJECT_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.OPEN_CURLY_BRACKET;
-import static org.onosproject.yangutils.utils.UtilConstants.OPEN_PARENTHESIS;
-import static org.onosproject.yangutils.utils.UtilConstants.PERIOD;
-import static org.onosproject.yangutils.utils.UtilConstants.PRIVATE;
-import static org.onosproject.yangutils.utils.UtilConstants.PUBLIC;
-import static org.onosproject.yangutils.utils.UtilConstants.QUESTION_MARK;
-import static org.onosproject.yangutils.utils.UtilConstants.SEMI_COLAN;
-import static org.onosproject.yangutils.utils.UtilConstants.SPACE;
-import static org.onosproject.yangutils.utils.UtilConstants.TYPE;
-import static org.onosproject.yangutils.utils.UtilConstants.UINT_MAX_RANGE_ATTR;
-import static org.onosproject.yangutils.utils.UtilConstants.UINT_MIN_RANGE_ATTR;
-import static org.onosproject.yangutils.utils.UtilConstants.ULONG_MAX_RANGE_ATTR;
-import static org.onosproject.yangutils.utils.UtilConstants.ULONG_MIN_RANGE_ATTR;
-import static org.onosproject.yangutils.utils.UtilConstants.YANG_AUGMENTED_INFO;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.ENUM_ATTRIBUTE;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.getJavaDoc;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getSmallCase;
-import static java.util.Collections.sort;
-
-/**
- * Represents utility class to generate the java snippet.
- */
-public final class JavaCodeSnippetGen {
-
- /**
- * Creates an instance of java code snippet gen.
- */
- private JavaCodeSnippetGen() {
- }
-
- /**
- * Returns the java file header comment.
- *
- * @return the java file header comment
- */
- public static String getFileHeaderComment() {
-
- /*
- * TODO return the file header.
- */
- return null;
- }
-
- /**
- * Returns the textual java code information corresponding to the import list.
- *
- * @param importInfo import info
- * @return the textual java code information corresponding to the import list
- */
- static String getImportText(JavaQualifiedTypeInfoTranslator importInfo) {
- return IMPORT + importInfo.getPkgInfo() + PERIOD + importInfo.getClassInfo() + SEMI_COLAN + NEW_LINE;
- }
-
- /**
- * Returns the textual java code for attribute definition in class.
- *
- * @param javaAttributeTypePkg Package of the attribute type
- * @param javaAttributeType java attribute type
- * @param javaAttributeName name of the attribute
- * @param isList is list attribute
- * @param attributeAccessType attribute access type
- * @return the textual java code for attribute definition in class
- */
- public static String getJavaAttributeDefinition(String javaAttributeTypePkg, String javaAttributeType,
- String javaAttributeName, boolean isList,
- String attributeAccessType) {
-
- String attributeDefinition = attributeAccessType + SPACE;
-
- if (!isList) {
- if (javaAttributeTypePkg != null) {
- attributeDefinition = attributeDefinition + javaAttributeTypePkg + PERIOD;
- }
-
- attributeDefinition = attributeDefinition + javaAttributeType + SPACE + javaAttributeName + SEMI_COLAN
- + NEW_LINE;
- } else {
- attributeDefinition = attributeDefinition + LIST + DIAMOND_OPEN_BRACKET;
- if (javaAttributeTypePkg != null) {
- attributeDefinition = attributeDefinition + javaAttributeTypePkg + PERIOD;
- }
-
- attributeDefinition = attributeDefinition + javaAttributeType + DIAMOND_CLOSE_BRACKET + SPACE
- + javaAttributeName + SPACE + EQUAL + SPACE + NEW + SPACE + ARRAY_LIST + SEMI_COLAN + NEW_LINE;
- }
- return attributeDefinition;
- }
-
- /**
- * Returns based on the file type and the YANG name of the file, generate the class / interface definition close.
- *
- * @return corresponding textual java code information
- */
- public static String getJavaClassDefClose() {
- return CLOSE_CURLY_BRACKET;
- }
-
- /**
- * Returns string for enum's attribute.
- *
- * @param name name of attribute
- * @param value value of the enum
- * @param pluginConfig plugin configurations
- * @return string for enum's attribute
- */
- public static String generateEnumAttributeString(String name, int value, YangPluginConfig pluginConfig) {
- return NEW_LINE + getJavaDoc(ENUM_ATTRIBUTE, name, false, pluginConfig)
- + EIGHT_SPACE_INDENTATION + getEnumJavaAttribute(name).toUpperCase() + OPEN_PARENTHESIS
- + value + CLOSE_PARENTHESIS + COMMA + NEW_LINE;
- }
-
- /**
- * Returns sorted import list.
- *
- * @param imports import list
- * @return sorted import list
- */
- public static List<String> sortImports(List<String> imports) {
- sort(imports);
- return imports;
- }
-
- /**
- * Returns event enum start.
- *
- * @return event enum start
- */
- static String getEventEnumTypeStart() {
- return FOUR_SPACE_INDENTATION + PUBLIC + SPACE + ENUM + SPACE + TYPE + SPACE + OPEN_CURLY_BRACKET
- + NEW_LINE;
- }
-
- /**
- * Adds listener's imports.
- *
- * @param curNode currentYangNode.
- * @param imports import list
- * @param operation add or remove
- * @param classInfo class info to be added to import list
- */
- public static void addListenersImport(YangNode curNode, List<String> imports, boolean operation,
- String classInfo) {
- String thisImport;
- TempJavaServiceFragmentFiles tempJavaServiceFragmentFiles = ((JavaCodeGeneratorInfo) curNode)
- .getTempJavaCodeFragmentFiles().getServiceTempFiles();
- if (classInfo.equals(LISTENER_SERVICE)) {
- thisImport = tempJavaServiceFragmentFiles.getJavaImportData().getListenerServiceImport();
- performOperationOnImports(imports, thisImport, operation);
- } else {
- thisImport = tempJavaServiceFragmentFiles.getJavaImportData().getListenerRegistryImport();
- performOperationOnImports(imports, thisImport, operation);
- }
- }
-
- /**
- * Performs given operations on import list.
- *
- * @param imports list of imports
- * @param curImport current import
- * @param operation add or remove
- * @return import list
- */
- private static List<String> performOperationOnImports(List<String> imports, String curImport,
- boolean operation) {
- if (operation) {
- imports.add(curImport);
- } else {
- imports.remove(curImport);
- }
- sortImports(imports);
- return imports;
- }
-
- /**
- * Returns integer attribute for enum's class to get the values.
- *
- * @param className enum's class name
- * @return enum's attribute
- */
- static String getEnumsValueAttribute(String className) {
- return NEW_LINE + FOUR_SPACE_INDENTATION + PRIVATE + SPACE + INT + SPACE + getSmallCase(className)
- + SEMI_COLAN + NEW_LINE;
- }
-
- /**
- * Returns attribute for augmentation.
- *
- * @return attribute for augmentation
- */
- static String addAugmentationAttribute() {
- return NEW_LINE + FOUR_SPACE_INDENTATION + PRIVATE + SPACE + MAP + DIAMOND_OPEN_BRACKET + CLASS_STRING
- + DIAMOND_OPEN_BRACKET + QUESTION_MARK + DIAMOND_CLOSE_BRACKET + COMMA + SPACE + OBJECT_STRING
- + DIAMOND_CLOSE_BRACKET + SPACE + getSmallCase(YANG_AUGMENTED_INFO) + MAP + SPACE + EQUAL + SPACE +
- NEW + SPACE + HASH_MAP + DIAMOND_OPEN_BRACKET + DIAMOND_CLOSE_BRACKET + OPEN_PARENTHESIS
- + CLOSE_PARENTHESIS + SEMI_COLAN;
- }
-
- /**
- * Adds attribute for int ranges.
- *
- * @param modifier modifier for attribute
- * @param addFirst true if int need to be added fist.
- * @return attribute for int ranges
- */
- static String addStaticAttributeIntRange(String modifier, boolean addFirst) {
- if (addFirst) {
- return NEW_LINE + FOUR_SPACE_INDENTATION + modifier + SPACE + INT_MIN_RANGE_ATTR + FOUR_SPACE_INDENTATION +
- modifier +
- SPACE + INT_MAX_RANGE_ATTR;
- } else {
- return NEW_LINE + FOUR_SPACE_INDENTATION + modifier + SPACE + UINT_MIN_RANGE_ATTR + FOUR_SPACE_INDENTATION +
- modifier + SPACE + UINT_MAX_RANGE_ATTR;
- }
- }
-
- /**
- * Adds attribute for long ranges.
- *
- * @param modifier modifier for attribute
- * @param addFirst if need to be added first
- * @return attribute for long ranges
- */
- static String addStaticAttributeLongRange(String modifier, boolean addFirst) {
- if (addFirst) {
- return NEW_LINE + FOUR_SPACE_INDENTATION + modifier + SPACE + LONG_MIN_RANGE_ATTR + FOUR_SPACE_INDENTATION +
- modifier + SPACE + LONG_MAX_RANGE_ATTR;
- } else {
- return NEW_LINE + FOUR_SPACE_INDENTATION + modifier + SPACE + ULONG_MIN_RANGE_ATTR +
- FOUR_SPACE_INDENTATION + modifier + SPACE + ULONG_MAX_RANGE_ATTR;
- }
- }
-
- /**
- * Returns operation type enum.
- *
- * @return operation type enum
- */
- static String getOperationTypeEnum() {
- return "\n" +
- " /**\n" +
- " * Specify the node specific operation in protocols like NETCONF.\n" +
- " * Applicable in protocol edit operation, not applicable in query operation\n" +
- " */\n" +
- " public enum OperationType {\n" +
- " MERGE,\n" +
- " REPLACE,\n" +
- " CREATE,\n" +
- " DELETE,\n" +
- " REMOVE\n" +
- " }\n";
- }
-
- /**
- * Returns operation type enum, leaf value set attribute and select leaf attribute.
- *
- * @return operation type enum, leaf value set attribute and select leaf attribute.
- */
- static String getOperationAttributes() {
- return " /**\n" +
- " * Identify the leafs whose value are explicitly set\n" +
- " * Applicable in protocol edit and query operation\n" +
- " */\n" +
- " private BitSet _valueLeafFlags = new BitSet();\n" +
- "\n" +
- " /**\n" +
- " * Identify the leafs to be selected, in a query operation\n" +
- " */\n" +
- " private BitSet _selectLeafFlags = new BitSet();\n";
- }
-
- /**
- * Returns operation type enum, leaf value set attribute and select leaf attribute.
- *
- * @return operation type enum, leaf value set attribute and select leaf attribute.
- */
- static String getOperationTypeAttr() {
- return "\n /**\n" +
- " * Specify the node specific operation in protocols like NETCONF.\n" +
- " * Applicable in protocol edit operation, will be ignored in query operation\n" +
- " */\n" +
- " private OperationType _operationType;\n" +
- "\n";
- }
-
- /**
- * Returns operation type enum, leaf value set attribute and select leaf attribute for constructor.
- *
- * @return operation type enum, leaf value set attribute and select leaf attribute for constructor
- */
- static String getOperationAttributeForConstructor() {
- return " this._valueLeafFlags = builderObject.get_valueLeafFlags();\n" +
- " this._selectLeafFlags = builderObject.get_selectLeafFlags();\n";
- }
-
- /**
- * Returns operation type enum, leaf value set attribute and select leaf attribute for constructor.
- *
- * @return operation type enum, leaf value set attribute and select leaf attribute for constructor
- */
- static String getOperationTypeForConstructor() {
- return " this._operationType = builderObject.get_operationType();\n";
- }
-
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaExtendsListHolder.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaExtendsListHolder.java
deleted file mode 100644
index 65983e4..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaExtendsListHolder.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * 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.translator.tojava.utils;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfoContainer;
-import org.onosproject.yangutils.translator.tojava.JavaImportData;
-import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator;
-import org.onosproject.yangutils.translator.tojava.TempJavaFragmentFiles;
-
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase;
-
-/**
- * Represent the extends list for generated java classes. It holds the class details which needs to be extended by the
- * generated java code.
- */
-public class JavaExtendsListHolder {
-
- private Map<JavaQualifiedTypeInfoTranslator, Boolean> extendedClassStore;
- private List<JavaQualifiedTypeInfoTranslator> extendsList;
-
- /**
- * Creates an instance of JavaExtendsListHolder.
- */
- public JavaExtendsListHolder() {
- setExtendedClassStore(new HashMap<>());
- setExtendsList(new ArrayList<>());
- }
-
- /**
- * Returns extends list.
- *
- * @return extends list
- */
- Map<JavaQualifiedTypeInfoTranslator, Boolean> getExtendedClassStore() {
- return extendedClassStore;
- }
-
- /**
- * Sets extends list.
- *
- * @param extendedClass map of classes need to be extended
- */
- private void setExtendedClassStore(Map<JavaQualifiedTypeInfoTranslator, Boolean> extendedClass) {
- extendedClassStore = extendedClass;
- }
-
- /**
- * Adds to the extends list.
- *
- * @param info java file info
- * @param node YANG node
- * @param tempJavaFragmentFiles temp java fragment files
- */
- public void addToExtendsList(JavaQualifiedTypeInfoTranslator info, YangNode node,
- TempJavaFragmentFiles tempJavaFragmentFiles) {
- JavaFileInfo fileInfo = ((JavaFileInfoContainer) node).getJavaFileInfo();
-
- JavaImportData importData = tempJavaFragmentFiles.getJavaImportData();
- boolean qualified = importData.addImportInfo(info,
- getCapitalCase(fileInfo.getJavaName()), fileInfo.getPackage());
-
- /*true means import should be added*/
- getExtendedClassStore().put(info, qualified);
-
- addToExtendsList(info);
- }
-
- /**
- * Returns extends list.
- *
- * @return the extendsList
- */
- public List<JavaQualifiedTypeInfoTranslator> getExtendsList() {
- return extendsList;
- }
-
- /**
- * Sets extends info list.
- *
- * @param classInfoList the extends List to set
- */
- private void setExtendsList(List<JavaQualifiedTypeInfoTranslator> classInfoList) {
- extendsList = classInfoList;
- }
-
- /**
- * Adds extends info to list.
- *
- * @param classInfo class info
- */
- private void addToExtendsList(JavaQualifiedTypeInfoTranslator classInfo) {
- getExtendsList().add(classInfo);
- }
-
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaFileGenerator.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaFileGenerator.java
deleted file mode 100644
index 434e09f..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaFileGenerator.java
+++ /dev/null
@@ -1,1091 +0,0 @@
-/*
- * 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.translator.tojava.utils;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.onosproject.yangutils.datamodel.YangAugmentableNode;
-import org.onosproject.yangutils.datamodel.YangChoice;
-import org.onosproject.yangutils.datamodel.YangDerivedInfo;
-import org.onosproject.yangutils.datamodel.YangLeavesHolder;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.datamodel.YangTypeDef;
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.translator.tojava.JavaAttributeInfo;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfoContainer;
-import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator;
-import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFilesContainer;
-import org.onosproject.yangutils.translator.tojava.TempJavaEnumerationFragmentFiles;
-import org.onosproject.yangutils.translator.tojava.TempJavaEventFragmentFiles;
-import org.onosproject.yangutils.translator.tojava.TempJavaServiceFragmentFiles;
-import org.onosproject.yangutils.translator.tojava.TempJavaTypeFragmentFiles;
-
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.BINARY;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.BITS;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.BUILDER_CLASS_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.BUILDER_INTERFACE_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.DEFAULT_CLASS_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_ENUM_CLASS;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_CLASS;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_LISTENER_INTERFACE;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_SUBJECT_CLASS;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_SERVICE_AND_MANAGER;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_TYPEDEF_CLASS;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_UNION_CLASS;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.INTERFACE_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.ADD_TO_LIST_IMPL_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.ADD_TO_LIST_INTERFACE_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.ATTRIBUTES_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.CONSTRUCTOR_FOR_TYPE_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.CONSTRUCTOR_IMPL_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.ENUM_IMPL_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.EQUALS_IMPL_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.EVENT_ENUM_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.EVENT_METHOD_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.EVENT_SUBJECT_ATTRIBUTE_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.EVENT_SUBJECT_GETTER_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.EVENT_SUBJECT_SETTER_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.FROM_STRING_IMPL_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.GETTER_FOR_CLASS_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.GETTER_FOR_INTERFACE_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.HASH_CODE_IMPL_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.LEAF_IDENTIFIER_ENUM_ATTRIBUTES_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.OF_STRING_IMPL_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.RPC_INTERFACE_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.SETTER_FOR_CLASS_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.SETTER_FOR_INTERFACE_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.TO_STRING_IMPL_MASK;
-import static org.onosproject.yangutils.translator.tojava.JavaAttributeInfo.getAttributeInfoForTheData;
-import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator.getQualifiedTypeInfoOfCurNode;
-import static org.onosproject.yangutils.translator.tojava.TempJavaFragmentFiles.getCurNodeAsAttributeInTarget;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaCodeSnippetGen.getEnumsValueAttribute;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaCodeSnippetGen.getEventEnumTypeStart;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaCodeSnippetGen.getOperationAttributeForConstructor;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaCodeSnippetGen.getOperationAttributes;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaCodeSnippetGen.getOperationTypeAttr;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaCodeSnippetGen.getOperationTypeEnum;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaCodeSnippetGen.getOperationTypeForConstructor;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGeneratorUtils.getDataFromTempFileHandle;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGeneratorUtils.initiateJavaFileGeneration;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.builderMethod;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getAddAugmentInfoMethodImpl;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getAddAugmentInfoMethodInterface;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getAugmentsDataMethodForService;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getConstructorStart;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getEnumsConstructor;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getEnumsOfMethod;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getEqualsMethodClose;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getEqualsMethodOpen;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getFromStringMethodClose;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getFromStringMethodSignature;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getGetter;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getGetterForOperationType;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getGetterString;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getGettersForValueAndSelectLeaf;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getHashCodeMethodClose;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getHashCodeMethodOpen;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getInterfaceLeafIdEnumMethods;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getInterfaceLeafIdEnumSignature;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getIsFilterContentMatch;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getOmitNullValueString;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getOperationAttributesGetters;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getOverRideString;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getRangeValidatorMethodForUnion;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getSetterForOperationType;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getSetterForSelectLeaf;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getSetterString;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getToStringMethodClose;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getToStringMethodOpen;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getYangAugmentInfoImpl;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getYangAugmentInfoInterface;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getYangAugmentInfoMapImpl;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getYangAugmentInfoMapInterface;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.isFilterContentMatchInterface;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.isLeafValueSetInterface;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.isSelectLeafSetInterface;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.setSelectLeafSetInterface;
-import static org.onosproject.yangutils.utils.UtilConstants.BASE64;
-import static org.onosproject.yangutils.utils.UtilConstants.BIG_INTEGER;
-import static org.onosproject.yangutils.utils.UtilConstants.BUILDER;
-import static org.onosproject.yangutils.utils.UtilConstants.CLOSE_CURLY_BRACKET;
-import static org.onosproject.yangutils.utils.UtilConstants.CLOSE_PARENTHESIS;
-import static org.onosproject.yangutils.utils.UtilConstants.COMMA;
-import static org.onosproject.yangutils.utils.UtilConstants.DEFAULT;
-import static org.onosproject.yangutils.utils.UtilConstants.EIGHT_SPACE_INDENTATION;
-import static org.onosproject.yangutils.utils.UtilConstants.EMPTY_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.ENCODE_TO_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.EVENT_LISTENER_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.EVENT_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.EVENT_SUBJECT_NAME_SUFFIX;
-import static org.onosproject.yangutils.utils.UtilConstants.FOUR_SPACE_INDENTATION;
-import static org.onosproject.yangutils.utils.UtilConstants.GET_ENCODER;
-import static org.onosproject.yangutils.utils.UtilConstants.IMPORT;
-import static org.onosproject.yangutils.utils.UtilConstants.INT;
-import static org.onosproject.yangutils.utils.UtilConstants.JAVA_UTIL_IMPORT_BASE64_CLASS;
-import static org.onosproject.yangutils.utils.UtilConstants.JAVA_UTIL_OBJECTS_IMPORT_PKG;
-import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE;
-import static org.onosproject.yangutils.utils.UtilConstants.OPEN_CURLY_BRACKET;
-import static org.onosproject.yangutils.utils.UtilConstants.OPEN_PARENTHESIS;
-import static org.onosproject.yangutils.utils.UtilConstants.OP_PARAM;
-import static org.onosproject.yangutils.utils.UtilConstants.PERIOD;
-import static org.onosproject.yangutils.utils.UtilConstants.PRIVATE;
-import static org.onosproject.yangutils.utils.UtilConstants.PUBLIC;
-import static org.onosproject.yangutils.utils.UtilConstants.RETURN;
-import static org.onosproject.yangutils.utils.UtilConstants.SEMI_COLAN;
-import static org.onosproject.yangutils.utils.UtilConstants.SERVICE_METHOD_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.SPACE;
-import static org.onosproject.yangutils.utils.UtilConstants.STRING_DATA_TYPE;
-import static org.onosproject.yangutils.utils.UtilConstants.TO;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.GETTER_METHOD;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.TYPE_CONSTRUCTOR;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.getJavaDoc;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.insertDataIntoJavaFile;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.trimAtLast;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.validateLineLength;
-import static java.util.Collections.sort;
-
-/**
- * Representation of java file generator.
- */
-public final class JavaFileGenerator {
-
- private JavaFileGenerator() {
- }
-
- /**
- * Returns generated interface file for current node.
- *
- * @param file file
- * @param imports imports for the file
- * @param curNode current YANG node
- * @param isAttrPresent if any attribute is present or not
- * @return interface file
- * @throws IOException when fails to write in file
- */
- public static File generateInterfaceFile(File file, List<String> imports, YangNode curNode,
- boolean isAttrPresent)
- throws IOException {
-
- JavaFileInfo javaFileInfo = ((JavaFileInfoContainer) curNode).getJavaFileInfo();
-
- String path;
- if (curNode instanceof YangModule || curNode instanceof YangSubModule) {
- path = javaFileInfo.getPluginConfig().getCodeGenDir() + javaFileInfo.getPackageFilePath();
- } else {
- path = javaFileInfo.getBaseCodeGenPath() + javaFileInfo.getPackageFilePath();
- }
-
- String className = getCapitalCase(javaFileInfo.getJavaName());
-
- boolean isLeavesPresent;
- YangLeavesHolder leavesHolder;
- if (curNode instanceof YangLeavesHolder) {
- leavesHolder = (YangLeavesHolder) curNode;
- isLeavesPresent = leavesHolder.getListOfLeaf() != null && !leavesHolder.getListOfLeaf().isEmpty()
- || leavesHolder.getListOfLeafList() != null && !leavesHolder.getListOfLeafList().isEmpty();
- } else {
- isLeavesPresent = false;
- }
-
- initiateJavaFileGeneration(file, INTERFACE_MASK, imports, curNode, className);
- List<String> methods = new ArrayList<>();
- if (isAttrPresent) {
- // Add getter methods to interface file.
- try {
- //Leaf identifier enum.
- if (isLeavesPresent) {
- insertDataIntoJavaFile(file, NEW_LINE + getInterfaceLeafIdEnumSignature(className) + NEW_LINE +
- trimAtLast(trimAtLast(
- getDataFromTempFileHandle(LEAF_IDENTIFIER_ENUM_ATTRIBUTES_MASK,
- ((TempJavaCodeFragmentFilesContainer) curNode)
- .getTempJavaCodeFragmentFiles()
- .getBeanTempFiles(), path), COMMA), NEW_LINE) + SEMI_COLAN
- + NEW_LINE + NEW_LINE + getInterfaceLeafIdEnumMethods());
- }
-
- //Getter methods.
- insertDataIntoJavaFile(file, getDataFromTempFileHandle(GETTER_FOR_INTERFACE_MASK,
- ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
- .getBeanTempFiles(), path));
- //Add to list method.
- insertDataIntoJavaFile(file, getDataFromTempFileHandle(ADD_TO_LIST_INTERFACE_MASK,
- ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
- .getBeanTempFiles(), path));
- } catch (IOException e) {
- throw new IOException("No data found in temporary java code fragment files for " + className
- + " while interface file generation");
- }
- }
-
- if (curNode instanceof YangAugmentableNode && !(curNode instanceof YangChoice)) {
- methods.add(getAddAugmentInfoMethodInterface());
- methods.add(getYangAugmentInfoInterface());
- methods.add(getYangAugmentInfoMapInterface(javaFileInfo.getPluginConfig()));
- }
- if (!(curNode instanceof YangChoice)) {
- methods.add(NEW_LINE + isFilterContentMatchInterface(className));
- }
- if (!(curNode instanceof YangChoice) && isLeavesPresent) {
- methods.add(NEW_LINE + isLeafValueSetInterface());
- methods.add(NEW_LINE + isSelectLeafSetInterface());
- }
- for (String method : methods) {
- insertDataIntoJavaFile(file, method);
- }
- return validateLineLength(file);
-
- }
-
- /**
- * Returns generated builder interface file for current node.
- *
- * @param file file
- * @param curNode current YANG node
- * @param isAttrPresent if any attribute is present or not
- * @return builder interface file
- * @throws IOException when fails to write in file
- */
- public static File generateBuilderInterfaceFile(File file, YangNode curNode, boolean isAttrPresent)
- throws IOException {
-
- JavaFileInfo javaFileInfo = ((JavaFileInfoContainer) curNode).getJavaFileInfo();
- YangPluginConfig pluginConfig = javaFileInfo.getPluginConfig();
-
- boolean isLeavesPresent;
- YangLeavesHolder leavesHolder;
- if (curNode instanceof YangLeavesHolder) {
- leavesHolder = (YangLeavesHolder) curNode;
- isLeavesPresent = leavesHolder.getListOfLeaf() != null && !leavesHolder.getListOfLeaf().isEmpty()
- || leavesHolder.getListOfLeafList() != null && !leavesHolder.getListOfLeafList().isEmpty();
- } else {
- isLeavesPresent = false;
- }
-
- String className = getCapitalCase(javaFileInfo.getJavaName());
- String path;
- if (curNode instanceof YangModule || curNode instanceof YangSubModule) {
- path = javaFileInfo.getPluginConfig().getCodeGenDir() + javaFileInfo.getPackageFilePath();
- } else {
- path = javaFileInfo.getBaseCodeGenPath() + javaFileInfo.getPackageFilePath();
- }
-
- initiateJavaFileGeneration(file, BUILDER_INTERFACE_MASK, null, curNode, className);
- List<String> methods = new ArrayList<>();
- if (isAttrPresent) {
- try {
-
- //Getter methods.
- methods.add(FOUR_SPACE_INDENTATION + getDataFromTempFileHandle(GETTER_FOR_INTERFACE_MASK,
- ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
- .getBeanTempFiles(), path));
-
- //Setter methods.
- methods.add(NEW_LINE);
- methods.add(FOUR_SPACE_INDENTATION + getDataFromTempFileHandle(SETTER_FOR_INTERFACE_MASK,
- ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
- .getBeanTempFiles(), path));
- } catch (IOException e) {
- throw new IOException("No data found in temporary java code fragment files for " + className
- + " while builder interface file generation");
- }
- }
-
- if (isLeavesPresent) {
- methods.add(NEW_LINE + setSelectLeafSetInterface(className));
- }
- //Add build method to builder interface file.
- methods.add(
- ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
- .addBuildMethodForInterface(pluginConfig));
-
-
- //Add getters and setters in builder interface.
- for (String method : methods) {
- insertDataIntoJavaFile(file, method);
- }
-
- insertDataIntoJavaFile(file, CLOSE_CURLY_BRACKET + NEW_LINE);
- return validateLineLength(file);
- }
-
- /**
- * Returns generated builder class file for current node.
- *
- * @param file file
- * @param curNode current YANG node
- * @param isAttrPresent if any attribute is present or not
- * @return builder class file
- * @throws IOException when fails to write in file
- */
-
- public static File generateBuilderClassFile(File file, YangNode curNode,
- boolean isAttrPresent) throws IOException {
-
- JavaFileInfo javaFileInfo = ((JavaFileInfoContainer) curNode).getJavaFileInfo();
- YangPluginConfig pluginConfig = javaFileInfo.getPluginConfig();
-
- boolean isLeavesPresent;
- YangLeavesHolder leavesHolder;
- if (curNode instanceof YangLeavesHolder) {
- leavesHolder = (YangLeavesHolder) curNode;
- isLeavesPresent = leavesHolder.getListOfLeaf() != null && !leavesHolder.getListOfLeaf().isEmpty()
- || leavesHolder.getListOfLeafList() != null && !leavesHolder.getListOfLeafList().isEmpty();
- } else {
- isLeavesPresent = false;
- }
-
- String className = getCapitalCase(javaFileInfo.getJavaName());
- boolean isRootNode = false;
- String path;
- if (curNode instanceof YangModule || curNode instanceof YangSubModule) {
- isRootNode = true;
- path = javaFileInfo.getPluginConfig().getCodeGenDir() + javaFileInfo.getPackageFilePath();
- } else {
- path = javaFileInfo.getBaseCodeGenPath() + javaFileInfo.getPackageFilePath();
- }
-
- initiateJavaFileGeneration(file, BUILDER_CLASS_MASK, null, curNode, className);
- List<String> methods = new ArrayList<>();
-
- if (isAttrPresent) {
-
- //Add attribute strings.
- try {
- insertDataIntoJavaFile(file,
- NEW_LINE + FOUR_SPACE_INDENTATION + getDataFromTempFileHandle(ATTRIBUTES_MASK,
- ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
- .getBeanTempFiles(), path));
- } catch (IOException e) {
- throw new IOException("No data found in temporary java code fragment files for " + className
- + " while builder class file generation");
- }
-
- insertDataIntoJavaFile(file, getOperationTypeAttr());
- if (isLeavesPresent) {
- insertDataIntoJavaFile(file, getOperationAttributes());
- }
- try {
- //Getter methods.
- methods.add(getDataFromTempFileHandle(GETTER_FOR_CLASS_MASK,
- ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
- .getBeanTempFiles(), path));
- // Setter methods.
- methods.add(getDataFromTempFileHandle(SETTER_FOR_CLASS_MASK,
- ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
- .getBeanTempFiles(), path));
-
- insertDataIntoJavaFile(file, NEW_LINE);
-
- methods.add(getGetterForOperationType());
- methods.add(getSetterForOperationType(className));
- //Add operation attribute methods.
- if (isLeavesPresent) {
- methods.add(getOperationAttributesGetters() + NEW_LINE);
- methods.add(getSetterForSelectLeaf(className, isRootNode));
- }
- } catch (IOException e) {
- throw new IOException("No data found in temporary java code fragment files for " + className
- + " while builder class file generation");
- }
- } else {
- insertDataIntoJavaFile(file, NEW_LINE);
- }
-
- // Add default constructor and build method impl.
- methods.add(((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
- .addBuildMethodImpl(curNode));
- methods.add(((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
- .addDefaultConstructor(PUBLIC, BUILDER, pluginConfig, curNode));
-
-
- //Add methods in builder class.
- for (String method : methods) {
- insertDataIntoJavaFile(file, method);
- }
-
- insertDataIntoJavaFile(file, CLOSE_CURLY_BRACKET);
- return validateLineLength(file);
- }
-
- /**
- * Returns generated default class file for current node.
- *
- * @param file file
- * @param curNode current YANG node
- * @param isAttrPresent if any attribute is present or not
- * @param imports list of imports
- * @return impl class file
- * @throws IOException when fails to write in file
- */
- public static File generateDefaultClassFile(File file, YangNode curNode, boolean isAttrPresent,
- List<String> imports)
- throws IOException {
-
- JavaFileInfo javaFileInfo = ((JavaFileInfoContainer) curNode).getJavaFileInfo();
- YangPluginConfig pluginConfig = javaFileInfo.getPluginConfig();
-
- boolean isLeavesPresent;
- YangLeavesHolder leavesHolder;
- if (curNode instanceof YangLeavesHolder) {
- leavesHolder = (YangLeavesHolder) curNode;
- isLeavesPresent = leavesHolder.getListOfLeaf() != null && !leavesHolder.getListOfLeaf().isEmpty()
- || leavesHolder.getListOfLeafList() != null && !leavesHolder.getListOfLeafList().isEmpty();
- } else {
- isLeavesPresent = false;
- }
-
- boolean isRootNode = false;
-
- String className = getCapitalCase(javaFileInfo.getJavaName());
- String opParamClassName = className;
- String path;
- if (curNode instanceof YangModule || curNode instanceof YangSubModule) {
- opParamClassName = className + OP_PARAM;
- isRootNode = true;
- path = javaFileInfo.getPluginConfig().getCodeGenDir() + javaFileInfo.getPackageFilePath();
- } else {
- path = javaFileInfo.getBaseCodeGenPath() + javaFileInfo.getPackageFilePath();
- }
-
- initiateJavaFileGeneration(file, DEFAULT_CLASS_MASK, imports, curNode, className);
-
- List<String> methods = new ArrayList<>();
- if (curNode instanceof YangAugmentableNode) {
- insertDataIntoJavaFile(file, JavaCodeSnippetGen.addAugmentationAttribute());
- }
- if (isAttrPresent) {
-
- //Add attribute strings.
- try {
- insertDataIntoJavaFile(file,
- NEW_LINE + FOUR_SPACE_INDENTATION + getDataFromTempFileHandle(ATTRIBUTES_MASK,
- ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
- .getBeanTempFiles(), path));
- } catch (IOException e) {
- throw new IOException("No data found in temporary java code fragment files for " + className
- + " while impl class file generation");
- }
-
- //Add operation attributes
- insertDataIntoJavaFile(file, getOperationTypeEnum());
- insertDataIntoJavaFile(file, getOperationTypeAttr());
- if (isLeavesPresent) {
- insertDataIntoJavaFile(file, getOperationAttributes());
- }
-
- try {
- //Getter methods.
- methods.add(getDataFromTempFileHandle(GETTER_FOR_CLASS_MASK,
- ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
- .getBeanTempFiles(), path));
-
- //Add to list impl method.
- methods.add(getDataFromTempFileHandle(ADD_TO_LIST_IMPL_MASK,
- ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
- .getBeanTempFiles(), path));
-
- // Hash code method.
- methods.add(getHashCodeMethodClose(getHashCodeMethodOpen() +
- getDataFromTempFileHandle(HASH_CODE_IMPL_MASK,
- ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
- .getBeanTempFiles(), path).replace(NEW_LINE, EMPTY_STRING)));
-
- //Equals method.
- if (isRootNode) {
- methods.add(getEqualsMethodClose(getEqualsMethodOpen(opParamClassName)
- + getDataFromTempFileHandle(EQUALS_IMPL_MASK,
- ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
- .getBeanTempFiles(), path)));
- } else {
- methods.add(getEqualsMethodClose(getEqualsMethodOpen(getCapitalCase(DEFAULT) + className)
- + getDataFromTempFileHandle(EQUALS_IMPL_MASK,
- ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
- .getBeanTempFiles(), path)));
- }
- // To string method.
- methods.add(getToStringMethodOpen() + getDataFromTempFileHandle(TO_STRING_IMPL_MASK,
- ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
- .getBeanTempFiles(), path)
- + getToStringMethodClose());
-
- } catch (IOException e) {
- throw new IOException("No data found in temporary java code fragment files for " + className
- + " while impl class file generation");
- }
- } else {
- insertDataIntoJavaFile(file, NEW_LINE);
- }
-
- if (curNode instanceof YangAugmentableNode) {
- methods.add(getAddAugmentInfoMethodImpl());
- methods.add(getYangAugmentInfoImpl());
- methods.add(getYangAugmentInfoMapImpl());
- }
- try {
- //Constructor.
- String constructor = getConstructorStart(className, pluginConfig, isRootNode);
- constructor = constructor + getDataFromTempFileHandle(CONSTRUCTOR_IMPL_MASK,
- ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
- .getBeanTempFiles(), path);
-
- if (isAttrPresent) {
- constructor = constructor + getOperationTypeForConstructor();
- }
- if (isLeavesPresent) {
- constructor = constructor + getOperationAttributeForConstructor();
- }
- methods.add(constructor + FOUR_SPACE_INDENTATION + CLOSE_CURLY_BRACKET + NEW_LINE);
- } catch (IOException e) {
- throw new IOException("No data found in temporary java code fragment files for " + className
- + " while impl class file generation");
- }
-
- methods.add(((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
- .addDefaultConstructor(PUBLIC, DEFAULT, pluginConfig, curNode));
-
- methods.add(builderMethod(className));
- methods.add(getIsFilterContentMatch(curNode, pluginConfig));
- if (isLeavesPresent) {
- methods.add(getOperationAttributesGetters());
- methods.add(getGettersForValueAndSelectLeaf());
- }
- // Add methods in impl class.
- for (String method : methods) {
- insertDataIntoJavaFile(file, method);
- }
-
- return validateLineLength(file);
- }
-
- /**
- * Generates class file for type def.
- *
- * @param file generated file
- * @param curNode current YANG node
- * @param imports imports for file
- * @return type def class file
- * @throws IOException when fails to generate class file
- */
- public static File generateTypeDefClassFile(File file, YangNode curNode, List<String> imports)
- throws IOException {
-
- JavaFileInfo javaFileInfo = ((JavaFileInfoContainer) curNode).getJavaFileInfo();
- YangPluginConfig pluginConfig = javaFileInfo.getPluginConfig();
-
- // import
- String className = getCapitalCase(javaFileInfo.getJavaName());
- String path = javaFileInfo.getBaseCodeGenPath() + javaFileInfo.getPackageFilePath();
- YangTypeDef typeDef = (YangTypeDef) curNode;
- List<YangType<?>> types = typeDef.getTypeList();
- YangType type = types.get(0);
- YangDataTypes yangDataTypes = type.getDataType();
- if (type.getDataType().equals(BINARY)) {
- imports.add(IMPORT + JAVA_UTIL_OBJECTS_IMPORT_PKG + PERIOD + JAVA_UTIL_IMPORT_BASE64_CLASS);
- }
-
- initiateJavaFileGeneration(file, className, GENERATE_TYPEDEF_CLASS, imports, path, pluginConfig);
-
- List<String> methods = new ArrayList<>();
-
-
- //Add attribute strings.
- try {
- insertDataIntoJavaFile(file,
- NEW_LINE + FOUR_SPACE_INDENTATION + getDataFromTempFileHandle(ATTRIBUTES_MASK,
- ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
- .getTypeTempFiles(), path));
- } catch (IOException e) {
- throw new IOException("No data found in temporary java code fragment files for " + className
- + " while type def class file generation");
- }
-
-
- //Default constructor.
- methods.add(((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
- .addDefaultConstructor(PRIVATE, EMPTY_STRING, pluginConfig, curNode));
-
- try {
-
- //Type constructor.
- methods.add(getDataFromTempFileHandle(CONSTRUCTOR_FOR_TYPE_MASK,
- ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles().getTypeTempFiles(),
- path));
-
-
- //Of method.
- methods.add(getDataFromTempFileHandle(OF_STRING_IMPL_MASK,
- ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles().getTypeTempFiles(),
- path));
-
- //Getter methods.
- methods.add(getDataFromTempFileHandle(GETTER_FOR_CLASS_MASK,
- ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles().getTypeTempFiles(),
- path));
-
-
- // Hash code method.
- methods.add(getHashCodeMethodClose(getHashCodeMethodOpen() +
- getDataFromTempFileHandle(HASH_CODE_IMPL_MASK,
- ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
- .getTypeTempFiles(), path)
- .replace(NEW_LINE, EMPTY_STRING)));
-
-
- //Equals method.
- methods.add(getEqualsMethodClose(getEqualsMethodOpen(className + EMPTY_STRING)
- + getDataFromTempFileHandle(EQUALS_IMPL_MASK,
- ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
- .getTypeTempFiles(), path)));
-
-
- //To string method.
- if (type.getDataType().equals(BINARY)) {
- JavaQualifiedTypeInfoTranslator qualifiedTypeInfo = getQualifiedTypeInfoOfCurNode(curNode,
- getCapitalCase("binary"));
-
- JavaAttributeInfo attr = getAttributeInfoForTheData(qualifiedTypeInfo, "binary", null, false,
- false);
- String attributeName = attr.getAttributeName();
- String bitsToStringMethod = getOverRideString() + FOUR_SPACE_INDENTATION + PUBLIC
- + SPACE + STRING_DATA_TYPE + SPACE + TO + STRING_DATA_TYPE + OPEN_PARENTHESIS
- + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE + EIGHT_SPACE_INDENTATION
- + RETURN + SPACE + BASE64 + PERIOD + GET_ENCODER + OPEN_PARENTHESIS + CLOSE_PARENTHESIS
- + PERIOD + ENCODE_TO_STRING + OPEN_PARENTHESIS + attributeName + CLOSE_PARENTHESIS
- + SEMI_COLAN + NEW_LINE + FOUR_SPACE_INDENTATION + CLOSE_CURLY_BRACKET + NEW_LINE;
- methods.add(bitsToStringMethod);
- } else if (type.getDataType().equals(BITS)) {
- JavaQualifiedTypeInfoTranslator qualifiedTypeInfo = getQualifiedTypeInfoOfCurNode(curNode,
- getCapitalCase("bits"));
-
- JavaAttributeInfo attr = getAttributeInfoForTheData(qualifiedTypeInfo, "bits", null, false, false);
- String attributeName = attr.getAttributeName();
- String bitsToStringMethod = getOverRideString() + FOUR_SPACE_INDENTATION + PUBLIC
- + SPACE + STRING_DATA_TYPE + SPACE + TO + STRING_DATA_TYPE + OPEN_PARENTHESIS
- + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE + EIGHT_SPACE_INDENTATION
- + RETURN + SPACE + attributeName + PERIOD + TO + STRING_DATA_TYPE + OPEN_PARENTHESIS
- + CLOSE_PARENTHESIS + SEMI_COLAN + NEW_LINE + FOUR_SPACE_INDENTATION + CLOSE_CURLY_BRACKET
- + NEW_LINE;
- methods.add(bitsToStringMethod);
- } else {
- methods.add(getToStringMethodOpen() + getDataFromTempFileHandle(TO_STRING_IMPL_MASK,
- ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
- .getTypeTempFiles(), path) + getToStringMethodClose());
- }
-
- JavaCodeGeneratorInfo javaGenInfo = (JavaCodeGeneratorInfo) curNode;
-
- //From string method.
- if ((type.getDataType().equals(YangDataTypes.DERIVED))
- && (((YangDerivedInfo) type.getDataTypeExtendedInfo()).getEffectiveBuiltInType()
- .equals(YangDataTypes.IDENTITYREF))) {
- yangDataTypes = YangDataTypes.IDENTITYREF;
- }
-
- if (type.getDataType().equals(YangDataTypes.IDENTITYREF)) {
- yangDataTypes = YangDataTypes.IDENTITYREF;
- }
-
- if (!yangDataTypes.equals(YangDataTypes.IDENTITYREF)) {
- methods.add(getFromStringMethodSignature(className, pluginConfig)
- + getDataFromTempFileHandle(FROM_STRING_IMPL_MASK, javaGenInfo.getTempJavaCodeFragmentFiles()
- .getTypeTempFiles(), path)
- + getFromStringMethodClose());
- }
-
- } catch (IOException e) {
- throw new IOException("No data found in temporary java code fragment files for " + className
- + " while type def class file generation");
- }
-
- for (String method : methods) {
- insertDataIntoJavaFile(file, method);
- }
- insertDataIntoJavaFile(file, CLOSE_CURLY_BRACKET + NEW_LINE);
-
- return validateLineLength(file);
- }
-
- /**
- * Generates class file for union type.
- *
- * @param file generated file
- * @param curNode current YANG node
- * @param imports imports for file
- * @return type def class file
- * @throws IOException when fails to generate class file
- */
- public static File generateUnionClassFile(File file, YangNode curNode, List<String> imports)
- throws IOException {
-
- JavaFileInfo javaFileInfo = ((JavaFileInfoContainer) curNode).getJavaFileInfo();
- YangPluginConfig pluginConfig = javaFileInfo.getPluginConfig();
-
- String className = getCapitalCase(javaFileInfo.getJavaName());
- String path = javaFileInfo.getBaseCodeGenPath() + javaFileInfo.getPackageFilePath();
-
- TempJavaTypeFragmentFiles tempJavaTypeFragmentFiles = ((JavaCodeGeneratorInfo) curNode)
- .getTempJavaCodeFragmentFiles().getTypeTempFiles();
-
- boolean isIntConflict = false;
- boolean isLongConflict = false;
- JavaAttributeInfo intAttr = tempJavaTypeFragmentFiles.getIntAttribute();
- if (intAttr == null) {
- intAttr = tempJavaTypeFragmentFiles.getUIntAttribute();
- }
-
- JavaAttributeInfo longAttr = tempJavaTypeFragmentFiles.getLongAttribute();
- if (longAttr == null) {
- longAttr = tempJavaTypeFragmentFiles.getULongAttribute();
- }
-
- if (intAttr != null) {
- isIntConflict = intAttr.isIntConflict();
- }
- if (longAttr != null) {
- isLongConflict = longAttr.isLongConflict();
- }
-
- if (isLongConflict) {
- imports.add(tempJavaTypeFragmentFiles.getJavaImportData().getBigIntegerImport());
- sort(imports);
- }
-
- initiateJavaFileGeneration(file, className, GENERATE_UNION_CLASS, imports, path, pluginConfig);
-
- List<String> methods = new ArrayList<>();
-
-
- // Add attribute strings.
- try {
- if (isIntConflict) {
- insertDataIntoJavaFile(file, JavaCodeSnippetGen.addStaticAttributeIntRange(PRIVATE,
- tempJavaTypeFragmentFiles.getIntIndex() < tempJavaTypeFragmentFiles.getUIntIndex()));
- }
-
- if (isLongConflict) {
- insertDataIntoJavaFile(file, JavaCodeSnippetGen.addStaticAttributeLongRange(PRIVATE,
- tempJavaTypeFragmentFiles.getLongIndex() < tempJavaTypeFragmentFiles.getULongIndex()));
- }
-
- insertDataIntoJavaFile(file,
- NEW_LINE + FOUR_SPACE_INDENTATION + getDataFromTempFileHandle(ATTRIBUTES_MASK,
- ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
- .getTypeTempFiles(), path));
- } catch (IOException e) {
- throw new IOException("No data found in temporary java code fragment files for " + className
- + " while union class file generation");
- }
-
-
- //Default constructor.
- methods.add(((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
- .addDefaultConstructor(PRIVATE, EMPTY_STRING, pluginConfig, curNode));
-
- try {
-
-
- //Type constructor.
- methods.add(getDataFromTempFileHandle(CONSTRUCTOR_FOR_TYPE_MASK,
- ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles().getTypeTempFiles(),
- path));
-
-
- // Of string method.
- methods.add(getDataFromTempFileHandle(OF_STRING_IMPL_MASK,
- ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles().getTypeTempFiles(),
- path));
-
- //Getter methods.
- methods.add(getDataFromTempFileHandle(GETTER_FOR_CLASS_MASK,
- ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles().getTypeTempFiles(),
- path));
-
-
- //Hash code method.
- methods.add(getHashCodeMethodClose(getHashCodeMethodOpen() +
- getDataFromTempFileHandle(HASH_CODE_IMPL_MASK,
- ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
- .getTypeTempFiles(), path)
- .replace(NEW_LINE, EMPTY_STRING)));
-
- //Equals method.
- methods.add(getEqualsMethodClose(getEqualsMethodOpen(className + EMPTY_STRING)
- + getDataFromTempFileHandle(EQUALS_IMPL_MASK,
- ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
- .getTypeTempFiles(), path)));
-
-
- //To string method.
- methods.add(getToStringMethodOpen() + getOmitNullValueString() +
- getDataFromTempFileHandle(TO_STRING_IMPL_MASK,
- ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
- .getTypeTempFiles(), path)
- + getToStringMethodClose());
-
-
- //From string method.
- methods.add(getFromStringMethodSignature(className, pluginConfig)
- + getDataFromTempFileHandle(FROM_STRING_IMPL_MASK,
- ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
- .getTypeTempFiles(), path)
- + getFromStringMethodClose());
-
- if (isIntConflict) {
- methods.add(getRangeValidatorMethodForUnion(INT));
- }
- if (isLongConflict) {
- methods.add(getRangeValidatorMethodForUnion(BIG_INTEGER));
- }
-
- } catch (IOException e) {
- throw new IOException("No data found in temporary java code fragment files for " + className
- + " while union class file generation");
- }
-
- for (String method : methods) {
- insertDataIntoJavaFile(file, method);
- }
- insertDataIntoJavaFile(file, CLOSE_CURLY_BRACKET + NEW_LINE);
-
- return validateLineLength(file);
- }
-
- /**
- * Generates class file for type enum.
- *
- * @param file generated file
- * @param curNode current YANG node
- * @return class file for type enum
- * @throws IOException when fails to generate class file
- */
- public static File generateEnumClassFile(File file, YangNode curNode)
- throws IOException {
-
- JavaFileInfo javaFileInfo = ((JavaFileInfoContainer) curNode).getJavaFileInfo();
- YangPluginConfig pluginConfig = javaFileInfo.getPluginConfig();
-
- String className = javaFileInfo.getJavaName();
- String path = javaFileInfo.getBaseCodeGenPath() + javaFileInfo.getPackageFilePath();
-
- initiateJavaFileGeneration(file, getCapitalCase(className), GENERATE_ENUM_CLASS, null, path, pluginConfig);
-
- //Add attribute strings.
- try {
- JavaCodeGeneratorInfo javaGenInfo = (JavaCodeGeneratorInfo) curNode;
- insertDataIntoJavaFile(file,
- trimAtLast(trimAtLast(getDataFromTempFileHandle(ENUM_IMPL_MASK, javaGenInfo
- .getTempJavaCodeFragmentFiles().getEnumerationTempFiles(), path), COMMA), NEW_LINE)
- + SEMI_COLAN + NEW_LINE);
- } catch (IOException e) {
- throw new IOException("No data found in temporary java code fragment files for " + getCapitalCase(className)
- + " while enum class file generation");
- }
-
-
- // Add an attribute to get the enum's values.
- insertDataIntoJavaFile(file, getEnumsValueAttribute(getCapitalCase(className)));
-
- // Add a constructor for enum.
- insertDataIntoJavaFile(file, getJavaDoc(TYPE_CONSTRUCTOR, className, false, pluginConfig)
- + getEnumsConstructor(getCapitalCase(className)) + NEW_LINE);
-
- TempJavaEnumerationFragmentFiles enumFragFiles = ((TempJavaCodeFragmentFilesContainer) curNode)
- .getTempJavaCodeFragmentFiles()
- .getEnumerationTempFiles();
- insertDataIntoJavaFile(file, getEnumsOfMethod(className,
- enumFragFiles.getJavaAttributeForEnum(pluginConfig),
- enumFragFiles.getEnumSetJavaMap(),
- enumFragFiles.getEnumStringList(), pluginConfig)
- + NEW_LINE);
-
- // Add a getter method for enum.
- insertDataIntoJavaFile(file, getJavaDoc(GETTER_METHOD, className, false, pluginConfig)
- + getGetter(INT, className, GENERATE_ENUM_CLASS) + NEW_LINE);
-
- try {
- insertDataIntoJavaFile(file, getFromStringMethodSignature(getCapitalCase(className), pluginConfig)
- + getDataFromTempFileHandle(FROM_STRING_IMPL_MASK,
- ((TempJavaCodeFragmentFilesContainer) curNode).getTempJavaCodeFragmentFiles()
- .getEnumerationTempFiles(), path)
- + getFromStringMethodClose());
- } catch (IOException e) {
- throw new IOException("No data found in temporary java code fragment files for " +
- getCapitalCase(className) + " while enum class file generation");
- }
-
- insertDataIntoJavaFile(file, CLOSE_CURLY_BRACKET + NEW_LINE);
-
- return validateLineLength(file);
- }
-
- /**
- * Generates interface file for rpc.
- *
- * @param file generated file
- * @param curNode current YANG node
- * @param imports imports for file
- * @return rpc class file
- * @throws IOException when fails to generate class file
- */
- public static File generateServiceInterfaceFile(File file, YangNode curNode, List<String> imports)
- throws IOException {
-
- JavaFileInfo javaFileInfo = ((JavaFileInfoContainer) curNode).getJavaFileInfo();
-
- TempJavaServiceFragmentFiles tempJavaServiceFragmentFiles = ((JavaCodeGeneratorInfo) curNode)
- .getTempJavaCodeFragmentFiles().getServiceTempFiles();
- String className = getCapitalCase(javaFileInfo.getJavaName()) + SERVICE_METHOD_STRING;
- String path = javaFileInfo.getBaseCodeGenPath() + javaFileInfo.getPackageFilePath();
- initiateJavaFileGeneration(file, GENERATE_SERVICE_AND_MANAGER, imports, curNode, className);
-
- List<String> methods = new ArrayList<>();
- JavaAttributeInfo rootAttribute = getCurNodeAsAttributeInTarget(curNode, curNode, false,
- tempJavaServiceFragmentFiles);
-
- try {
-
- //Getter methods.
- methods.add(getGetterString(rootAttribute, GENERATE_SERVICE_AND_MANAGER,
- javaFileInfo.getPluginConfig()) + NEW_LINE);
- // Setter methods.
- methods.add(getSetterString(rootAttribute, className, GENERATE_SERVICE_AND_MANAGER,
- javaFileInfo.getPluginConfig()) + NEW_LINE);
-
- methods.add(getAugmentsDataMethodForService(curNode) + NEW_LINE);
-
- if (((JavaCodeGeneratorInfo) curNode).getTempJavaCodeFragmentFiles().getServiceTempFiles() != null) {
- JavaCodeGeneratorInfo javaGenInfo = (JavaCodeGeneratorInfo) curNode;
-
- // Rpc methods
- methods.add(getDataFromTempFileHandle(RPC_INTERFACE_MASK,
- javaGenInfo.getTempJavaCodeFragmentFiles().getServiceTempFiles(), path));
- }
- } catch (IOException e) {
- throw new IOException("No data found in temporary java code fragment files for " + className
- + " while rpc class file generation");
- }
-
- for (String method : methods) {
- insertDataIntoJavaFile(file, method);
- }
- insertDataIntoJavaFile(file, CLOSE_CURLY_BRACKET + NEW_LINE);
-
- return validateLineLength(file);
- }
-
- /**
- * Generates event file.
- *
- * @param file generated file
- * @param curNode current YANG node
- * @param imports imports for file
- * @throws IOException when fails to generate class file
- */
- public static void generateEventFile(File file, YangNode curNode, List<String> imports) throws IOException {
-
- String className = getCapitalCase(((JavaFileInfoContainer) curNode).getJavaFileInfo().getJavaName())
- + EVENT_STRING;
-
- TempJavaEventFragmentFiles tempFiles = ((TempJavaCodeFragmentFilesContainer) curNode)
- .getTempJavaCodeFragmentFiles().getEventFragmentFiles();
-
- String path = ((JavaFileInfoContainer) curNode).getJavaFileInfo().getBaseCodeGenPath()
- + ((JavaFileInfoContainer) curNode).getJavaFileInfo().getPackageFilePath();
- initiateJavaFileGeneration(file, GENERATE_EVENT_CLASS, imports, curNode, className);
- try {
- insertDataIntoJavaFile(file, NEW_LINE + getEventEnumTypeStart() +
- trimAtLast(getDataFromTempFileHandle(EVENT_ENUM_MASK, tempFiles, path), COMMA)
- + FOUR_SPACE_INDENTATION + CLOSE_CURLY_BRACKET + NEW_LINE);
-
- insertDataIntoJavaFile(file, getDataFromTempFileHandle(EVENT_METHOD_MASK, tempFiles, path));
-
- } catch (IOException e) {
- throw new IOException("No data found in temporary java code fragment files for " + className
- + " while event class file generation");
- }
-
- insertDataIntoJavaFile(file, CLOSE_CURLY_BRACKET + NEW_LINE);
- validateLineLength(file);
- }
-
- /**
- * Generates event listener file.
- *
- * @param file generated file
- * @param curNode current YANG node
- * @param imports imports for file
- * @throws IOException when fails to generate class file
- */
- public static void generateEventListenerFile(File file, YangNode curNode, List<String> imports)
- throws IOException {
-
- String className = getCapitalCase(((JavaFileInfoContainer) curNode).getJavaFileInfo().getJavaName())
- + EVENT_LISTENER_STRING;
-
- initiateJavaFileGeneration(file, GENERATE_EVENT_LISTENER_INTERFACE, imports, curNode, className);
- insertDataIntoJavaFile(file, CLOSE_CURLY_BRACKET + NEW_LINE);
- validateLineLength(file);
- }
-
- /**
- * Generates event subject's file.
- *
- * @param file file handle
- * @param curNode current YANG node
- * @throws IOException when fails to do IO exceptions
- */
- public static void generateEventSubjectFile(File file, YangNode curNode)
- throws IOException {
-
- String className = getCapitalCase(((JavaFileInfoContainer) curNode).getJavaFileInfo().getJavaName())
- + EVENT_SUBJECT_NAME_SUFFIX;
-
- initiateJavaFileGeneration(file, GENERATE_EVENT_SUBJECT_CLASS, null, curNode, className);
-
- String path = ((JavaFileInfoContainer) curNode).getJavaFileInfo().getBaseCodeGenPath()
- + ((JavaFileInfoContainer) curNode).getJavaFileInfo().getPackageFilePath();
-
- TempJavaEventFragmentFiles tempFiles = ((TempJavaCodeFragmentFilesContainer) curNode)
- .getTempJavaCodeFragmentFiles().getEventFragmentFiles();
-
- insertDataIntoJavaFile(file, NEW_LINE);
- try {
- insertDataIntoJavaFile(file, getDataFromTempFileHandle(EVENT_SUBJECT_ATTRIBUTE_MASK, tempFiles, path));
-
- insertDataIntoJavaFile(file, getDataFromTempFileHandle(EVENT_SUBJECT_GETTER_MASK, tempFiles, path));
-
- insertDataIntoJavaFile(file, getDataFromTempFileHandle(EVENT_SUBJECT_SETTER_MASK, tempFiles, path));
-
- } catch (IOException e) {
- throw new IOException("No data found in temporary java code fragment files for " + className
- + " while event class file generation");
- }
-
- insertDataIntoJavaFile(file, CLOSE_CURLY_BRACKET + NEW_LINE);
- validateLineLength(file);
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaFileGeneratorUtils.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaFileGeneratorUtils.java
deleted file mode 100644
index b09f123..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaFileGeneratorUtils.java
+++ /dev/null
@@ -1,743 +0,0 @@
-/*
- * 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.translator.tojava.utils;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.onosproject.yangutils.datamodel.YangAtomicPath;
-import org.onosproject.yangutils.datamodel.YangAugment;
-import org.onosproject.yangutils.datamodel.YangLeafRef;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeIdentifier;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfoContainer;
-import org.onosproject.yangutils.translator.tojava.JavaImportData;
-import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator;
-import org.onosproject.yangutils.translator.tojava.TempJavaBeanFragmentFiles;
-import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
-import org.onosproject.yangutils.translator.tojava.TempJavaEnumerationFragmentFiles;
-import org.onosproject.yangutils.translator.tojava.TempJavaEventFragmentFiles;
-import org.onosproject.yangutils.translator.tojava.TempJavaFragmentFiles;
-import org.onosproject.yangutils.translator.tojava.TempJavaServiceFragmentFiles;
-import org.onosproject.yangutils.translator.tojava.TempJavaTypeFragmentFiles;
-import org.onosproject.yangutils.utils.io.impl.CopyrightHeader;
-import org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType;
-
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.BUILDER_CLASS_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.BUILDER_INTERFACE_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.DEFAULT_CLASS_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_ENUM_CLASS;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_CLASS;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_LISTENER_INTERFACE;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_SUBJECT_CLASS;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_IDENTITY_CLASS;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_SERVICE_AND_MANAGER;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_TYPEDEF_CLASS;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_UNION_CLASS;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.INTERFACE_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.ADD_TO_LIST_IMPL_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.ADD_TO_LIST_INTERFACE_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.ATTRIBUTES_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.CONSTRUCTOR_FOR_TYPE_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.CONSTRUCTOR_IMPL_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.ENUM_IMPL_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.EQUALS_IMPL_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.EVENT_ENUM_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.EVENT_METHOD_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.EVENT_SUBJECT_ATTRIBUTE_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.EVENT_SUBJECT_GETTER_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.EVENT_SUBJECT_SETTER_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.FROM_STRING_IMPL_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.GETTER_FOR_CLASS_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.GETTER_FOR_INTERFACE_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.HASH_CODE_IMPL_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.LEAF_IDENTIFIER_ENUM_ATTRIBUTES_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.OF_STRING_IMPL_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.RPC_IMPL_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.RPC_INTERFACE_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.SETTER_FOR_CLASS_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.SETTER_FOR_INTERFACE_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.TO_STRING_IMPL_MASK;
-import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator.getQualifiedTypeInfoOfCurNode;
-import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.getNodesPackage;
-import static org.onosproject.yangutils.translator.tojava.utils.ClassDefinitionGenerator.generateClassDefinition;
-import static org.onosproject.yangutils.utils.UtilConstants.CLOSE_CURLY_BRACKET;
-import static org.onosproject.yangutils.utils.UtilConstants.LEAFREF;
-import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE;
-import static org.onosproject.yangutils.utils.UtilConstants.OP_PARAM;
-import static org.onosproject.yangutils.utils.UtilConstants.PACKAGE;
-import static org.onosproject.yangutils.utils.UtilConstants.PERIOD;
-import static org.onosproject.yangutils.utils.UtilConstants.SEMI_COLAN;
-import static org.onosproject.yangutils.utils.UtilConstants.SLASH;
-import static org.onosproject.yangutils.utils.UtilConstants.SPACE;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.BUILDER_CLASS;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.BUILDER_INTERFACE;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.ENUM_CLASS;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.EVENT;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.EVENT_LISTENER;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.EVENT_SUBJECT_CLASS;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.IMPL_CLASS;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.INTERFACE;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.RPC_INTERFACE;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.getJavaDoc;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCamelCase;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getJavaPackageFromPackagePath;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.insertDataIntoJavaFile;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.parsePkg;
-
-/**
- * Represents utilities for java file generator.
- */
-public final class JavaFileGeneratorUtils {
-
- /**
- * Creates an instance of java file generator util.
- */
- private JavaFileGeneratorUtils() {
- }
-
- /**
- * Returns a file object for generated file.
- *
- * @param filePath file package path
- * @param fileName file name
- * @param extension file extension
- * @param handler cached file handle
- * @return file object
- */
- public static File getFileObject(String filePath, String fileName, String extension, JavaFileInfo handler) {
- return new File(handler.getBaseCodeGenPath() + filePath + SLASH + fileName + extension);
- }
-
- /**
- * Returns data stored in temporary files.
- *
- * @param generatedTempFiles temporary file types
- * @param tempJavaFragmentFiles temp java fragment files
- * @param absolutePath absolute path
- * @return data stored in temporary files
- * @throws IOException when failed to get the data from temporary file handle
- */
- static String getDataFromTempFileHandle(int generatedTempFiles,
- TempJavaFragmentFiles tempJavaFragmentFiles, String absolutePath)
- throws IOException {
-
- TempJavaTypeFragmentFiles typeFragmentFiles = null;
-
- if (tempJavaFragmentFiles instanceof TempJavaTypeFragmentFiles) {
- typeFragmentFiles = (TempJavaTypeFragmentFiles) tempJavaFragmentFiles;
- }
-
- TempJavaBeanFragmentFiles beanFragmentFiles = null;
-
- if (tempJavaFragmentFiles instanceof TempJavaBeanFragmentFiles) {
- beanFragmentFiles = (TempJavaBeanFragmentFiles) tempJavaFragmentFiles;
- }
-
- TempJavaServiceFragmentFiles serviceFragmentFiles = null;
- if (tempJavaFragmentFiles instanceof TempJavaServiceFragmentFiles) {
- serviceFragmentFiles = (TempJavaServiceFragmentFiles) tempJavaFragmentFiles;
- }
-
- TempJavaEventFragmentFiles eventFragmentFiles = null;
- if (tempJavaFragmentFiles instanceof TempJavaEventFragmentFiles) {
- eventFragmentFiles = (TempJavaEventFragmentFiles) tempJavaFragmentFiles;
- }
-
- if ((generatedTempFiles & ATTRIBUTES_MASK) != 0) {
- return tempJavaFragmentFiles
- .getTemporaryDataFromFileHandle(tempJavaFragmentFiles.getAttributesTempFileHandle(),
- absolutePath);
- } else if ((generatedTempFiles & GETTER_FOR_INTERFACE_MASK) != 0) {
- return tempJavaFragmentFiles
- .getTemporaryDataFromFileHandle(tempJavaFragmentFiles.getGetterInterfaceTempFileHandle(),
- absolutePath);
- } else if ((generatedTempFiles & SETTER_FOR_INTERFACE_MASK) != 0) {
- return tempJavaFragmentFiles
- .getTemporaryDataFromFileHandle(tempJavaFragmentFiles.getSetterInterfaceTempFileHandle(),
- absolutePath);
- } else if ((generatedTempFiles & GETTER_FOR_CLASS_MASK) != 0) {
- return tempJavaFragmentFiles
- .getTemporaryDataFromFileHandle(tempJavaFragmentFiles.getGetterImplTempFileHandle(),
- absolutePath);
- } else if ((generatedTempFiles & SETTER_FOR_CLASS_MASK) != 0) {
- return tempJavaFragmentFiles
- .getTemporaryDataFromFileHandle(tempJavaFragmentFiles.getSetterImplTempFileHandle(),
- absolutePath);
- } else if ((generatedTempFiles & ADD_TO_LIST_INTERFACE_MASK) != 0) {
- return tempJavaFragmentFiles
- .getTemporaryDataFromFileHandle(tempJavaFragmentFiles.getAddToListInterfaceTempFileHandle(),
- absolutePath);
- } else if ((generatedTempFiles & ADD_TO_LIST_IMPL_MASK) != 0) {
- return tempJavaFragmentFiles
- .getTemporaryDataFromFileHandle(tempJavaFragmentFiles.getAddToListImplTempFileHandle(),
- absolutePath);
- } else if ((generatedTempFiles & LEAF_IDENTIFIER_ENUM_ATTRIBUTES_MASK) != 0) {
- return tempJavaFragmentFiles
- .getTemporaryDataFromFileHandle(tempJavaFragmentFiles.getLeafIdAttributeTempFileHandle(),
- absolutePath);
- } else if ((generatedTempFiles & CONSTRUCTOR_IMPL_MASK) != 0) {
- if (beanFragmentFiles == null) {
- throw new TranslatorException("Required constructor info is missing.");
- }
- return beanFragmentFiles
- .getTemporaryDataFromFileHandle(beanFragmentFiles.getConstructorImplTempFileHandle(),
- absolutePath);
- } else if ((generatedTempFiles & HASH_CODE_IMPL_MASK) != 0) {
- return tempJavaFragmentFiles
- .getTemporaryDataFromFileHandle(tempJavaFragmentFiles.getHashCodeImplTempFileHandle(),
- absolutePath);
- } else if ((generatedTempFiles & EQUALS_IMPL_MASK) != 0) {
- return tempJavaFragmentFiles
- .getTemporaryDataFromFileHandle(tempJavaFragmentFiles.getEqualsImplTempFileHandle(),
- absolutePath);
- } else if ((generatedTempFiles & TO_STRING_IMPL_MASK) != 0) {
- return tempJavaFragmentFiles
- .getTemporaryDataFromFileHandle(tempJavaFragmentFiles.getToStringImplTempFileHandle(),
- absolutePath);
- } else if ((generatedTempFiles & OF_STRING_IMPL_MASK) != 0) {
- if (typeFragmentFiles == null) {
- throw new TranslatorException("Required of string implementation info is missing.");
- }
- return typeFragmentFiles
- .getTemporaryDataFromFileHandle(typeFragmentFiles.getOfStringImplTempFileHandle(), absolutePath);
- } else if ((generatedTempFiles & CONSTRUCTOR_FOR_TYPE_MASK) != 0) {
- if (typeFragmentFiles == null) {
- throw new TranslatorException("Required constructor implementation info is missing.");
- }
- return typeFragmentFiles
- .getTemporaryDataFromFileHandle(typeFragmentFiles.getConstructorForTypeTempFileHandle(),
- absolutePath);
- } else if ((generatedTempFiles & FROM_STRING_IMPL_MASK) != 0) {
- return tempJavaFragmentFiles
- .getTemporaryDataFromFileHandle(tempJavaFragmentFiles.getFromStringImplTempFileHandle(),
- absolutePath);
- } else if ((generatedTempFiles & ENUM_IMPL_MASK) != 0) {
- if (!(tempJavaFragmentFiles instanceof TempJavaEnumerationFragmentFiles)) {
- throw new TranslatorException("Required enum info is missing.");
- }
- TempJavaEnumerationFragmentFiles enumFragmentFiles =
- (TempJavaEnumerationFragmentFiles) tempJavaFragmentFiles;
- return enumFragmentFiles
- .getTemporaryDataFromFileHandle(enumFragmentFiles.getEnumClassTempFileHandle(), absolutePath);
- } else if ((generatedTempFiles & RPC_INTERFACE_MASK) != 0) {
- if (serviceFragmentFiles == null) {
- throw new TranslatorException("Required rpc interface info is missing.");
- }
- return serviceFragmentFiles
- .getTemporaryDataFromFileHandle(serviceFragmentFiles.getRpcInterfaceTempFileHandle(),
- absolutePath);
- } else if ((generatedTempFiles & RPC_IMPL_MASK) != 0) {
- if (serviceFragmentFiles == null) {
- throw new TranslatorException("Required rpc implementation info is missing.");
- }
- return serviceFragmentFiles
- .getTemporaryDataFromFileHandle(serviceFragmentFiles.getRpcImplTempFileHandle(),
- absolutePath);
- } else if ((generatedTempFiles & EVENT_ENUM_MASK) != 0) {
- if (eventFragmentFiles == null) {
- throw new TranslatorException("Required event enum implementation info is missing.");
- }
- return eventFragmentFiles
- .getTemporaryDataFromFileHandle(eventFragmentFiles.getEventEnumTempFileHandle(),
- absolutePath);
- } else if ((generatedTempFiles & EVENT_METHOD_MASK) != 0) {
- if (eventFragmentFiles == null) {
- throw new TranslatorException("Required event method implementation info is missing.");
- }
- return eventFragmentFiles
- .getTemporaryDataFromFileHandle(eventFragmentFiles.getEventMethodTempFileHandle(),
- absolutePath);
- } else if ((generatedTempFiles & EVENT_SUBJECT_GETTER_MASK) != 0) {
- if (eventFragmentFiles == null) {
- throw new TranslatorException("Required event subject getter implementation info is missing.");
- }
- return eventFragmentFiles
- .getTemporaryDataFromFileHandle(eventFragmentFiles.getEventSubjectGetterTempFileHandle(),
- absolutePath);
- } else if ((generatedTempFiles & EVENT_SUBJECT_SETTER_MASK) != 0) {
- if (eventFragmentFiles == null) {
- throw new TranslatorException("Required event subject setter implementation info is missing.");
- }
- return eventFragmentFiles
- .getTemporaryDataFromFileHandle(eventFragmentFiles.getEventSubjectSetterTempFileHandle(),
- absolutePath);
- } else if ((generatedTempFiles & EVENT_SUBJECT_ATTRIBUTE_MASK) != 0) {
- if (eventFragmentFiles == null) {
- throw new TranslatorException("Required event subject attribute implementation info is missing.");
- }
- return eventFragmentFiles
- .getTemporaryDataFromFileHandle(eventFragmentFiles.getEventSubjectAttributeTempFileHandle(),
- absolutePath);
- }
- return null;
- }
-
- /**
- * Initiates generation of file based on generated file type.
- *
- * @param file generated file
- * @param className generated file class name
- * @param genType generated file type
- * @param imports imports for the file
- * @param pkg generated file package
- * @param pluginConfig plugin configurations
- * @throws IOException when fails to generate a file
- */
- public static void initiateJavaFileGeneration(File file, String className, int genType, List<String> imports,
- String pkg, YangPluginConfig pluginConfig)
- throws IOException {
-
- boolean isFileCreated;
- try {
- isFileCreated = file.createNewFile();
- if (!isFileCreated) {
- throw new IOException("Failed to create " + file.getName() + " class file.");
- }
- appendContents(file, className, genType, imports, pkg, pluginConfig);
- } catch (IOException e) {
- throw new IOException("Failed to append contents in " + file.getName() + " class file.");
- }
- }
-
- /**
- * Initiates generation of file based on generated file type.
- *
- * @param file generated file
- * @param genType generated file type
- * @param imports imports for the file
- * @param curNode current YANG node
- * @param className class name
- * @throws IOException when fails to generate a file
- */
- public static void initiateJavaFileGeneration(File file, int genType, List<String> imports,
- YangNode curNode, String className)
- throws IOException {
-
- boolean isFileCreated;
- try {
- isFileCreated = file.createNewFile();
- if (!isFileCreated) {
- throw new IOException("Failed to create " + file.getName() + " class file.");
- }
- appendContents(file, genType, imports, curNode, className);
- } catch (IOException e) {
- throw new IOException("Failed to append contents in " + file.getName() + " class file.");
- }
- }
-
- /**
- * Appends all the contents into a generated java file.
- *
- * @param file generated file
- * @param genType generated file type
- * @param importsList list of java imports
- * @param curNode current YANG node
- * @param className class name
- * @throws IOException when fails to do IO operations
- */
- private static void appendContents(File file, int genType, List<String> importsList, YangNode curNode,
- String className)
- throws IOException {
-
- JavaFileInfo javaFileInfo = ((JavaFileInfoContainer) curNode).getJavaFileInfo();
-
- String name = javaFileInfo.getJavaName();
- String path = javaFileInfo.getBaseCodeGenPath() + javaFileInfo.getPackageFilePath();
-
- String pkgString;
- if (genType == GENERATE_EVENT_CLASS
- || genType == GENERATE_EVENT_LISTENER_INTERFACE
- || genType == GENERATE_EVENT_SUBJECT_CLASS) {
- pkgString = parsePackageString((path + PERIOD + name).toLowerCase(), importsList);
- } else {
- pkgString = parsePackageString(path, importsList);
- }
- switch (genType) {
- case INTERFACE_MASK:
- appendHeaderContents(file, pkgString, importsList);
- write(file, genType, INTERFACE, curNode, className);
- break;
- case DEFAULT_CLASS_MASK:
- appendHeaderContents(file, pkgString, importsList);
- write(file, genType, IMPL_CLASS, curNode, className);
- break;
- case BUILDER_CLASS_MASK:
- write(file, genType, BUILDER_CLASS, curNode, className);
- break;
- case BUILDER_INTERFACE_MASK:
- write(file, genType, BUILDER_INTERFACE, curNode, className);
- break;
- case GENERATE_SERVICE_AND_MANAGER:
- appendHeaderContents(file, pkgString, importsList);
- write(file, genType, RPC_INTERFACE, curNode, className);
- break;
- case GENERATE_EVENT_CLASS:
- appendHeaderContents(file, pkgString, importsList);
- write(file, genType, EVENT, curNode, className);
- break;
- case GENERATE_EVENT_LISTENER_INTERFACE:
- appendHeaderContents(file, pkgString, importsList);
- write(file, genType, EVENT_LISTENER, curNode, className);
- break;
- case GENERATE_EVENT_SUBJECT_CLASS:
- appendHeaderContents(file, pkgString, importsList);
- write(file, genType, EVENT_SUBJECT_CLASS, curNode, className);
- break;
- case GENERATE_IDENTITY_CLASS:
- appendHeaderContents(file, pkgString, importsList);
- write(file, genType, EVENT_SUBJECT_CLASS, curNode, className);
- insertDataIntoJavaFile(file, CLOSE_CURLY_BRACKET);
- break;
- default:
- break;
- }
- }
-
- /**
- * Appends all the contents into a generated java file.
- *
- * @param file generated file
- * @param fileName generated file name
- * @param genType generated file type
- * @param importsList list of java imports
- * @param pkg generated file package
- * @param pluginConfig plugin configurations
- * @throws IOException when fails to append contents
- */
- private static void appendContents(File file, String fileName, int genType, List<String> importsList, String pkg,
- YangPluginConfig pluginConfig)
- throws IOException {
-
- String pkgString = parsePackageString(pkg, importsList);
-
- switch (genType) {
- case GENERATE_TYPEDEF_CLASS:
- appendHeaderContents(file, pkgString, importsList);
- write(file, fileName, genType, IMPL_CLASS, pluginConfig);
- break;
- case GENERATE_UNION_CLASS:
- appendHeaderContents(file, pkgString, importsList);
- write(file, fileName, genType, IMPL_CLASS, pluginConfig);
- break;
- case GENERATE_ENUM_CLASS:
- appendHeaderContents(file, pkgString, importsList);
- write(file, fileName, genType, ENUM_CLASS, pluginConfig);
- break;
- default:
- break;
- }
- }
-
- /**
- * Removes base directory path from package and generates package string for file.
- *
- * @param javaPkg generated java package
- * @param importsList list of imports
- * @return package string
- */
- private static String parsePackageString(String javaPkg, List<String> importsList) {
-
- javaPkg = parsePkg(getJavaPackageFromPackagePath(javaPkg));
- if (importsList != null) {
- if (!importsList.isEmpty()) {
- return PACKAGE + SPACE + javaPkg + SEMI_COLAN + NEW_LINE;
- } else {
- return PACKAGE + SPACE + javaPkg + SEMI_COLAN;
- }
- } else {
- return PACKAGE + SPACE + javaPkg + SEMI_COLAN;
- }
- }
-
- /**
- * Appends other contents to interface, impl and typedef classes. for example : ONOS copyright, imports and
- * package.
- *
- * @param file generated file
- * @param pkg generated package
- * @param importsList list of imports
- * @throws IOException when fails to append contents
- */
- private static void appendHeaderContents(File file, String pkg, List<String> importsList)
- throws IOException {
-
- insertDataIntoJavaFile(file, CopyrightHeader.getCopyrightHeader());
- insertDataIntoJavaFile(file, pkg);
-
- /*
- * TODO: add the file header using comments for snippet of yang file.
- * JavaCodeSnippetGen.getFileHeaderComment
- */
-
- if (importsList != null) {
- insertDataIntoJavaFile(file, NEW_LINE);
- for (String imports : importsList) {
- insertDataIntoJavaFile(file, imports);
- }
- }
- }
-
- /**
- * Writes data to the specific generated file.
- *
- * @param file generated file
- * @param genType generated file type
- * @param javaDocType java doc type
- * @param curNode current YANG node
- * @param fileName file name
- * @throws IOException when fails to write into a file
- */
- private static void write(File file, int genType, JavaDocType javaDocType, YangNode curNode, String fileName)
- throws IOException {
-
- YangPluginConfig pluginConfig = ((JavaFileInfoContainer) curNode).getJavaFileInfo().getPluginConfig();
- insertDataIntoJavaFile(file, getJavaDoc(javaDocType, fileName, false, pluginConfig));
- insertDataIntoJavaFile(file, generateClassDefinition(genType, fileName, curNode));
- }
-
- /**
- * Writes data to the specific generated file.
- *
- * @param file generated file
- * @param fileName file name
- * @param genType generated file type
- * @param javaDocType java doc type
- * @param pluginConfig plugin configurations
- * @throws IOException when fails to write into a file
- */
- private static void write(File file, String fileName, int genType, JavaDocType javaDocType,
- YangPluginConfig pluginConfig)
- throws IOException {
- insertDataIntoJavaFile(file, getJavaDoc(javaDocType, fileName, false, pluginConfig));
- insertDataIntoJavaFile(file, generateClassDefinition(genType, fileName));
- }
-
- /**
- * Returns set of node identifiers.
- *
- * @param parent parent node
- * @return set of node identifiers
- */
- static List<YangAtomicPath> getSetOfNodeIdentifiers(YangNode parent) {
-
- List<YangAtomicPath> targets = new ArrayList<>();
- YangNodeIdentifier nodeId;
- List<YangAugment> augments = getListOfAugments(parent);
- for (YangAugment augment : augments) {
- nodeId = augment.getTargetNode().get(0).getNodeIdentifier();
-
- if (validateNodeIdentifierInSet(nodeId, targets)) {
- targets.add(augment.getTargetNode().get(0));
- }
- }
- return targets;
- }
-
- /* Returns list of augments.*/
- private static List<YangAugment> getListOfAugments(YangNode parent) {
- List<YangAugment> augments = new ArrayList<>();
- YangNode child = parent.getChild();
- while (child != null) {
- if (child instanceof YangAugment) {
- augments.add((YangAugment) child);
- }
- child = child.getNextSibling();
- }
- return augments;
- }
-
- /*Validates the set for duplicate names of node identifiers.*/
- private static boolean validateNodeIdentifierInSet(YangNodeIdentifier nodeId, List<YangAtomicPath> targets) {
- boolean isPresent = true;
- for (YangAtomicPath target : targets) {
- if (target.getNodeIdentifier().getName().equals(nodeId.getName())) {
- if (target.getNodeIdentifier().getPrefix() != null) {
- isPresent = !target.getNodeIdentifier().getPrefix().equals(nodeId.getPrefix());
- } else {
- isPresent = nodeId.getPrefix() != null;
- }
- }
- }
- return isPresent;
- }
-
- /**
- * Adds resolved augmented node imports to manager class.
- *
- * @param parent parent node
- */
- public static void addResolvedAugmentedDataNodeImports(YangNode parent) {
- List<YangAtomicPath> targets = getSetOfNodeIdentifiers(parent);
- TempJavaCodeFragmentFiles tempJavaCodeFragmentFiles = ((JavaCodeGeneratorInfo) parent)
- .getTempJavaCodeFragmentFiles();
- YangNode augmentedNode;
- JavaQualifiedTypeInfoTranslator javaQualifiedTypeInfo;
- String curNodeName;
- JavaFileInfo parentInfo = ((JavaFileInfoContainer) parent).getJavaFileInfo();
- for (YangAtomicPath nodeId : targets) {
- augmentedNode = nodeId.getResolvedNode().getParent();
- if (((JavaFileInfoContainer) augmentedNode).getJavaFileInfo().getJavaName() != null) {
- curNodeName = ((JavaFileInfoContainer) augmentedNode).getJavaFileInfo().getJavaName();
- } else {
- curNodeName = getCapitalCase(getCamelCase(augmentedNode.getName(), parentInfo.getPluginConfig()
- .getConflictResolver()));
- }
-
- javaQualifiedTypeInfo = getQualifiedTypeInfoOfAugmentedNode(augmentedNode, getCapitalCase(curNodeName),
- parentInfo.getPluginConfig());
- tempJavaCodeFragmentFiles.getServiceTempFiles().getJavaImportData().addImportInfo(javaQualifiedTypeInfo,
- parentInfo.getJavaName(), parentInfo.getPackage());
- if (augmentedNode instanceof YangModule || augmentedNode instanceof YangSubModule) {
- javaQualifiedTypeInfo = getQualifiedTypeInfoOfAugmentedNode(augmentedNode,
- getCapitalCase(curNodeName) + OP_PARAM,
- parentInfo.getPluginConfig());
- tempJavaCodeFragmentFiles.getServiceTempFiles().getJavaImportData().addImportInfo(javaQualifiedTypeInfo,
- parentInfo.getJavaName(), parentInfo.getPackage());
- }
-
- }
- }
-
- /**
- * Returns qualified type info of augmented node.
- *
- * @param augmentedNode augmented node
- * @param curNodeName current node name
- * @param pluginConfig plugin configurations
- * @return qualified type info of augmented node
- */
- private static JavaQualifiedTypeInfoTranslator getQualifiedTypeInfoOfAugmentedNode(YangNode augmentedNode,
- String curNodeName,
- YangPluginConfig pluginConfig) {
- JavaQualifiedTypeInfoTranslator javaQualifiedTypeInfo = getQualifiedTypeInfoOfCurNode(augmentedNode,
- getCapitalCase(curNodeName));
- if (javaQualifiedTypeInfo.getPkgInfo() == null) {
- javaQualifiedTypeInfo.setPkgInfo(getNodesPackage(augmentedNode,
- pluginConfig));
- }
- return javaQualifiedTypeInfo;
- }
-
- /**
- * Validates if augmented node is imported in parent node.
- *
- * @param javaQualifiedTypeInfo qualified type info
- * @param importData import data
- * @return true if present in imports
- */
- private static boolean validateQualifiedInfoOfAugmentedNode(JavaQualifiedTypeInfoTranslator javaQualifiedTypeInfo,
- JavaImportData importData) {
- for (JavaQualifiedTypeInfoTranslator curImportInfo : importData.getImportSet()) {
- if (curImportInfo.getClassInfo()
- .contentEquals(javaQualifiedTypeInfo.getClassInfo())) {
- return curImportInfo.getPkgInfo()
- .contentEquals(javaQualifiedTypeInfo.getPkgInfo());
- }
- }
- return true;
- }
-
- /**
- * Return augmented class name for data methods in manager and service.
- *
- * @param augmentedNode augmented node
- * @param parent parent node
- * @return augmented class name for data methods in manager and service
- */
- static String getAugmentedClassNameForDataMethods(YangNode augmentedNode, YangNode parent) {
- String curNodeName;
- JavaQualifiedTypeInfoTranslator javaQualifiedTypeInfo;
- JavaFileInfo parentInfo = ((JavaFileInfoContainer) parent).getJavaFileInfo();
- YangPluginConfig pluginConfig = parentInfo.getPluginConfig();
- TempJavaServiceFragmentFiles tempJavaServiceFragmentFiles = ((JavaCodeGeneratorInfo) parent)
- .getTempJavaCodeFragmentFiles().getServiceTempFiles();
- if (((JavaFileInfoContainer) augmentedNode).getJavaFileInfo().getJavaName() != null) {
- curNodeName = ((JavaFileInfoContainer) augmentedNode).getJavaFileInfo().getJavaName();
- } else {
- curNodeName = getCapitalCase(getCamelCase(augmentedNode.getName(), pluginConfig
- .getConflictResolver()));
- }
-
- javaQualifiedTypeInfo = getQualifiedTypeInfoOfAugmentedNode(augmentedNode,
- getCapitalCase(curNodeName),
- parentInfo.getPluginConfig());
- if (validateQualifiedInfoOfAugmentedNode(javaQualifiedTypeInfo,
- tempJavaServiceFragmentFiles.getJavaImportData())) {
- return javaQualifiedTypeInfo.getClassInfo();
- } else {
- return javaQualifiedTypeInfo.getPkgInfo() + PERIOD + javaQualifiedTypeInfo.getClassInfo();
- }
- }
-
- /**
- * Returns parent node name for data methods in manager and service.
- *
- * @param parent parent node
- * @param pluginConfig plugin configurations
- * @return parent node name for data methods in manager and service
- */
- static String getParentNodeNameForDataMethods(YangNode parent, YangPluginConfig pluginConfig) {
- JavaFileInfo parentInfo = ((JavaFileInfoContainer) parent).getJavaFileInfo();
- if (parentInfo.getJavaName() != null) {
- return getCapitalCase(parentInfo.getJavaName());
- }
- return getCapitalCase(getCamelCase(parent.getName(), pluginConfig
- .getConflictResolver()));
-
- }
-
- /**
- * Checks if the type name is leafref and returns the effective type name.
- *
- * @param attributeName name of the current type
- * @param attributeType effective type
- * @return name of the effective type
- */
- public static String isTypeNameLeafref(String attributeName, YangType<?> attributeType) {
- if (attributeName.equalsIgnoreCase(LEAFREF)) {
- return attributeType.getDataTypeName();
- }
- return attributeName;
- }
-
- /**
- * Checks if the type is leafref and returns the effective type.
- *
- * @param attributeType current type
- * @return effective type
- */
- public static YangType isTypeLeafref(YangType<?> attributeType) {
- if (attributeType.getDataType() == YangDataTypes.LEAFREF) {
- YangLeafRef leafRef = (YangLeafRef) attributeType.getDataTypeExtendedInfo();
- return leafRef.getEffectiveDataType();
- }
- return attributeType;
- }
-
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaIdentifierSyntax.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaIdentifierSyntax.java
deleted file mode 100644
index 2fec762..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaIdentifierSyntax.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * 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.translator.tojava.utils;
-
-import java.io.File;
-import java.io.IOException;
-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 org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangToJavaNamingConflictUtil;
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfoContainer;
-
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.getParentNodeInGenCode;
-import static org.onosproject.yangutils.utils.UtilConstants.COLAN;
-import static org.onosproject.yangutils.utils.UtilConstants.DEFAULT_BASE_PKG;
-import static org.onosproject.yangutils.utils.UtilConstants.EMPTY_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.HYPHEN;
-import static org.onosproject.yangutils.utils.UtilConstants.JAVA_KEY_WORDS;
-import static org.onosproject.yangutils.utils.UtilConstants.PERIOD;
-import static org.onosproject.yangutils.utils.UtilConstants.QUOTES;
-import static org.onosproject.yangutils.utils.UtilConstants.REGEX_FOR_FIRST_DIGIT;
-import static org.onosproject.yangutils.utils.UtilConstants.REGEX_WITH_ALL_SPECIAL_CHAR;
-import static org.onosproject.yangutils.utils.UtilConstants.REVISION_PREFIX;
-import static org.onosproject.yangutils.utils.UtilConstants.SLASH;
-import static org.onosproject.yangutils.utils.UtilConstants.UNDER_SCORE;
-import static org.onosproject.yangutils.utils.UtilConstants.VERSION_PREFIX;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.addPackageInfo;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.createDirectories;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getAbsolutePackagePath;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getJavaPackageFromPackagePath;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getPackageDirPathFromJavaJPackage;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getPrefixForIdentifier;
-
-/**
- * Represents an utility Class for translating the name from YANG to java convention.
- */
-public final class JavaIdentifierSyntax {
-
- private static final int INDEX_ZERO = 0;
- private static final int INDEX_ONE = 1;
- private static final int VALUE_CHECK = 10;
- private static final String ZERO = "0";
- private static final String DATE_FORMAT = "yyyy-MM-dd";
-
- /**
- * Create instance of java identifier syntax.
- */
- private JavaIdentifierSyntax() {
- }
-
- /**
- * Returns the root package string.
- *
- * @param version YANG version
- * @param nameSpace name space of the module
- * @param revision revision of the module defined
- * @param conflictResolver object of YANG to java naming conflict util
- * @return the root package string
- */
- public static String getRootPackage(byte version, String nameSpace, Date revision,
- YangToJavaNamingConflictUtil conflictResolver) {
-
- String pkg;
- pkg = DEFAULT_BASE_PKG;
- pkg = pkg + PERIOD;
- pkg = pkg + getYangVersion(version);
- pkg = pkg + PERIOD;
- pkg = pkg + getPkgFromNameSpace(nameSpace, conflictResolver);
- pkg = pkg + PERIOD;
- pkg = pkg + getYangRevisionStr(revision);
-
- return pkg.toLowerCase();
- }
-
- /**
- * Returns version.
- *
- * @param ver YANG version
- * @return version
- */
- private static String getYangVersion(byte ver) {
- return VERSION_PREFIX + ver;
- }
-
- /**
- * Returns package name from name space.
- *
- * @param nameSpace name space of YANG module
- * @param conflictResolver object of YANG to java naming conflict util
- * @return java package name as per java rules
- */
- private static String getPkgFromNameSpace(String nameSpace, YangToJavaNamingConflictUtil conflictResolver) {
-
- ArrayList<String> pkgArr = new ArrayList<>();
- nameSpace = nameSpace.replace(QUOTES, EMPTY_STRING);
- String properNameSpace = nameSpace.replaceAll(REGEX_WITH_ALL_SPECIAL_CHAR, COLAN);
- String[] nameSpaceArr = properNameSpace.split(COLAN);
-
- Collections.addAll(pkgArr, nameSpaceArr);
- return getPkgFrmArr(pkgArr, conflictResolver);
- }
-
- /**
- * Returns revision string array.
- *
- * @param date YANG module revision
- * @return revision string
- */
- private static String getYangRevisionStr(Date date) {
- SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
- String dateInString = sdf.format(date);
- String[] revisionArr = dateInString.split(HYPHEN);
-
- String rev = REVISION_PREFIX;
- rev = rev + revisionArr[INDEX_ZERO];
-
- for (int i = INDEX_ONE; i < revisionArr.length; i++) {
- Integer val = Integer.parseInt(revisionArr[i]);
- if (val < VALUE_CHECK) {
- rev = rev + ZERO;
- }
- rev = rev + val;
- }
- return rev;
- }
-
- /**
- * Returns the package string.
- *
- * @param pkgArr package array
- * @param conflictResolver object of YANG to java naming conflict util
- * @return package string
- */
- private static String getPkgFrmArr(ArrayList<String> pkgArr, YangToJavaNamingConflictUtil conflictResolver) {
-
- String pkg = EMPTY_STRING;
- int size = pkgArr.size();
- int i = 0;
- for (String member : pkgArr) {
- boolean presenceOfKeyword = JAVA_KEY_WORDS.contains(member.toLowerCase());
- if (presenceOfKeyword || member.matches(REGEX_FOR_FIRST_DIGIT)) {
- String prefix = getPrefixForIdentifier(conflictResolver);
- member = prefix + member;
- }
- pkg = pkg + member;
- if (i != size - 1) {
- pkg = pkg + PERIOD;
- }
- i++;
- }
- return pkg;
- }
-
- /**
- * Returns enum's java name.
- *
- * @param name enum's name
- * @return enum's java name
- */
- public static String getEnumJavaAttribute(String name) {
-
- name = name.replaceAll(REGEX_WITH_ALL_SPECIAL_CHAR, COLAN);
- String[] strArray = name.split(COLAN);
- String output = EMPTY_STRING;
- if (strArray[0].isEmpty()) {
- List<String> stringArrangement = new ArrayList<>();
- stringArrangement.addAll(Arrays.asList(strArray).subList(1, strArray.length));
- strArray = stringArrangement.toArray(new String[stringArrangement.size()]);
- }
- for (int i = 0; i < strArray.length; i++) {
- if (i > 0 && i < strArray.length) {
- output = output + UNDER_SCORE;
- }
- output = output + strArray[i];
- }
- return output;
- }
-
- /**
- * Creates a package structure with package info java file if not present.
- *
- * @param yangNode YANG node for which code is being generated
- * @throws IOException any IO exception
- */
- public static void createPackage(YangNode yangNode) throws IOException {
- if (!(yangNode instanceof JavaFileInfoContainer)) {
- throw new TranslatorException("current node must have java file info");
- }
- String pkgInfo;
- JavaFileInfo javaFileInfo = ((JavaFileInfoContainer) yangNode).getJavaFileInfo();
- String pkg = getAbsolutePackagePath(javaFileInfo.getBaseCodeGenPath(), javaFileInfo.getPackageFilePath());
- if (!doesPackageExist(pkg)) {
- try {
- File pack = createDirectories(pkg);
- YangNode parent = getParentNodeInGenCode(yangNode);
- if (parent != null) {
- pkgInfo = ((JavaFileInfoContainer) parent).getJavaFileInfo().getJavaName();
- addPackageInfo(pack, pkgInfo, getJavaPackageFromPackagePath(pkg), true,
- ((JavaFileInfoContainer) parent).getJavaFileInfo().getPluginConfig());
- } else {
- pkgInfo = ((JavaFileInfoContainer) yangNode).getJavaFileInfo().getJavaName();
- addPackageInfo(pack, pkgInfo, getJavaPackageFromPackagePath(pkg), false,
- ((JavaFileInfoContainer) yangNode).getJavaFileInfo().getPluginConfig());
- }
- } catch (IOException e) {
- throw new IOException("failed to create package-info file");
- }
- }
- }
-
- /**
- * Checks if the package directory structure created.
- *
- * @param pkg Package to check if it is created
- * @return existence status of package
- */
- static boolean doesPackageExist(String pkg) {
- File pkgDir = new File(getPackageDirPathFromJavaJPackage(pkg));
- File pkgWithFile = new File(pkgDir + SLASH + "package-info.java");
- return pkgDir.exists() && pkgWithFile.isFile();
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGenerator.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGenerator.java
deleted file mode 100644
index 2550883..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGenerator.java
+++ /dev/null
@@ -1,1949 +0,0 @@
-/*
- * 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.translator.tojava.utils;
-
-import java.util.List;
-import java.util.Map;
-
-import org.onosproject.yangutils.datamodel.YangAtomicPath;
-import org.onosproject.yangutils.datamodel.YangAugmentableNode;
-import org.onosproject.yangutils.datamodel.YangIsFilterContentNodes;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangLeafList;
-import org.onosproject.yangutils.datamodel.YangLeafRef;
-import org.onosproject.yangutils.datamodel.YangLeavesHolder;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.JavaAttributeInfo;
-import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfoContainer;
-import org.onosproject.yangutils.translator.tojava.TempJavaBeanFragmentFiles;
-import org.onosproject.yangutils.utils.io.impl.JavaDocGen;
-
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.BINARY;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.BITS;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.BOOLEAN;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.DECIMAL64;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.EMPTY;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.INT16;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.INT32;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.INT64;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.INT8;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.LEAFREF;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.UINT16;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.UINT32;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.UINT64;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.UINT8;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_SUBJECT_CLASS;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_SERVICE_AND_MANAGER;
-import static org.onosproject.yangutils.translator.tojava.TempJavaFragmentFiles.getJavaAttributeOfLeaf;
-import static org.onosproject.yangutils.translator.tojava.TempJavaFragmentFiles.getJavaAttributeOfLeafList;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGeneratorUtils.getAugmentedClassNameForDataMethods;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGeneratorUtils.getParentNodeNameForDataMethods;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGeneratorUtils.getSetOfNodeIdentifiers;
-import static org.onosproject.yangutils.translator.tojava.utils.ValidatorTypeForUnionTypes.INT_TYPE_CONFLICT;
-import static org.onosproject.yangutils.utils.UtilConstants.ADD;
-import static org.onosproject.yangutils.utils.UtilConstants.ADD_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.AND;
-import static org.onosproject.yangutils.utils.UtilConstants.APP_INSTANCE;
-import static org.onosproject.yangutils.utils.UtilConstants.AUGMENTED;
-import static org.onosproject.yangutils.utils.UtilConstants.BASE64;
-import static org.onosproject.yangutils.utils.UtilConstants.BIG_DECIMAL;
-import static org.onosproject.yangutils.utils.UtilConstants.BIG_INTEGER;
-import static org.onosproject.yangutils.utils.UtilConstants.BOOLEAN_DATA_TYPE;
-import static org.onosproject.yangutils.utils.UtilConstants.BOOLEAN_WRAPPER;
-import static org.onosproject.yangutils.utils.UtilConstants.BREAK;
-import static org.onosproject.yangutils.utils.UtilConstants.BUILD;
-import static org.onosproject.yangutils.utils.UtilConstants.BUILDER;
-import static org.onosproject.yangutils.utils.UtilConstants.BYTE;
-import static org.onosproject.yangutils.utils.UtilConstants.BYTE_WRAPPER;
-import static org.onosproject.yangutils.utils.UtilConstants.CASE;
-import static org.onosproject.yangutils.utils.UtilConstants.CATCH;
-import static org.onosproject.yangutils.utils.UtilConstants.CHECK_NOT_NULL_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.CLASS;
-import static org.onosproject.yangutils.utils.UtilConstants.CLASS_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.CLOSE_CURLY_BRACKET;
-import static org.onosproject.yangutils.utils.UtilConstants.CLOSE_PARENTHESIS;
-import static org.onosproject.yangutils.utils.UtilConstants.COLAN;
-import static org.onosproject.yangutils.utils.UtilConstants.COLON;
-import static org.onosproject.yangutils.utils.UtilConstants.COMMA;
-import static org.onosproject.yangutils.utils.UtilConstants.DECODE;
-import static org.onosproject.yangutils.utils.UtilConstants.DEFAULT;
-import static org.onosproject.yangutils.utils.UtilConstants.DIAMOND_CLOSE_BRACKET;
-import static org.onosproject.yangutils.utils.UtilConstants.DIAMOND_OPEN_BRACKET;
-import static org.onosproject.yangutils.utils.UtilConstants.DOUBLE;
-import static org.onosproject.yangutils.utils.UtilConstants.EIGHT_SPACE_INDENTATION;
-import static org.onosproject.yangutils.utils.UtilConstants.ELSE;
-import static org.onosproject.yangutils.utils.UtilConstants.EMPTY_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.ENUM;
-import static org.onosproject.yangutils.utils.UtilConstants.EQUAL;
-import static org.onosproject.yangutils.utils.UtilConstants.EQUALS_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.EXCEPTION;
-import static org.onosproject.yangutils.utils.UtilConstants.EXCEPTION_VAR;
-import static org.onosproject.yangutils.utils.UtilConstants.FALSE;
-import static org.onosproject.yangutils.utils.UtilConstants.FILTER_CONTENT_MATCH;
-import static org.onosproject.yangutils.utils.UtilConstants.FLAG;
-import static org.onosproject.yangutils.utils.UtilConstants.FOR;
-import static org.onosproject.yangutils.utils.UtilConstants.FOUR_SPACE_INDENTATION;
-import static org.onosproject.yangutils.utils.UtilConstants.FROM_STRING_METHOD_NAME;
-import static org.onosproject.yangutils.utils.UtilConstants.FROM_STRING_PARAM_NAME;
-import static org.onosproject.yangutils.utils.UtilConstants.GET;
-import static org.onosproject.yangutils.utils.UtilConstants.GET_CLASS;
-import static org.onosproject.yangutils.utils.UtilConstants.GET_DECODER;
-import static org.onosproject.yangutils.utils.UtilConstants.GET_FILTER_LEAF;
-import static org.onosproject.yangutils.utils.UtilConstants.GET_LEAF_INDEX;
-import static org.onosproject.yangutils.utils.UtilConstants.GET_METHOD;
-import static org.onosproject.yangutils.utils.UtilConstants.GET_METHOD_PREFIX;
-import static org.onosproject.yangutils.utils.UtilConstants.GOOGLE_MORE_OBJECT_METHOD_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.HASH;
-import static org.onosproject.yangutils.utils.UtilConstants.HASH_CODE_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.IF;
-import static org.onosproject.yangutils.utils.UtilConstants.ILLEGAL_ACCESS_EXCEPTION;
-import static org.onosproject.yangutils.utils.UtilConstants.INSTANCE_OF;
-import static org.onosproject.yangutils.utils.UtilConstants.INT;
-import static org.onosproject.yangutils.utils.UtilConstants.INTEGER_WRAPPER;
-import static org.onosproject.yangutils.utils.UtilConstants.INT_MAX_RANGE;
-import static org.onosproject.yangutils.utils.UtilConstants.INT_MIN_RANGE;
-import static org.onosproject.yangutils.utils.UtilConstants.INVOCATION_TARGET_EXCEPTION;
-import static org.onosproject.yangutils.utils.UtilConstants.INVOKE;
-import static org.onosproject.yangutils.utils.UtilConstants.IS_EMPTY;
-import static org.onosproject.yangutils.utils.UtilConstants.IS_SELECT_LEAF;
-import static org.onosproject.yangutils.utils.UtilConstants.LEAF_IDENTIFIER;
-import static org.onosproject.yangutils.utils.UtilConstants.LIST;
-import static org.onosproject.yangutils.utils.UtilConstants.LONG;
-import static org.onosproject.yangutils.utils.UtilConstants.LONG_MAX_RANGE;
-import static org.onosproject.yangutils.utils.UtilConstants.LONG_MIN_RANGE;
-import static org.onosproject.yangutils.utils.UtilConstants.LONG_WRAPPER;
-import static org.onosproject.yangutils.utils.UtilConstants.MAP;
-import static org.onosproject.yangutils.utils.UtilConstants.MAX_RANGE;
-import static org.onosproject.yangutils.utils.UtilConstants.MIN_RANGE;
-import static org.onosproject.yangutils.utils.UtilConstants.NEW;
-import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE;
-import static org.onosproject.yangutils.utils.UtilConstants.NOT;
-import static org.onosproject.yangutils.utils.UtilConstants.NO_SUCH_METHOD_EXCEPTION;
-import static org.onosproject.yangutils.utils.UtilConstants.NULL;
-import static org.onosproject.yangutils.utils.UtilConstants.OBJ;
-import static org.onosproject.yangutils.utils.UtilConstants.OBJECT;
-import static org.onosproject.yangutils.utils.UtilConstants.OBJECT_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.OF;
-import static org.onosproject.yangutils.utils.UtilConstants.OMIT_NULL_VALUE_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.OPEN_CURLY_BRACKET;
-import static org.onosproject.yangutils.utils.UtilConstants.OPEN_PARENTHESIS;
-import static org.onosproject.yangutils.utils.UtilConstants.OP_PARAM;
-import static org.onosproject.yangutils.utils.UtilConstants.OR_OPERATION;
-import static org.onosproject.yangutils.utils.UtilConstants.OTHER;
-import static org.onosproject.yangutils.utils.UtilConstants.OVERRIDE;
-import static org.onosproject.yangutils.utils.UtilConstants.PARSE_BOOLEAN;
-import static org.onosproject.yangutils.utils.UtilConstants.PARSE_BYTE;
-import static org.onosproject.yangutils.utils.UtilConstants.PARSE_INT;
-import static org.onosproject.yangutils.utils.UtilConstants.PARSE_LONG;
-import static org.onosproject.yangutils.utils.UtilConstants.PARSE_SHORT;
-import static org.onosproject.yangutils.utils.UtilConstants.PERIOD;
-import static org.onosproject.yangutils.utils.UtilConstants.PRIVATE;
-import static org.onosproject.yangutils.utils.UtilConstants.PUBLIC;
-import static org.onosproject.yangutils.utils.UtilConstants.PUT;
-import static org.onosproject.yangutils.utils.UtilConstants.QUESTION_MARK;
-import static org.onosproject.yangutils.utils.UtilConstants.QUOTES;
-import static org.onosproject.yangutils.utils.UtilConstants.REPLACE_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.RETURN;
-import static org.onosproject.yangutils.utils.UtilConstants.RPC_INPUT_VAR_NAME;
-import static org.onosproject.yangutils.utils.UtilConstants.SEMI_COLAN;
-import static org.onosproject.yangutils.utils.UtilConstants.SET_METHOD_PREFIX;
-import static org.onosproject.yangutils.utils.UtilConstants.SET_SELECT_LEAF;
-import static org.onosproject.yangutils.utils.UtilConstants.SHORT;
-import static org.onosproject.yangutils.utils.UtilConstants.SHORT_WRAPPER;
-import static org.onosproject.yangutils.utils.UtilConstants.SINGLE_QUOTE;
-import static org.onosproject.yangutils.utils.UtilConstants.SIXTEEN_SPACE_INDENTATION;
-import static org.onosproject.yangutils.utils.UtilConstants.SPACE;
-import static org.onosproject.yangutils.utils.UtilConstants.SPLIT_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.SQUARE_BRACKETS;
-import static org.onosproject.yangutils.utils.UtilConstants.STATIC;
-import static org.onosproject.yangutils.utils.UtilConstants.STRING_DATA_TYPE;
-import static org.onosproject.yangutils.utils.UtilConstants.SUFFIX_S;
-import static org.onosproject.yangutils.utils.UtilConstants.SWITCH;
-import static org.onosproject.yangutils.utils.UtilConstants.THIS;
-import static org.onosproject.yangutils.utils.UtilConstants.TMP_VAL;
-import static org.onosproject.yangutils.utils.UtilConstants.TO;
-import static org.onosproject.yangutils.utils.UtilConstants.TRIM_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.TRUE;
-import static org.onosproject.yangutils.utils.UtilConstants.TRY;
-import static org.onosproject.yangutils.utils.UtilConstants.TWELVE_SPACE_INDENTATION;
-import static org.onosproject.yangutils.utils.UtilConstants.TWENTY_FOUR_SPACE_INDENTATION;
-import static org.onosproject.yangutils.utils.UtilConstants.TWENTY_SPACE_INDENTATION;
-import static org.onosproject.yangutils.utils.UtilConstants.UINT_MAX_RANGE;
-import static org.onosproject.yangutils.utils.UtilConstants.UINT_MIN_RANGE;
-import static org.onosproject.yangutils.utils.UtilConstants.ULONG_MAX_RANGE;
-import static org.onosproject.yangutils.utils.UtilConstants.ULONG_MIN_RANGE;
-import static org.onosproject.yangutils.utils.UtilConstants.UNDER_SCORE;
-import static org.onosproject.yangutils.utils.UtilConstants.VALIDATE_RANGE;
-import static org.onosproject.yangutils.utils.UtilConstants.VALUE;
-import static org.onosproject.yangutils.utils.UtilConstants.VALUE_LEAF_SET;
-import static org.onosproject.yangutils.utils.UtilConstants.VOID;
-import static org.onosproject.yangutils.utils.UtilConstants.YANG_AUGMENTED_INFO;
-import static org.onosproject.yangutils.utils.UtilConstants.YANG_AUGMENTED_OP_PARAM_INFO;
-import static org.onosproject.yangutils.utils.UtilConstants.YANG_UTILS_TODO;
-import static org.onosproject.yangutils.utils.UtilConstants.ZERO;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.BUILD_METHOD;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.CONSTRUCTOR;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.DEFAULT_CONSTRUCTOR;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.FROM_METHOD;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.GETTER_METHOD;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.MANAGER_SETTER_METHOD;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.OF_METHOD;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.SETTER_METHOD;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.TYPE_CONSTRUCTOR;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.generateForAddAugmentation;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.generateForBuilderMethod;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.generateForGetAugmentation;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.generateForGetMethodWithAttribute;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.generateForValidatorMethod;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.getJavaDoc;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCamelCase;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getSmallCase;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.trimAtLast;
-
-/**
- * Represents generator for methods of generated files based on the file type.
- */
-public final class MethodsGenerator {
- private static final String BITS_STRING_ARRAY_VAR = "bitsTemp";
- private static final String BIT_TEMP_VAR = "bitTemp";
-
- /**
- * Creates an instance of method generator.
- */
- private MethodsGenerator() {
- }
-
- /**
- * Returns the methods strings for builder interface.
- *
- * @param name attribute name
- * @param pluginConfig plugin configurations
- * @return method string for builder interface
- */
- public static String parseBuilderInterfaceBuildMethodString(String name, YangPluginConfig pluginConfig) {
- return getJavaDoc(BUILD_METHOD, name, false, pluginConfig) + getBuildForInterface(name);
- }
-
- /**
- * Returns getter string.
- *
- * @param attr attribute info
- * @param generatedJavaFiles generated java files
- * @param pluginConfig plugin configurations
- * @return getter string
- */
- public static String getGetterString(JavaAttributeInfo attr, int generatedJavaFiles,
- YangPluginConfig pluginConfig) {
-
- String returnType = getReturnType(attr);
- String attributeName = attr.getAttributeName();
- if (generatedJavaFiles == GENERATE_SERVICE_AND_MANAGER) {
- return generateForGetMethodWithAttribute(returnType)
- + getGetterForInterface(attributeName, returnType, attr.isListAttr(), generatedJavaFiles);
- }
-
- return getJavaDoc(GETTER_METHOD, attributeName, attr.isListAttr(), pluginConfig)
- + getGetterForInterface(attributeName, returnType, attr.isListAttr(), generatedJavaFiles);
- }
-
- /**
- * Returns setter string.
- *
- * @param attr attribute info
- * @param className java class name
- * @param generatedJavaFiles generated java files
- * @param pluginConfig plugin configurations
- * @return setter string
- */
- public static String getSetterString(JavaAttributeInfo attr, String className, int generatedJavaFiles,
- YangPluginConfig pluginConfig) {
-
- String attrType = getReturnType(attr);
- String attributeName = attr.getAttributeName();
- JavaDocGen.JavaDocType type;
- if (generatedJavaFiles == GENERATE_SERVICE_AND_MANAGER) {
- type = MANAGER_SETTER_METHOD;
- } else {
- type = SETTER_METHOD;
- }
-
- return getJavaDoc(type, attributeName, attr.isListAttr(), pluginConfig)
- + getSetterForInterface(attributeName, attrType, className, attr.isListAttr(), generatedJavaFiles);
- }
-
- /**
- * Returns constructor method string.
- *
- * @param name class name
- * @param pluginConfig plugin configurations
- * @return constructor string
- */
- private static String getConstructorString(String name, YangPluginConfig pluginConfig) {
- return getJavaDoc(CONSTRUCTOR, name, false, pluginConfig);
- }
-
- /**
- * Returns default constructor method string.
- *
- * @param name class name
- * @param modifierType modifier type
- * @param pluginConfig plugin configurations
- * @return default constructor string
- */
- public static String getDefaultConstructorString(String name, String modifierType,
- YangPluginConfig pluginConfig) {
- return getJavaDoc(DEFAULT_CONSTRUCTOR, name, false, pluginConfig)
- + getDefaultConstructor(name, modifierType)
- + NEW_LINE;
- }
-
- /**
- * Returns check not null string.
- *
- * @param name attribute name
- * @return check not null string
- */
- static String getCheckNotNull(String name) {
- return EIGHT_SPACE_INDENTATION + CHECK_NOT_NULL_STRING + OPEN_PARENTHESIS + name + COMMA + SPACE + name
- + CLOSE_PARENTHESIS + SEMI_COLAN + NEW_LINE;
- }
-
- /**
- * Returns build method string.
- *
- * @param name class name
- * @param isRootNode if root node
- * @return build string
- */
- public static String getBuildString(String name, boolean isRootNode) {
- if (isRootNode) {
- return NEW_LINE + getBuild(name, true);
- }
- return FOUR_SPACE_INDENTATION + OVERRIDE + NEW_LINE + getBuild(name, false);
- }
-
- /**
- * Returns the getter method strings for class file.
- *
- * @param attr attribute info
- * @param generatedJavaFiles for the type of java file being generated
- * @return getter method for class
- */
- public static String getGetterForClass(JavaAttributeInfo attr, int generatedJavaFiles) {
-
- String attrQualifiedType = getReturnType(attr);
- String attributeName = attr.getAttributeName();
-
- if (!attr.isListAttr()) {
- return getGetter(attrQualifiedType, attributeName, generatedJavaFiles);
- }
- String listAttr = getListString() + attrQualifiedType + DIAMOND_CLOSE_BRACKET;
- return getGetter(listAttr, attributeName, generatedJavaFiles);
- }
-
- /**
- * Returns getter for attribute.
- *
- * @param type return type
- * @param name attribute name
- * @param generatedJavaFiles generated java files
- * @return getter for attribute
- */
- static String getGetter(String type, String name, int generatedJavaFiles) {
- String ret = parseTypeForReturnValue(type);
- if (generatedJavaFiles == GENERATE_SERVICE_AND_MANAGER) {
- return FOUR_SPACE_INDENTATION + PUBLIC + SPACE + type + SPACE + GET_METHOD_PREFIX + getCapitalCase(name)
- + OPEN_PARENTHESIS + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE +
- EIGHT_SPACE_INDENTATION + YANG_UTILS_TODO + NEW_LINE + EIGHT_SPACE_INDENTATION +
- RETURN + SPACE + ret + SEMI_COLAN + NEW_LINE + FOUR_SPACE_INDENTATION + CLOSE_CURLY_BRACKET;
- } else {
- return FOUR_SPACE_INDENTATION + PUBLIC + SPACE + type + SPACE + name
- + OPEN_PARENTHESIS + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE +
- EIGHT_SPACE_INDENTATION + RETURN + SPACE + name + SEMI_COLAN + NEW_LINE + FOUR_SPACE_INDENTATION
- + CLOSE_CURLY_BRACKET;
- }
-
- }
-
- /*Provides string to return for type.*/
- private static String parseTypeForReturnValue(String type) {
- switch (type) {
- case BYTE:
- case INT:
- case SHORT:
- case LONG:
- case DOUBLE:
- return "0";
- case BOOLEAN_DATA_TYPE:
- return FALSE;
- default:
- return null;
- }
- }
-
- /**
- * Returns the setter method strings for class file.
- *
- * @param attr attribute info
- * @param className name of the class
- * @param generatedJavaFiles generated java files
- * @return setter method for class
- */
- public static String getSetterForClass(JavaAttributeInfo attr, String className, int generatedJavaFiles) {
-
- String attrQualifiedType = getReturnType(attr);
- String attributeName = attr.getAttributeName();
- boolean isTypeNull = false;
- if (attr.getAttributeType() == null) {
- isTypeNull = true;
- }
- if (!attr.isListAttr()) {
- return getSetter(className, attributeName, attrQualifiedType, generatedJavaFiles, isTypeNull, false);
- }
- String listAttr = getListString() + attrQualifiedType + DIAMOND_CLOSE_BRACKET;
- return getSetter(className, attributeName, listAttr, generatedJavaFiles, isTypeNull, true);
- }
-
- /**
- * Returns setter for attribute.
- *
- * @param className class name
- * @param name attribute name
- * @param type return type
- * @param isTypeNull if attribute type is null
- * @param isList true if leaf-list
- * @return setter for attribute
- */
- private static String getSetter(String className, String name, String type, int generatedJavaFiles,
- boolean isTypeNull, boolean isList) {
- if (generatedJavaFiles == GENERATE_SERVICE_AND_MANAGER) {
- return FOUR_SPACE_INDENTATION + PUBLIC + SPACE + VOID + SPACE + SET_METHOD_PREFIX
- + getCapitalCase(name) + OPEN_PARENTHESIS + type + SPACE + name + CLOSE_PARENTHESIS + SPACE +
- OPEN_CURLY_BRACKET + NEW_LINE + EIGHT_SPACE_INDENTATION + YANG_UTILS_TODO +
- NEW_LINE + FOUR_SPACE_INDENTATION + CLOSE_CURLY_BRACKET;
- } else if (generatedJavaFiles == GENERATE_EVENT_SUBJECT_CLASS) {
- return FOUR_SPACE_INDENTATION + PUBLIC + SPACE + VOID + SPACE + name + OPEN_PARENTHESIS + type + SPACE
- + name + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE + EIGHT_SPACE_INDENTATION
- + THIS + PERIOD + name + SPACE + EQUAL + SPACE + name + SEMI_COLAN + NEW_LINE
- + FOUR_SPACE_INDENTATION + CLOSE_CURLY_BRACKET;
- } else {
- String method = FOUR_SPACE_INDENTATION + PUBLIC + SPACE + className + BUILDER + SPACE +
- name + OPEN_PARENTHESIS + type + SPACE + name + CLOSE_PARENTHESIS + SPACE
- + OPEN_CURLY_BRACKET;
- if (!isTypeNull && !isList) {
- method = method + getValueLeafSetString(name);
- } else {
- method = method + EMPTY_STRING;
- }
- return method + NEW_LINE + EIGHT_SPACE_INDENTATION + THIS +
- PERIOD + name + SPACE
- + EQUAL + SPACE + name + SEMI_COLAN + NEW_LINE + EIGHT_SPACE_INDENTATION + RETURN + SPACE
- + THIS + SEMI_COLAN + NEW_LINE + FOUR_SPACE_INDENTATION + CLOSE_CURLY_BRACKET;
- }
-
- }
-
- //Returns value leaf flag setter.
- private static String getValueLeafSetString(String name) {
- return "\n get_valueLeafFlags().set(LeafIdentifier." + name.toUpperCase() + ".getLeafIndex());";
- }
-
- /**
- * Returns the setter method strings for class file.
- *
- * @param attr attribute info
- * @return setter method for class
- */
- static String getSetterForTypeDefClass(JavaAttributeInfo attr) {
-
- String attrQualifiedType = getReturnType(attr);
- String attributeName = attr.getAttributeName();
- return getTypeDefSetter(attrQualifiedType, attributeName);
- }
-
- /**
- * Returns type def's setter for attribute.
- *
- * @param type data type
- * @param name attribute name
- * @return setter for type def's attribute
- */
- private static String getTypeDefSetter(String type, String name) {
- return FOUR_SPACE_INDENTATION + PUBLIC + SPACE + VOID + SPACE + SET_METHOD_PREFIX + getCapitalCase(name)
- + OPEN_PARENTHESIS + type + SPACE + VALUE + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE
- + EIGHT_SPACE_INDENTATION + THIS + PERIOD + name + SPACE + EQUAL + SPACE + VALUE + SEMI_COLAN +
- NEW_LINE + FOUR_SPACE_INDENTATION + CLOSE_CURLY_BRACKET;
- }
-
- /**
- * Returns override string.
- *
- * @return override string
- */
- public static String getOverRideString() {
- return NEW_LINE + FOUR_SPACE_INDENTATION + OVERRIDE + NEW_LINE;
- }
-
- /**
- * Returns the getter method strings for interface file.
- *
- * @param yangName name of the attribute
- * @param returnType return type of attribute
- * @param isList is list attribute
- * @param generatedJavaFiles generated java files
- * @return getter method for interface
- */
- static String getGetterForInterface(String yangName, String returnType, boolean isList,
- int generatedJavaFiles) {
-
- if (!isList) {
- return getGetterInterfaceString(returnType, yangName, generatedJavaFiles);
- }
- String listAttr = getListString() + returnType + DIAMOND_CLOSE_BRACKET;
- return getGetterInterfaceString(listAttr, yangName, generatedJavaFiles);
- }
-
- /**
- * Returns getter for attribute in interface.
- *
- * @param returnType return type
- * @param yangName attribute name
- * @return getter for interface
- */
- private static String getGetterInterfaceString(String returnType, String yangName,
- int generatedJavaFiles) {
- if (generatedJavaFiles == GENERATE_SERVICE_AND_MANAGER) {
- return getGetMethodWithArgument(returnType, yangName);
- } else {
- return FOUR_SPACE_INDENTATION + returnType + SPACE + yangName
- + OPEN_PARENTHESIS + CLOSE_PARENTHESIS + SEMI_COLAN;
- }
- }
-
- /**
- * Returns the setter method strings for interface file.
- *
- * @param attrName name of the attribute
- * @param attrType return type of attribute
- * @param className name of the java class being generated
- * @param isList is list attribute
- * @param generatedJavaFiles generated java files
- * @return setter method for interface
- */
- static String getSetterForInterface(String attrName, String attrType, String className,
- boolean isList, int generatedJavaFiles) {
-
- if (!isList) {
- return getSetterInterfaceString(className, attrName, attrType, generatedJavaFiles);
- }
- String listAttr = getListString() + attrType + DIAMOND_CLOSE_BRACKET;
- return getSetterInterfaceString(className, attrName, listAttr, generatedJavaFiles);
- }
-
- /**
- * Returns setter string for interface.
- *
- * @param className class name
- * @param attrName attribute name
- * @param attrType attribute type
- * @return setter string
- */
- private static String getSetterInterfaceString(String className, String attrName, String attrType,
- int generatedJavaFiles) {
- if (generatedJavaFiles == GENERATE_SERVICE_AND_MANAGER) {
- return FOUR_SPACE_INDENTATION + VOID + SPACE + SET_METHOD_PREFIX + getCapitalCase(attrName)
- + OPEN_PARENTHESIS + attrType + SPACE + attrName + CLOSE_PARENTHESIS + SEMI_COLAN;
- } else {
- return FOUR_SPACE_INDENTATION + className + BUILDER + SPACE + attrName
- + OPEN_PARENTHESIS + attrType + SPACE + attrName + CLOSE_PARENTHESIS + SEMI_COLAN;
- }
- }
-
- /**
- * Returns list string.
- *
- * @return list string
- */
- private static String getListString() {
- return LIST + DIAMOND_OPEN_BRACKET;
- }
-
- /**
- * Returns return type for attribute.
- *
- * @param attr attribute info
- * @return return type
- */
- private static String getReturnType(JavaAttributeInfo attr) {
-
- String returnType = EMPTY_STRING;
- if (attr.isQualifiedName() && attr.getImportInfo().getPkgInfo() != null) {
- returnType = attr.getImportInfo().getPkgInfo() + PERIOD;
- }
- returnType = returnType + attr.getImportInfo().getClassInfo();
- return returnType;
- }
-
- /**
- * Returns the build method strings for interface file.
- *
- * @param yangName name of the interface
- * @return build method for interface
- */
- static String getBuildForInterface(String yangName) {
- return FOUR_SPACE_INDENTATION + yangName + SPACE + BUILD + OPEN_PARENTHESIS + CLOSE_PARENTHESIS + SEMI_COLAN
- + NEW_LINE;
- }
-
- /**
- * Returns constructor string for impl class.
- *
- * @param yangName class name
- * @param pluginConfig plugin configurations
- * @param isRootNode if root node
- * @return constructor string
- */
- static String getConstructorStart(String yangName, YangPluginConfig pluginConfig, boolean isRootNode) {
-
- String javadoc = getConstructorString(yangName, pluginConfig);
-
- String returnType = getCapitalCase(DEFAULT) + yangName;
- if (isRootNode) {
- returnType = yangName + OP_PARAM;
- }
- String constructor = FOUR_SPACE_INDENTATION + PUBLIC + SPACE + returnType +
- OPEN_PARENTHESIS + yangName + BUILDER + SPACE + BUILDER.toLowerCase() + OBJECT
- + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE;
- return javadoc + constructor;
- }
-
- /**
- * Returns the constructor strings for class file.
- *
- * @param attr attribute info
- * @param generatedJavaFiles generated java files
- * @param pluginConfig plugin configurations
- * @return constructor for class
- */
- public static String getConstructor(JavaAttributeInfo attr, int generatedJavaFiles,
- YangPluginConfig pluginConfig) {
-
- String attributeName = attr.getAttributeName();
- String constructor;
-
- if (generatedJavaFiles == GENERATE_SERVICE_AND_MANAGER) {
- constructor = EIGHT_SPACE_INDENTATION + THIS + PERIOD
- + getCamelCase(attributeName, pluginConfig.getConflictResolver()) + SPACE + EQUAL
- + SPACE + BUILDER.toLowerCase() + OBJECT + PERIOD + GET_METHOD_PREFIX
- + getCapitalCase(getCamelCase(attributeName, pluginConfig.getConflictResolver()))
- + OPEN_PARENTHESIS + CLOSE_PARENTHESIS + SEMI_COLAN + NEW_LINE;
- } else {
- constructor = EIGHT_SPACE_INDENTATION + THIS + PERIOD
- + getCamelCase(attributeName, pluginConfig.getConflictResolver()) + SPACE + EQUAL
- + SPACE + BUILDER.toLowerCase() + OBJECT + PERIOD
- + getCamelCase(attributeName, pluginConfig.getConflictResolver()) +
- OPEN_PARENTHESIS + CLOSE_PARENTHESIS + SEMI_COLAN + NEW_LINE;
- }
- return constructor;
- }
-
- /**
- * Returns the rpc strings for service interface.
- *
- * @param rpcName name of the rpc
- * @param inputName name of input
- * @param outputName name of output
- * @param pluginConfig plugin configurations
- * @return rpc method string
- */
- public static String getRpcServiceMethod(String rpcName, String inputName, String outputName,
- YangPluginConfig pluginConfig) {
-
- rpcName = getCamelCase(rpcName, pluginConfig.getConflictResolver());
- if (!inputName.equals(EMPTY_STRING)) {
- inputName = inputName + SPACE + RPC_INPUT_VAR_NAME;
- }
- return FOUR_SPACE_INDENTATION + outputName + SPACE + rpcName + OPEN_PARENTHESIS + inputName
- + CLOSE_PARENTHESIS + SEMI_COLAN;
- }
-
- /**
- * Returns the rpc strings for manager impl.
- *
- * @param rpcName name of the rpc
- * @param inputName name of input
- * @param outputName name of output
- * @param pluginConfig plugin configurations
- * @return rpc method string
- */
- public static String getRpcManagerMethod(String rpcName, String inputName, String outputName,
- YangPluginConfig pluginConfig) {
-
- rpcName = getCamelCase(rpcName, pluginConfig.getConflictResolver());
- if (!inputName.equals(EMPTY_STRING)) {
- inputName = inputName + SPACE + RPC_INPUT_VAR_NAME;
- }
-
- String method = getOverRideString() + FOUR_SPACE_INDENTATION + PUBLIC + SPACE + outputName + SPACE + rpcName
- + OPEN_PARENTHESIS + inputName + CLOSE_PARENTHESIS + SPACE
- + OPEN_CURLY_BRACKET + NEW_LINE + EIGHT_SPACE_INDENTATION + YANG_UTILS_TODO + NEW_LINE;
- if (!outputName.contentEquals(VOID)) {
- method += EIGHT_SPACE_INDENTATION + RETURN + SPACE + parseTypeForReturnValue(outputName) + SEMI_COLAN
- + NEW_LINE;
- }
- method += FOUR_SPACE_INDENTATION + CLOSE_CURLY_BRACKET;
-
- return method;
- }
-
- /**
- * Returns the build method strings for class file.
- *
- * @param yangName class name
- * @param isRootNode if root node
- * @return build method string for class
- */
- static String getBuild(String yangName, boolean isRootNode) {
- String type = getCapitalCase(DEFAULT) + yangName;
- if (isRootNode) {
- type = yangName + OP_PARAM;
- }
- return FOUR_SPACE_INDENTATION + PUBLIC + SPACE + yangName + SPACE + BUILD + OPEN_PARENTHESIS +
- CLOSE_PARENTHESIS
- + SPACE + OPEN_CURLY_BRACKET + NEW_LINE + EIGHT_SPACE_INDENTATION + RETURN + SPACE + NEW + SPACE +
- type + OPEN_PARENTHESIS + THIS + CLOSE_PARENTHESIS + SEMI_COLAN
- + NEW_LINE + FOUR_SPACE_INDENTATION + CLOSE_CURLY_BRACKET;
- }
-
- /**
- * Returns the Default constructor strings for class file.
- *
- * @param name name of the class
- * @param modifierType modifier type for default constructor
- * @return Default constructor for class
- */
- private static String getDefaultConstructor(String name, String modifierType) {
- return FOUR_SPACE_INDENTATION + modifierType + SPACE + name + OPEN_PARENTHESIS + CLOSE_PARENTHESIS + SPACE
- + OPEN_CURLY_BRACKET + NEW_LINE + FOUR_SPACE_INDENTATION + CLOSE_CURLY_BRACKET;
- }
-
- /**
- * Returns to string method's open strings.
- *
- * @return string method's open string
- */
- static String getToStringMethodOpen() {
- return getOverRideString() + FOUR_SPACE_INDENTATION + PUBLIC + SPACE + STRING_DATA_TYPE + SPACE + TO
- + STRING_DATA_TYPE + OPEN_PARENTHESIS + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE
- + EIGHT_SPACE_INDENTATION + RETURN + GOOGLE_MORE_OBJECT_METHOD_STRING + NEW_LINE;
- }
-
- /**
- * Returns whether the data type is of primitive data type.
- *
- * @param dataType data type to be checked
- * @return true, if data type can have primitive data type, false otherwise
- */
- private static boolean isPrimitiveDataType(YangDataTypes dataType) {
- return dataType == INT8
- || dataType == INT16
- || dataType == INT32
- || dataType == INT64
- || dataType == UINT8
- || dataType == UINT16
- || dataType == UINT32
- || dataType == UINT64
- || dataType == DECIMAL64
- || dataType == BOOLEAN
- || dataType == EMPTY;
-
- }
-
- private static String getAttrTypeForFilterContentMatchWhenPrimitiveDataType(String attributeName) {
- return APP_INSTANCE + PERIOD + attributeName + OPEN_PARENTHESIS + CLOSE_PARENTHESIS
- + SPACE + NOT + EQUAL + SPACE + attributeName + OPEN_PARENTHESIS
- + CLOSE_PARENTHESIS;
- }
-
- private static String getAttrTypeForFilterContentMatchWhenNonPrimitiveDataTypes(String attributeName) {
- return APP_INSTANCE + PERIOD + attributeName + OPEN_PARENTHESIS + CLOSE_PARENTHESIS
- + SPACE + EQUAL + EQUAL + SPACE + NULL + SPACE + OR_OPERATION + SPACE
- + NOT + OPEN_PARENTHESIS + attributeName + OPEN_PARENTHESIS + CLOSE_PARENTHESIS
- + PERIOD + EQUALS_STRING + OPEN_PARENTHESIS + APP_INSTANCE + PERIOD
- + attributeName + OPEN_PARENTHESIS + CLOSE_PARENTHESIS
- + CLOSE_PARENTHESIS + CLOSE_PARENTHESIS;
- }
-
- private static String getIfFilterContentMatchMethodImpl(String attributeName,
- YangType dataType) {
- String attrQualifiedType;
-
- if (isPrimitiveDataType(dataType.getDataType())) {
- attrQualifiedType = getAttrTypeForFilterContentMatchWhenPrimitiveDataType(attributeName);
- } else if (dataType.getDataType() == LEAFREF) {
- YangType type = ((YangLeafRef) dataType.getDataTypeExtendedInfo()).getEffectiveDataType();
- if (isPrimitiveDataType(type.getDataType())) {
- attrQualifiedType = getAttrTypeForFilterContentMatchWhenPrimitiveDataType(attributeName);
- } else {
- attrQualifiedType = getAttrTypeForFilterContentMatchWhenNonPrimitiveDataTypes(attributeName);
- }
- } else {
- attrQualifiedType = getAttrTypeForFilterContentMatchWhenNonPrimitiveDataTypes(attributeName);
- }
-
- return attrQualifiedType;
- }
-
- /**
- * Returns string for is filter content match method.
- *
- * @param curNode current YANG node
- * @param pluginConfig plugin configurations
- * @return string for is filter content match method
- */
- static String getIsFilterContentMatch(YangNode curNode, YangPluginConfig pluginConfig) {
-
- String filterMethod = getOverRideString();
- TempJavaBeanFragmentFiles tempFragmentFiles = ((JavaCodeGeneratorInfo) curNode)
- .getTempJavaCodeFragmentFiles().getBeanTempFiles();
- JavaFileInfo javaFileInfo = ((JavaFileInfoContainer) curNode).getJavaFileInfo();
- if (curNode instanceof YangLeavesHolder) {
- filterMethod = filterMethod + FOUR_SPACE_INDENTATION + PUBLIC + SPACE + BOOLEAN_DATA_TYPE
- + SPACE + FILTER_CONTENT_MATCH + OPEN_PARENTHESIS + getCapitalCase(javaFileInfo.getJavaName())
- + SPACE + APP_INSTANCE + CLOSE_PARENTHESIS + SPACE
- + OPEN_CURLY_BRACKET + NEW_LINE;
- if (curNode instanceof YangAugmentableNode) {
- filterMethod = filterMethod + getAugmentableOpParamSyntax();
- }
-
- YangLeavesHolder leavesHolder = (YangLeavesHolder) curNode;
- List<YangLeaf> leaves = leavesHolder.getListOfLeaf();
- List<YangLeafList> listOfLeafList = leavesHolder.getListOfLeafList();
- String attrQualifiedType;
- if (leaves != null) {
- for (YangLeaf leaf : leaves) {
- JavaAttributeInfo javaAttributeInfo = getJavaAttributeOfLeaf(tempFragmentFiles, leaf,
- pluginConfig);
- String attributeName = javaAttributeInfo.getAttributeName();
- attrQualifiedType = getIfFilterContentMatchMethodImpl(attributeName,
- leaf.getDataType());
- filterMethod = filterMethod + EIGHT_SPACE_INDENTATION + IF + SPACE + OPEN_PARENTHESIS
- + GET_FILTER_LEAF + OPEN_PARENTHESIS + CLOSE_PARENTHESIS + PERIOD + GET_METHOD_PREFIX
- + OPEN_PARENTHESIS + LEAF_IDENTIFIER + PERIOD + attributeName.toUpperCase() + PERIOD +
- GET_LEAF_INDEX
- + CLOSE_PARENTHESIS + CLOSE_PARENTHESIS
- + SPACE + OPEN_CURLY_BRACKET + NEW_LINE + TWELVE_SPACE_INDENTATION + IF + SPACE
- + OPEN_PARENTHESIS + attrQualifiedType + CLOSE_PARENTHESIS + SPACE
- + OPEN_CURLY_BRACKET + NEW_LINE + SIXTEEN_SPACE_INDENTATION + RETURN + SPACE + FALSE
- + SEMI_COLAN + NEW_LINE + TWELVE_SPACE_INDENTATION + CLOSE_CURLY_BRACKET + NEW_LINE
- + EIGHT_SPACE_INDENTATION + CLOSE_CURLY_BRACKET + NEW_LINE + NEW_LINE;
- }
- }
-
- if (listOfLeafList != null) {
- for (YangLeafList leafList : listOfLeafList) {
- JavaAttributeInfo javaAttributeInfo = getJavaAttributeOfLeafList(tempFragmentFiles, leafList,
- pluginConfig);
- String attributeName = javaAttributeInfo.getAttributeName();
- filterMethod = filterMethod + getIsFileContentMatchForLists(getCapitalCase(attributeName), true,
- javaAttributeInfo.getImportInfo().getClassInfo());
- }
- }
- YangNode tempNode = curNode.getChild();
- JavaFileInfo fileInfo;
- String name;
- while (tempNode != null) {
- if (tempNode instanceof YangIsFilterContentNodes) {
- fileInfo = ((JavaFileInfoContainer) tempNode).getJavaFileInfo();
- name = getCapitalCase(fileInfo.getJavaName());
- if (tempNode instanceof YangList) {
- filterMethod = filterMethod +
- getIsFileContentMatchForLists(name, false, null);
- } else {
-
- filterMethod = filterMethod + getIsFilerContentMatchForChildNode(name);
- }
- }
- tempNode = tempNode.getNextSibling();
- }
-
- filterMethod = filterMethod + EIGHT_SPACE_INDENTATION + RETURN + SPACE + TRUE + SEMI_COLAN +
- NEW_LINE + FOUR_SPACE_INDENTATION + CLOSE_CURLY_BRACKET + NEW_LINE;
-
- }
- return filterMethod;
- }
-
- /**
- * Returns filter content match for child nodes.
- *
- * @param name name of node
- * @return filter content match for child nodes
- */
- private static String getIsFilerContentMatchForChildNode(String name) {
- name = getSmallCase(name);
- String method = EIGHT_SPACE_INDENTATION + IF + SPACE + OPEN_PARENTHESIS + name + OPEN_PARENTHESIS +
- CLOSE_PARENTHESIS + SPACE + NOT + EQUAL + SPACE + NULL + CLOSE_PARENTHESIS + SPACE +
- OPEN_CURLY_BRACKET + NEW_LINE + TWELVE_SPACE_INDENTATION + IF + SPACE + OPEN_PARENTHESIS + APP_INSTANCE
- + PERIOD + name + OPEN_PARENTHESIS + CLOSE_PARENTHESIS + SPACE + EQUAL
- + EQUAL + SPACE + NULL + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE +
- SIXTEEN_SPACE_INDENTATION + RETURN + SPACE + FALSE + NEW_LINE + TWELVE_SPACE_INDENTATION +
- CLOSE_CURLY_BRACKET + NEW_LINE;
- return method + TWELVE_SPACE_INDENTATION + IF + SPACE + OPEN_PARENTHESIS + name + OPEN_PARENTHESIS +
- CLOSE_PARENTHESIS + PERIOD + FILTER_CONTENT_MATCH + OPEN_PARENTHESIS + APP_INSTANCE + PERIOD + name +
- OPEN_PARENTHESIS + CLOSE_PARENTHESIS + CLOSE_PARENTHESIS + CLOSE_PARENTHESIS + SPACE +
- OPEN_CURLY_BRACKET + NEW_LINE + SIXTEEN_SPACE_INDENTATION + RETURN + SPACE + FALSE + SEMI_COLAN +
- NEW_LINE + TWELVE_SPACE_INDENTATION + CLOSE_CURLY_BRACKET + NEW_LINE + EIGHT_SPACE_INDENTATION
- + CLOSE_CURLY_BRACKET + NEW_LINE;
- }
-
- /**
- * Returns filter content match for list types.
- *
- * @param name name of node
- * @param isLeafList if for leaf list
- * @param type type of the attribute
- * @return filter content match for list types
- */
- private static String getIsFileContentMatchForLists(String name, boolean isLeafList, String type) {
- String method = EIGHT_SPACE_INDENTATION + IF + SPACE + OPEN_PARENTHESIS + getSmallCase(name) + OPEN_PARENTHESIS
- + CLOSE_PARENTHESIS + SPACE + NOT + EQUAL + SPACE + NULL + SPACE + AND + AND + SPACE + NOT +
- getSmallCase(name) + OPEN_PARENTHESIS + CLOSE_PARENTHESIS + PERIOD + IS_EMPTY +
- CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET
- + NEW_LINE;
- method = method + TWELVE_SPACE_INDENTATION + IF + OPEN_PARENTHESIS + APP_INSTANCE + PERIOD + getSmallCase(name)
- + OPEN_PARENTHESIS
- + CLOSE_PARENTHESIS + SPACE + EQUAL + EQUAL + SPACE + NULL + SPACE + "||" + SPACE +
- getSmallCase(name) + OPEN_PARENTHESIS + CLOSE_PARENTHESIS + PERIOD + IS_EMPTY + CLOSE_PARENTHESIS +
- SPACE + OPEN_CURLY_BRACKET
- + NEW_LINE + SIXTEEN_SPACE_INDENTATION + RETURN + SPACE + FALSE + SEMI_COLAN + NEW_LINE +
- TWELVE_SPACE_INDENTATION + CLOSE_CURLY_BRACKET + NEW_LINE;
- if (isLeafList) {
- if (type.equals(getSmallCase(STRING_DATA_TYPE))) {
- type = STRING_DATA_TYPE;
- }
- method = method + TWELVE_SPACE_INDENTATION + FOR + SPACE + OPEN_PARENTHESIS + type + SPACE +
- getSmallCase(name)
- + SPACE + COLAN + SPACE + getSmallCase(name) + OPEN_PARENTHESIS + CLOSE_PARENTHESIS +
- CLOSE_PARENTHESIS
- + SPACE + OPEN_CURLY_BRACKET + NEW_LINE + SIXTEEN_SPACE_INDENTATION + BOOLEAN_DATA_TYPE + SPACE +
- FLAG + SPACE + EQUAL + SPACE + FALSE + SEMI_COLAN + NEW_LINE;
- method = method + SIXTEEN_SPACE_INDENTATION + FOR + SPACE + OPEN_PARENTHESIS + type + SPACE +
- UNDER_SCORE + getSmallCase(name)
- + SPACE + COLAN + SPACE + APP_INSTANCE + PERIOD + getSmallCase(name) + OPEN_PARENTHESIS
- + CLOSE_PARENTHESIS + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE;
- method = method + TWENTY_SPACE_INDENTATION + IF + SPACE + OPEN_PARENTHESIS + getSmallCase(name) + PERIOD;
- } else {
- method = method + TWELVE_SPACE_INDENTATION + FOR + SPACE + OPEN_PARENTHESIS + name + SPACE +
- getSmallCase(name)
- + SPACE + COLAN + SPACE + getSmallCase(name) + OPEN_PARENTHESIS + CLOSE_PARENTHESIS +
- CLOSE_PARENTHESIS
- + SPACE + OPEN_CURLY_BRACKET + NEW_LINE + SIXTEEN_SPACE_INDENTATION + BOOLEAN_DATA_TYPE + SPACE +
- FLAG + SPACE + EQUAL + SPACE + FALSE + SEMI_COLAN + NEW_LINE;
- method = method + SIXTEEN_SPACE_INDENTATION + FOR + SPACE + OPEN_PARENTHESIS + name + SPACE +
- UNDER_SCORE + getSmallCase(name)
- + SPACE + COLAN + SPACE + APP_INSTANCE + PERIOD + getSmallCase(name) + OPEN_PARENTHESIS
- + CLOSE_PARENTHESIS + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE;
- method = method + TWENTY_SPACE_INDENTATION + IF + SPACE + OPEN_PARENTHESIS + getSmallCase(name) + PERIOD;
- }
- if (!isLeafList) {
- method = method + FILTER_CONTENT_MATCH;
- } else {
- method = method + EQUALS_STRING;
- }
- method = method + OPEN_PARENTHESIS + UNDER_SCORE + getSmallCase(name) + CLOSE_PARENTHESIS + CLOSE_PARENTHESIS
- + SPACE +
- OPEN_CURLY_BRACKET + NEW_LINE + TWENTY_FOUR_SPACE_INDENTATION + FLAG + SPACE + EQUAL + SPACE + TRUE +
- SEMI_COLAN
- + NEW_LINE + TWENTY_FOUR_SPACE_INDENTATION + BREAK + SEMI_COLAN + NEW_LINE + TWENTY_SPACE_INDENTATION
- + CLOSE_CURLY_BRACKET + NEW_LINE + SIXTEEN_SPACE_INDENTATION + CLOSE_CURLY_BRACKET + NEW_LINE;
-
- method = method + SIXTEEN_SPACE_INDENTATION + IF + SPACE + OPEN_PARENTHESIS + FLAG + SPACE + EQUAL + EQUAL
- + SPACE + FALSE + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE + TWENTY_SPACE_INDENTATION
- + RETURN + SPACE + FALSE + SEMI_COLAN + NEW_LINE + SIXTEEN_SPACE_INDENTATION + CLOSE_CURLY_BRACKET +
- NEW_LINE;
- return method + TWELVE_SPACE_INDENTATION + CLOSE_CURLY_BRACKET + NEW_LINE + EIGHT_SPACE_INDENTATION +
- CLOSE_CURLY_BRACKET + NEW_LINE + NEW_LINE;
-
- }
-
- //Returns method string for op params augmented syntax
- private static String getAugmentableOpParamSyntax() {
- return EIGHT_SPACE_INDENTATION + FOR + SPACE + OPEN_PARENTHESIS + OBJECT_STRING + SPACE +
- getSmallCase(YANG_AUGMENTED_INFO) + SPACE + COLAN + SPACE + THIS +
- PERIOD + getSmallCase(YANG_AUGMENTED_INFO) + MAP + OPEN_PARENTHESIS + CLOSE_PARENTHESIS + PERIOD
- + VALUE + "s" + OPEN_PARENTHESIS + CLOSE_PARENTHESIS + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET +
- NEW_LINE + TWELVE_SPACE_INDENTATION + OBJECT_STRING + SPACE +
- getSmallCase(YANG_AUGMENTED_OP_PARAM_INFO) + SPACE + EQUAL + SPACE + APP_INSTANCE + PERIOD +
- getSmallCase(YANG_AUGMENTED_INFO) + OPEN_PARENTHESIS + APP_INSTANCE + PERIOD + GET_CLASS +
- CLOSE_PARENTHESIS + SEMI_COLAN +
- NEW_LINE + TWELVE_SPACE_INDENTATION
- + BOOLEAN_DATA_TYPE + SPACE + FILTER_CONTENT_MATCH + SPACE + EQUAL + SPACE + FALSE + SEMI_COLAN
- + NEW_LINE + TWELVE_SPACE_INDENTATION + TRY + SPACE + OPEN_CURLY_BRACKET + NEW_LINE +
- SIXTEEN_SPACE_INDENTATION +
- FILTER_CONTENT_MATCH + SPACE + EQUAL + SPACE + OPEN_PARENTHESIS
- + BOOLEAN_DATA_TYPE + CLOSE_PARENTHESIS + SPACE + getSmallCase(YANG_AUGMENTED_INFO) + PERIOD +
- GET_CLASS + NEW_LINE + TWENTY_SPACE_INDENTATION + PERIOD + GET_METHOD
- + OPEN_PARENTHESIS + QUOTES + FILTER_CONTENT_MATCH + QUOTES + COMMA + SPACE + OBJECT_STRING + PERIOD
- + CLASS + CLOSE_PARENTHESIS + PERIOD + INVOKE + OPEN_PARENTHESIS + getSmallCase(YANG_AUGMENTED_INFO) +
- NEW_LINE + TWENTY_FOUR_SPACE_INDENTATION + PERIOD + GET_CLASS + COMMA + SPACE +
- getSmallCase(YANG_AUGMENTED_OP_PARAM_INFO)
- + CLOSE_PARENTHESIS + SEMI_COLAN + NEW_LINE
- + TWELVE_SPACE_INDENTATION + CLOSE_CURLY_BRACKET + SPACE + CATCH + OPEN_PARENTHESIS
- + NO_SUCH_METHOD_EXCEPTION + " | " + INVOCATION_TARGET_EXCEPTION + " | " + ILLEGAL_ACCESS_EXCEPTION +
- SPACE + EXCEPTION_VAR + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE
- + SIXTEEN_SPACE_INDENTATION + RETURN + SPACE + FALSE + SEMI_COLAN + NEW_LINE + TWELVE_SPACE_INDENTATION
- + CLOSE_CURLY_BRACKET + NEW_LINE + TWELVE_SPACE_INDENTATION
- + IF + OPEN_PARENTHESIS + NOT + FILTER_CONTENT_MATCH + CLOSE_PARENTHESIS +
- SPACE + OPEN_CURLY_BRACKET + NEW_LINE + SIXTEEN_SPACE_INDENTATION + RETURN + SPACE + FALSE +
- SEMI_COLAN + NEW_LINE + TWELVE_SPACE_INDENTATION
- + CLOSE_CURLY_BRACKET + NEW_LINE + EIGHT_SPACE_INDENTATION + CLOSE_CURLY_BRACKET + NEW_LINE;
- }
-
- /*
- * Returns omit null value string.
- *
- * @return omit null value string
- */
- static String getOmitNullValueString() {
- return TWELVE_SPACE_INDENTATION + PERIOD + OMIT_NULL_VALUE_STRING + NEW_LINE;
- }
-
- /**
- * Returns to string method's close string.
- *
- * @return to string method close string
- */
- static String getToStringMethodClose() {
- return TWELVE_SPACE_INDENTATION + PERIOD + TO + STRING_DATA_TYPE + OPEN_PARENTHESIS + CLOSE_PARENTHESIS
- + SEMI_COLAN + NEW_LINE + FOUR_SPACE_INDENTATION + CLOSE_CURLY_BRACKET + NEW_LINE;
- }
-
- /**
- * Returns to string method for class.
- *
- * @param attr attribute info
- * @return to string method
- */
- public static String getToStringMethod(JavaAttributeInfo attr) {
-
- String attributeName = attr.getAttributeName();
- return TWELVE_SPACE_INDENTATION + PERIOD + ADD_STRING + OPEN_PARENTHESIS + QUOTES + attributeName + QUOTES
- + COMMA + SPACE + attributeName + CLOSE_PARENTHESIS;
- }
-
- /**
- * Returns from string method's open string.
- *
- * @param className name of the class
- * @param pluginConfig plugin configurations
- * @return from string method's open string
- */
- static String getFromStringMethodSignature(String className, YangPluginConfig pluginConfig) {
- return getJavaDoc(FROM_METHOD, className, false, pluginConfig) + FOUR_SPACE_INDENTATION + PUBLIC + SPACE
- + STATIC + SPACE + className + SPACE + FROM_STRING_METHOD_NAME + OPEN_PARENTHESIS
- + STRING_DATA_TYPE + SPACE + FROM_STRING_PARAM_NAME + CLOSE_PARENTHESIS + SPACE
- + OPEN_CURLY_BRACKET + NEW_LINE;
- }
-
- /**
- * Return from string method's close string.
- *
- * @return from string method's close string
- */
- static String getFromStringMethodClose() {
- return EIGHT_SPACE_INDENTATION + RETURN + SPACE + NULL + SEMI_COLAN + NEW_LINE + FOUR_SPACE_INDENTATION +
- CLOSE_CURLY_BRACKET + NEW_LINE;
- }
-
- /**
- * Return from string method's body string.
- *
- * @param attr attribute info
- * @param fromStringAttributeInfo attribute info for the from string wrapper type
- * @return from string method's body string
- */
- public static String getFromStringMethod(JavaAttributeInfo attr,
- JavaAttributeInfo fromStringAttributeInfo) {
-
- return EIGHT_SPACE_INDENTATION + getTrySubString() + NEW_LINE + TWELVE_SPACE_INDENTATION
- + getParsedSubString(attr, fromStringAttributeInfo) + NEW_LINE + TWELVE_SPACE_INDENTATION
- + getReturnOfSubString() + NEW_LINE + EIGHT_SPACE_INDENTATION + getCatchSubString()
- + NEW_LINE + EIGHT_SPACE_INDENTATION + CLOSE_CURLY_BRACKET;
- }
-
- /**
- * Returns sub string with try statement for union's from string method.
- *
- * @return sub string with try statement for union's from string method
- */
- private static String getTrySubString() {
- return TRY + SPACE + OPEN_CURLY_BRACKET;
- }
-
- /**
- * Returns sub string with return statement for union's from string method.
- *
- * @return sub string with return statement for union's from string method
- */
- private static String getReturnOfSubString() {
- return RETURN + SPACE + OF + OPEN_PARENTHESIS + TMP_VAL + CLOSE_PARENTHESIS + SEMI_COLAN;
- }
-
- /**
- * Returns sub string with catch statement for union's from string method.
- *
- * @return sub string with catch statement for union's from string method
- */
- private static String getCatchSubString() {
- return CLOSE_CURLY_BRACKET + SPACE + CATCH + SPACE + OPEN_PARENTHESIS + EXCEPTION + SPACE + EXCEPTION_VAR
- + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET;
- }
-
- /**
- * Returns sub string with parsed statement for union's from string method.
- *
- * @param attr attribute info
- * @return sub string with parsed statement for union's from string method
- */
- private static String getParsedSubString(JavaAttributeInfo attr,
- JavaAttributeInfo fromStringAttributeInfo) {
-
- String targetDataType = getReturnType(attr);
- if (fromStringAttributeInfo.getAttributeType().getDataType() == BITS) {
- String lines = targetDataType + SPACE + TMP_VAL + SPACE + EQUAL + SPACE + NEW + SPACE + targetDataType
- + OPEN_PARENTHESIS + CLOSE_PARENTHESIS + SEMI_COLAN + NEW_LINE;
- lines += TWELVE_SPACE_INDENTATION + FROM_STRING_PARAM_NAME + SPACE + EQUAL + SPACE + FROM_STRING_PARAM_NAME
- + PERIOD + REPLACE_STRING + OPEN_PARENTHESIS + SINGLE_QUOTE + OPEN_CURLY_BRACKET + SINGLE_QUOTE
- + COMMA + SPACE + SINGLE_QUOTE + SPACE + SINGLE_QUOTE + CLOSE_PARENTHESIS + SEMI_COLAN + NEW_LINE;
- lines += TWELVE_SPACE_INDENTATION + FROM_STRING_PARAM_NAME + SPACE + EQUAL + SPACE + FROM_STRING_PARAM_NAME
- + PERIOD + REPLACE_STRING + OPEN_PARENTHESIS + SINGLE_QUOTE + CLOSE_CURLY_BRACKET + SINGLE_QUOTE
- + COMMA + SPACE + SINGLE_QUOTE + SPACE + SINGLE_QUOTE + CLOSE_PARENTHESIS + SEMI_COLAN + NEW_LINE;
- lines += TWELVE_SPACE_INDENTATION + FROM_STRING_PARAM_NAME + SPACE + EQUAL + SPACE + FROM_STRING_PARAM_NAME
- + PERIOD + TRIM_STRING + OPEN_PARENTHESIS + CLOSE_PARENTHESIS + SEMI_COLAN + NEW_LINE;
- lines += TWELVE_SPACE_INDENTATION + STRING_DATA_TYPE + SQUARE_BRACKETS + SPACE + BITS_STRING_ARRAY_VAR
- + SPACE + EQUAL + SPACE + FROM_STRING_PARAM_NAME + PERIOD + SPLIT_STRING + OPEN_PARENTHESIS
- + QUOTES + COMMA + QUOTES + COMMA + SPACE + ZERO + CLOSE_PARENTHESIS + SEMI_COLAN + NEW_LINE;
- lines += TWELVE_SPACE_INDENTATION + FOR + SPACE + OPEN_PARENTHESIS + STRING_DATA_TYPE + SPACE
- + BIT_TEMP_VAR + SPACE + COLON + SPACE + BITS_STRING_ARRAY_VAR + CLOSE_PARENTHESIS + SPACE
- + OPEN_CURLY_BRACKET + NEW_LINE;
- lines += SIXTEEN_SPACE_INDENTATION + BIT_TEMP_VAR + SPACE + EQUAL + SPACE + BIT_TEMP_VAR + PERIOD
- + TRIM_STRING + OPEN_PARENTHESIS + CLOSE_PARENTHESIS + SEMI_COLAN + NEW_LINE;
- lines += SIXTEEN_SPACE_INDENTATION + TMP_VAL + PERIOD + SET_METHOD_PREFIX + OPEN_PARENTHESIS
- + INTEGER_WRAPPER + PERIOD + PARSE_INT + OPEN_PARENTHESIS + BIT_TEMP_VAR + CLOSE_PARENTHESIS
- + CLOSE_PARENTHESIS + SEMI_COLAN + NEW_LINE;
- lines += TWELVE_SPACE_INDENTATION + CLOSE_CURLY_BRACKET;
- return lines;
- } else if (attr.getAttributeType().getDataType() == BINARY) {
- return targetDataType + SPACE + TMP_VAL + SPACE + EQUAL + SPACE + BASE64 + PERIOD
- + GET_DECODER + OPEN_PARENTHESIS + CLOSE_PARENTHESIS + PERIOD + DECODE + OPEN_PARENTHESIS
- + FROM_STRING_PARAM_NAME + CLOSE_PARENTHESIS + SEMI_COLAN;
- } else {
- String parseFromStringMethod = getParseFromStringMethod(targetDataType,
- fromStringAttributeInfo.getAttributeType());
- return targetDataType + SPACE + TMP_VAL + SPACE + EQUAL + SPACE + parseFromStringMethod
- + OPEN_PARENTHESIS + FROM_STRING_PARAM_NAME + CLOSE_PARENTHESIS + SEMI_COLAN;
- }
- }
-
- /**
- * Returns hash code method open strings.
- *
- * @return hash code method open string
- */
- static String getHashCodeMethodOpen() {
- return getOverRideString() + FOUR_SPACE_INDENTATION + PUBLIC + SPACE + INT + SPACE + HASH_CODE_STRING
- + OPEN_PARENTHESIS + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE +
- EIGHT_SPACE_INDENTATION
- + RETURN + SPACE + OBJECT_STRING + SUFFIX_S + PERIOD + HASH + OPEN_PARENTHESIS + SPACE;
- }
-
- /**
- * Returns hash code methods close string.
- *
- * @param hashcodeString hash code string
- * @return to hash code method close string
- */
- static String getHashCodeMethodClose(String hashcodeString) {
- hashcodeString = trimAtLast(hashcodeString, COMMA);
- hashcodeString = trimAtLast(hashcodeString, SPACE);
- return hashcodeString + CLOSE_PARENTHESIS + SEMI_COLAN + NEW_LINE + FOUR_SPACE_INDENTATION +
- CLOSE_CURLY_BRACKET
- + NEW_LINE;
- }
-
- /**
- * Returns hash code method for class.
- *
- * @param attr attribute info
- * @return hash code method
- */
- public static String getHashCodeMethod(JavaAttributeInfo attr) {
- return attr.getAttributeName() + COMMA + SPACE;
- }
-
- /**
- * Returns equals method open strings.
- *
- * @param className class name
- * @return equals method open string
- */
- static String getEqualsMethodOpen(String className) {
- return getOverRideString() + FOUR_SPACE_INDENTATION + PUBLIC + SPACE + BOOLEAN_DATA_TYPE + SPACE +
- EQUALS_STRING
- + OPEN_PARENTHESIS + OBJECT_STRING + SPACE + OBJ + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET
- + NEW_LINE + getEqualsMethodsCommonIfCondition() + getEqualsMethodsSpecificIfCondition(className);
- }
-
- /**
- * Returns equal methods if condition string.
- *
- * @return if condition string
- */
- private static String getEqualsMethodsCommonIfCondition() {
- return EIGHT_SPACE_INDENTATION + IF + SPACE + OPEN_PARENTHESIS + THIS + SPACE + EQUAL + EQUAL + SPACE + OBJ
- + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE + TWELVE_SPACE_INDENTATION + RETURN + SPACE
- + TRUE + SEMI_COLAN + NEW_LINE + EIGHT_SPACE_INDENTATION + CLOSE_CURLY_BRACKET + NEW_LINE;
- }
-
- /**
- * Returns if condition for specific class object in equals method.
- *
- * @param className class name
- * @return if condition string
- */
- private static String getEqualsMethodsSpecificIfCondition(String className) {
- return EIGHT_SPACE_INDENTATION + IF + SPACE + OPEN_PARENTHESIS + OBJ + INSTANCE_OF + className
- + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE + TWELVE_SPACE_INDENTATION + className
- + SPACE + OTHER + SPACE + EQUAL + SPACE + OPEN_PARENTHESIS + className + CLOSE_PARENTHESIS + SPACE
- + OBJ + SEMI_COLAN + NEW_LINE + TWELVE_SPACE_INDENTATION + RETURN + NEW_LINE;
- }
-
- /**
- * Returns equals methods close string.
- *
- * @param equalMethodString equal method string
- * @return equals method close string
- */
- static String getEqualsMethodClose(String equalMethodString) {
- equalMethodString = trimAtLast(equalMethodString, AND);
- equalMethodString = trimAtLast(equalMethodString, AND);
- equalMethodString = trimAtLast(equalMethodString, SPACE);
- equalMethodString = trimAtLast(equalMethodString, NEW_LINE) + SEMI_COLAN + NEW_LINE;
- return equalMethodString + EIGHT_SPACE_INDENTATION + CLOSE_CURLY_BRACKET + NEW_LINE + EIGHT_SPACE_INDENTATION
- + RETURN + SPACE + FALSE + SEMI_COLAN + NEW_LINE + FOUR_SPACE_INDENTATION + CLOSE_CURLY_BRACKET
- + NEW_LINE;
- }
-
- /**
- * Returns equals method for class.
- *
- * @param attr attribute info
- * @return equals method
- */
- public static String getEqualsMethod(JavaAttributeInfo attr) {
-
- String attributeName = attr.getAttributeName();
- return SIXTEEN_SPACE_INDENTATION + SPACE + OBJECT_STRING + SUFFIX_S + PERIOD + EQUALS_STRING + OPEN_PARENTHESIS
- + attributeName + COMMA + SPACE + OTHER + PERIOD + attributeName + CLOSE_PARENTHESIS + SPACE + AND
- + AND;
- }
-
- /**
- * Returns of method string for class.
- *
- * @param name class name
- * @param attr attribute info
- * @return of method string
- */
- static String getOfMethod(String name, JavaAttributeInfo attr) {
-
- String attrQualifiedType = getReturnType(attr);
-
- return FOUR_SPACE_INDENTATION + PUBLIC + SPACE + STATIC + SPACE + name + SPACE + OF + OPEN_PARENTHESIS
- + attrQualifiedType + SPACE + VALUE + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE
- + EIGHT_SPACE_INDENTATION + RETURN + SPACE + NEW + SPACE + name + OPEN_PARENTHESIS + VALUE
- + CLOSE_PARENTHESIS + SEMI_COLAN + NEW_LINE + FOUR_SPACE_INDENTATION + CLOSE_CURLY_BRACKET + NEW_LINE;
- }
-
- /**
- * Returns of method's string and java doc for special type.
- *
- * @param attr attribute info
- * @param generatedJavaClassName class name
- * @param pluginConfig plugin configurations
- * @return of method's string and java doc for special type
- */
- public static String getOfMethodStringAndJavaDoc(JavaAttributeInfo attr, String generatedJavaClassName,
- YangPluginConfig pluginConfig) {
-
- String attrType = getReturnType(attr);
- String attrName = attr.getAttributeName();
-
- return getJavaDoc(OF_METHOD, generatedJavaClassName + " for type " + attrName, false, pluginConfig)
- + getOfMethodString(attrType, generatedJavaClassName);
- }
-
- /**
- * Returns of method's string.
- *
- * @param type data type
- * @param className class name
- * @return of method's string
- */
- private static String getOfMethodString(String type, String className) {
-
- return FOUR_SPACE_INDENTATION + PUBLIC + SPACE + STATIC + SPACE + className + SPACE + OF + OPEN_PARENTHESIS
- + type + SPACE + VALUE + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE
- + EIGHT_SPACE_INDENTATION + RETURN + SPACE + NEW + SPACE + className + OPEN_PARENTHESIS + VALUE
- + CLOSE_PARENTHESIS + SEMI_COLAN + NEW_LINE + FOUR_SPACE_INDENTATION + CLOSE_CURLY_BRACKET;
- }
-
- /**
- * Returns string and java doc for constructor of type class.
- *
- * @param attr attribute info
- * @param generatedJavaClassName class name
- * @param pluginConfig plugin configurations
- * @return string and java doc for constructor of type class
- */
- public static String getTypeConstructorStringAndJavaDoc(JavaAttributeInfo attr,
- String generatedJavaClassName,
- YangPluginConfig pluginConfig) {
-
- String attrType = getReturnType(attr);
- String attrName = attr.getAttributeName();
-
- return getJavaDoc(TYPE_CONSTRUCTOR, generatedJavaClassName + " for type " + attrName, false, pluginConfig)
- + getTypeConstructorString(attrType, attrName, generatedJavaClassName);
- }
-
- /**
- * Returns string and java doc for constructor of type class.
- *
- * @param attr1 first attribute info
- * @param attr2 second attribute info
- * @param generatedJavaClassName class name
- * @param pluginConfig plugin config
- * @param type conflict validate type
- * @param addFirst whether int came first or uInt came first
- * @return string and java doc for constructor of type class
- */
- public static String getTypeConstructorStringAndJavaDoc(JavaAttributeInfo attr1, JavaAttributeInfo
- attr2, String generatedJavaClassName, YangPluginConfig pluginConfig, ValidatorTypeForUnionTypes type,
- boolean addFirst) {
-
- String attrType = getReturnType(attr1);
- String attrName1 = "";
- String attrName2 = "";
- if (attr1 != null) {
- attrName1 = attr1.getAttributeName();
- }
- if (attr2 != null) {
- attrName2 = attr2.getAttributeName();
- }
-
- return getJavaDoc(TYPE_CONSTRUCTOR, generatedJavaClassName + " for type " + attrName1, false, pluginConfig)
- + getTypeConstructorString(attrType, attrName1, attrName2, generatedJavaClassName, type, addFirst);
- }
-
- /**
- * Returns type constructor string.
- *
- * @param type data type
- * @param name attribute name
- * @param className class name
- * @return type constructor string
- */
- private static String getTypeConstructorString(String type, String name, String className) {
-
- return FOUR_SPACE_INDENTATION + PUBLIC + SPACE + className + OPEN_PARENTHESIS + type + SPACE + VALUE
- + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE + EIGHT_SPACE_INDENTATION + THIS + PERIOD
- + name + SPACE + EQUAL + SPACE + VALUE + SEMI_COLAN + NEW_LINE + FOUR_SPACE_INDENTATION
- + CLOSE_CURLY_BRACKET;
- }
-
- /**
- * Returns type constructor string.
- *
- * @param type data type
- * @param attr1 attribute attr1
- * @param className class attr1
- * @return type constructor string
- */
- private static String getTypeConstructorString(String type, String attr1, String attr2, String className,
- ValidatorTypeForUnionTypes validatorType, boolean addInt) {
-
- String constructor;
- constructor = FOUR_SPACE_INDENTATION + PUBLIC + SPACE + className + OPEN_PARENTHESIS + type + SPACE + VALUE
- + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE;
-
- String name1;
- String name2;
- if (addInt) {
- name1 = attr1;
- name2 = attr2;
- } else {
- name1 = attr2;
- name2 = attr1;
- }
- constructor = constructor + ifConditionForIntInTypeDefConstructor(validatorType, addInt) +
- TWELVE_SPACE_INDENTATION + THIS + PERIOD
- + name1 + SPACE + EQUAL + SPACE + VALUE + SEMI_COLAN + NEW_LINE + EIGHT_SPACE_INDENTATION
- + CLOSE_CURLY_BRACKET + SPACE + ELSE + SPACE + OPEN_CURLY_BRACKET + NEW_LINE + TWELVE_SPACE_INDENTATION
- + THIS + PERIOD
- + name2 + SPACE + EQUAL + SPACE + VALUE + SEMI_COLAN + NEW_LINE + EIGHT_SPACE_INDENTATION
- + CLOSE_CURLY_BRACKET + NEW_LINE + FOUR_SPACE_INDENTATION
- + CLOSE_CURLY_BRACKET;
-
- return constructor;
- }
-
- /**
- * Returns interface of add augmentation.
- *
- * @return interface of add augmentation
- */
- static String getAddAugmentInfoMethodInterface() {
- return generateForAddAugmentation() + FOUR_SPACE_INDENTATION + VOID + SPACE +
- ADD_STRING + YANG_AUGMENTED_INFO + OPEN_PARENTHESIS + OBJECT_STRING + SPACE + VALUE + COMMA +
- SPACE + CLASS_STRING + SPACE + CLASS + OBJECT_STRING + CLOSE_PARENTHESIS + SEMI_COLAN + NEW_LINE;
- }
-
- /**
- * Returns implementation of add augmentation.
- *
- * @return implementation of add augmentation
- */
- static String getAddAugmentInfoMethodImpl() {
- return getOverRideString() + FOUR_SPACE_INDENTATION + PUBLIC + SPACE + VOID + SPACE +
- ADD_STRING + YANG_AUGMENTED_INFO + OPEN_PARENTHESIS + OBJECT_STRING + SPACE + VALUE + COMMA +
- SPACE + CLASS_STRING + SPACE + CLASS + OBJECT_STRING + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET +
- NEW_LINE + EIGHT_SPACE_INDENTATION + getSmallCase(YANG_AUGMENTED_INFO) + MAP + PERIOD + PUT +
- OPEN_PARENTHESIS + CLASS + OBJECT_STRING + COMMA + SPACE + VALUE +
- CLOSE_PARENTHESIS + SEMI_COLAN + NEW_LINE + FOUR_SPACE_INDENTATION +
- CLOSE_CURLY_BRACKET + NEW_LINE;
- }
-
- /**
- * Returns interface of get YANG augment info.
- *
- * @return interface of get YANG augment info
- */
- static String getYangAugmentInfoInterface() {
- return generateForGetAugmentation() + FOUR_SPACE_INDENTATION + OBJECT_STRING + SPACE +
- getSmallCase(YANG_AUGMENTED_INFO) + OPEN_PARENTHESIS + CLASS_STRING + SPACE + CLASS + OBJECT_STRING +
- CLOSE_PARENTHESIS + SEMI_COLAN + NEW_LINE;
- }
-
- /**
- * Returns implementation of get YANG augment info.
- *
- * @return implementation of get YANG augment info
- */
- static String getYangAugmentInfoImpl() {
- return getOverRideString() + FOUR_SPACE_INDENTATION + PUBLIC + SPACE +
- OBJECT_STRING + SPACE +
- getSmallCase(YANG_AUGMENTED_INFO) + OPEN_PARENTHESIS + CLASS_STRING + SPACE + CLASS + OBJECT_STRING +
- CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE + EIGHT_SPACE_INDENTATION +
- RETURN + SPACE + getSmallCase(YANG_AUGMENTED_INFO) + MAP + PERIOD + GET + OPEN_PARENTHESIS + CLASS +
- OBJECT_STRING + CLOSE_PARENTHESIS + SEMI_COLAN + NEW_LINE + FOUR_SPACE_INDENTATION +
- CLOSE_CURLY_BRACKET + NEW_LINE;
- }
-
- /**
- * Returns implementation of get YANG augment info.
- *
- * @return implementation of get YANG augment info
- */
- static String getYangAugmentInfoMapInterface(YangPluginConfig pluginConfig) {
- return getJavaDoc(GETTER_METHOD, getSmallCase(YANG_AUGMENTED_INFO) + MAP, false, pluginConfig)
- + FOUR_SPACE_INDENTATION + MAP + DIAMOND_OPEN_BRACKET + CLASS_STRING + DIAMOND_OPEN_BRACKET +
- QUESTION_MARK + DIAMOND_CLOSE_BRACKET + COMMA + SPACE + OBJECT_STRING + DIAMOND_CLOSE_BRACKET +
- SPACE + getSmallCase(YANG_AUGMENTED_INFO) + MAP + OPEN_PARENTHESIS +
- CLOSE_PARENTHESIS + SEMI_COLAN + NEW_LINE;
- }
-
- /**
- * Returns implementation of get YANG augment info.
- *
- * @return implementation of get YANG augment info
- */
- static String getYangAugmentInfoMapImpl() {
- return getOverRideString()
- + FOUR_SPACE_INDENTATION + PUBLIC + SPACE +
- MAP + DIAMOND_OPEN_BRACKET + CLASS_STRING + DIAMOND_OPEN_BRACKET + QUESTION_MARK +
- DIAMOND_CLOSE_BRACKET + COMMA + SPACE + OBJECT_STRING + DIAMOND_CLOSE_BRACKET + SPACE +
- getSmallCase(YANG_AUGMENTED_INFO) + MAP + OPEN_PARENTHESIS +
- CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE + EIGHT_SPACE_INDENTATION +
- RETURN + SPACE + getSmallCase(YANG_AUGMENTED_INFO) + MAP + SEMI_COLAN + NEW_LINE
- + FOUR_SPACE_INDENTATION + CLOSE_CURLY_BRACKET + NEW_LINE;
- }
-
- /**
- * Returns enum's constructor.
- *
- * @param className enum's class name
- * @return enum's constructor
- */
- static String getEnumsConstructor(String className) {
- return FOUR_SPACE_INDENTATION + className + OPEN_PARENTHESIS + INT + SPACE + VALUE + CLOSE_PARENTHESIS + SPACE
- + OPEN_CURLY_BRACKET + NEW_LINE + EIGHT_SPACE_INDENTATION + getSmallCase(className) + SPACE + EQUAL
- + SPACE + VALUE + SEMI_COLAN + NEW_LINE + FOUR_SPACE_INDENTATION + CLOSE_CURLY_BRACKET;
- }
-
- /**
- * Returns of method for enum class.
- *
- * @param className class name
- * @param attr java attribute
- * @param enumMap enum's sets map
- * @param enumList enum's sets list
- * @param pluginConfig plugin configurations
- * @return of method
- */
- static String getEnumsOfMethod(String className, JavaAttributeInfo attr,
- Map<String, Integer> enumMap, List<String> enumList,
- YangPluginConfig pluginConfig) {
- String attrType = getReturnType(attr);
- String attrName = attr.getAttributeName();
-
- String method = FOUR_SPACE_INDENTATION + PUBLIC + SPACE + STATIC + SPACE + getCapitalCase(className) + SPACE
- + OF + OPEN_PARENTHESIS
- + attrType + SPACE + VALUE + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE
- + EIGHT_SPACE_INDENTATION + SWITCH + SPACE + OPEN_PARENTHESIS + VALUE
- + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE;
- int value;
- for (String str : enumList) {
-
- value = enumMap.get(str);
- method = method + TWELVE_SPACE_INDENTATION + CASE + SPACE + value + COLON + NEW_LINE
- + SIXTEEN_SPACE_INDENTATION + RETURN + SPACE + getCapitalCase(className) + PERIOD
- + str + SEMI_COLAN + NEW_LINE;
- }
- method = method + TWELVE_SPACE_INDENTATION + DEFAULT + SPACE + COLON + NEW_LINE + SIXTEEN_SPACE_INDENTATION
- + RETURN + SPACE + NULL + SEMI_COLAN + NEW_LINE + EIGHT_SPACE_INDENTATION + CLOSE_CURLY_BRACKET
- + NEW_LINE + FOUR_SPACE_INDENTATION + CLOSE_CURLY_BRACKET;
-
- return getJavaDoc(OF_METHOD, getCapitalCase(className) + " for type " + attrName, false, pluginConfig)
- + method;
- }
-
- /**
- * Returns from string method parsed string.
- *
- * @param targetDataType target data type
- * @param yangType YANG type
- * @return parsed string
- */
- private static String getParseFromStringMethod(String targetDataType, YangType<?> yangType) {
-
- YangDataTypes type = yangType.getDataType();
-
- switch (type) {
- case INT8:
- return BYTE_WRAPPER + PERIOD + PARSE_BYTE;
- case INT16:
- return SHORT_WRAPPER + PERIOD + PARSE_SHORT;
- case INT32:
- return INTEGER_WRAPPER + PERIOD + PARSE_INT;
- case INT64:
- return LONG_WRAPPER + PERIOD + PARSE_LONG;
- case UINT8:
- return SHORT_WRAPPER + PERIOD + PARSE_SHORT;
- case UINT16:
- return INTEGER_WRAPPER + PERIOD + PARSE_INT;
- case UINT32:
- return LONG_WRAPPER + PERIOD + PARSE_LONG;
- case UINT64:
- return NEW + SPACE + BIG_INTEGER;
- case DECIMAL64:
- return NEW + SPACE + BIG_DECIMAL;
- case STRING:
- case IDENTITYREF:
- return EMPTY_STRING;
- case EMPTY:
- case BOOLEAN:
- return BOOLEAN_WRAPPER + PERIOD + PARSE_BOOLEAN;
- case BITS:
- case UNION:
- case ENUMERATION:
- case DERIVED:
- return targetDataType + PERIOD + FROM_STRING_METHOD_NAME;
- default:
- throw new TranslatorException("given data type is not supported.");
- }
- }
-
- /**
- * Returns augmented data getter and setter methods for service class.
- *
- * @param parent parent node
- * @return augmented data getter and setter methods for service class
- */
- static String getAugmentsDataMethodForService(YangNode parent) {
- List<YangAtomicPath> targets = getSetOfNodeIdentifiers(parent);
- YangNode augmentedNode;
- String curNodeName;
- String method;
- StringBuilder methods = new StringBuilder();
- String parentName;
- String returnType;
- YangNode methodNode;
- YangPluginConfig pluginConfig = ((JavaFileInfoContainer) parent).getJavaFileInfo().getPluginConfig();
- for (YangAtomicPath nodeId : targets) {
- augmentedNode = nodeId.getResolvedNode().getParent();
- methodNode = nodeId.getResolvedNode();
- if (((JavaFileInfoContainer) methodNode).getJavaFileInfo().getJavaName() != null) {
- curNodeName = ((JavaFileInfoContainer) methodNode).getJavaFileInfo().getJavaName();
- } else {
- curNodeName = getCapitalCase(getCamelCase(methodNode.getName(), pluginConfig
- .getConflictResolver()));
- }
- returnType = getAugmentedClassNameForDataMethods(augmentedNode, parent);
- parentName = getParentNodeNameForDataMethods(augmentedNode, pluginConfig);
- method = generateForGetMethodWithAttribute(returnType)
- + getGetMethodWithArgument(returnType, AUGMENTED + parentName
- + getCapitalCase(curNodeName)) + NEW_LINE;
- methods.append(method);
-
- method = getJavaDoc(MANAGER_SETTER_METHOD, AUGMENTED +
- getCapitalCase(parentName) + getCapitalCase(curNodeName), false, pluginConfig) +
- getSetterForInterface(getSmallCase(AUGMENTED) + parentName +
- getCapitalCase(curNodeName), returnType, parentName,
- false,
- GENERATE_SERVICE_AND_MANAGER) + NEW_LINE;
- methods.append(method);
- }
- return methods.toString();
- }
-
- /**
- * Returns validator method for range in union class.
- *
- * @param type type
- * @return validator method for range in union class
- */
- static String getRangeValidatorMethodForUnion(String type) {
- String newType;
- if (type.contentEquals(BIG_INTEGER)) {
- newType = LONG;
- } else {
- newType = INT;
- }
- String method = generateForValidatorMethod() + FOUR_SPACE_INDENTATION + PRIVATE + SPACE + BOOLEAN_DATA_TYPE +
- SPACE +
- VALIDATE_RANGE +
- OPEN_PARENTHESIS
- + type + SPACE + MIN_RANGE + COMMA + SPACE + type + SPACE + MAX_RANGE + COMMA + SPACE +
- newType + SPACE + VALUE + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE;
- if (type.contentEquals(BIG_INTEGER)) {
- method = method + EIGHT_SPACE_INDENTATION + BIG_INTEGER + SPACE + getSmallCase(BIG_INTEGER)
- + SPACE + EQUAL + SPACE + NEW + SPACE + BIG_INTEGER + OPEN_PARENTHESIS + QUOTES + SPACE +
- QUOTES + SPACE + ADD + SPACE + VALUE + CLOSE_PARENTHESIS + SEMI_COLAN + NEW_LINE +
- EIGHT_SPACE_INDENTATION + RETURN + SPACE + getSmallCase(BIG_INTEGER) + PERIOD + "compareTo"
- + OPEN_PARENTHESIS + MIN_RANGE + CLOSE_PARENTHESIS + SPACE + EQUAL + EQUAL + " 1" + SPACE + AND +
- AND + SPACE + getSmallCase(BIG_INTEGER) + PERIOD + "compareTo" + OPEN_PARENTHESIS + MAX_RANGE +
- CLOSE_PARENTHESIS + SPACE + EQUAL + EQUAL + " 1" + SEMI_COLAN + NEW_LINE;
- } else {
- method = method + EIGHT_SPACE_INDENTATION
- + RETURN + SPACE + VALUE + SPACE + DIAMOND_CLOSE_BRACKET + EQUAL + SPACE + MIN_RANGE + SPACE + AND +
- AND + SPACE + VALUE + DIAMOND_OPEN_BRACKET + EQUAL + SPACE + MAX_RANGE + SEMI_COLAN + NEW_LINE;
- }
- return method + FOUR_SPACE_INDENTATION + CLOSE_CURLY_BRACKET + NEW_LINE;
- }
-
- /**
- * Returns if condition string for typedef constructor.
- *
- * @param type type of conflict
- * @param addFirst true int/long need to be added first
- * @return if condition string for typedef constructor
- */
- private static String ifConditionForIntInTypeDefConstructor(ValidatorTypeForUnionTypes type, boolean addFirst) {
- String condition = EIGHT_SPACE_INDENTATION + IF + SPACE + OPEN_PARENTHESIS + VALIDATE_RANGE + OPEN_PARENTHESIS;
-
- if (type == INT_TYPE_CONFLICT) {
- if (addFirst) {
- condition = condition + INT_MIN_RANGE + COMMA + SPACE + INT_MAX_RANGE + COMMA + SPACE + VALUE;
- } else {
- condition = condition + UINT_MIN_RANGE + COMMA + SPACE + UINT_MAX_RANGE + COMMA + SPACE + VALUE;
- }
- } else {
- if (addFirst) {
- condition = condition + LONG_MIN_RANGE + COMMA + SPACE + LONG_MAX_RANGE + COMMA + SPACE + VALUE;
- } else {
- condition = condition + ULONG_MIN_RANGE + COMMA + SPACE + ULONG_MAX_RANGE + COMMA + SPACE + VALUE;
- }
- }
- return condition + CLOSE_PARENTHESIS + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE;
- }
-
- //Get method with arguments.
- private static String getGetMethodWithArgument(String returnType, String yangName) {
- return FOUR_SPACE_INDENTATION + returnType + SPACE + GET_METHOD_PREFIX + getCapitalCase(yangName)
- + OPEN_PARENTHESIS + returnType + OP_PARAM + SPACE + getSmallCase(returnType) + CLOSE_PARENTHESIS +
- SEMI_COLAN;
- }
-
- /**
- * Returns add to list method interface.
- *
- * @param attr java attribute
- * @return add to list method interface
- */
- public static String getAddToListMethodInterface(JavaAttributeInfo attr) {
- return FOUR_SPACE_INDENTATION + VOID + SPACE + ADD_STRING + getCapitalCase(TO) +
- getCapitalCase(attr.getAttributeName()) + OPEN_PARENTHESIS + getReturnType(attr) + SPACE +
- VALUE + CLOSE_PARENTHESIS + SEMI_COLAN;
- }
-
- /**
- * Returns add to list method impl.
- *
- * @param attr java attribute
- * @return add to list method impl
- */
- public static String getAddToListMethodImpl(JavaAttributeInfo attr) {
- return getOverRideString() + FOUR_SPACE_INDENTATION + PUBLIC + SPACE + VOID + SPACE + ADD_STRING +
- getCapitalCase(TO) + getCapitalCase(attr.getAttributeName()) + OPEN_PARENTHESIS +
- getReturnType(attr) + SPACE + VALUE + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET
- + NEW_LINE + EIGHT_SPACE_INDENTATION + attr.getAttributeName() + OPEN_PARENTHESIS + CLOSE_PARENTHESIS
- + PERIOD + ADD_STRING + OPEN_PARENTHESIS + VALUE + CLOSE_PARENTHESIS + SEMI_COLAN +
- NEW_LINE + FOUR_SPACE_INDENTATION + CLOSE_CURLY_BRACKET;
- }
-
- /**
- * Returns builder method for class.
- *
- * @param name name of class
- * @return builder method for class
- */
- static String builderMethod(String name) {
- return NEW_LINE + generateForBuilderMethod(name) + FOUR_SPACE_INDENTATION + PUBLIC + SPACE + STATIC + SPACE
- + name + BUILDER + SPACE + getSmallCase(BUILDER) + OPEN_PARENTHESIS + CLOSE_PARENTHESIS + SPACE +
- OPEN_CURLY_BRACKET + NEW_LINE + EIGHT_SPACE_INDENTATION + RETURN + SPACE + NEW + SPACE + name +
- BUILDER + OPEN_PARENTHESIS + CLOSE_PARENTHESIS + SEMI_COLAN + NEW_LINE + FOUR_SPACE_INDENTATION +
- CLOSE_CURLY_BRACKET;
- }
-
- /**
- * Returns is filter content match interface.
- *
- * @param name name of node
- * @return is filter content match interface
- */
- static String isFilterContentMatchInterface(String name) {
- String method = " /**\n" +
- " * Checks if the passed " + name + " maps the content match query condition.\n" +
- " *\n" +
- " * @param " + getSmallCase(name) + SPACE + getSmallCase(name) + SPACE + "being passed to check" +
- " for" +
- " content match\n" +
- " * @return match result\n" +
- " */\n";
- return method + FOUR_SPACE_INDENTATION + BOOLEAN_DATA_TYPE + SPACE + FILTER_CONTENT_MATCH + OPEN_PARENTHESIS
- + name + SPACE + getSmallCase(name) + CLOSE_PARENTHESIS + SEMI_COLAN + NEW_LINE;
- }
-
- /**
- * Returns is value set interface.
- *
- * @return is value set interface
- */
- static String isLeafValueSetInterface() {
- String method = " /**\n" +
- " * Checks if the leaf value is set.\n" +
- " *\n" +
- " * @param leaf leaf whose value status needs to checked\n" +
- " * @return result of leaf value set in object\n" +
- " */\n";
- return method + FOUR_SPACE_INDENTATION + BOOLEAN_DATA_TYPE + SPACE + VALUE_LEAF_SET + OPEN_PARENTHESIS
- + LEAF_IDENTIFIER + SPACE + "leaf" + CLOSE_PARENTHESIS + SEMI_COLAN + NEW_LINE;
- }
-
- /**
- * Returns is select leaf set interface.
- *
- * @return is select leaf set interface
- */
- static String isSelectLeafSetInterface() {
- String method = " /**\n" +
- " * Checks if the leaf is set to be a selected leaf.\n" +
- " *\n" +
- " * @param leaf if leaf needs to be selected\n" +
- " * @return result of leaf value set in object\n" +
- " */\n";
- return method + FOUR_SPACE_INDENTATION + BOOLEAN_DATA_TYPE + SPACE + IS_SELECT_LEAF + OPEN_PARENTHESIS
- + LEAF_IDENTIFIER + SPACE + "leaf" + CLOSE_PARENTHESIS + SEMI_COLAN + NEW_LINE;
- }
-
- /**
- * Returns set select leaf set interface.
- *
- * @param name node name
- * @return set select leaf set interface
- */
- static String setSelectLeafSetInterface(String name) {
- String method = " /**\n" +
- " * Set a leaf to be selected.\n" +
- " *\n" +
- " * @param leaf leaf needs to be selected\n" +
- " */\n";
- return method + FOUR_SPACE_INDENTATION + name + BUILDER + SPACE + SET_SELECT_LEAF + OPEN_PARENTHESIS
- + LEAF_IDENTIFIER + SPACE + "leaf" + CLOSE_PARENTHESIS + SEMI_COLAN + NEW_LINE;
- }
-
- /**
- * Returns leaf identifier interface enum signature.
- *
- * @param name name of node
- * @return leaf identifier interface enum signature
- */
- static String getInterfaceLeafIdEnumSignature(String name) {
- String start = " /**\n" +
- " * Identify the leaf of " + name + PERIOD + NEW_LINE +
- " */\n";
- return start + FOUR_SPACE_INDENTATION + PUBLIC + SPACE + ENUM + SPACE + LEAF_IDENTIFIER + SPACE +
- OPEN_CURLY_BRACKET + NEW_LINE;
- }
-
- /**
- * Returns interface leaf identifier enum method.
- *
- * @return interface leaf identifier enum method
- */
- static String getInterfaceLeafIdEnumMethods() {
- return " private int leafIndex;\n" +
- "\n" +
- " public int getLeafIndex() {\n" +
- " return leafIndex;\n" +
- " }\n" +
- "\n" +
- " LeafIdentifier(int value) {\n" +
- " this.leafIndex = value;\n" +
- " }\n" +
- " }\n";
- }
-
- /**
- * Returns getter methods for operation attributes.
- *
- * @return getter methods for operation attributes
- */
- static String getOperationAttributesGetters() {
- return "\n" +
- " /**\n" +
- " * Returns the _valueLeafFlags.\n" +
- " *\n" +
- " * @return value of _valueLeafFlags\n" +
- " */\n" +
- " public BitSet get_valueLeafFlags() {\n" +
- " return _valueLeafFlags;\n" +
- " }\n" +
- "\n" +
- " /**\n" +
- " * Returns the _selectLeafFlags.\n" +
- " *\n" +
- " * @return value of _selectLeafFlags\n" +
- " */\n" +
- " public BitSet get_selectLeafFlags() {\n" +
- " return _selectLeafFlags;\n" +
- " }\n" +
- "\n";
- }
-
- /**
- * Returns getter for operation type.
- *
- * @return getter for operation type
- */
- static String getGetterForOperationType() {
- return " /**\n" +
- " * Returns the _operationType.\n" +
- " *\n" +
- " * @return value of _operationType\n" +
- " */\n" +
- " public OperationType get_operationType() {\n" +
- " return _operationType;\n" +
- " }\n";
- }
-
- /**
- * Returns getters for value and select leaf.
- *
- * @return getters for value and select leaf
- */
- static String getGettersForValueAndSelectLeaf() {
- return "\n" +
- " @Override\n" +
- " public boolean isLeafValueSet(LeafIdentifier leaf) {\n" +
- " return get_valueLeafFlags().get(leaf.getLeafIndex());\n" +
- " }\n" +
- "\n" +
- " @Override\n" +
- " public boolean isSelectLeaf(LeafIdentifier leaf) {\n" +
- " return get_selectLeafFlags().get(leaf.getLeafIndex());\n" +
- " }\n";
- }
-
- /**
- * Returns setter for operation type.
- *
- * @param name name of node
- * @return setter for operation type
- */
- static String getSetterForOperationType(String name) {
- return " /**\n" +
- " * Set operation type.\n" +
- " *\n" +
- " * @param _operationType operation type\n" +
- " */\n" +
- " public " + name + BUILDER + " set_operationType(OperationType _operationType) {\n" +
- " this._operationType = _operationType;\n" +
- " return this;\n" +
- " }\n";
- }
-
- /**
- * Returns setter for select leaf.
- *
- * @param name name of node
- * @param isRootNode if root node
- * @return setter for select leaf
- */
- static String getSetterForSelectLeaf(String name, boolean isRootNode) {
- String append = OVERRIDE;
- if (isRootNode) {
- append = EMPTY_STRING;
- }
- return "\n" +
- " " + append + "\n" +
- " public " + name + BUILDER + " selectLeaf(LeafIdentifier leaf) {\n" +
- " get_selectLeafFlags().set(leaf.getLeafIndex());\n" +
- " return this;\n" +
- " }\n";
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/ValidatorTypeForUnionTypes.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/ValidatorTypeForUnionTypes.java
deleted file mode 100644
index a9890bd..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/ValidatorTypeForUnionTypes.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.translator.tojava.utils;
-
-/**
- * Validator types for union when there is conflict between two types.
- */
-public enum ValidatorTypeForUnionTypes {
-
- /**
- * When conflict is there for int32 and uInt16.
- */
- INT_TYPE_CONFLICT,
-
- /**
- * When conflict is there for int64 and uInt32.
- */
- LONG_TYPE_CONFLICT
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/package-info.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/package-info.java
deleted file mode 100644
index 709e704..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Translator's utils for YANG plugin.
- */
-package org.onosproject.yangutils.translator.tojava.utils;
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/UtilConstants.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/UtilConstants.java
deleted file mode 100644
index 21f2723..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/UtilConstants.java
+++ /dev/null
@@ -1,1390 +0,0 @@
-/*
- * 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.utils;
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * Represents utilities constants which are used while generating java files.
- */
-public final class UtilConstants {
-
- /**
- * JavaDocs for impl class.
- */
- public static final String IMPL_CLASS_JAVA_DOC = " * Represents the implementation of ";
-
- /**
- * JavaDocs for builder class.
- */
- public static final String BUILDER_CLASS_JAVA_DOC = " * Represents the builder implementation of ";
-
- /**
- * JavaDocs for interface class.
- */
- public static final String INTERFACE_JAVA_DOC = " * Abstraction of an entity which represents the"
- + " functionality of ";
-
- /**
- * JavaDocs for event.
- */
- public static final String EVENT_JAVA_DOC = " * Represents event implementation of ";
-
- /**
- * JavaDocs for op param class.
- */
- public static final String OP_PARAM_JAVA_DOC = " * Represents operation parameter implementation of ";
-
- /**
- * JavaDocs for event listener.
- */
- public static final String EVENT_LISTENER_JAVA_DOC = " * Abstraction for event listener of ";
-
- /**
- * JavaDocs for builder interface class.
- */
- public static final String BUILDER_INTERFACE_JAVA_DOC = " * Builder for ";
-
- /**
- * JavaDocs for enum class.
- */
- public static final String ENUM_CLASS_JAVADOC = " * Represents ENUM data of ";
-
- /**
- * JavaDocs for enum attribute.
- */
- public static final String ENUM_ATTRIBUTE_JAVADOC = " * Represents ";
-
- /**
- * JavaDocs for package info class.
- */
- public static final String PACKAGE_INFO_JAVADOC = " * Implementation of YANG node ";
-
- /**
- * JavaDocs for package info class.
- */
- public static final String PACKAGE_INFO_JAVADOC_OF_CHILD = "'s children nodes";
-
- /**
- * JavaDocs's first line.
- */
- public static final String JAVA_DOC_FIRST_LINE = "/**\n";
-
- /**
- * JavaDocs's last line.
- */
- public static final String JAVA_DOC_END_LINE = " */\n";
-
- /**
- * JavaDocs's param annotation.
- */
- public static final String JAVA_DOC_PARAM = " * @param ";
-
- /**
- * JavaDocs's return annotation.
- */
- public static final String JAVA_DOC_RETURN = " * @return ";
-
- /**
- * JavaDocs's description for setter method.
- */
- public static final String JAVA_DOC_SETTERS = " * Returns the builder object of ";
-
- /**
- * JavaDocs's description for add to list method.
- */
- public static final String JAVA_DOC_ADD_TO_LIST = " * Adds to the list of ";
-
- /**
- * JavaDocs's description for setter method.
- */
- public static final String JAVA_DOC_MANAGER_SETTERS = " * Sets the value to attribute ";
-
- /**
- * JavaDocs's description for OF method.
- */
- public static final String JAVA_DOC_OF = " * Returns the object of ";
-
- /**
- * JavaDocs's description for typedef' setter method.
- */
- public static final String JAVA_DOC_SETTERS_COMMON = " * Sets the value of ";
-
- /**
- * JavaDocs's description for getter method.
- */
- public static final String JAVA_DOC_GETTERS = " * Returns the attribute ";
-
- /**
- * JavaDocs's description for getter method.
- */
- public static final String JAVA_DOC_FOR_VALIDATOR = " * Validates if value is in given range.";
-
- /**
- * JavaDocs's description for getter method.
- */
- public static final String JAVA_DOC_FOR_VALIDATOR_RETURN = " * @return true if value is in range";
-
- /**
- * JavaDocs's description for constructor.
- */
- public static final String JAVA_DOC_CONSTRUCTOR = " * Creates an instance of ";
-
- /**
- * JavaDocs's description for build method.
- */
- public static final String JAVA_DOC_BUILD = " * Builds object of ";
-
- /**
- * JavaDocs's return statement for build method.
- */
- public static final String JAVA_DOC_BUILD_RETURN = "object of ";
-
- /**
- * JavaDocs's statement for builder object.
- */
- public static final String BUILDER_OBJECT = "builder object of ";
-
- /**
- * JavaDocs's statement for rpc method.
- */
- public static final String JAVA_DOC_RPC = " * Service interface of ";
-
- /**
- * JavaDocs's statement for rpc's input string.
- */
- public static final String RPC_INPUT_STRING = "input of service interface ";
-
- /**
- * JavaDocs's statement for rpc's output string.
- */
- public static final String RPC_OUTPUT_STRING = "output of service interface ";
-
- /**
- * Static attribute for new line.
- */
- public static final String NEW_LINE = "\n";
-
- /**
- * Static attribute for default.
- */
- public static final String DEFAULT = "default";
-
- /**
- * Static attribute for op param class.
- */
- public static final String OPERATION = "OpParam";
-
- /**
- * Static attribute for java code generation for sbi.
- */
- public static final String SBI = "sbi";
-
- /**
- * Static attribute for multiple new line.
- */
- public static final String MULTIPLE_NEW_LINE = "\n\n";
-
- /**
- * Static attribute for empty line.
- */
- public static final String EMPTY_STRING = "";
-
- /**
- * Static attribute for new line with asterisk.
- */
- public static final String NEW_LINE_ASTERISK = " *\n";
-
- /**
- * Static attribute for period.
- */
- public static final String PERIOD = ".";
-
- /**
- * Static attribute for period.
- */
- public static final String INVOKE = "invoke";
-
- /**
- * Static attribute for parse byte.
- */
- public static final String PARSE_BYTE = "parseByte";
-
- /**
- * Static attribute for parse boolean.
- */
- public static final String PARSE_BOOLEAN = "parseBoolean";
-
- /**
- * Static attribute for parse short.
- */
- public static final String PARSE_SHORT = "parseShort";
-
- /**
- * Static attribute for parse int.
- */
- public static final String PARSE_INT = "parseInt";
-
- /**
- * Static attribute for parse long.
- */
- public static final String PARSE_LONG = "parseLong";
-
- /**
- * Static attribute for base64.
- */
- public static final String BASE64 = "Base64";
-
- /**
- * Static attribute for getEncoder.
- */
- public static final String GET_ENCODER = "getEncoder";
-
- /**
- * Static attribute for encodeToString.
- */
- public static final String ENCODE_TO_STRING = "encodeToString";
-
- /**
- * Static attribute for getDecoder.
- */
- public static final String GET_DECODER = "getDecoder";
-
- /**
- * Static attribute for decode.
- */
- public static final String DECODE = "decode";
-
- /**
- * Static attribute for omit null value.
- */
- public static final String OMIT_NULL_VALUE_STRING = "omitNullValues()";
-
- /**
- * Static attribute for colan.
- */
- public static final String COLAN = ":";
-
- /**
- * Static attribute for underscore.
- */
- public static final String UNDER_SCORE = "_";
-
- /**
- * Static attribute for semi-colan.
- */
- public static final String SEMI_COLAN = ";";
-
- /**
- * Static attribute for hyphen.
- */
- public static final String HYPHEN = "-";
-
- /**
- * Static attribute for space.
- */
- public static final String SPACE = " ";
-
- /**
- * Static attribute for validateRange.
- */
- public static final String VALIDATE_RANGE = "validateRange";
-
- /**
- * Static attribute for minRange.
- */
- public static final String MIN_RANGE = "minRange";
-
- /**
- * Static attribute for maxRange.
- */
- public static final String MAX_RANGE = "maxRange";
-
- /**
- * Static attribute for minRange.
- */
- public static final String INT_MIN_RANGE_ATTR = "static final int INT32_MIN_RANGE = -2147483648;\n";
-
- /**
- * Static attribute for minRange.
- */
- public static final String INT_MIN_RANGE = "INT32_MIN_RANGE";
-
- /**
- * Static attribute for minRange.
- */
- public static final String INT_MAX_RANGE = "INT32_MAX_RANGE";
-
- /**
- * Static attribute for maxRange.
- */
- public static final String INT_MAX_RANGE_ATTR = "static final int INT32_MAX_RANGE = 2147483647;";
-
-
- /**
- * Static attribute for minRange.
- */
- public static final String UINT_MIN_RANGE_ATTR = "static final int UINT16_MIN_RANGE = 0;\n";
-
- /**
- * Static attribute for maxRange.
- */
- public static final String UINT_MAX_RANGE_ATTR = "static final int UINT16_MAX_RANGE = 2147483647;";
-
-
- /**
- * Static attribute for minRange.
- */
- public static final String UINT_MIN_RANGE = "UINT16_MIN_RANGE";
-
- /**
- * Static attribute for maxRange.
- */
- public static final String UINT_MAX_RANGE = "UINT16_MAX_RANGE";
-
- /**
- * Static attribute for minRange.
- */
- public static final String LONG_MIN_RANGE_ATTR = "static final BigInteger INT64_MIN_RANGE =" +
- " new BigInteger(\"-9223372036854775808\");\n";
-
- /**
- * Static attribute for maxRange.
- */
- public static final String LONG_MAX_RANGE_ATTR = "static final BigInteger INT64_MAX_RANGE =" +
- " new BigInteger(\"9223372036854775807\");";
-
- /**
- * Static attribute for minRange.
- */
- public static final String LONG_MIN_RANGE = "INT64_MIN_RANGE";
-
- /**
- * Static attribute for maxRange.
- */
- public static final String LONG_MAX_RANGE = "INT64_MAX_RANGE";
-
- /**
- * Static attribute for minRange.
- */
- public static final String ULONG_MIN_RANGE_ATTR = "static final BigInteger UINT32_MIN_RANGE =" +
- " new BigInteger(\"0\");\n";
-
- /**
- * Static attribute for maxRange.
- */
- public static final String ULONG_MAX_RANGE_ATTR = "static final BigInteger UINT32_MAX_RANGE =" +
- " new BigInteger(\"9223372036854775807\");";
-
-
- /**
- * Static attribute for minRange.
- */
- public static final String ULONG_MIN_RANGE = "UINT32_MIN_RANGE";
-
- /**
- * Static attribute for maxRange.
- */
- public static final String ULONG_MAX_RANGE = "UINT32_MAX_RANGE";
-
- /**
- * Static attribute for subject.
- */
- public static final String SUBJECT = "Subject";
-
- /**
- * Static attribute for ListenerRegistry.
- */
- public static final String LISTENER_REG = "ListenerRegistry";
-
- /**
- * Static attribute for ListenerService.
- */
- public static final String LISTENER_SERVICE = "ListenerService";
-
- /**
- * Static attribute for listener package.
- */
- public static final String ONOS_EVENT_PKG = "org.onosproject.event";
-
- /**
- * Static attribute for colon.
- */
- public static final String COLON = ":";
-
- /**
- * Static attribute for caret.
- */
- public static final String CARET = "^";
-
- /**
- * Static attribute for input string.
- */
- public static final String INPUT = "input";
-
- /**
- * Static attribute for output string.
- */
- public static final String OUTPUT = "output";
-
- /**
- * Static attribute for current string.
- */
- public static final String CURRENT = "current";
-
- /**
- * Static attribute for leafref string.
- */
- public static final String LEAFREF = "leafref";
-
- /**
- * Static attribute for identityref string.
- */
- public static final String IDENTITYREF = "identityref";
-
- /**
- * Static attribute for output variable of rpc.
- */
- public static final String RPC_INPUT_VAR_NAME = "inputVar";
-
- /**
- * Static attribute for new line.
- */
- public static final String EQUAL = "=";
-
- /**
- * Static attribute for slash syntax.
- */
- public static final String SLASH = File.separator;
-
- /**
- * Static attribute for add syntax.
- */
- public static final String ADD = "+";
-
- /**
- * Static attribute for single quote.
- */
- public static final String SINGLE_QUOTE = "\'";
-
- /**
- * Static attribute for quotes.
- */
- public static final String QUOTES = "\"";
-
- /**
- * Static attribute for zero.
- */
- public static final String ZERO = "0";
-
- /**
- * Static attribute for ampersand.
- */
- public static final String AND = "&";
-
- /**
- * Static attribute for comma.
- */
- public static final String COMMA = ",";
-
- /**
- * Static attribute for class.
- */
- public static final String CLASS_STRING = "Class";
-
- /**
- * Static attribute for put.
- */
- public static final String PUT = "put";
-
- /**
- * Static attribute for get.
- */
- public static final String GET = "get";
-
- /**
- * Static attribute for slash character.
- */
- public static final char CHAR_OF_SLASH = '/';
-
- /**
- * Static attribute for open square bracket character.
- */
- public static final char CHAR_OF_OPEN_SQUARE_BRACKET = '[';
-
- /**
- * Static attribute for close square bracket character.
- */
- public static final char CHAR_OF_CLOSE_SQUARE_BRACKET = ']';
-
- /**
- * Static attribute for slash string.
- */
- public static final String SLASH_FOR_STRING = "/";
-
- /**
- * Static attribute for open square bracket.
- */
- public static final String OPEN_SQUARE_BRACKET = "[";
-
- /**
- * Static attribute for ancestor accessor.
- */
- public static final String ANCESTOR_ACCESSOR = "..";
-
- /**
- * Static attribute for ancestor accessor along with path.
- */
- public static final String ANCESTOR_ACCESSOR_IN_PATH = "../";
-
- /**
- * Static attribute for add syntax.
- */
- public static final String ADD_STRING = "add";
-
- /**
- * Static attribute for string replace syntax.
- */
- public static final String REPLACE_STRING = "replace";
-
- /**
- * Static attribute for string trim syntax.
- */
- public static final String TRIM_STRING = "trim";
-
- /**
- * Static attribute for string split syntax.
- */
- public static final String SPLIT_STRING = "split";
-
- /**
- * Static attribute for from syntax.
- */
- public static final String FROM_STRING_METHOD_NAME = "fromString";
-
- /**
- * Static attribute for check not null syntax.
- */
- public static final String CHECK_NOT_NULL_STRING = "checkNotNull";
-
- /**
- * Static attribute for hash code syntax.
- */
- public static final String HASH_CODE_STRING = "hashCode";
-
- /**
- * Static attribute for equals syntax.
- */
- public static final String EQUALS_STRING = "equals";
-
- /**
- * Static attribute for object.
- */
- public static final String OBJECT_STRING = "Object";
-
- /**
- * Static attribute for instance of syntax.
- */
- public static final String INSTANCE_OF = " instanceof ";
-
- /**
- * Static attribute for value syntax.
- */
- public static final String VALUE = "value";
-
- /**
- * Static attribute for suffix s.
- */
- public static final String SUFFIX_S = "s";
-
- /**
- * Static attribute for if.
- */
- public static final String IF = "if";
-
- /**
- * Static attribute for of.
- */
- public static final String OF = "of";
-
- /**
- * Static attribute for other.
- */
- public static final String OTHER = "other";
-
- /**
- * Static attribute for obj syntax.
- */
- public static final String OBJ = "obj";
-
- /**
- * Static attribute for hash syntax.
- */
- public static final String HASH = "hash";
-
- /**
- * Static attribute for to syntax.
- */
- public static final String TO = "to";
-
- /**
- * Static attribute for true syntax.
- */
- public static final String TRUE = "true";
-
- /**
- * Static attribute for false syntax.
- */
- public static final String FALSE = "false";
-
- /**
- * Static attribute for org.
- */
- public static final String ORG = "org";
-
- /**
- * Static attribute for temp.
- */
- public static final String TEMP = "temp";
-
- /**
- * Static attribute for YANG file directory.
- */
- public static final String YANG_RESOURCES = "yang/resources";
-
- /**
- * Static attribute for diamond close bracket syntax.
- */
- public static final String DIAMOND_OPEN_BRACKET = "<";
-
- /**
- * Static attribute for diamond close bracket syntax.
- */
- public static final String DIAMOND_CLOSE_BRACKET = ">";
-
- /**
- * Static attribute for exception syntax.
- */
- public static final String EXCEPTION = "Exception";
-
- /**
- * Static attribute for exception variable syntax.
- */
- public static final String EXCEPTION_VAR = "e";
-
- /**
- * Static attribute for open parenthesis syntax.
- */
- public static final String OPEN_PARENTHESIS = "(";
-
- /**
- * Static attribute for switch syntax.
- */
- public static final String SWITCH = "switch";
-
- /**
- * Static attribute for case syntax.
- */
- public static final String CASE = "case";
-
- /**
- * Static attribute for temp val syntax.
- */
- public static final String TMP_VAL = "tmpVal";
-
- /**
- * Static attribute for close curly bracket syntax.
- */
- public static final String ELSE = "else";
-
- /**
- * From string parameter name.
- */
- public static final String FROM_STRING_PARAM_NAME = "valInString";
-
- /**
- * Static attribute for close parenthesis syntax.
- */
- public static final String CLOSE_PARENTHESIS = ")";
-
- /**
- * Static attribute for open curly bracket syntax.
- */
- public static final String OPEN_CURLY_BRACKET = "{";
-
- /**
- * Static attribute for close curly bracket syntax.
- */
- public static final String CLOSE_CURLY_BRACKET = "}";
-
- /**
- * Static attribute for square brackets syntax.
- */
- public static final String SQUARE_BRACKETS = "[]";
-
- /**
- * Static attribute for getter method prefix.
- */
- public static final String GET_METHOD_PREFIX = "get";
-
- /**
- * Static attribute for getter method prefix.
- */
- public static final String GET_METHOD = "getMethod";
-
- /**
- * Static attribute for getter method prefix.
- */
- public static final String GET_CLASS = "getClass()";
-
- /**
- * Static attribute for setter method prefix.
- */
- public static final String SET_METHOD_PREFIX = "set";
-
- /**
- * Static attribute for get filter leaf flags.
- */
- public static final String GET_FILTER_LEAF = "get_valueLeafFlags";
-
- /**
- * Static attribute for getLeafIndex.
- */
- public static final String GET_LEAF_INDEX = "getLeafIndex()";
-
- /**
- * Static attribute for op param.
- */
- public static final String OP_PARAM = "OpParam";
-
-
- /**
- * Static attribute for is filter content match method prefix.
- */
- public static final String FILTER_CONTENT_MATCH = "isFilterContentMatch";
-
- /**
- * Static attribute for flag prefix.
- */
- public static final String FLAG = "flag";
-
- /**
- * Static attribute for break prefix.
- */
- public static final String BREAK = "break";
-
- /**
- * Static attribute for break prefix.
- */
- public static final String IS_EMPTY = "isEmpty()";
-
- /**
- * Static attribute for is isLeafValueSet method prefix.
- */
- public static final String VALUE_LEAF_SET = "isLeafValueSet";
-
- /**
- * Static attribute for is isSelectLeaf method prefix.
- */
- public static final String IS_SELECT_LEAF = "isSelectLeaf";
-
- /**
- * Static attribute for is selectLeaf method prefix.
- */
- public static final String SET_SELECT_LEAF = "selectLeaf";
-
- /**
- * Static attribute for is LeafIdentifier enum prefix.
- */
- public static final String LEAF_IDENTIFIER = "LeafIdentifier";
-
- /**
- * Static attribute for four space indentation.
- */
- public static final String FOUR_SPACE_INDENTATION = " ";
-
- /**
- * Static attribute for not syntax.
- */
- public static final String NOT = "!";
-
- /**
- * Static attribute for try syntax.
- */
- public static final String TRY = "try";
-
- /**
- * Static attribute for catch syntax.
- */
- public static final String CATCH = "catch";
-
- /**
- * Static attribute for eight space indentation.
- */
- public static final String EIGHT_SPACE_INDENTATION = FOUR_SPACE_INDENTATION + FOUR_SPACE_INDENTATION;
-
- /**
- * Static attribute for twelve space indentation.
- */
- public static final String TWELVE_SPACE_INDENTATION = FOUR_SPACE_INDENTATION + EIGHT_SPACE_INDENTATION;
-
- /**
- * Static attribute for sixteen space indentation.
- */
- public static final String SIXTEEN_SPACE_INDENTATION = EIGHT_SPACE_INDENTATION + EIGHT_SPACE_INDENTATION;
-
- /**
- * Static attribute for twenty space indentation.
- */
- public static final String TWENTY_SPACE_INDENTATION = FOUR_SPACE_INDENTATION + SIXTEEN_SPACE_INDENTATION;
-
- /**
- * Static attribute for twenty four space indentation.
- */
- public static final String TWENTY_FOUR_SPACE_INDENTATION = EIGHT_SPACE_INDENTATION + SIXTEEN_SPACE_INDENTATION;
-
- /**
- * Static attribute for generated code path.
- */
- public static final String YANG_GEN_DIR = "src/main/java/";
-
- /**
- * Static attribute for base package.
- */
- public static final String DEFAULT_BASE_PKG = "org.onosproject.yang.gen";
-
- /**
- * Static attribute for YANG date prefix.
- */
- public static final String REVISION_PREFIX = "rev";
-
- /**
- * Static attribute for YANG automatic prefix for identifiers with keywords and beginning with digits.
- */
- public static final String YANG_AUTO_PREFIX = "yangAutoPrefix";
-
- /**
- * Static attribute for YANG version prefix.
- */
- public static final String VERSION_PREFIX = "v";
-
- /**
- * Static attribute for private modifier.
- */
- public static final String PRIVATE = "private";
-
- /**
- * Static attribute for public modifier.
- */
- public static final String PUBLIC = "public";
-
- /**
- * Static attribute for abstract modifier.
- */
- public static final String ABSTRACT = "abstract";
-
- /**
- * Static attribute for protected modifier.
- */
- public static final String PROTECTED = "protected";
-
- /**
- * Void java type.
- */
- public static final String VOID = "void";
-
- /**
- * String built in java type.
- */
- public static final String STRING_DATA_TYPE = "String";
-
- /**
- * Java.lang.* packages.
- */
- public static final String JAVA_LANG = "java.lang";
-
- /**
- * Java.math.* packages.
- */
- public static final String JAVA_MATH = "java.math";
-
- /**
- * Boolean built in java type.
- */
- public static final String BOOLEAN_DATA_TYPE = "boolean";
-
- /**
- * BigInteger built in java type.
- */
- public static final String BIG_INTEGER = "BigInteger";
-
- /**
- * BigDecimal built in java type.
- */
- public static final String BIG_DECIMAL = "BigDecimal";
-
- /**
- * BitSet built in java type.
- */
- public static final String BIT_SET = "BitSet";
-
- /**
- * Byte java built in type.
- */
- public static final String BYTE = "byte";
-
- /**
- * Short java built in type.
- */
- public static final String SHORT = "short";
-
- /**
- * Int java built in type.
- */
- public static final String INT = "int";
-
- /**
- * Long java built in type.
- */
- public static final String LONG = "long";
-
- /**
- * Double java built in type.
- */
- public static final String DOUBLE = "double";
-
- /**
- * Boolean built in java wrapper type.
- */
- public static final String BOOLEAN_WRAPPER = "Boolean";
-
- /**
- * Byte java built in wrapper type.
- */
- public static final String BYTE_WRAPPER = "Byte";
-
- /**
- * Short java built in wrapper type.
- */
- public static final String SHORT_WRAPPER = "Short";
-
- /**
- * Integer java built in wrapper type.
- */
- public static final String INTEGER_WRAPPER = "Integer";
-
- /**
- * Long java built in wrapper type.
- */
- public static final String LONG_WRAPPER = "Long";
-
- /**
- * Static variable for question mark.
- */
- public static final String QUESTION_MARK = "?";
-
- /**
- * List of keywords in java, this is used for checking if the input does not contain these keywords.
- */
- public static final List<String> JAVA_KEY_WORDS = Arrays.asList(
- "abstract", "assert", "boolean", "break", "byte", "case", "catch", "char", "class", "const", "continue",
- "default", "do", "double", "else", "extends", "false", "final", "finally", "float", "for", "goto", "if",
- "implements", "import", "instanceof", "enum", "int", "interface", "long", "native", "new", "null",
- "package", "private", "protected", "public", "return", "short", "static", "strictfp", "super", "switch",
- "synchronized", "this", "throw", "throws", "transient", "true", "try", "void", "volatile", "while");
-
- /**
- * Static attribute for regex for all the special characters.
- */
- public static final String REGEX_WITH_ALL_SPECIAL_CHAR = "\\p{Punct}+";
-
- /**
- * Static attribute for regex for three special characters used in identifier.
- */
- public static final String REGEX_FOR_IDENTIFIER_SPECIAL_CHAR = "[. _ -]+";
-
- /**
- * Static attribute for regex for period.
- */
- public static final String REGEX_FOR_PERIOD = "[.]";
-
- /**
- * Static attribute for regex for underscore.
- */
- public static final String REGEX_FOR_UNDERSCORE = "[_]";
-
- /**
- * Static attribute for regex for hyphen.
- */
- public static final String REGEX_FOR_HYPHEN = "[-]";
-
- /**
- * Static attribute for regex for digits.
- */
- public static final String REGEX_FOR_FIRST_DIGIT = "\\d.*";
-
- /**
- * Static attribute for regex with digits.
- */
- public static final String REGEX_WITH_DIGITS = "(?=\\d+)";
-
- /**
- * Static attribute for regex for single letter.
- */
- public static final String REGEX_FOR_SINGLE_LETTER = "[a-zA-Z]";
-
- /**
- * Static attribute for regex for digits with single letter.
- */
- public static final String REGEX_FOR_DIGITS_WITH_SINGLE_LETTER = "[0-9]+[a-zA-Z]";
-
- /**
- * Static attribute for regex with uppercase.
- */
- public static final String REGEX_WITH_UPPERCASE = "(?=\\p{Upper})";
-
- /**
- * Static attribute for regex for single capital case letter.
- */
- public static final String REGEX_WITH_SINGLE_CAPITAL_CASE = "[A-Z]";
-
- /**
- * Static attribute for regex for capital case letter with any number of digits and small case letters.
- */
- public static final String REGEX_WITH_SINGLE_CAPITAL_CASE_AND_DIGITS_SMALL_CASES = "[A-Z][0-9a-z]+";
-
- /**
- * Static attribute for regex for any string ending with service.
- */
- public static final String REGEX_FOR_ANY_STRING_ENDING_WITH_SERVICE = ".+Service";
-
- /**
- * Static attribute for class syntax.
- */
- public static final String CLASS = "class";
-
- /**
- * Static attribute for builder syntax.
- */
- public static final String BUILDER = "Builder";
-
- /**
- * Static attribute for manager syntax.
- */
- public static final String MANAGER = "Manager";
-
- /**
- * Static attribute for service syntax.
- */
- public static final String SERVICE = "Service";
-
- /**
- * Static attribute for interface syntax.
- */
- public static final String INTERFACE = "interface";
-
- /**
- * Static attribute for enum syntax.
- */
- public static final String ENUM = "enum";
-
- /**
- * Static attribute for type syntax.
- */
- public static final String TYPE = "Type";
-
- /**
- * Static attribute for static syntax.
- */
- public static final String STATIC = "static";
-
- /**
- * Static attribute for final syntax.
- */
- public static final String FINAL = "final";
-
- /**
- * Static attribute for package syntax.
- */
- public static final String PACKAGE = "package";
-
- /**
- * Static attribute for import syntax.
- */
- public static final String IMPORT = "import ";
-
- /**
- * Static attribute for null syntax.
- */
- public static final String NULL = "null";
-
- /**
- * Static attribute for return syntax.
- */
- public static final String RETURN = "return";
-
- /**
- * Static attribute for java new syntax.
- */
- public static final String NEW = "new";
-
- /**
- * Static attribute for this syntax.
- */
- public static final String THIS = "this";
-
- /**
- * Static attribute for implements syntax.
- */
- public static final String IMPLEMENTS = "implements";
-
- /**
- * Static attribute for extends syntax.
- */
- public static final String EXTEND = "extends";
-
- /**
- * Static attribute for service interface suffix syntax.
- */
- public static final String SERVICE_METHOD_STRING = "Service";
-
- /**
- * For event file generation.
- */
- public static final String EVENT_STRING = "Event";
-
- /**
- * For event listener file generation.
- */
- public static final String EVENT_LISTENER_STRING = "EventListener";
-
- /**
- * For event subject file generation.
- */
- public static final String EVENT_SUBJECT_NAME_SUFFIX = "EventSubject";
-
- /**
- * Static attribute for build method syntax.
- */
- public static final String BUILD = "build";
-
- /**
- * Static attribute for object.
- */
- public static final String OBJECT = "Object";
-
- /**
- * Static attribute for app instance.
- */
- public static final String APP_INSTANCE = "appInstance";
-
- /**
- * Static attribute for override annotation.
- */
- public static final String OVERRIDE = "@Override";
-
- /**
- * Static attribute for collections.
- */
- public static final String COLLECTION_IMPORTS = "java.util";
-
- /**
- * Static attribute for map.
- */
- public static final String MAP = "Map";
-
- /**
- * Static attribute for hash map.
- */
- public static final String HASH_MAP = "HashMap";
-
-
- /**
- * Static attribute for more object import package.
- */
- public static final String GOOGLE_MORE_OBJECT_IMPORT_PKG = "com.google.common.base";
-
- /**
- * Static attribute for more object import class.
- */
- public static final String GOOGLE_MORE_OBJECT_IMPORT_CLASS = "MoreObjects;\n";
-
- /**
- * Static attribute for to string method.
- */
- public static final String GOOGLE_MORE_OBJECT_METHOD_STRING = " MoreObjects.toStringHelper(getClass())";
-
- /**
- * Static attribute for java utilities import package.
- */
- public static final String JAVA_UTIL_OBJECTS_IMPORT_PKG = "java.util";
-
- /**
- * Static attribute for bitset.
- */
- public static final String BITSET = "BitSet";
-
- /**
- * Static attribute for java utilities objects import class.
- */
- public static final String JAVA_UTIL_OBJECTS_IMPORT_CLASS = "Objects;\n";
-
- /**
- * Static attribute for java utilities import base64 class.
- */
- public static final String JAVA_UTIL_IMPORT_BASE64_CLASS = "Base64;\n";
-
- /**
- * Static attribute for AugmentedInfo class.
- */
- public static final String YANG_AUGMENTED_INFO = "YangAugmentedInfo";
-
- /**
- * Static attribute for augmented.
- */
- public static final String AUGMENTED = "Augmented";
-
- /**
- * Static attribute for list.
- */
- public static final String LIST = "List";
-
- /**
- * Comment to be added for auto generated impl methods.
- */
- public static final String YANG_UTILS_TODO = "//TODO: YANG utils generated code";
-
- /**
- * Static attribute for AbstractEvent.
- */
- public static final String ABSTRACT_EVENT = "AbstractEvent";
-
- /**
- * Static attribute for EventListener.
- */
- public static final String EVENT_LISTENER = "EventListener";
-
- /**
- * Static attribute for or operator.
- */
- public static final String OR_OPERATION = "||";
-
- /**
- * Static attribute for YANG file error.
- */
- public static final String YANG_FILE_ERROR = "YANG file error : ";
-
- /**
- * Static attribute for unsupported error information.
- */
- public static final String UNSUPPORTED_YANG_CONSTRUCT = " is not supported.";
-
- /**
- * Static attribute for currently unsupported error information.
- */
- public static final String CURRENTLY_UNSUPPORTED = " is not supported in current version, please check wiki" +
- " for YANG utils road map.";
-
- /**
- * Static attribute for typedef linker error information.
- */
- public static final String TYPEDEF_LINKER_ERROR = "YANG file error: Unable to find base "
- + "typedef for given type";
-
- /**
- * Static attribute for grouping linker error information.
- */
- public static final String GROUPING_LINKER_ERROR = "YANG file error: Unable to find base "
- + "grouping for given uses";
-
- /**
- * Static attribute for if-feature linker error information.
- */
- public static final String FEATURE_LINKER_ERROR = "YANG file error: Unable to find feature "
- + "for given if-feature";
-
- /**
- * Static attribute for leafref linker error information.
- */
- public static final String LEAFREF_LINKER_ERROR = "YANG file error: Unable to find base "
- + "leaf/leaf-list for given leafref";
-
- /**
- * Static attribute for base linker error information.
- */
- public static final String BASE_LINKER_ERROR = "YANG file error: Unable to find base "
- + "identity for given base";
-
- /**
- * Static attribute for identityref linker error information.
- */
- public static final String IDENTITYREF_LINKER_ERROR = "YANG file error: Unable to find base "
- + "identity for given base";
-
- /**
- * Static attribute for jar.
- */
- public static final String JAR = "jar";
-
- /**
- * Static attribute for for.
- */
- public static final String FOR = "for";
-
- /**
- * Static attribute for YangAugmentedOpParamInfo.
- */
- public static final String YANG_AUGMENTED_OP_PARAM_INFO = "YangAugmentedOpParamInfo";
-
- /**
- * Static attribute for NoSuchMethodException.
- */
- public static final String NO_SUCH_METHOD_EXCEPTION = "NoSuchMethodException";
-
- /**
- * Static attribute for InvocationTargetException.
- */
- public static final String INVOCATION_TARGET_EXCEPTION = "InvocationTargetException";
-
- /**
- * Static attribute for InvocationTargetException.
- */
- public static final String INVOCATION_TARGET_EXCEPTION_IMPORT = "import" +
- " java.lang.reflect.InvocationTargetException;\n";
- /**
- * Static attribute for IllegalAccessException.
- */
- public static final String ILLEGAL_ACCESS_EXCEPTION = "IllegalAccessException";
-
- /**
- * Static attribute for arrayList.
- */
- public static final String ARRAY_LIST = "ArrayList<>()";
-
- /**
- * Static attribute for arrayList import.
- */
- public static final String ARRAY_LIST_IMPORT = IMPORT + COLLECTION_IMPORTS + ".ArrayList;\n";
-
- /**
- * Creates an instance of util constants.
- */
- private UtilConstants() {
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/CopyrightHeader.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/CopyrightHeader.java
deleted file mode 100644
index 5833de2..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/CopyrightHeader.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * 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.utils.io.impl;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Calendar;
-
-import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE;
-
-/**
- * Represents the license header for the generated files.
- */
-public final class CopyrightHeader {
-
- private static final int EOF = -1;
- private static final String COPYRIGHT_HEADER_FILE = "CopyrightHeader.txt";
- private static final String COPYRIGHTS_FIRST_LINE = "/*\n * Copyright " + Calendar.getInstance().get(Calendar.YEAR)
- + "-present Open Networking Laboratory\n";
- private static final String TEMP_FILE = "temp.txt";
- private static ClassLoader classLoader = CopyrightHeader.class.getClassLoader();
-
- private static String copyrightHeader;
-
- /**
- * Creates an instance of copyright header.
- */
- private CopyrightHeader() {
- }
-
- /**
- * Returns copyright file header.
- *
- * @return copyright file header
- * @throws IOException when fails to parse copyright header
- */
- public static String getCopyrightHeader() throws IOException {
-
- if (copyrightHeader == null) {
- parseCopyrightHeader();
- }
- return copyrightHeader;
- }
-
- /**
- * Sets the copyright header.
- *
- * @param header copyright header
- */
- private static void setCopyrightHeader(String header) {
-
- copyrightHeader = header;
- }
-
- /**
- * parses Copyright to the temporary file.
- *
- * @throws IOException when fails to get the copyright header
- */
- private static void parseCopyrightHeader() throws IOException {
-
- File temp = new File(TEMP_FILE);
-
- try {
- InputStream stream = classLoader.getResourceAsStream(COPYRIGHT_HEADER_FILE);
- OutputStream out = new FileOutputStream(temp);
-
- int index;
- out.write(COPYRIGHTS_FIRST_LINE.getBytes());
- while ((index = stream.read()) != EOF) {
- out.write(index);
- }
- out.close();
- stream.close();
- getStringFileContent(temp);
- setCopyrightHeader(getStringFileContent(temp));
- } catch (IOException e) {
- throw new IOException("failed to parse the Copyright header");
- } finally {
- temp.delete();
- }
- }
-
- /**
- * Converts it to string.
- *
- * @param toAppend file to be converted.
- * @return string of file.
- * @throws IOException when fails to convert to string
- */
- private static String getStringFileContent(File toAppend) throws IOException {
-
- FileReader fileReader = new FileReader(toAppend);
- BufferedReader bufferReader = new BufferedReader(fileReader);
- try {
- StringBuilder stringBuilder = new StringBuilder();
- String line = bufferReader.readLine();
-
- while (line != null) {
- stringBuilder.append(line);
- stringBuilder.append(NEW_LINE);
- line = bufferReader.readLine();
- }
- return stringBuilder.toString();
- } finally {
- fileReader.close();
- bufferReader.close();
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/FileSystemUtil.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/FileSystemUtil.java
deleted file mode 100644
index 1b58c0f..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/FileSystemUtil.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * 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.utils.io.impl;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.onosproject.yangutils.utils.UtilConstants.EIGHT_SPACE_INDENTATION;
-import static org.onosproject.yangutils.utils.UtilConstants.EMPTY_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.FOUR_SPACE_INDENTATION;
-import static org.onosproject.yangutils.utils.UtilConstants.MULTIPLE_NEW_LINE;
-import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE;
-import static org.onosproject.yangutils.utils.UtilConstants.SPACE;
-
-/**
- * Represents utility to handle file system operations.
- */
-public final class FileSystemUtil {
-
- /**
- * Creates an instance of file system util.
- */
- private FileSystemUtil() {
- }
-
- /**
- * Reads the contents from source file and append its contents to append file.
- *
- * @param toAppend destination file in which the contents of source file is appended
- * @param srcFile source file from which data is read and added to to append file
- * @throws IOException any IO errors
- */
- static void appendFileContents(File toAppend, File srcFile)
- throws IOException {
- updateFileHandle(srcFile, NEW_LINE + readAppendFile(toAppend.toString(), FOUR_SPACE_INDENTATION), false);
- }
-
- /**
- * Reads file and convert it to string.
- *
- * @param toAppend file to be converted
- * @param spaces spaces to be appended
- * @return string of file
- * @throws IOException when fails to convert to string
- */
- public static String readAppendFile(String toAppend, String spaces)
- throws IOException {
-
- FileReader fileReader = new FileReader(toAppend);
- BufferedReader bufferReader = new BufferedReader(fileReader);
- try {
- StringBuilder stringBuilder = new StringBuilder();
- String line = bufferReader.readLine();
-
- while (line != null) {
- switch (line) {
- case SPACE:
- case EMPTY_STRING:
- case EIGHT_SPACE_INDENTATION:
- case MULTIPLE_NEW_LINE:
- stringBuilder.append(NEW_LINE);
- break;
- case FOUR_SPACE_INDENTATION:
- stringBuilder.append(EMPTY_STRING);
- break;
- default:
- String append = spaces + line;
- stringBuilder.append(append);
- stringBuilder.append(NEW_LINE);
- break;
- }
- line = bufferReader.readLine();
- }
- return stringBuilder.toString();
- } finally {
- fileReader.close();
- bufferReader.close();
- }
- }
-
- /**
- * Updates the generated file handle.
- *
- * @param inputFile input file
- * @param contentTobeAdded content to be appended to the file
- * @param isClose when close of file is called.
- * @throws IOException if the named file exists but is a directory rather than a regular file, does not exist but
- * cannot be created, or cannot be opened for any other reason
- */
- static void updateFileHandle(File inputFile, String contentTobeAdded, boolean isClose)
- throws IOException {
-
- List<FileWriter> fileWriterStore = new ArrayList<>();
-
- FileWriter fileWriter = new FileWriter(inputFile, true);
- fileWriterStore.add(fileWriter);
- PrintWriter outputPrintWriter = new PrintWriter(fileWriter, true);
- if (!isClose) {
- outputPrintWriter.write(contentTobeAdded);
- outputPrintWriter.flush();
- outputPrintWriter.close();
- } else {
- for (FileWriter curWriter : fileWriterStore) {
- curWriter.flush();
- curWriter.close();
- }
- }
- }
-
- /**
- * Closes the file handle for temporary file.
- *
- * @param file file to be closed
- * @param toBeDeleted flag to indicate if file needs to be deleted
- * @throws IOException when failed to close the file handle
- */
- public static void closeFile(File file, boolean toBeDeleted)
- throws IOException {
-
- if (file != null) {
- updateFileHandle(file, null, true);
- if (toBeDeleted) {
- boolean deleted = file.delete();
- if (!deleted) {
- throw new IOException("Failed to delete temporary file " + file.getName());
- }
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/JavaDocGen.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/JavaDocGen.java
deleted file mode 100644
index 3b47386..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/JavaDocGen.java
+++ /dev/null
@@ -1,740 +0,0 @@
-/*
- * 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.utils.io.impl;
-
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-
-import static org.onosproject.yangutils.utils.UtilConstants.AUGMENTED;
-import static org.onosproject.yangutils.utils.UtilConstants.BUILDER;
-import static org.onosproject.yangutils.utils.UtilConstants.BUILDER_CLASS_JAVA_DOC;
-import static org.onosproject.yangutils.utils.UtilConstants.BUILDER_INTERFACE_JAVA_DOC;
-import static org.onosproject.yangutils.utils.UtilConstants.BUILDER_OBJECT;
-import static org.onosproject.yangutils.utils.UtilConstants.CLASS;
-import static org.onosproject.yangutils.utils.UtilConstants.EIGHT_SPACE_INDENTATION;
-import static org.onosproject.yangutils.utils.UtilConstants.EMPTY_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.ENUM_ATTRIBUTE_JAVADOC;
-import static org.onosproject.yangutils.utils.UtilConstants.ENUM_CLASS_JAVADOC;
-import static org.onosproject.yangutils.utils.UtilConstants.EVENT_JAVA_DOC;
-import static org.onosproject.yangutils.utils.UtilConstants.EVENT_LISTENER_JAVA_DOC;
-import static org.onosproject.yangutils.utils.UtilConstants.FOUR_SPACE_INDENTATION;
-import static org.onosproject.yangutils.utils.UtilConstants.FROM_STRING_METHOD_NAME;
-import static org.onosproject.yangutils.utils.UtilConstants.FROM_STRING_PARAM_NAME;
-import static org.onosproject.yangutils.utils.UtilConstants.IMPL_CLASS_JAVA_DOC;
-import static org.onosproject.yangutils.utils.UtilConstants.INPUT;
-import static org.onosproject.yangutils.utils.UtilConstants.INTERFACE_JAVA_DOC;
-import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_ADD_TO_LIST;
-import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_BUILD;
-import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_BUILD_RETURN;
-import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_CONSTRUCTOR;
-import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_END_LINE;
-import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_FIRST_LINE;
-import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_FOR_VALIDATOR;
-import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_FOR_VALIDATOR_RETURN;
-import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_GETTERS;
-import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_MANAGER_SETTERS;
-import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_OF;
-import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_PARAM;
-import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_RETURN;
-import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_RPC;
-import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_SETTERS;
-import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_SETTERS_COMMON;
-import static org.onosproject.yangutils.utils.UtilConstants.LIST;
-import static org.onosproject.yangutils.utils.UtilConstants.MAP;
-import static org.onosproject.yangutils.utils.UtilConstants.MAX_RANGE;
-import static org.onosproject.yangutils.utils.UtilConstants.MIN_RANGE;
-import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE;
-import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE_ASTERISK;
-import static org.onosproject.yangutils.utils.UtilConstants.OBJECT;
-import static org.onosproject.yangutils.utils.UtilConstants.OBJECT_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.OF;
-import static org.onosproject.yangutils.utils.UtilConstants.OP_PARAM_JAVA_DOC;
-import static org.onosproject.yangutils.utils.UtilConstants.PACKAGE_INFO_JAVADOC;
-import static org.onosproject.yangutils.utils.UtilConstants.PACKAGE_INFO_JAVADOC_OF_CHILD;
-import static org.onosproject.yangutils.utils.UtilConstants.PERIOD;
-import static org.onosproject.yangutils.utils.UtilConstants.RPC_INPUT_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.RPC_OUTPUT_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.SPACE;
-import static org.onosproject.yangutils.utils.UtilConstants.STRING_DATA_TYPE;
-import static org.onosproject.yangutils.utils.UtilConstants.VALUE;
-import static org.onosproject.yangutils.utils.UtilConstants.VOID;
-import static org.onosproject.yangutils.utils.UtilConstants.YANG_AUGMENTED_INFO;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCamelCase;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getSmallCase;
-
-/**
- * Represents javadoc for the generated classes.
- */
-public final class JavaDocGen {
-
- /**
- * Creates an instance of java doc gen.
- */
- private JavaDocGen() {
- }
-
- /**
- * Returns java docs.
- *
- * @param type java doc type
- * @param name name of the YangNode
- * @param isList is list attribute
- * @param pluginConfig plugin configurations
- * @return javaDocs.
- */
- public static String getJavaDoc(JavaDocType type, String name, boolean isList, YangPluginConfig pluginConfig) {
-
- name = YangIoUtils.getSmallCase(getCamelCase(name, pluginConfig.getConflictResolver()));
- switch (type) {
- case IMPL_CLASS: {
- return generateForClass(name);
- }
- case BUILDER_CLASS: {
- return generateForBuilderClass(name);
- }
- case OPERATION_CLASS: {
- return generateForOpParamClass(name);
- }
- case OPERATION_BUILDER_CLASS: {
- return generateForOpParamClass(name);
- }
- case INTERFACE: {
- return generateForInterface(name);
- }
- case BUILDER_INTERFACE: {
- return generateForBuilderInterface(name);
- }
- case PACKAGE_INFO: {
- return generateForPackage(name, isList);
- }
- case GETTER_METHOD: {
- return generateForGetters(name, isList);
- }
- case TYPE_DEF_SETTER_METHOD: {
- return generateForTypeDefSetter(name);
- }
- case SETTER_METHOD: {
- return generateForSetters(name, isList);
- }
- case MANAGER_SETTER_METHOD: {
- return generateForManagerSetters(name, isList);
- }
- case OF_METHOD: {
- return generateForOf(name);
- }
- case DEFAULT_CONSTRUCTOR: {
- return generateForDefaultConstructors(name);
- }
- case BUILD_METHOD: {
- return generateForBuild(name);
- }
- case TYPE_CONSTRUCTOR: {
- return generateForTypeConstructor(name);
- }
- case FROM_METHOD: {
- return generateForFromString(name);
- }
- case ENUM_CLASS: {
- return generateForEnum(name);
- }
- case ENUM_ATTRIBUTE: {
- return generateForEnumAttr(name);
- }
- case RPC_INTERFACE: {
- return generateForRpcService(name);
- }
- case RPC_MANAGER: {
- return generateForClass(name);
- }
- case EVENT: {
- return generateForEvent(name);
- }
- case EVENT_LISTENER: {
- return generateForEventListener(name);
- }
- case EVENT_SUBJECT_CLASS: {
- return generateForClass(name);
- }
- case ADD_TO_LIST: {
- return generateForAddToList(name);
- }
- default: {
- return generateForConstructors(name);
- }
- }
- }
-
- /**
- * Generates javaDocs for enum's attributes.
- *
- * @param name attribute name
- * @return javaDocs
- */
- private static String generateForEnumAttr(String name) {
- return EIGHT_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE + EIGHT_SPACE_INDENTATION + ENUM_ATTRIBUTE_JAVADOC
- + name + PERIOD + NEW_LINE + EIGHT_SPACE_INDENTATION + JAVA_DOC_END_LINE;
- }
-
- /**
- * Generates javaDocs for rpc method.
- *
- * @param rpcName name of the rpc
- * @param inputName name of input
- * @param outputName name of output
- * @param pluginConfig plugin configurations
- * @return javaDocs of rpc method
- */
- public static String generateJavaDocForRpc(String rpcName, String inputName, String outputName,
- YangPluginConfig pluginConfig) {
- rpcName = getCamelCase(rpcName, pluginConfig.getConflictResolver());
-
- String javadoc =
- NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_RPC
- + rpcName + PERIOD + NEW_LINE + FOUR_SPACE_INDENTATION + NEW_LINE_ASTERISK;
- if (!inputName.equals(EMPTY_STRING)) {
- javadoc = javadoc + getInputString(inputName, rpcName);
- }
- if (!outputName.equals(VOID)) {
- javadoc = javadoc + getOutputString(outputName, rpcName);
- }
- return javadoc + FOUR_SPACE_INDENTATION + JAVA_DOC_END_LINE;
- }
-
- /**
- * Returns output string of rpc.
- *
- * @param outputName name of output
- * @param rpcName name of rpc
- * @return javaDocs for output string of rpc
- */
- private static String getOutputString(String outputName, String rpcName) {
- return FOUR_SPACE_INDENTATION + JAVA_DOC_RETURN + outputName + SPACE + RPC_OUTPUT_STRING + rpcName + NEW_LINE;
- }
-
- /**
- * Returns input string of rpc.
- *
- * @param inputName name of input
- * @param rpcName name of rpc
- * @return javaDocs for input string of rpc
- */
- private static String getInputString(String inputName, String rpcName) {
- if (inputName.equals("")) {
- return null;
- } else {
- return FOUR_SPACE_INDENTATION + JAVA_DOC_PARAM + inputName + SPACE + RPC_INPUT_STRING + rpcName + NEW_LINE;
- }
- }
-
- /**
- * Generates javaDoc for the interface.
- *
- * @param interfaceName interface name
- * @return javaDocs
- */
- private static String generateForRpcService(String interfaceName) {
- return NEW_LINE + JAVA_DOC_FIRST_LINE + INTERFACE_JAVA_DOC + interfaceName + PERIOD + NEW_LINE
- + JAVA_DOC_END_LINE;
- }
-
- /**
- * Generates javaDoc for the event.
- *
- * @param eventClassName event class name
- * @return javaDocs
- */
- private static String generateForEvent(String eventClassName) {
- return NEW_LINE + JAVA_DOC_FIRST_LINE + EVENT_JAVA_DOC + eventClassName + PERIOD + NEW_LINE
- + JAVA_DOC_END_LINE;
- }
-
- /**
- * Generates javaDoc for the event listener.
- *
- * @param eventListenerInterfaceName event class name
- * @return javaDocs
- */
- private static String generateForEventListener(String eventListenerInterfaceName) {
- return NEW_LINE + JAVA_DOC_FIRST_LINE + EVENT_LISTENER_JAVA_DOC + eventListenerInterfaceName
- + PERIOD + NEW_LINE + JAVA_DOC_END_LINE;
- }
-
- /**
- * Generates javaDocs for getter method.
- *
- * @param attribute attribute
- * @param isList is list attribute
- * @return javaDocs
- */
- private static String generateForGetters(String attribute, boolean isList) {
-
- String getter = NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE + FOUR_SPACE_INDENTATION
- + JAVA_DOC_GETTERS + attribute + PERIOD + NEW_LINE + FOUR_SPACE_INDENTATION + NEW_LINE_ASTERISK
- + FOUR_SPACE_INDENTATION + JAVA_DOC_RETURN;
- if (isList) {
- String listAttribute = LIST.toLowerCase() + SPACE + OF + SPACE;
- getter = getter + listAttribute;
- } else {
- getter = getter + VALUE + SPACE + OF + SPACE;
- }
-
- getter = getter + attribute + NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_END_LINE;
- return getter;
- }
-
- /**
- * Generates javaDocs for setter method.
- *
- * @param attribute attribute
- * @param isList is list attribute
- * @return javaDocs
- */
- private static String generateForSetters(String attribute, boolean isList) {
-
- String setter = NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE + FOUR_SPACE_INDENTATION
- + JAVA_DOC_SETTERS + attribute + PERIOD + NEW_LINE + FOUR_SPACE_INDENTATION + NEW_LINE_ASTERISK
- + FOUR_SPACE_INDENTATION + JAVA_DOC_PARAM + attribute + SPACE;
- if (isList) {
- String listAttribute = LIST.toLowerCase() + SPACE + OF + SPACE;
- setter = setter + listAttribute;
- } else {
- setter = setter + VALUE + SPACE + OF + SPACE;
- }
- setter = setter + attribute + NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_RETURN + BUILDER_OBJECT
- + attribute
- + NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_END_LINE;
- return setter;
- }
-
- /**
- * Generates javaDocs for setter method.
- *
- * @param attribute attribute
- * @param isList is list attribute
- * @return javaDocs
- */
- private static String generateForManagerSetters(String attribute, boolean isList) {
-
- String setter = NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE + FOUR_SPACE_INDENTATION
- + JAVA_DOC_MANAGER_SETTERS + attribute + PERIOD + NEW_LINE + FOUR_SPACE_INDENTATION + NEW_LINE_ASTERISK
- + FOUR_SPACE_INDENTATION + JAVA_DOC_PARAM + attribute + SPACE;
- if (isList) {
- String listAttribute = LIST.toLowerCase() + SPACE + OF + SPACE;
- setter = setter + listAttribute;
- } else {
- setter = setter + VALUE + SPACE + OF + SPACE;
- }
- setter = setter + attribute
- + NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_END_LINE;
- return setter;
- }
-
- /**
- * Generates javaDocs for of method.
- *
- * @param attribute attribute
- * @return javaDocs
- */
- private static String generateForOf(String attribute) {
- return NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_OF
- + attribute + PERIOD + NEW_LINE + FOUR_SPACE_INDENTATION + NEW_LINE_ASTERISK + FOUR_SPACE_INDENTATION
- + JAVA_DOC_PARAM + VALUE + SPACE + VALUE + SPACE + OF + SPACE + attribute + NEW_LINE
- + FOUR_SPACE_INDENTATION + JAVA_DOC_RETURN + OBJECT + SPACE + OF + SPACE + attribute + NEW_LINE
- + FOUR_SPACE_INDENTATION + JAVA_DOC_END_LINE;
- }
-
- /**
- * Generates javaDocs for from method.
- *
- * @param attribute attribute
- * @return javaDocs
- */
- private static String generateForFromString(String attribute) {
-
- return NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_OF
- + attribute + SPACE + FROM_STRING_METHOD_NAME + SPACE + INPUT + SPACE + STRING_DATA_TYPE + PERIOD
- + NEW_LINE + FOUR_SPACE_INDENTATION + NEW_LINE_ASTERISK + FOUR_SPACE_INDENTATION + JAVA_DOC_PARAM
- + FROM_STRING_PARAM_NAME + SPACE + INPUT + SPACE + STRING_DATA_TYPE + NEW_LINE
- + FOUR_SPACE_INDENTATION + JAVA_DOC_RETURN + OBJECT + SPACE + OF + SPACE + attribute + NEW_LINE
- + FOUR_SPACE_INDENTATION + JAVA_DOC_END_LINE;
- }
-
- /**
- * Generates javaDocs for typedef setter method.
- *
- * @param attribute attribute
- * @return javaDocs
- */
- private static String generateForTypeDefSetter(String attribute) {
- return NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE + FOUR_SPACE_INDENTATION
- + JAVA_DOC_SETTERS_COMMON + attribute + PERIOD + NEW_LINE + FOUR_SPACE_INDENTATION + NEW_LINE_ASTERISK
- + FOUR_SPACE_INDENTATION + JAVA_DOC_PARAM + VALUE + SPACE + VALUE + SPACE + OF + SPACE + attribute
- + NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_END_LINE;
- }
-
- /**
- * Generates javaDocs for the impl class.
- *
- * @param className class name
- * @return javaDocs
- */
- private static String generateForClass(String className) {
- return NEW_LINE + JAVA_DOC_FIRST_LINE + IMPL_CLASS_JAVA_DOC + className + PERIOD + NEW_LINE + JAVA_DOC_END_LINE;
- }
-
- /**
- * Generates javaDocs for enum.
- *
- * @param className enum class name
- * @return javaDocs
- */
- private static String generateForEnum(String className) {
- return NEW_LINE + NEW_LINE + JAVA_DOC_FIRST_LINE + ENUM_CLASS_JAVADOC + className + PERIOD + NEW_LINE
- + JAVA_DOC_END_LINE;
- }
-
- /**
- * Generates javaDocs for the builder class.
- *
- * @param className class name
- * @return javaDocs
- */
- private static String generateForBuilderClass(String className) {
- return NEW_LINE + JAVA_DOC_FIRST_LINE + BUILDER_CLASS_JAVA_DOC + className + PERIOD + NEW_LINE
- + JAVA_DOC_END_LINE;
- }
-
- /**
- * Generates javaDocs for the op param class.
- *
- * @param className class name
- * @return javaDocs
- */
- private static String generateForOpParamClass(String className) {
- return NEW_LINE + JAVA_DOC_FIRST_LINE + OP_PARAM_JAVA_DOC + className + PERIOD + NEW_LINE
- + JAVA_DOC_END_LINE;
- }
-
- /**
- * Generates javaDoc for the interface.
- *
- * @param interfaceName interface name
- * @return javaDocs
- */
- private static String generateForInterface(String interfaceName) {
- return NEW_LINE + JAVA_DOC_FIRST_LINE + INTERFACE_JAVA_DOC + interfaceName + PERIOD + NEW_LINE
- + JAVA_DOC_END_LINE;
- }
-
- /**
- * Generates javaDoc for the builder interface.
- *
- * @param builderForName builder for name
- * @return javaDocs
- */
- private static String generateForBuilderInterface(String builderForName) {
- return JAVA_DOC_FIRST_LINE + BUILDER_INTERFACE_JAVA_DOC + builderForName + PERIOD + NEW_LINE
- + JAVA_DOC_END_LINE;
- }
-
- /**
- * Generates javaDocs for package-info.
- *
- * @param packageName package name
- * @param isChildNode is it child node
- * @return javaDocs
- */
- private static String generateForPackage(String packageName, boolean isChildNode) {
- String javaDoc = JAVA_DOC_FIRST_LINE + PACKAGE_INFO_JAVADOC + packageName;
- if (isChildNode) {
- javaDoc = javaDoc + PACKAGE_INFO_JAVADOC_OF_CHILD;
- }
- return javaDoc + PERIOD + NEW_LINE + JAVA_DOC_END_LINE;
- }
-
- /**
- * Generates javaDocs for default constructor.
- *
- * @param className class name
- * @return javaDocs
- */
- private static String generateForDefaultConstructors(String className) {
- return FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_CONSTRUCTOR + className
- + PERIOD + NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_END_LINE;
- }
-
- /**
- * Generates javaDocs for constructor with parameters.
- *
- * @param className class name
- * @return javaDocs
- */
- private static String generateForConstructors(String className) {
- return NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_CONSTRUCTOR
- + className + PERIOD + NEW_LINE + FOUR_SPACE_INDENTATION + NEW_LINE_ASTERISK
- + FOUR_SPACE_INDENTATION + JAVA_DOC_PARAM + BUILDER.toLowerCase() + OBJECT + SPACE + BUILDER_OBJECT
- + className + NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_END_LINE;
- }
-
- /**
- * Generates javaDocs for build.
- *
- * @param buildName builder name
- * @return javaDocs
- */
- private static String generateForBuild(String buildName) {
- return NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_BUILD
- + buildName + PERIOD + NEW_LINE + FOUR_SPACE_INDENTATION + NEW_LINE_ASTERISK + FOUR_SPACE_INDENTATION
- + JAVA_DOC_RETURN + JAVA_DOC_BUILD_RETURN + buildName + PERIOD + NEW_LINE + FOUR_SPACE_INDENTATION
- + JAVA_DOC_END_LINE;
- }
-
- /**
- * Generates javaDocs for type constructor.
- *
- * @param attribute attribute string
- * @return javaDocs for type constructor
- */
- private static String generateForTypeConstructor(String attribute) {
- return NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_CONSTRUCTOR
- + attribute + PERIOD + NEW_LINE + FOUR_SPACE_INDENTATION + NEW_LINE_ASTERISK + FOUR_SPACE_INDENTATION
- + JAVA_DOC_PARAM + VALUE + SPACE + VALUE + SPACE + OF + SPACE + attribute + NEW_LINE
- + FOUR_SPACE_INDENTATION + JAVA_DOC_END_LINE;
- }
-
- /**
- * Generates javaDocs for add augmentation method.
- *
- * @return javaDocs
- */
- public static String generateForAddAugmentation() {
- return NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE + FOUR_SPACE_INDENTATION
- + JAVA_DOC_SETTERS_COMMON + getSmallCase(YANG_AUGMENTED_INFO) + MAP + PERIOD + NEW_LINE +
- FOUR_SPACE_INDENTATION + NEW_LINE_ASTERISK + FOUR_SPACE_INDENTATION + JAVA_DOC_PARAM + VALUE + SPACE +
- VALUE + SPACE + OF + SPACE + getSmallCase(YANG_AUGMENTED_INFO) + NEW_LINE + FOUR_SPACE_INDENTATION
- + JAVA_DOC_PARAM + CLASS + OBJECT_STRING + SPACE +
- VALUE + SPACE + OF + SPACE + AUGMENTED + CLASS + NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_END_LINE;
- }
-
- /**
- * Returns javadoc for get augmentation method.
- *
- * @return javadoc for get augmentation method
- */
- public static String generateForGetAugmentation() {
- return NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE + FOUR_SPACE_INDENTATION
- + JAVA_DOC_GETTERS + getSmallCase(YANG_AUGMENTED_INFO) + PERIOD + NEW_LINE +
- FOUR_SPACE_INDENTATION + NEW_LINE_ASTERISK + FOUR_SPACE_INDENTATION + JAVA_DOC_PARAM + CLASS +
- OBJECT_STRING + SPACE + VALUE + SPACE + OF + SPACE + AUGMENTED + CLASS + NEW_LINE +
- FOUR_SPACE_INDENTATION + JAVA_DOC_RETURN + VALUE + SPACE +
- OF + SPACE + YANG_AUGMENTED_INFO + NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_END_LINE;
- }
-
- /**
- * Returns javadoc for validator method.
- *
- * @return javadoc for validator method
- */
- public static String generateForValidatorMethod() {
- return NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE + FOUR_SPACE_INDENTATION +
- JAVA_DOC_FOR_VALIDATOR + NEW_LINE + FOUR_SPACE_INDENTATION + NEW_LINE_ASTERISK +
- FOUR_SPACE_INDENTATION + JAVA_DOC_PARAM + MIN_RANGE + SPACE + MIN_RANGE + SPACE + OF + SPACE +
- VALUE + NEW_LINE +
- FOUR_SPACE_INDENTATION + JAVA_DOC_PARAM + MAX_RANGE + SPACE + MAX_RANGE + SPACE + OF + SPACE + VALUE +
- NEW_LINE +
- FOUR_SPACE_INDENTATION + JAVA_DOC_PARAM + VALUE + SPACE + VALUE + NEW_LINE +
- FOUR_SPACE_INDENTATION + JAVA_DOC_FOR_VALIDATOR_RETURN + NEW_LINE + FOUR_SPACE_INDENTATION +
- JAVA_DOC_END_LINE;
- }
-
- /**
- * Generates javaDocs for type constructor.
- *
- * @param attribute attribute string
- * @return javaDocs for type constructor
- */
- public static String generateForGetMethodWithAttribute(String attribute) {
- return NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_GETTERS
- + attribute + PERIOD + NEW_LINE + FOUR_SPACE_INDENTATION + NEW_LINE_ASTERISK + FOUR_SPACE_INDENTATION
- + JAVA_DOC_PARAM + attribute + SPACE + VALUE + SPACE + OF + SPACE + attribute + NEW_LINE
- + FOUR_SPACE_INDENTATION + JAVA_DOC_RETURN + VALUE + SPACE + OF + SPACE + attribute + NEW_LINE
- + FOUR_SPACE_INDENTATION + JAVA_DOC_END_LINE;
- }
-
- /**
- * Returns javaDocs for add to list method.
- *
- * @param attribute attribute
- * @return javaDocs
- */
- private static String generateForAddToList(String attribute) {
- String javadoc = NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE + FOUR_SPACE_INDENTATION
- + JAVA_DOC_ADD_TO_LIST + attribute + PERIOD + NEW_LINE + FOUR_SPACE_INDENTATION + NEW_LINE_ASTERISK
- + FOUR_SPACE_INDENTATION + JAVA_DOC_PARAM + VALUE + SPACE;
- javadoc = javadoc + VALUE + SPACE + OF + SPACE;
- javadoc = javadoc + attribute + NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_END_LINE;
- return javadoc;
- }
-
- /**
- * Generates for builder method.
- *
- * @param attribute attribute
- * @return javaDocs
- */
- public static String generateForBuilderMethod(String attribute) {
-
- String javadoc = FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE + FOUR_SPACE_INDENTATION
- + JAVA_DOC_GETTERS + attribute + BUILDER + PERIOD + NEW_LINE + FOUR_SPACE_INDENTATION
- + NEW_LINE_ASTERISK + FOUR_SPACE_INDENTATION + JAVA_DOC_RETURN;
- javadoc = javadoc + VALUE + SPACE + OF + SPACE;
- javadoc = javadoc + attribute + BUILDER + NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_END_LINE;
- return javadoc;
- }
-
-
- /**
- * JavaDocs types.
- */
- public enum JavaDocType {
-
- /**
- * For class.
- */
- IMPL_CLASS,
-
- /**
- * For builder class.
- */
- BUILDER_CLASS,
-
- /**
- * For interface.
- */
- INTERFACE,
-
- /**
- * For builder interface.
- */
- BUILDER_INTERFACE,
-
- /**
- * For package-info.
- */
- PACKAGE_INFO,
-
- /**
- * For getters.
- */
- GETTER_METHOD,
-
- /**
- * For rpc service.
- */
- RPC_INTERFACE,
-
- /**
- * For rpc manager.
- */
- RPC_MANAGER,
-
- /**
- * For event.
- */
- EVENT,
-
- /**
- * For event listener.
- */
- EVENT_LISTENER,
-
- /**
- * For setters.
- */
- SETTER_METHOD,
-
- /**
- * For type def's setters.
- */
- TYPE_DEF_SETTER_METHOD,
-
- /**
- * For of method.
- */
- OF_METHOD,
-
- /**
- * For default constructor.
- */
- DEFAULT_CONSTRUCTOR,
-
- /**
- * For constructor.
- */
- CONSTRUCTOR,
-
- /**
- * For from method.
- */
- FROM_METHOD,
-
- /**
- * For type constructor.
- */
- TYPE_CONSTRUCTOR,
-
- /**
- * For build.
- */
- BUILD_METHOD,
-
- /**
- * For enum.
- */
- ENUM_CLASS,
-
- /**
- * For enum's attributes.
- */
- ENUM_ATTRIBUTE,
-
- /**
- * For manager setters.
- */
- MANAGER_SETTER_METHOD,
-
- /**
- * For event subject.
- */
- EVENT_SUBJECT_CLASS,
-
- /**
- * For operation.
- */
- OPERATION_CLASS,
-
- /**
- * For operation builder.
- */
- OPERATION_BUILDER_CLASS,
-
- /**
- * For add to list.
- */
- ADD_TO_LIST,
- }
-
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/YangFileScanner.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/YangFileScanner.java
deleted file mode 100644
index b5f5fca..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/YangFileScanner.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * 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.utils.io.impl;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Stack;
-
-/**
- * Represents utility for searching the files in a directory.
- */
-public final class YangFileScanner {
-
- private static final String JAVA_FILE_EXTENSION = ".java";
- private static final String YANG_FILE_EXTENSION = ".yang";
-
- /**
- * Creates an instance of YANG file scanner.
- */
- private YangFileScanner() {
- }
-
- /**
- * Returns the list of java files.
- *
- * @param root specified directory
- * @return list of java files
- * @throws NullPointerException when no files are there.
- * @throws IOException when files get deleted while performing the
- * operations
- */
- static List<String> getJavaFiles(String root) throws IOException {
- return getFiles(root, JAVA_FILE_EXTENSION);
- }
-
- /**
- * Returns the list of YANG file.
- *
- * @param root specified directory
- * @return list of YANG file information
- * @throws NullPointerException when no files are there
- * @throws IOException when files get deleted while performing the
- * operations
- */
- public static List<String> getYangFiles(String root) throws IOException {
- return getFiles(root, YANG_FILE_EXTENSION);
- }
-
- /**
- * Returns the list of required files.
- *
- * @param root specified directory
- * @param extension file extension
- * @return list of required files
- * @throws NullPointerException when no file is there
- * @throws IOException when files get deleted while performing the operations
- */
- private static List<String> getFiles(String root, String extension) throws IOException {
-
- List<String> store = new LinkedList<>();
- Stack<String> stack = new Stack<>();
- stack.push(root);
- File file;
- File[] fileList;
- try {
- while (!stack.empty()) {
- root = stack.pop();
- file = new File(root);
- fileList = file.listFiles();
- if ((fileList == null) || (fileList.length == 0)) {
- continue;
- }
- for (File current : fileList) {
- if (current.isDirectory()) {
- stack.push(current.toString());
- } else {
- String yangFile = current.getCanonicalPath();
- if (yangFile.endsWith(extension)) {
- store.add(yangFile);
- }
- }
- }
- }
- return store;
- } catch (IOException e) {
- throw new IOException("No File found of " + extension + " extension in " + root + " directory.");
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/YangIoUtils.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/YangIoUtils.java
deleted file mode 100644
index 7b91ae9..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/YangIoUtils.java
+++ /dev/null
@@ -1,692 +0,0 @@
-/*
- * 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.utils.io.impl;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Stack;
-import java.util.regex.Pattern;
-
-import org.apache.commons.io.FileUtils;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangToJavaNamingConflictUtil;
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-
-import static org.onosproject.yangutils.utils.UtilConstants.COLAN;
-import static org.onosproject.yangutils.utils.UtilConstants.EMPTY_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.HASH;
-import static org.onosproject.yangutils.utils.UtilConstants.HYPHEN;
-import static org.onosproject.yangutils.utils.UtilConstants.JAVA_KEY_WORDS;
-import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE;
-import static org.onosproject.yangutils.utils.UtilConstants.OPEN_PARENTHESIS;
-import static org.onosproject.yangutils.utils.UtilConstants.ORG;
-import static org.onosproject.yangutils.utils.UtilConstants.PACKAGE;
-import static org.onosproject.yangutils.utils.UtilConstants.PERIOD;
-import static org.onosproject.yangutils.utils.UtilConstants.REGEX_FOR_DIGITS_WITH_SINGLE_LETTER;
-import static org.onosproject.yangutils.utils.UtilConstants.REGEX_FOR_FIRST_DIGIT;
-import static org.onosproject.yangutils.utils.UtilConstants.REGEX_FOR_HYPHEN;
-import static org.onosproject.yangutils.utils.UtilConstants.REGEX_FOR_IDENTIFIER_SPECIAL_CHAR;
-import static org.onosproject.yangutils.utils.UtilConstants.REGEX_FOR_PERIOD;
-import static org.onosproject.yangutils.utils.UtilConstants.REGEX_FOR_SINGLE_LETTER;
-import static org.onosproject.yangutils.utils.UtilConstants.REGEX_FOR_UNDERSCORE;
-import static org.onosproject.yangutils.utils.UtilConstants.REGEX_WITH_ALL_SPECIAL_CHAR;
-import static org.onosproject.yangutils.utils.UtilConstants.REGEX_WITH_DIGITS;
-import static org.onosproject.yangutils.utils.UtilConstants.REGEX_WITH_SINGLE_CAPITAL_CASE;
-import static org.onosproject.yangutils.utils.UtilConstants.REGEX_WITH_SINGLE_CAPITAL_CASE_AND_DIGITS_SMALL_CASES;
-import static org.onosproject.yangutils.utils.UtilConstants.REGEX_WITH_UPPERCASE;
-import static org.onosproject.yangutils.utils.UtilConstants.SEMI_COLAN;
-import static org.onosproject.yangutils.utils.UtilConstants.SLASH;
-import static org.onosproject.yangutils.utils.UtilConstants.SPACE;
-import static org.onosproject.yangutils.utils.UtilConstants.TWELVE_SPACE_INDENTATION;
-import static org.onosproject.yangutils.utils.UtilConstants.UNDER_SCORE;
-import static org.onosproject.yangutils.utils.UtilConstants.YANG_AUTO_PREFIX;
-import static org.onosproject.yangutils.utils.io.impl.CopyrightHeader.getCopyrightHeader;
-import static org.onosproject.yangutils.utils.io.impl.FileSystemUtil.appendFileContents;
-import static org.onosproject.yangutils.utils.io.impl.FileSystemUtil.updateFileHandle;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.PACKAGE_INFO;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.getJavaDoc;
-
-/**
- * Represents common utility functionalities for code generation.
- */
-public final class YangIoUtils {
-
- private static final int LINE_SIZE = 118;
- private static final int SUB_LINE_SIZE = 112;
- private static final int ZERO = 0;
-
- /**
- * Creates an instance of YANG io utils.
- */
- private YangIoUtils() {
- }
-
- /**
- * Creates the directory structure.
- *
- * @param path directory path
- * @return directory structure
- * @throws IOException when fails to do IO operations
- */
- public static File createDirectories(String path) throws IOException {
- File generatedDir = new File(path);
- if (!generatedDir.exists()) {
- boolean isGenerated = generatedDir.mkdirs();
- if (!isGenerated) {
- throw new IOException("failed to generated directory " + path);
- }
- }
- return generatedDir;
- }
-
- /**
- * Adds package info file for the created directory.
- *
- * @param path directory path
- * @param classInfo class info for the package
- * @param pack package of the directory
- * @param isChildNode is it a child node
- * @param pluginConfig plugin configurations
- * @throws IOException when fails to create package info file
- */
- public static void addPackageInfo(File path, String classInfo, String pack, boolean isChildNode,
- YangPluginConfig pluginConfig)
- throws IOException {
-
- pack = parsePkg(pack);
-
- try {
-
- File packageInfo = new File(path + SLASH + "package-info.java");
- if (!packageInfo.exists()) {
- boolean isGenerated = packageInfo.createNewFile();
- if (!isGenerated) {
- throw new IOException("failed to generated package-info " + path);
- }
- }
- FileWriter fileWriter = new FileWriter(packageInfo);
- BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
-
- bufferedWriter.write(getCopyrightHeader());
- bufferedWriter.write(getJavaDoc(PACKAGE_INFO, classInfo, isChildNode, pluginConfig));
- String pkg = PACKAGE + SPACE + pack + SEMI_COLAN;
- if (pkg.length() > LINE_SIZE) {
- pkg = whenDelimiterIsPresent(pkg, LINE_SIZE);
- }
- bufferedWriter.write(pkg);
- bufferedWriter.close();
- fileWriter.close();
- } catch (IOException e) {
- throw new IOException("Exception occurred while creating package info file.");
- }
- }
-
- /**
- * Parses package and returns updated package.
- *
- * @param pack package needs to be updated
- * @return updated package
- */
- public static String parsePkg(String pack) {
-
- if (pack.contains(ORG)) {
- String[] strArray = pack.split(ORG);
- if (strArray.length >= 3) {
- for (int i = 1; i < strArray.length; i++) {
- if (i == 1) {
- pack = ORG + strArray[1];
- } else {
- pack = pack + ORG + strArray[i];
- }
- }
- } else {
- pack = ORG + strArray[1];
- }
- }
-
- return pack;
- }
-
- /**
- * Cleans the generated directory if already exist in source folder.
- *
- * @param dir generated directory in previous build
- * @throws IOException when failed to delete directory
- */
- public static void deleteDirectory(String dir)
- throws IOException {
- File generatedDirectory = new File(dir);
- if (generatedDirectory.exists()) {
- try {
- FileUtils.deleteDirectory(generatedDirectory);
- } catch (IOException e) {
- throw new IOException(
- "Failed to delete the generated files in " + generatedDirectory + " directory");
- }
- }
- }
-
- /**
- * Searches and deletes generated temporary directories.
- *
- * @param root root directory
- * @throws IOException when fails to do IO operations.
- */
- public static void searchAndDeleteTempDir(String root)
- throws IOException {
- List<File> store = new LinkedList<>();
- Stack<String> stack = new Stack<>();
- stack.push(root);
-
- while (!stack.empty()) {
- root = stack.pop();
- File file = new File(root);
- File[] fileList = file.listFiles();
- if (fileList == null || fileList.length == 0) {
- continue;
- }
- for (File current : fileList) {
- if (current.isDirectory()) {
- stack.push(current.toString());
- if (current.getName().endsWith("-Temp")) {
- store.add(current);
- }
- }
- }
- }
-
- for (File dir : store) {
- FileUtils.deleteDirectory(dir);
- }
- }
-
- /**
- * Removes extra char from the string.
- *
- * @param valueString string to be trimmed
- * @param removalString extra chars
- * @return new string
- */
- public static String trimAtLast(String valueString, String removalString) {
- StringBuilder stringBuilder = new StringBuilder(valueString);
- int index = valueString.lastIndexOf(removalString);
- if (index != -1) {
- stringBuilder.deleteCharAt(index);
- }
- return stringBuilder.toString();
- }
-
- /**
- * Returns the directory path of the package in canonical form.
- *
- * @param baseCodeGenPath base path where the generated files needs to be
- * put
- * @param pathOfJavaPkg java package of the file being generated
- * @return absolute path of the package in canonical form
- */
- public static String getDirectory(String baseCodeGenPath, String pathOfJavaPkg) {
-
- if (pathOfJavaPkg.charAt(pathOfJavaPkg.length() - 1) == File.separatorChar) {
- pathOfJavaPkg = trimAtLast(pathOfJavaPkg, SLASH);
- }
- String[] strArray = pathOfJavaPkg.split(SLASH);
- if (strArray[0].equals(EMPTY_STRING)) {
- return pathOfJavaPkg;
- } else {
- return baseCodeGenPath + SLASH + pathOfJavaPkg;
- }
- }
-
- /**
- * Returns the absolute path of the package in canonical form.
- *
- * @param baseCodeGenPath base path where the generated files needs to be
- * put
- * @param pathOfJavaPkg java package of the file being generated
- * @return absolute path of the package in canonical form
- */
- public static String getAbsolutePackagePath(String baseCodeGenPath, String pathOfJavaPkg) {
- return baseCodeGenPath + pathOfJavaPkg;
- }
-
- /**
- * Merges the temp java files to main java files.
- *
- * @param appendFile temp file
- * @param srcFile main file
- * @throws IOException when fails to append contents
- */
- public static void mergeJavaFiles(File appendFile, File srcFile)
- throws IOException {
- try {
- appendFileContents(appendFile, srcFile);
- } catch (IOException e) {
- throw new IOException("Failed to append " + appendFile + " in " + srcFile);
- }
- }
-
- /**
- * Inserts data in the generated file.
- *
- * @param file file in which need to be inserted
- * @param data data which need to be inserted
- * @throws IOException when fails to insert into file
- */
- public static void insertDataIntoJavaFile(File file, String data)
- throws IOException {
- try {
- updateFileHandle(file, data, false);
- } catch (IOException e) {
- throw new IOException("Failed to insert in " + file + "file");
- }
- }
-
- /**
- * Validates a line size in given file whether it is having more then 120 characters.
- * If yes it will update and give a new file.
- *
- * @param dataFile file in which need to verify all lines.
- * @return updated file
- * @throws IOException when fails to do IO operations.
- */
- public static File validateLineLength(File dataFile)
- throws IOException {
- FileReader fileReader = new FileReader(dataFile);
- BufferedReader bufferReader = new BufferedReader(fileReader);
- String append;
- try {
- StringBuilder stringBuilder = new StringBuilder();
- String line = bufferReader.readLine();
-
- while (line != null) {
- if (line.length() > LINE_SIZE) {
- if (line.contains(PERIOD)) {
- line = whenDelimiterIsPresent(line, LINE_SIZE);
- } else if (line.contains(SPACE)) {
- line = whenSpaceIsPresent(line, LINE_SIZE);
- }
- stringBuilder.append(line);
- } else {
- append = line + NEW_LINE;
- stringBuilder.append(append);
- }
- line = bufferReader.readLine();
- }
- FileWriter writer = new FileWriter(dataFile);
- writer.write(stringBuilder.toString());
- writer.close();
- return dataFile;
- } finally {
- fileReader.close();
- bufferReader.close();
- }
- }
-
- /* When delimiters are present in the given line. */
- private static String whenDelimiterIsPresent(String line, int lineSize) {
- StringBuilder stringBuilder = new StringBuilder();
- String append;
- if (line.length() > lineSize) {
- String[] strArray = line.split(Pattern.quote(PERIOD));
- stringBuilder = updateString(strArray, stringBuilder, PERIOD, lineSize);
- } else {
- append = line + NEW_LINE;
- stringBuilder.append(append);
- }
- String[] strArray = stringBuilder.toString().split(NEW_LINE);
- StringBuilder tempBuilder = new StringBuilder();
- for (String str : strArray) {
- if (str.length() > SUB_LINE_SIZE) {
- if (line.contains(PERIOD) && !line.contains(PERIOD + HASH + OPEN_PARENTHESIS)) {
- String[] strArr = str.split(Pattern.quote(PERIOD));
- tempBuilder = updateString(strArr, tempBuilder, PERIOD, SUB_LINE_SIZE);
- } else if (str.contains(SPACE)) {
- tempBuilder.append(whenSpaceIsPresent(str, SUB_LINE_SIZE));
- }
- } else {
- append = str + NEW_LINE;
- tempBuilder.append(append);
- }
- }
- return tempBuilder.toString();
-
- }
-
- /* When spaces are present in the given line. */
- private static String whenSpaceIsPresent(String line, int lineSize) {
- StringBuilder stringBuilder = new StringBuilder();
- String append;
- if (line.length() > lineSize) {
- String[] strArray = line.split(SPACE);
- stringBuilder = updateString(strArray, stringBuilder, SPACE, lineSize);
- } else {
- append = line + NEW_LINE;
- stringBuilder.append(append);
- }
-
- String[] strArray = stringBuilder.toString().split(NEW_LINE);
- StringBuilder tempBuilder = new StringBuilder();
- for (String str : strArray) {
- if (str.length() > SUB_LINE_SIZE) {
- if (str.contains(SPACE)) {
- String[] strArr = str.split(SPACE);
- tempBuilder = updateString(strArr, tempBuilder, SPACE, SUB_LINE_SIZE);
- }
- } else {
- append = str + NEW_LINE;
- tempBuilder.append(append);
- }
- }
- return tempBuilder.toString();
- }
-
- /* Updates the given line with the given size conditions. */
- private static StringBuilder updateString(String[] strArray, StringBuilder stringBuilder, String string,
- int lineSize) {
-
- StringBuilder tempBuilder = new StringBuilder();
- String append;
- for (String str : strArray) {
- append = str + string;
- tempBuilder.append(append);
- if (tempBuilder.length() > lineSize) {
- String tempString = stringBuilder.toString();
- stringBuilder.delete(ZERO, stringBuilder.length());
- tempString = trimAtLast(tempString, string);
- stringBuilder.append(tempString);
- if (string.equals(PERIOD)) {
- append = NEW_LINE + TWELVE_SPACE_INDENTATION + PERIOD + str + string;
- stringBuilder.append(append);
- } else {
- append = NEW_LINE + TWELVE_SPACE_INDENTATION + str + string;
- stringBuilder.append(append);
- }
- tempBuilder.delete(ZERO, tempBuilder.length());
- tempBuilder.append(TWELVE_SPACE_INDENTATION);
- } else {
- append = str + string;
- stringBuilder.append(append);
- }
- }
- String tempString = stringBuilder.toString();
- tempString = trimAtLast(tempString, string);
- stringBuilder.delete(ZERO, stringBuilder.length());
- append = tempString + NEW_LINE;
- stringBuilder.append(append);
- return stringBuilder;
- }
-
- /**
- * Returns the java Package from package path.
- *
- * @param packagePath package path
- * @return java package
- */
- public static String getJavaPackageFromPackagePath(String packagePath) {
- return packagePath.replace(SLASH, PERIOD);
- }
-
- /**
- * Returns the directory path corresponding to java package.
- *
- * @param packagePath package path
- * @return java package
- */
- public static String getPackageDirPathFromJavaJPackage(String packagePath) {
- return packagePath.replace(PERIOD, SLASH);
- }
-
- /**
- * Returns the YANG identifier name as java identifier with first letter
- * in small.
- *
- * @param yangIdentifier identifier in YANG file.
- * @return corresponding java identifier
- */
- public static String getSmallCase(String yangIdentifier) {
- return yangIdentifier.substring(0, 1).toLowerCase() + yangIdentifier.substring(1);
- }
-
- /**
- * Returns the YANG identifier name as java identifier with first letter
- * in capital.
- *
- * @param yangIdentifier identifier in YANG file
- * @return corresponding java identifier
- */
- public static String getCapitalCase(String yangIdentifier) {
- yangIdentifier = yangIdentifier.substring(0, 1).toUpperCase() + yangIdentifier.substring(1);
- return restrictConsecutiveCapitalCase(yangIdentifier);
- }
-
- /**
- * Restricts consecutive capital cased string as a rule in camel case.
- *
- * @param consecCapitalCaseRemover which requires the restriction of consecutive capital case
- * @return string without consecutive capital case
- */
- private static String restrictConsecutiveCapitalCase(String consecCapitalCaseRemover) {
-
- for (int k = 0; k < consecCapitalCaseRemover.length(); k++) {
- if (k + 1 < consecCapitalCaseRemover.length()) {
- if (Character.isUpperCase(consecCapitalCaseRemover.charAt(k))) {
- if (Character.isUpperCase(consecCapitalCaseRemover.charAt(k + 1))) {
- consecCapitalCaseRemover = consecCapitalCaseRemover.substring(0, k + 1)
- + consecCapitalCaseRemover.substring(k + 1, k + 2).toLowerCase()
- + consecCapitalCaseRemover.substring(k + 2);
- }
- }
- }
- }
- return consecCapitalCaseRemover;
- }
-
- /**
- * Adds prefix, if the string begins with digit or is a java key word.
- *
- * @param camelCasePrefix string for adding prefix
- * @param conflictResolver object of YANG to java naming conflict util
- * @return prefixed camel case string
- */
- private static String addPrefix(String camelCasePrefix, YangToJavaNamingConflictUtil conflictResolver) {
-
- String prefix = getPrefixForIdentifier(conflictResolver);
- if (camelCasePrefix.matches(REGEX_FOR_FIRST_DIGIT)) {
- camelCasePrefix = prefix + camelCasePrefix;
- }
- if (JAVA_KEY_WORDS.contains(camelCasePrefix)) {
- camelCasePrefix = prefix + camelCasePrefix.substring(0, 1).toUpperCase()
- + camelCasePrefix.substring(1);
- }
- return camelCasePrefix;
- }
-
- /**
- * Applies the rule that a string does not end with a capitalized letter and capitalizes
- * the letter next to a number in an array.
- *
- * @param stringArray containing strings for camel case separation
- * @param conflictResolver object of YANG to java naming conflict util
- * @return camel case rule checked string
- */
- private static String applyCamelCaseRule(String[] stringArray, YangToJavaNamingConflictUtil conflictResolver) {
-
- String ruleChecker = stringArray[0].toLowerCase();
- int i;
- if (ruleChecker.matches(REGEX_FOR_FIRST_DIGIT)) {
- i = 0;
- ruleChecker = EMPTY_STRING;
- } else {
- i = 1;
- }
- for (; i < stringArray.length; i++) {
- if (i + 1 == stringArray.length) {
- if (stringArray[i].matches(REGEX_FOR_SINGLE_LETTER)
- || stringArray[i].matches(REGEX_FOR_DIGITS_WITH_SINGLE_LETTER)) {
- ruleChecker = ruleChecker + stringArray[i].toLowerCase();
- break;
- }
- }
- if (stringArray[i].matches(REGEX_FOR_FIRST_DIGIT)) {
- for (int j = 0; j < stringArray[i].length(); j++) {
- char letterCheck = stringArray[i].charAt(j);
- if (Character.isLetter(letterCheck)) {
- stringArray[i] = stringArray[i].substring(0, j)
- + stringArray[i].substring(j, j + 1).toUpperCase() + stringArray[i].substring(j + 1);
- break;
- }
- }
- ruleChecker = ruleChecker + stringArray[i];
- } else {
- ruleChecker = ruleChecker + stringArray[i].substring(0, 1).toUpperCase() + stringArray[i].substring(1);
- }
- }
- String ruleCheckerWithPrefix = addPrefix(ruleChecker, conflictResolver);
- return restrictConsecutiveCapitalCase(ruleCheckerWithPrefix);
- }
-
- /**
- * Resolves the conflict when input has upper case.
- *
- * @param stringArray containing strings for upper case conflict resolver
- * @param conflictResolver object of YANG to java naming conflict util
- * @return camel cased string
- */
- private static String upperCaseConflictResolver(String[] stringArray,
- YangToJavaNamingConflictUtil conflictResolver) {
-
- for (int l = 0; l < stringArray.length; l++) {
- String[] upperCaseSplitArray = stringArray[l].split(REGEX_WITH_UPPERCASE);
- for (int m = 0; m < upperCaseSplitArray.length; m++) {
- if (upperCaseSplitArray[m].matches(REGEX_WITH_SINGLE_CAPITAL_CASE)) {
- int check = m;
- while (check + 1 < upperCaseSplitArray.length) {
- if (upperCaseSplitArray[check + 1].matches(REGEX_WITH_SINGLE_CAPITAL_CASE)) {
- upperCaseSplitArray[check + 1] = upperCaseSplitArray[check + 1].toLowerCase();
- check = check + 1;
- } else if (upperCaseSplitArray[check + 1]
- .matches(REGEX_WITH_SINGLE_CAPITAL_CASE_AND_DIGITS_SMALL_CASES)) {
- upperCaseSplitArray[check + 1] = upperCaseSplitArray[check + 1].toLowerCase();
- break;
- } else {
- break;
- }
- }
- }
- }
- StringBuilder strBuilder = new StringBuilder();
- for (String element : upperCaseSplitArray) {
- strBuilder.append(element);
- }
- stringArray[l] = strBuilder.toString();
- }
- List<String> result = new ArrayList<>();
- for (String element : stringArray) {
- String[] capitalCaseSplitArray = element.split(REGEX_WITH_UPPERCASE);
- for (String letter : capitalCaseSplitArray) {
- String[] arrayForAddition = letter.split(REGEX_WITH_DIGITS);
- List<String> list = Arrays.asList(arrayForAddition);
- for (String str : list) {
- if (str != null && !str.isEmpty()) {
- result.add(str);
- }
- }
- }
- }
- stringArray = result.toArray(new String[result.size()]);
- return applyCamelCaseRule(stringArray, conflictResolver);
- }
-
- /**
- * Returns the YANG identifier name as java identifier.
- *
- * @param yangIdentifier identifier in YANG file
- * @param conflictResolver object of YANG to java naming conflict util
- * @return corresponding java identifier
- */
- public static String getCamelCase(String yangIdentifier, YangToJavaNamingConflictUtil conflictResolver) {
-
- if (conflictResolver != null) {
- String replacementForHyphen = conflictResolver.getReplacementForHyphen();
- String replacementForPeriod = conflictResolver.getReplacementForPeriod();
- String replacementForUnderscore = conflictResolver.getReplacementForUnderscore();
- if (replacementForPeriod != null) {
- yangIdentifier = yangIdentifier.replaceAll(REGEX_FOR_PERIOD,
- PERIOD + replacementForPeriod.toLowerCase() + PERIOD);
- }
- if (replacementForUnderscore != null) {
- yangIdentifier = yangIdentifier.replaceAll(REGEX_FOR_UNDERSCORE,
- UNDER_SCORE + replacementForUnderscore.toLowerCase() + UNDER_SCORE);
- }
- if (replacementForHyphen != null) {
- yangIdentifier = yangIdentifier.replaceAll(REGEX_FOR_HYPHEN,
- HYPHEN + replacementForHyphen.toLowerCase() + HYPHEN);
- }
- }
- yangIdentifier = yangIdentifier.replaceAll(REGEX_FOR_IDENTIFIER_SPECIAL_CHAR, COLAN);
- String[] strArray = yangIdentifier.split(COLAN);
- if (strArray[0].isEmpty()) {
- List<String> stringArrangement = new ArrayList<>();
- stringArrangement.addAll(Arrays.asList(strArray).subList(1, strArray.length));
- strArray = stringArrangement.toArray(new String[stringArrangement.size()]);
- }
- return upperCaseConflictResolver(strArray, conflictResolver);
- }
-
- /**
- * Prefix for adding with identifier and namespace, when it is a java keyword or starting with digits.
- *
- * @param conflictResolver object of YANG to java naming conflict util
- * @return prefix which needs to be added
- */
- public static String getPrefixForIdentifier(YangToJavaNamingConflictUtil conflictResolver) {
-
- String prefixForIdentifier = null;
- if (conflictResolver != null) {
- prefixForIdentifier = conflictResolver.getPrefixForIdentifier();
- }
- if (prefixForIdentifier != null) {
- prefixForIdentifier = prefixForIdentifier.replaceAll(REGEX_WITH_ALL_SPECIAL_CHAR, COLAN);
- String[] strArray = prefixForIdentifier.split(COLAN);
- try {
- if (strArray[0].isEmpty()) {
- List<String> stringArrangement = new ArrayList<>();
- stringArrangement.addAll(Arrays.asList(strArray).subList(1, strArray.length));
- strArray = stringArrangement.toArray(new String[stringArrangement.size()]);
- }
- prefixForIdentifier = strArray[0];
- for (int j = 1; j < strArray.length; j++) {
- prefixForIdentifier = prefixForIdentifier + strArray[j].substring(0, 1).toUpperCase() +
- strArray[j].substring(1);
- }
- } catch (ArrayIndexOutOfBoundsException outOfBoundsException) {
- throw new TranslatorException("The given prefix in pom.xml is invalid.");
- }
- } else {
- prefixForIdentifier = YANG_AUTO_PREFIX;
- }
- return prefixForIdentifier;
- }
-}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/package-info.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/package-info.java
deleted file mode 100644
index a128fa2..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * File system utilities implementation.
- */
-package org.onosproject.yangutils.utils.io.impl;
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/package-info.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/package-info.java
deleted file mode 100644
index 856653e..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * File system utilities.
- */
-package org.onosproject.yangutils.utils.io;
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/package-info.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/package-info.java
deleted file mode 100644
index 2123da0..0000000
--- a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Utilities for YANG maven plugin.
- */
-package org.onosproject.yangutils.utils;
diff --git a/utils/yangutils/plugin/src/main/resources/CopyrightHeader.txt b/utils/yangutils/plugin/src/main/resources/CopyrightHeader.txt
deleted file mode 100644
index 2cbed45..0000000
--- a/utils/yangutils/plugin/src/main/resources/CopyrightHeader.txt
+++ /dev/null
@@ -1,14 +0,0 @@
- *
- * 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.
- */
-
diff --git a/utils/yangutils/plugin/src/main/resources/GeneratedYang.g4 b/utils/yangutils/plugin/src/main/resources/GeneratedYang.g4
deleted file mode 100644
index 0362cb0..0000000
--- a/utils/yangutils/plugin/src/main/resources/GeneratedYang.g4
+++ /dev/null
@@ -1,1347 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * This is a YANG grammar for parser based on which ANTLR will generate YANG parser.
- */
-
-grammar GeneratedYang;
-import YangLexer;
-
-@header {
-package org.onosproject.yangutils.parser.antlrgencode;
-}
-
- yangfile : moduleStatement EOF
- | subModuleStatement EOF;
-
- /**
- * module-stmt = optsep module-keyword sep identifier-arg-str
- * optsep
- * "{" stmtsep
- * module-header-stmts
- * linkage-stmts
- * meta-stmts
- * revision-stmts
- * body-stmts
- * "}" optsep
- */
-
- moduleStatement : MODULE_KEYWORD identifier LEFT_CURLY_BRACE moduleBody RIGHT_CURLY_BRACE;
-
- moduleBody : moduleHeaderStatement linkageStatements metaStatements revisionStatements bodyStatements;
-
- /**
- * module-header-stmts = ;; these stmts can appear in any order
- * [yang-version-stmt stmtsep]
- * namespace-stmt stmtsep
- * prefix-stmt stmtsep
- */
-
- moduleHeaderStatement : yangVersionStatement? namespaceStatement prefixStatement
- | yangVersionStatement? prefixStatement namespaceStatement
- | namespaceStatement yangVersionStatement? prefixStatement
- | namespaceStatement prefixStatement yangVersionStatement?
- | prefixStatement namespaceStatement yangVersionStatement?
- | prefixStatement yangVersionStatement? namespaceStatement
- ;
-
- /**
- * linkage-stmts = ;; these stmts can appear in any order
- * *(import-stmt stmtsep)
- * *(include-stmt stmtsep)
- */
- linkageStatements : (importStatement
- | includeStatement)*;
-
- /**
- * meta-stmts = ;; these stmts can appear in any order
- * [organization-stmt stmtsep]
- * [contact-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- */
- metaStatements : organizationStatement? contactStatement? descriptionStatement? referenceStatement?
- | organizationStatement? contactStatement? referenceStatement? descriptionStatement?
- | organizationStatement? descriptionStatement? contactStatement? referenceStatement?
- | organizationStatement? descriptionStatement? referenceStatement? contactStatement?
- | organizationStatement? referenceStatement? contactStatement? descriptionStatement?
- | organizationStatement? referenceStatement? descriptionStatement? contactStatement?
- | contactStatement? organizationStatement? descriptionStatement? referenceStatement?
- | contactStatement? organizationStatement? referenceStatement? descriptionStatement?
- | contactStatement? referenceStatement? organizationStatement? descriptionStatement?
- | contactStatement? referenceStatement? descriptionStatement? organizationStatement?
- | contactStatement? descriptionStatement? referenceStatement? organizationStatement?
- | contactStatement? descriptionStatement? organizationStatement? referenceStatement?
- | referenceStatement? contactStatement? organizationStatement? descriptionStatement?
- | referenceStatement? contactStatement? descriptionStatement? organizationStatement?
- | referenceStatement? organizationStatement? contactStatement? descriptionStatement?
- | referenceStatement? organizationStatement? descriptionStatement? contactStatement?
- | referenceStatement? descriptionStatement? organizationStatement? contactStatement?
- | referenceStatement? descriptionStatement? contactStatement? organizationStatement?
- | descriptionStatement? referenceStatement? contactStatement? organizationStatement?
- | descriptionStatement? referenceStatement? organizationStatement? contactStatement?
- | descriptionStatement? contactStatement? referenceStatement? organizationStatement?
- | descriptionStatement? contactStatement? organizationStatement? referenceStatement?
- | descriptionStatement? organizationStatement? contactStatement? referenceStatement?
- | descriptionStatement? organizationStatement? referenceStatement? contactStatement?
- ;
-
- // revision-stmts = *(revision-stmt stmtsep)
- revisionStatements : revisionStatement*;
-
- /**
- * body-stmts = *((extension-stmt /
- * feature-stmt /
- * identity-stmt /
- * typedef-stmt /
- * grouping-stmt /
- * data-def-stmt /
- * augment-stmt /
- * rpc-stmt /
- * notification-stmt /
- * deviation-stmt) stmtsep)
- */
- bodyStatements : (extensionStatement
- | featureStatement
- | identityStatement
- | typedefStatement
- | groupingStatement
- | dataDefStatement
- | augmentStatement
- | rpcStatement
- | notificationStatement
- | deviationStatement
- | compilerAnnotationStatement)*
- ;
-
- /**
- * yang-version-stmt = yang-version-keyword sep yang-version-arg-str
- * optsep stmtend
- */
- yangVersionStatement : YANG_VERSION_KEYWORD version STMTEND;
-
-
- /**
- * namespace-stmt = namespace-keyword sep uri-str optsep stmtend
- * For namespace validation TODO in Listener
- */
- namespaceStatement : NAMESPACE_KEYWORD string STMTEND;
-
- /**
- * prefix-stmt = prefix-keyword sep prefix-arg-str
- * optsep stmtend
- */
- prefixStatement : PREFIX_KEYWORD identifier STMTEND;
-
- /**
- * import-stmt = import-keyword sep identifier-arg-str optsep
- * "{" stmtsep
- * prefix-stmt stmtsep
- * [revision-date-stmt stmtsep]
- * "}"
- */
- importStatement : IMPORT_KEYWORD identifier LEFT_CURLY_BRACE importStatementBody RIGHT_CURLY_BRACE;
-
- importStatementBody : prefixStatement revisionDateStatement?;
-
- // revision-date-stmt = revision-date-keyword sep revision-date stmtend
- revisionDateStatement : REVISION_DATE_KEYWORD dateArgumentString STMTEND;
-
- /**
- * include-stmt = include-keyword sep identifier-arg-str optsep
- * (";" /
- * "{" stmtsep
- * [revision-date-stmt stmtsep]
- * "}")
- */
- includeStatement : INCLUDE_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE revisionDateStatement? RIGHT_CURLY_BRACE);
-
- /**
- * organization-stmt = organization-keyword sep string
- * optsep stmtend
- */
- organizationStatement : ORGANIZATION_KEYWORD string STMTEND;
-
- // contact-stmt = contact-keyword sep string optsep stmtend
- contactStatement : CONTACT_KEYWORD string STMTEND;
-
- // description-stmt = description-keyword sep string optsep stmtend
- descriptionStatement : DESCRIPTION_KEYWORD string STMTEND;
-
- // reference-stmt = reference-keyword sep string optsep stmtend
- referenceStatement : REFERENCE_KEYWORD string STMTEND;
-
- /**
- * revision-stmt = revision-keyword sep revision-date optsep
- * (";" /
- * "{" stmtsep
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * "}")
- */
- revisionStatement : REVISION_KEYWORD dateArgumentString (STMTEND | LEFT_CURLY_BRACE revisionStatementBody RIGHT_CURLY_BRACE);
- revisionStatementBody : descriptionStatement? referenceStatement?;
-
- /**
- * submodule-stmt = optsep submodule-keyword sep identifier-arg-str
- * optsep
- * "{" stmtsep
- * submodule-header-stmts
- * linkage-stmts
- * meta-stmts
- * revision-stmts
- * body-stmts
- * "}" optsep
- */
- subModuleStatement : SUBMODULE_KEYWORD identifier LEFT_CURLY_BRACE submoduleBody RIGHT_CURLY_BRACE;
- submoduleBody : submoduleHeaderStatement linkageStatements metaStatements revisionStatements bodyStatements;
-
- /** submodule-header-stmts =
- * ;; these stmts can appear in any order
- * [yang-version-stmt stmtsep]
- * belongs-to-stmt stmtsep
- */
- submoduleHeaderStatement : yangVersionStatement? belongstoStatement
- | belongstoStatement yangVersionStatement?
- ;
-
- /**
- * belongs-to-stmt = belongs-to-keyword sep identifier-arg-str
- * optsep
- * "{" stmtsep
- * prefix-stmt stmtsep
- * "}"
- */
- belongstoStatement : BELONGS_TO_KEYWORD identifier LEFT_CURLY_BRACE belongstoStatementBody RIGHT_CURLY_BRACE;
- belongstoStatementBody : prefixStatement;
-
- /**
- * extension-stmt = extension-keyword sep identifier-arg-str optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [argument-stmt stmtsep]
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * "}")
- */
- extensionStatement : EXTENSION_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE extensionBody RIGHT_CURLY_BRACE);
- extensionBody : argumentStatement? statusStatement? descriptionStatement? referenceStatement?
- | argumentStatement? statusStatement? referenceStatement? descriptionStatement?
- | argumentStatement? descriptionStatement? statusStatement? referenceStatement?
- | argumentStatement? descriptionStatement? referenceStatement? statusStatement?
- | argumentStatement? referenceStatement? descriptionStatement? statusStatement?
- | argumentStatement? referenceStatement? statusStatement? descriptionStatement?
- | statusStatement? referenceStatement? argumentStatement? descriptionStatement?
- | statusStatement? referenceStatement? descriptionStatement? argumentStatement?
- | statusStatement? descriptionStatement? referenceStatement? argumentStatement?
- | statusStatement? descriptionStatement? argumentStatement? referenceStatement?
- | statusStatement? argumentStatement? referenceStatement? descriptionStatement?
- | statusStatement? argumentStatement? descriptionStatement? referenceStatement?
- | descriptionStatement? argumentStatement? statusStatement? referenceStatement?
- | descriptionStatement? argumentStatement? referenceStatement? statusStatement?
- | descriptionStatement? statusStatement? argumentStatement? referenceStatement?
- | descriptionStatement? statusStatement? referenceStatement? argumentStatement?
- | descriptionStatement? referenceStatement? statusStatement? argumentStatement?
- | descriptionStatement? referenceStatement? argumentStatement? statusStatement?
- | referenceStatement? descriptionStatement? argumentStatement? statusStatement?
- | referenceStatement? descriptionStatement? statusStatement? argumentStatement?
- | referenceStatement? statusStatement? argumentStatement? descriptionStatement?
- | referenceStatement? statusStatement? descriptionStatement? argumentStatement?
- | referenceStatement? argumentStatement? descriptionStatement? statusStatement?
- | referenceStatement? argumentStatement? statusStatement? descriptionStatement?
- ;
-
- /**
- * argument-stmt = argument-keyword sep identifier-arg-str optsep
- * (";" /
- * "{" stmtsep
- * [yin-element-stmt stmtsep]
- * "}")
- */
- argumentStatement : ARGUMENT_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE argumentBody RIGHT_CURLY_BRACE);
- argumentBody : yinElementStatement?;
-
- /**
- * yin-element-stmt = yin-element-keyword sep yin-element-arg-str
- * stmtend
- */
- yinElementStatement : YIN_ELEMENT_KEYWORD (TRUE_KEYWORD | FALSE_KEYWORD) STMTEND;
-
- /**
- * identity-stmt = identity-keyword sep identifier-arg-str optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [base-stmt stmtsep]
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * "}")
- */
- identityStatement : IDENTITY_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE identityBody RIGHT_CURLY_BRACE);
- identityBody : baseStatement? statusStatement? descriptionStatement? referenceStatement?
- | baseStatement? statusStatement? referenceStatement? descriptionStatement?
- | baseStatement? descriptionStatement? statusStatement? referenceStatement?
- | baseStatement? descriptionStatement? referenceStatement? statusStatement?
- | baseStatement? referenceStatement? descriptionStatement? statusStatement?
- | baseStatement? referenceStatement? statusStatement? descriptionStatement?
- | referenceStatement? baseStatement? statusStatement? descriptionStatement?
- | referenceStatement? baseStatement? descriptionStatement? statusStatement?
- | referenceStatement? statusStatement? baseStatement? descriptionStatement?
- | referenceStatement? statusStatement? descriptionStatement? baseStatement?
- | referenceStatement? descriptionStatement? statusStatement? baseStatement?
- | referenceStatement? descriptionStatement? baseStatement? statusStatement?
- | descriptionStatement? referenceStatement? statusStatement? baseStatement?
- | descriptionStatement? referenceStatement? statusStatement? baseStatement?
- | descriptionStatement? referenceStatement? baseStatement? statusStatement?
- | descriptionStatement? statusStatement? baseStatement? referenceStatement?
- | descriptionStatement? statusStatement? referenceStatement? baseStatement?
- | descriptionStatement? baseStatement? referenceStatement? statusStatement?
- | descriptionStatement? baseStatement? statusStatement? referenceStatement?
- | statusStatement? baseStatement? descriptionStatement? referenceStatement?
- | statusStatement? baseStatement? referenceStatement? descriptionStatement?
- | statusStatement? descriptionStatement? baseStatement? referenceStatement?
- | statusStatement? descriptionStatement? referenceStatement? baseStatement?
- | statusStatement? referenceStatement? descriptionStatement? baseStatement?
- | statusStatement? referenceStatement? baseStatement? descriptionStatement?
- ;
-
- /**
- * base-stmt = base-keyword sep identifier-ref-arg-str
- * optsep stmtend*
- * identifier-ref-arg = [prefix ":"] identifier
- */
- baseStatement : BASE_KEYWORD string STMTEND;
-
- /**
- * feature-stmt = feature-keyword sep identifier-arg-str optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * *(if-feature-stmt stmtsep)
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * "}")
- */
- featureStatement : FEATURE_KEYWORD string (STMTEND | LEFT_CURLY_BRACE featureBody RIGHT_CURLY_BRACE);
- featureBody : ifFeatureStatement* statusStatement? descriptionStatement? referenceStatement?
- | ifFeatureStatement* statusStatement? referenceStatement? descriptionStatement?
- | ifFeatureStatement* descriptionStatement? statusStatement? referenceStatement?
- | ifFeatureStatement* descriptionStatement? referenceStatement? statusStatement?
- | ifFeatureStatement* referenceStatement? statusStatement? descriptionStatement?
- | ifFeatureStatement* referenceStatement? descriptionStatement? statusStatement?
- | statusStatement? ifFeatureStatement* descriptionStatement? referenceStatement?
- | statusStatement? ifFeatureStatement* referenceStatement? descriptionStatement?
- | statusStatement? descriptionStatement? ifFeatureStatement* referenceStatement?
- | statusStatement? descriptionStatement? referenceStatement? ifFeatureStatement*
- | statusStatement? referenceStatement? ifFeatureStatement* descriptionStatement?
- | statusStatement? referenceStatement? descriptionStatement? ifFeatureStatement*
- | descriptionStatement? ifFeatureStatement* statusStatement? referenceStatement?
- | descriptionStatement? ifFeatureStatement* referenceStatement? statusStatement?
- | descriptionStatement? statusStatement? ifFeatureStatement* referenceStatement?
- | descriptionStatement? statusStatement? referenceStatement? ifFeatureStatement*
- | descriptionStatement? referenceStatement* statusStatement? ifFeatureStatement*
- | descriptionStatement? referenceStatement* ifFeatureStatement? statusStatement?
- | referenceStatement? ifFeatureStatement* statusStatement? descriptionStatement?
- | referenceStatement? ifFeatureStatement* descriptionStatement? statusStatement?
- | referenceStatement? descriptionStatement? statusStatement? ifFeatureStatement*
- | referenceStatement? descriptionStatement? ifFeatureStatement* statusStatement?
- | referenceStatement? statusStatement? descriptionStatement? ifFeatureStatement*
- | referenceStatement? statusStatement? ifFeatureStatement* descriptionStatement?
- ;
-
- /**
- * data-def-stmt = container-stmt /
- * leaf-stmt /
- * leaf-list-stmt /
- * list-stmt /
- * choice-stmt /
- * anyxml-stmt /
- * uses-stmt
- */
- dataDefStatement : containerStatement
- | leafStatement
- | leafListStatement
- | listStatement
- | choiceStatement
- | anyxmlStatement
- | usesStatement;
-
- /**
- * if-feature-stmt = if-feature-keyword sep identifier-ref-arg-str
- * optsep stmtend
- */
- ifFeatureStatement : IF_FEATURE_KEYWORD string STMTEND;
-
- /**
- * units-stmt = units-keyword sep string optsep stmtend
- */
- unitsStatement : UNITS_KEYWORD string STMTEND;
-
- /**
- * typedef-stmt = typedef-keyword sep identifier-arg-str optsep
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * type-stmt stmtsep
- * [units-stmt stmtsep]
- * [default-stmt stmtsep]
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * "}"
- * TODO : 0..1 occurance to be validated in listener
- */
- typedefStatement : TYPEDEF_KEYWORD identifier LEFT_CURLY_BRACE
- (typeStatement | unitsStatement | defaultStatement | statusStatement | descriptionStatement | referenceStatement)*
- RIGHT_CURLY_BRACE;
-
- /**
- * type-stmt = type-keyword sep identifier-ref-arg-str optsep
- * (";" /
- * "{" stmtsep
- * type-body-stmts
- * "}")
- */
- typeStatement : TYPE_KEYWORD string (STMTEND | LEFT_CURLY_BRACE typeBodyStatements RIGHT_CURLY_BRACE);
-
- /**
- * type-body-stmts = numerical-restrictions /
- * decimal64-specification /
- * string-restrictions /
- * enum-specification /
- * leafref-specification /
- * identityref-specification /
- * instance-identifier-specification /
- * bits-specification /
- * union-specification
- *
- */
- typeBodyStatements : numericalRestrictions | decimal64Specification | stringRestrictions | enumSpecification
- | leafrefSpecification | identityrefSpecification | instanceIdentifierSpecification
- | bitsSpecification | unionSpecification;
-
- /**
- * decimal64-specification = ;; these stmts can appear in any order
- * fraction-digits-stmt
- * [range-stmt]
- */
- decimal64Specification : fractionDigitStatement rangeStatement?;
-
- /**
- * fraction-digits-stmt = fraction-digits-keyword sep
- * fraction-digits-arg-str stmtend
- *
- * fraction-digits-arg-str = < a string that matches the rule
- * fraction-digits-arg >
- *
- * fraction-digits-arg = ("1" ["0" / "1" / "2" / "3" / "4" /
- * "5" / "6" / "7" / "8"])
- * / "2" / "3" / "4" / "5" / "6" / "7" / "8" / "9"
- */
- fractionDigitStatement : FRACTION_DIGITS_KEYWORD fraction STMTEND;
-
- /**
- * numerical-restrictions = range-stmt stmtsep
- */
- numericalRestrictions : rangeStatement;
-
- /**
- * range-stmt = range-keyword sep range-arg-str optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [error-message-stmt stmtsep]
- * [error-app-tag-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * "}")
- */
- rangeStatement : RANGE_KEYWORD range (STMTEND | LEFT_CURLY_BRACE commonStatements RIGHT_CURLY_BRACE);
-
- commonStatements : errorMessageStatement? errorAppTagStatement? descriptionStatement? referenceStatement?
- | errorMessageStatement? errorAppTagStatement? referenceStatement? descriptionStatement?
- | errorMessageStatement? descriptionStatement? errorAppTagStatement? referenceStatement?
- | errorMessageStatement? descriptionStatement? referenceStatement? errorAppTagStatement?
- | errorMessageStatement? referenceStatement? errorAppTagStatement? descriptionStatement?
- | errorMessageStatement? referenceStatement? descriptionStatement? errorAppTagStatement?
- | errorAppTagStatement? errorMessageStatement? descriptionStatement? referenceStatement?
- | errorAppTagStatement? errorMessageStatement? referenceStatement? descriptionStatement?
- | errorAppTagStatement? descriptionStatement? descriptionStatement? errorMessageStatement?
- | errorAppTagStatement? descriptionStatement? errorMessageStatement? descriptionStatement?
- | errorAppTagStatement? referenceStatement? errorMessageStatement? descriptionStatement?
- | errorAppTagStatement? referenceStatement? descriptionStatement? errorMessageStatement?
- | descriptionStatement? errorMessageStatement? errorAppTagStatement? referenceStatement?
- | descriptionStatement? errorMessageStatement? referenceStatement? errorAppTagStatement?
- | descriptionStatement? errorAppTagStatement? errorMessageStatement? referenceStatement?
- | descriptionStatement? errorAppTagStatement? referenceStatement? errorMessageStatement?
- | descriptionStatement? referenceStatement? errorMessageStatement? errorAppTagStatement?
- | descriptionStatement? referenceStatement? errorAppTagStatement? errorMessageStatement?
- | referenceStatement? errorMessageStatement? descriptionStatement? errorAppTagStatement?
- | referenceStatement? errorMessageStatement? errorAppTagStatement? descriptionStatement?
- | referenceStatement? errorAppTagStatement? descriptionStatement? errorMessageStatement?
- | referenceStatement? errorAppTagStatement? errorMessageStatement? descriptionStatement?
- | referenceStatement? descriptionStatement? errorMessageStatement? errorAppTagStatement?
- | referenceStatement? descriptionStatement? errorAppTagStatement? errorMessageStatement?
- ;
-
- /**
- * string-restrictions = ;; these stmts can appear in any order
- * [length-stmt stmtsep]
- * *(pattern-stmt stmtsep)
- */
- stringRestrictions : ((lengthStatement)? (patternStatement)*) | ((patternStatement)* (lengthStatement)?);
-
- /**
- * length-stmt = length-keyword sep length-arg-str optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [error-message-stmt stmtsep]
- * [error-app-tag-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * "}")
- */
- lengthStatement : LENGTH_KEYWORD length
- (STMTEND | LEFT_CURLY_BRACE commonStatements RIGHT_CURLY_BRACE);
-
- /**
- * pattern-stmt = pattern-keyword sep string optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [error-message-stmt stmtsep]
- * [error-app-tag-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * "}")
- */
- patternStatement : PATTERN_KEYWORD string (STMTEND | LEFT_CURLY_BRACE commonStatements RIGHT_CURLY_BRACE);
-
- /**
- * default-stmt = default-keyword sep string stmtend
- */
- defaultStatement : DEFAULT_KEYWORD string STMTEND;
-
- /**
- * enum-specification = 1*(enum-stmt stmtsep)
- */
- enumSpecification : enumStatement+;
-
- /**
- * enum-stmt = enum-keyword sep string optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [value-stmt stmtsep]
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * "}")
- */
- enumStatement : ENUM_KEYWORD string (STMTEND | LEFT_CURLY_BRACE enumStatementBody RIGHT_CURLY_BRACE);
-
- enumStatementBody : valueStatement? statusStatement? descriptionStatement? referenceStatement?
- | valueStatement? statusStatement? referenceStatement? descriptionStatement?
- | valueStatement? descriptionStatement? statusStatement? referenceStatement?
- | valueStatement? descriptionStatement? referenceStatement? statusStatement?
- | valueStatement? referenceStatement? statusStatement? descriptionStatement?
- | valueStatement? referenceStatement? descriptionStatement? statusStatement?
- | statusStatement? valueStatement? descriptionStatement? referenceStatement?
- | statusStatement? valueStatement? referenceStatement? descriptionStatement?
- | statusStatement? descriptionStatement? descriptionStatement? valueStatement?
- | statusStatement? descriptionStatement? valueStatement? descriptionStatement?
- | statusStatement? referenceStatement? valueStatement? descriptionStatement?
- | statusStatement? referenceStatement? descriptionStatement? valueStatement?
- | descriptionStatement? valueStatement? statusStatement? referenceStatement?
- | descriptionStatement? valueStatement? referenceStatement? statusStatement?
- | descriptionStatement? statusStatement? valueStatement? referenceStatement?
- | descriptionStatement? statusStatement? referenceStatement? valueStatement?
- | descriptionStatement? referenceStatement? valueStatement? statusStatement?
- | descriptionStatement? referenceStatement? statusStatement? valueStatement?
- | referenceStatement? valueStatement? descriptionStatement? statusStatement?
- | referenceStatement? valueStatement? statusStatement? descriptionStatement?
- | referenceStatement? statusStatement? descriptionStatement? valueStatement?
- | referenceStatement? statusStatement? valueStatement? descriptionStatement?
- | referenceStatement? descriptionStatement? valueStatement? statusStatement?
- | referenceStatement? descriptionStatement? statusStatement? valueStatement?
- ;
-
- /**
- * leafref-specification =
- * ;; these stmts can appear in any order
- * path-stmt stmtsep
- * [require-instance-stmt stmtsep]
- */
- leafrefSpecification : (pathStatement (requireInstanceStatement)?) | ((requireInstanceStatement)? pathStatement);
-
- /**
- * path-stmt = path-keyword sep path-arg-str stmtend
- */
- pathStatement : PATH_KEYWORD path STMTEND;
-
- /**
- * require-instance-stmt = require-instance-keyword sep
- * require-instance-arg-str stmtend
- * require-instance-arg-str = < a string that matches the rule
- * require-instance-arg >
- * require-instance-arg = true-keyword / false-keyword
- */
- requireInstanceStatement : REQUIRE_INSTANCE_KEYWORD requireInstance STMTEND;
-
- /**
- * instance-identifier-specification =
- * [require-instance-stmt stmtsep]
- */
- instanceIdentifierSpecification : requireInstanceStatement?;
-
- /**
- * identityref-specification =
- * base-stmt stmtsep
- */
- identityrefSpecification : baseStatement;
-
- /**
- * union-specification = 1*(type-stmt stmtsep)
- */
- unionSpecification : typeStatement+;
-
- /**
- * bits-specification = 1*(bit-stmt stmtsep)
- */
- bitsSpecification : bitStatement+;
-
- /**
- * bit-stmt = bit-keyword sep identifier-arg-str optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [position-stmt stmtsep]
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * "}"
- * "}")
- */
- bitStatement : BIT_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE bitBodyStatement RIGHT_CURLY_BRACE);
-
- bitBodyStatement : positionStatement? statusStatement? descriptionStatement? referenceStatement?
- | positionStatement? statusStatement? referenceStatement? descriptionStatement?
- | positionStatement? descriptionStatement? statusStatement? referenceStatement?
- | positionStatement? descriptionStatement? referenceStatement? statusStatement?
- | positionStatement? referenceStatement? statusStatement? descriptionStatement?
- | positionStatement? referenceStatement? descriptionStatement? statusStatement?
- | statusStatement? positionStatement? descriptionStatement? referenceStatement?
- | statusStatement? positionStatement? referenceStatement? descriptionStatement?
- | statusStatement? descriptionStatement? descriptionStatement? positionStatement?
- | statusStatement? descriptionStatement? positionStatement? descriptionStatement?
- | statusStatement? referenceStatement? positionStatement? descriptionStatement?
- | statusStatement? referenceStatement? descriptionStatement? positionStatement?
- | descriptionStatement? positionStatement? statusStatement? referenceStatement?
- | descriptionStatement? positionStatement? referenceStatement? statusStatement?
- | descriptionStatement? statusStatement? positionStatement? referenceStatement?
- | descriptionStatement? statusStatement? referenceStatement? positionStatement?
- | descriptionStatement? referenceStatement? positionStatement? statusStatement?
- | descriptionStatement? referenceStatement? statusStatement? positionStatement?
- | referenceStatement? positionStatement? descriptionStatement? statusStatement?
- | referenceStatement? positionStatement? statusStatement? descriptionStatement?
- | referenceStatement? statusStatement? descriptionStatement? positionStatement?
- | referenceStatement? statusStatement? positionStatement? descriptionStatement?
- | referenceStatement? descriptionStatement? positionStatement? statusStatement?
- | referenceStatement? descriptionStatement? statusStatement? positionStatement?
- ;
-
- /**
- * position-stmt = position-keyword sep
- * position-value-arg-str stmtend
- * position-value-arg-str = < a string that matches the rule
- * position-value-arg >
- * position-value-arg = non-negative-integer-value
- */
- positionStatement : POSITION_KEYWORD position STMTEND;
-
- /**
- * status-stmt = status-keyword sep status-arg-str stmtend
- * status-arg-str = < a string that matches the rule
- * status-arg >
- * status-arg = current-keyword /
- * obsolete-keyword /
- * deprecated-keyword
- */
- statusStatement : STATUS_KEYWORD status STMTEND;
-
- /**
- * config-stmt = config-keyword sep
- * config-arg-str stmtend
- * config-arg-str = < a string that matches the rule
- * config-arg >
- * config-arg = true-keyword / false-keyword
- */
- configStatement : CONFIG_KEYWORD config STMTEND;
-
- /**
- * mandatory-stmt = mandatory-keyword sep
- * mandatory-arg-str stmtend
- *
- * mandatory-arg-str = < a string that matches the rule
- * mandatory-arg >
- *
- * mandatory-arg = true-keyword / false-keyword
- */
- mandatoryStatement : MANDATORY_KEYWORD mandatory STMTEND;
-
- /**
- * presence-stmt = presence-keyword sep string stmtend
- */
- presenceStatement : PRESENCE_KEYWORD string STMTEND;
-
- /**
- * ordered-by-stmt = ordered-by-keyword sep
- * ordered-by-arg-str stmtend
- *
- * ordered-by-arg-str = < a string that matches the rule
- * ordered-by-arg >
- *
- * ordered-by-arg = user-keyword / system-keyword
- */
- orderedByStatement : ORDERED_BY_KEYWORD orderedBy STMTEND;
-
- /**
- * must-stmt = must-keyword sep string optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [error-message-stmt stmtsep]
- * [error-app-tag-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * "}")
- */
- mustStatement : MUST_KEYWORD string (STMTEND | LEFT_CURLY_BRACE commonStatements RIGHT_CURLY_BRACE);
-
- /**
- * error-message-stmt = error-message-keyword sep string stmtend
- */
- errorMessageStatement : ERROR_MESSAGE_KEYWORD string STMTEND;
-
- /**
- * error-app-tag-stmt = error-app-tag-keyword sep string stmtend
- */
- errorAppTagStatement : ERROR_APP_TAG_KEYWORD string STMTEND;
-
- /**
- * min-elements-stmt = min-elements-keyword sep
- * min-value-arg-str stmtend
- * min-value-arg-str = < a string that matches the rule
- * min-value-arg >
- * min-value-arg = non-negative-integer-value
- */
- minElementsStatement : MIN_ELEMENTS_KEYWORD minValue STMTEND;
-
- /**
- * max-elements-stmt = max-elements-keyword sep
- * max-value-arg-str stmtend
- * max-value-arg-str = < a string that matches the rule
- * max-value-arg >
- * max-value-arg = unbounded-keyword /
- * positive-integer-value
- */
- maxElementsStatement : MAX_ELEMENTS_KEYWORD maxValue STMTEND;
-
- /**
- * value-stmt = value-keyword sep integer-value stmtend
- */
- valueStatement : VALUE_KEYWORD value STMTEND;
-
- /**
- * grouping-stmt = grouping-keyword sep identifier-arg-str optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * *((typedef-stmt /
- * grouping-stmt) stmtsep)
- * *(data-def-stmt stmtsep)
- * "}")
- * TODO : 0..1 occurance to be checked in listener
- */
- groupingStatement : GROUPING_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE
- (statusStatement | descriptionStatement | referenceStatement | typedefStatement | groupingStatement
- | dataDefStatement)* RIGHT_CURLY_BRACE);
-
- /**
- * container-stmt = container-keyword sep identifier-arg-str optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [when-stmt stmtsep]
- * *(if-feature-stmt stmtsep)
- * *(must-stmt stmtsep)
- * [presence-stmt stmtsep]
- * [config-stmt stmtsep]
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * *((typedef-stmt /
- * grouping-stmt) stmtsep)
- * *(data-def-stmt stmtsep)
- * "}")
- * TODO : 0..1 occurance to be checked in listener
- */
- containerStatement : CONTAINER_KEYWORD identifier
- (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | mustStatement | presenceStatement | configStatement
- | statusStatement | descriptionStatement | referenceStatement | typedefStatement | groupingStatement
- | dataDefStatement)* RIGHT_CURLY_BRACE);
-
- /**
- * leaf-stmt = leaf-keyword sep identifier-arg-str optsep
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [when-stmt stmtsep]
- * *(if-feature-stmt stmtsep)
- * type-stmt stmtsep
- * [units-stmt stmtsep]
- * *(must-stmt stmtsep)
- * [default-stmt stmtsep]
- * [config-stmt stmtsep]
- * [mandatory-stmt stmtsep]
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * "}"
- * TODO : 0..1 occurance to be checked in listener
- */
- leafStatement : LEAF_KEYWORD identifier LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | typeStatement | unitsStatement
- | mustStatement | defaultStatement | configStatement | mandatoryStatement | statusStatement | descriptionStatement
- | referenceStatement)* RIGHT_CURLY_BRACE;
-
- /**
- * leaf-list-stmt = leaf-list-keyword sep identifier-arg-str optsep
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [when-stmt stmtsep]
- * *(if-feature-stmt stmtsep)
- * type-stmt stmtsep
- * [units-stmt stmtsep]
- * *(must-stmt stmtsep)
- * [config-stmt stmtsep]
- * [min-elements-stmt stmtsep]
- * [max-elements-stmt stmtsep]
- * [ordered-by-stmt stmtsep]
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * "}"
- * TODO : 0..1 occurance to be checked in listener
- */
- leafListStatement : LEAF_LIST_KEYWORD identifier LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | typeStatement
- | unitsStatement | mustStatement | configStatement | minElementsStatement | maxElementsStatement | orderedByStatement
- | statusStatement | descriptionStatement | referenceStatement)* RIGHT_CURLY_BRACE;
-
- /**
- * list-stmt = list-keyword sep identifier-arg-str optsep
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [when-stmt stmtsep]
- * *(if-feature-stmt stmtsep)
- * *(must-stmt stmtsep)
- * [key-stmt stmtsep]
- * *(unique-stmt stmtsep)
- * [config-stmt stmtsep]
- * [min-elements-stmt stmtsep]
- * [max-elements-stmt stmtsep]
- * [ordered-by-stmt stmtsep]
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * *((typedef-stmt /
- * grouping-stmt) stmtsep)
- * 1*(data-def-stmt stmtsep)
- * "}"
- * TODO : 0..1 occurance to be checked in listener
- */
- listStatement : LIST_KEYWORD identifier LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | mustStatement | keyStatement
- | uniqueStatement | configStatement | minElementsStatement | maxElementsStatement | orderedByStatement | statusStatement
- | descriptionStatement | referenceStatement | typedefStatement | groupingStatement| dataDefStatement)* RIGHT_CURLY_BRACE;
-
- /**
- * key-stmt = key-keyword sep key-arg-str stmtend
- */
- keyStatement : KEY_KEYWORD key STMTEND;
-
- /**
- * unique-stmt = unique-keyword sep unique-arg-str stmtend
- */
- uniqueStatement: UNIQUE_KEYWORD unique STMTEND;
-
- /**
- * choice-stmt = choice-keyword sep identifier-arg-str optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [when-stmt stmtsep]
- * *(if-feature-stmt stmtsep)
- * [default-stmt stmtsep]
- * [config-stmt stmtsep]
- * [mandatory-stmt stmtsep]
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * *((short-case-stmt / case-stmt) stmtsep)
- * "}")
- * TODO : 0..1 occurance to be checked in listener
- */
- choiceStatement : CHOICE_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | defaultStatement
- | configStatement | mandatoryStatement | statusStatement | descriptionStatement | referenceStatement | shortCaseStatement
- | caseStatement)* RIGHT_CURLY_BRACE);
-
- /**
- * short-case-stmt = container-stmt /
- * leaf-stmt /
- * leaf-list-stmt /
- * list-stmt /
- * anyxml-stmt
- */
- shortCaseStatement : containerStatement | leafStatement | leafListStatement | listStatement | anyxmlStatement;
-
- /**
- * case-stmt = case-keyword sep identifier-arg-str optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [when-stmt stmtsep]
- * *(if-feature-stmt stmtsep)
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * *(data-def-stmt stmtsep)
- * "}")
- * TODO : 0..1 occurance to be checked in listener
- */
- caseStatement : CASE_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | statusStatement
- | descriptionStatement | referenceStatement | dataDefStatement)* RIGHT_CURLY_BRACE);
-
- /**
- * anyxml-stmt = anyxml-keyword sep identifier-arg-str optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [when-stmt stmtsep]
- * *(if-feature-stmt stmtsep)
- * *(must-stmt stmtsep)
- * [config-stmt stmtsep]
- * [mandatory-stmt stmtsep]
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * "}")
- */
- anyxmlStatement : ANYXML_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement
- | mustStatement | configStatement | mandatoryStatement | statusStatement | descriptionStatement
- | referenceStatement)* RIGHT_CURLY_BRACE);
-
- /**
- * uses-stmt = uses-keyword sep identifier-ref-arg-str optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [when-stmt stmtsep]
- * *(if-feature-stmt stmtsep)
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * *(refine-stmt stmtsep)
- * *(uses-augment-stmt stmtsep)
- * "}")
- * TODO : 0..1 occurance to be checked in listener
- */
- usesStatement : USES_KEYWORD string (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | statusStatement
- | descriptionStatement | referenceStatement | refineStatement | augmentStatement)* RIGHT_CURLY_BRACE);
-
- /**
- * refine-stmt = refine-keyword sep refine-arg-str optsep
- * (";" /
- * "{" stmtsep
- * (refine-container-stmts /
- * refine-leaf-stmts /
- * refine-leaf-list-stmts /
- * refine-list-stmts /
- * refine-choice-stmts /
- * refine-case-stmts /
- * refine-anyxml-stmts)
- * "}")
- */
- refineStatement : REFINE_KEYWORD refine (STMTEND | LEFT_CURLY_BRACE (refineContainerStatements
- | refineLeafStatements | refineLeafListStatements | refineListStatements | refineChoiceStatements
- | refineCaseStatements | refineAnyxmlStatements) RIGHT_CURLY_BRACE);
-
- /**
- * refine-container-stmts =
- * ;; these stmts can appear in any order
- * *(must-stmt stmtsep)
- * [presence-stmt stmtsep]
- * [config-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * TODO : 0..1 occurance to be checked in listener
- */
- refineContainerStatements : (mustStatement | presenceStatement | configStatement | descriptionStatement | referenceStatement)* ;
-
- /**
- * refine-leaf-stmts = ;; these stmts can appear in any order
- * *(must-stmt stmtsep)
- * [default-stmt stmtsep]
- * [config-stmt stmtsep]
- * [mandatory-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * TODO : 0..1 occurance to be checked in listener
- */
- refineLeafStatements : (mustStatement | defaultStatement | configStatement | mandatoryStatement | descriptionStatement | referenceStatement)*;
-
- /**
- * refine-leaf-list-stmts =
- * ;; these stmts can appear in any order
- * *(must-stmt stmtsep)
- * [config-stmt stmtsep]
- * [min-elements-stmt stmtsep]
- * [max-elements-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * TODO : 0..1 occurance to be checked in listener
- */
- refineLeafListStatements : (mustStatement | configStatement | minElementsStatement | maxElementsStatement | descriptionStatement
- | referenceStatement)*;
-
- /**
- * refine-list-stmts = ;; these stmts can appear in any order
- * *(must-stmt stmtsep)
- * [config-stmt stmtsep]
- * [min-elements-stmt stmtsep]
- * [max-elements-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * TODO : 0..1 occurance to be checked in listener
- */
- refineListStatements : (mustStatement | configStatement | minElementsStatement | maxElementsStatement | descriptionStatement
- | referenceStatement)*;
-
- /**
- * refine-choice-stmts = ;; these stmts can appear in any order
- * [default-stmt stmtsep]
- * [config-stmt stmtsep]
- * [mandatory-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * TODO : 0..1 occurance to be checked in listener
- */
- refineChoiceStatements : (defaultStatement | configStatement | mandatoryStatement | descriptionStatement | referenceStatement)*;
-
- /**
- * refine-case-stmts = ;; these stmts can appear in any order
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- *
- */
- refineCaseStatements : (descriptionStatement | referenceStatement)? | (referenceStatement | descriptionStatement)?;
-
- /**
- * refine-anyxml-stmts = ;; these stmts can appear in any order
- * *(must-stmt stmtsep)
- * [config-stmt stmtsep]
- * [mandatory-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- */
- refineAnyxmlStatements : (mustStatement | configStatement | mandatoryStatement | descriptionStatement
- | referenceStatement)*;
-
- /**
- * augment-stmt = augment-keyword sep augment-arg-str optsep
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [when-stmt stmtsep]
- * *(if-feature-stmt stmtsep)
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * 1*((data-def-stmt stmtsep) /
- * (case-stmt stmtsep))
- * "}"
- * TODO : 0..1 occurance to be checked in listener
- */
- augmentStatement : AUGMENT_KEYWORD augment LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | statusStatement
- | descriptionStatement | referenceStatement | dataDefStatement | caseStatement)* RIGHT_CURLY_BRACE;
-
- /**
- * when-stmt = when-keyword sep string optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * "}")
- *
- */
- whenStatement : WHEN_KEYWORD string (STMTEND | LEFT_CURLY_BRACE ((descriptionStatement? referenceStatement?)
- | (referenceStatement? descriptionStatement?)) RIGHT_CURLY_BRACE);
-
- /**
- * rpc-stmt = rpc-keyword sep identifier-arg-str optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * *(if-feature-stmt stmtsep)
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * *((typedef-stmt /
- * grouping-stmt) stmtsep)
- * [input-stmt stmtsep]
- * [output-stmt stmtsep]
- * "}")
- */
- rpcStatement : RPC_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE (ifFeatureStatement | statusStatement | descriptionStatement
- | referenceStatement | typedefStatement | groupingStatement | inputStatement | outputStatement)* RIGHT_CURLY_BRACE);
-
- /**
- * input-stmt = input-keyword optsep
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * *((typedef-stmt /
- * grouping-stmt) stmtsep)
- * 1*(data-def-stmt stmtsep)
- * "}"
- */
- inputStatement : INPUT_KEYWORD LEFT_CURLY_BRACE (typedefStatement | groupingStatement | dataDefStatement)* RIGHT_CURLY_BRACE;
-
- /**
- * output-stmt = output-keyword optsep
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * *((typedef-stmt /
- * grouping-stmt) stmtsep)
- * 1*(data-def-stmt stmtsep)
- * "}"
- */
- outputStatement : OUTPUT_KEYWORD LEFT_CURLY_BRACE (typedefStatement | groupingStatement | dataDefStatement)* RIGHT_CURLY_BRACE;
-
- /**
- * notification-stmt = notification-keyword sep
- * identifier-arg-str optsep
- * (";" /
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * *(if-feature-stmt stmtsep)
- * [status-stmt stmtsep]
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * *((typedef-stmt /
- * grouping-stmt) stmtsep)
- * *(data-def-stmt stmtsep)
- * "}")
- * TODO : 0..1 occurance to be checked in listener
- */
- notificationStatement : NOTIFICATION_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE (ifFeatureStatement
- | statusStatement | descriptionStatement | referenceStatement | typedefStatement
- | groupingStatement | dataDefStatement)* RIGHT_CURLY_BRACE);
-
- /**
- * deviation-stmt = deviation-keyword sep
- * deviation-arg-str optsep
- * "{" stmtsep
- * ;; these stmts can appear in any order
- * [description-stmt stmtsep]
- * [reference-stmt stmtsep]
- * (deviate-not-supported-stmt /
- * 1*(deviate-add-stmt /
- * deviate-replace-stmt /
- * deviate-delete-stmt))
- * "}"
- * TODO : 0..1 occurance to be checked in listener
- */
- deviationStatement: DEVIATION_KEYWORD deviation LEFT_CURLY_BRACE (descriptionStatement | referenceStatement
- | deviateNotSupportedStatement | deviateAddStatement | deviateReplaceStatement
- | deviateDeleteStatement)* RIGHT_CURLY_BRACE;
-
- /**
- * deviate-not-supported-stmt =
- * deviate-keyword sep
- * not-supported-keyword optsep
- * (";" /
- * "{" stmtsep
- * "}")
- */
- deviateNotSupportedStatement: DEVIATE_KEYWORD NOT_SUPPORTED_KEYWORD (STMTEND | LEFT_CURLY_BRACE RIGHT_CURLY_BRACE);
-
- /**
- * deviate-add-stmt = deviate-keyword sep add-keyword optsep
- * (";" /
- * "{" stmtsep
- * [units-stmt stmtsep]
- * *(must-stmt stmtsep)
- * *(unique-stmt stmtsep)
- * [default-stmt stmtsep]
- * [config-stmt stmtsep]
- * [mandatory-stmt stmtsep]
- * [min-elements-stmt stmtsep]
- * [max-elements-stmt stmtsep]
- * "}")
- */
- deviateAddStatement: DEVIATE_KEYWORD ADD_KEYWORD (STMTEND | (LEFT_CURLY_BRACE unitsStatement? mustStatement* uniqueStatement*
- defaultStatement? configStatement? mandatoryStatement? minElementsStatement? maxElementsStatement?
- RIGHT_CURLY_BRACE));
-
- /**
- * deviate-delete-stmt = deviate-keyword sep delete-keyword optsep
- * (";" /
- * "{" stmtsep
- * [units-stmt stmtsep]
- * *(must-stmt stmtsep)
- * *(unique-stmt stmtsep)
- * [default-stmt stmtsep]
- * "}")
- */
- deviateDeleteStatement: DEVIATE_KEYWORD DELETE_KEYWORD (STMTEND
- | (LEFT_CURLY_BRACE unitsStatement? mustStatement* uniqueStatement* defaultStatement? RIGHT_CURLY_BRACE));
-
- /**
- * deviate-replace-stmt = deviate-keyword sep replace-keyword optsep
- * (";" /
- * "{" stmtsep
- * [type-stmt stmtsep]
- * [units-stmt stmtsep]
- * [default-stmt stmtsep]
- * [config-stmt stmtsep]
- * [mandatory-stmt stmtsep]
- * [min-elements-stmt stmtsep]
- * [max-elements-stmt stmtsep]
- * "}")
- */
- deviateReplaceStatement: DEVIATE_KEYWORD REPLACE_KEYWORD (STMTEND | (LEFT_CURLY_BRACE typeStatement? unitsStatement?
- defaultStatement? configStatement? mandatoryStatement? minElementsStatement?
- maxElementsStatement? RIGHT_CURLY_BRACE));
-
- /**
- * compiler-annotation-stmt = prefix:compiler-annotation-keyword string
- * "{"
- * [app-data-structure-stmt stmtsep]
- * [app-extended-stmt stmtsep]
- * "}"
- */
- compilerAnnotationStatement : COMPILER_ANNOTATION string LEFT_CURLY_BRACE
- compilerAnnotationBodyStatement RIGHT_CURLY_BRACE;
-
- compilerAnnotationBodyStatement : appDataStructureStatement? appExtendedStatement? ;
-
- /**
- * app-data-structure-stmt = prefix:app-data-structure-keyword string
- * (";" /
- * "{"
- * [data-structure-key-stmt stmtsep]
- * "}")
- */
- appDataStructureStatement : APP_DATA_STRUCTURE appDataStructure (STMTEND | (LEFT_CURLY_BRACE
- dataStructureKeyStatement? RIGHT_CURLY_BRACE));
-
- /**
- * data-structure-key-stmt = prefix:key-keyword string ";"
- */
- dataStructureKeyStatement : DATA_STRUCTURE_KEY string STMTEND;
-
- /**
- * app-extended-stmt = prefix:app-extended-name-keyword string ";"
- */
- appExtendedStatement : APP_EXTENDED extendedName STMTEND;
-
- string : STRING (PLUS STRING)*
- | IDENTIFIER
- | INTEGER
- | yangConstruct;
-
- identifier : STRING (PLUS STRING)*
- | IDENTIFIER
- | yangConstruct;
-
- dateArgumentString : DATE_ARG
- | STRING (PLUS STRING)*;
-
- version : string;
-
- range : string;
-
- length : string;
-
- path : string;
-
- position : string;
-
- status : string;
-
- config : string;
-
- mandatory : string;
-
- orderedBy : string;
-
- minValue : string;
-
- maxValue : string;
-
- key : string;
-
- unique : string;
-
- refine : string;
-
- requireInstance : string;
-
- augment : string;
-
- deviation : string;
-
- value : string;
-
- fraction : string;
-
- appDataStructure : string;
-
- extendedName : string;
-
- yangConstruct : ANYXML_KEYWORD | ARGUMENT_KEYWORD | AUGMENT_KEYWORD | BASE_KEYWORD | BELONGS_TO_KEYWORD
- | BIT_KEYWORD | CASE_KEYWORD | CHOICE_KEYWORD | CONFIG_KEYWORD | CONTACT_KEYWORD | CONTAINER_KEYWORD
- | DEFAULT_KEYWORD | DESCRIPTION_KEYWORD | ENUM_KEYWORD | ERROR_APP_TAG_KEYWORD | ERROR_MESSAGE_KEYWORD
- | EXTENSION_KEYWORD | DEVIATION_KEYWORD | DEVIATE_KEYWORD | FEATURE_KEYWORD
- | FRACTION_DIGITS_KEYWORD | GROUPING_KEYWORD | IDENTITY_KEYWORD | IF_FEATURE_KEYWORD
- | IMPORT_KEYWORD | INCLUDE_KEYWORD | INPUT_KEYWORD | KEY_KEYWORD | LEAF_KEYWORD | LEAF_LIST_KEYWORD
- | LENGTH_KEYWORD | LIST_KEYWORD | MANDATORY_KEYWORD | MAX_ELEMENTS_KEYWORD | MIN_ELEMENTS_KEYWORD
- | MODULE_KEYWORD | MUST_KEYWORD | NAMESPACE_KEYWORD | NOTIFICATION_KEYWORD | ORDERED_BY_KEYWORD
- | ORGANIZATION_KEYWORD | OUTPUT_KEYWORD | PATH_KEYWORD | PATTERN_KEYWORD | POSITION_KEYWORD
- | PREFIX_KEYWORD | PRESENCE_KEYWORD | RANGE_KEYWORD | REFERENCE_KEYWORD | REFINE_KEYWORD
- | REQUIRE_INSTANCE_KEYWORD | REVISION_KEYWORD | REVISION_DATE_KEYWORD | RPC_KEYWORD
- | STATUS_KEYWORD | SUBMODULE_KEYWORD | TYPE_KEYWORD | TYPEDEF_KEYWORD | UNIQUE_KEYWORD
- | UNITS_KEYWORD | USES_KEYWORD | VALUE_KEYWORD | WHEN_KEYWORD | YANG_VERSION_KEYWORD
- | YIN_ELEMENT_KEYWORD | ADD_KEYWORD | CURRENT_KEYWORD | DELETE_KEYWORD | DEPRECATED_KEYWORD
- | FALSE_KEYWORD | MAX_KEYWORD | MIN_KEYWORD | NOT_SUPPORTED_KEYWORD | OBSOLETE_KEYWORD
- | REPLACE_KEYWORD | SYSTEM_KEYWORD | TRUE_KEYWORD | UNBOUNDED_KEYWORD | USER_KEYWORD
- | COMPILER_ANNOTATION_KEYWORD | APP_DATA_STRUCTURE_KEYWORD | DATA_STRUCTURE_KEYWORD
- | APP_EXTENDED_KEYWORD;
diff --git a/utils/yangutils/plugin/src/main/resources/YangLexer.g4 b/utils/yangutils/plugin/src/main/resources/YangLexer.g4
deleted file mode 100644
index 8abe32f..0000000
--- a/utils/yangutils/plugin/src/main/resources/YangLexer.g4
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * This is a YANG grammar for lexer based on which ANTLR will generate YANG lexer.
- */
-
-lexer grammar YangLexer;
-
- // Statements keywords
- ANYXML_KEYWORD : 'anyxml';
- ARGUMENT_KEYWORD : 'argument';
- AUGMENT_KEYWORD : 'augment';
- BASE_KEYWORD : 'base';
- BELONGS_TO_KEYWORD : 'belongs-to';
- BIT_KEYWORD : 'bit';
- CASE_KEYWORD : 'case';
- CHOICE_KEYWORD : 'choice';
- CONFIG_KEYWORD : 'config';
- CONTACT_KEYWORD : 'contact';
- CONTAINER_KEYWORD : 'container';
- DEFAULT_KEYWORD : 'default';
- DESCRIPTION_KEYWORD : 'description';
- ENUM_KEYWORD : 'enum';
- ERROR_APP_TAG_KEYWORD : 'error-app-tag';
- ERROR_MESSAGE_KEYWORD : 'error-message';
- EXTENSION_KEYWORD : 'extension';
- DEVIATION_KEYWORD : 'deviation';
- DEVIATE_KEYWORD : 'deviate';
- FEATURE_KEYWORD : 'feature';
- FRACTION_DIGITS_KEYWORD : 'fraction-digits';
- GROUPING_KEYWORD : 'grouping';
- IDENTITY_KEYWORD : 'identity';
- IF_FEATURE_KEYWORD : 'if-feature';
- IMPORT_KEYWORD : 'import';
- INCLUDE_KEYWORD : 'include';
- INPUT_KEYWORD : 'input';
- KEY_KEYWORD : 'key';
- LEAF_KEYWORD : 'leaf';
- LEAF_LIST_KEYWORD : 'leaf-list';
- LENGTH_KEYWORD : 'length';
- LIST_KEYWORD : 'list';
- MANDATORY_KEYWORD : 'mandatory';
- MAX_ELEMENTS_KEYWORD : 'max-elements';
- MIN_ELEMENTS_KEYWORD : 'min-elements';
- MODULE_KEYWORD : 'module';
- MUST_KEYWORD : 'must';
- NAMESPACE_KEYWORD : 'namespace';
- NOTIFICATION_KEYWORD: 'notification';
- ORDERED_BY_KEYWORD : 'ordered-by';
- ORGANIZATION_KEYWORD: 'organization';
- OUTPUT_KEYWORD : 'output';
- PATH_KEYWORD : 'path';
- PATTERN_KEYWORD : 'pattern';
- POSITION_KEYWORD : 'position';
- PREFIX_KEYWORD : 'prefix';
- PRESENCE_KEYWORD : 'presence';
- RANGE_KEYWORD : 'range';
- REFERENCE_KEYWORD : 'reference';
- REFINE_KEYWORD : 'refine';
- REQUIRE_INSTANCE_KEYWORD : 'require-instance';
- REVISION_KEYWORD : 'revision';
- REVISION_DATE_KEYWORD : 'revision-date';
- RPC_KEYWORD : 'rpc';
- STATUS_KEYWORD : 'status';
- SUBMODULE_KEYWORD : 'submodule';
- TYPE_KEYWORD : 'type';
- TYPEDEF_KEYWORD : 'typedef';
- UNIQUE_KEYWORD : 'unique';
- UNITS_KEYWORD : 'units';
- USES_KEYWORD : 'uses';
- VALUE_KEYWORD : 'value';
- WHEN_KEYWORD : 'when';
- YANG_VERSION_KEYWORD: 'yang-version';
- YIN_ELEMENT_KEYWORD : 'yin-element';
- ADD_KEYWORD : 'add';
- CURRENT_KEYWORD : 'current';
- DELETE_KEYWORD : 'delete';
- DEPRECATED_KEYWORD : 'deprecated';
- FALSE_KEYWORD : 'false';
- MAX_KEYWORD : 'max';
- MIN_KEYWORD : 'min';
- NOT_SUPPORTED_KEYWORD : 'not-supported';
- OBSOLETE_KEYWORD : 'obsolete';
- REPLACE_KEYWORD : 'replace';
- SYSTEM_KEYWORD : 'system';
- TRUE_KEYWORD : 'true';
- UNBOUNDED_KEYWORD : 'unbounded';
- USER_KEYWORD : 'user';
- COMPILER_ANNOTATION_KEYWORD : 'compiler-annotation';
- COMPILER_ANNOTATION : IDENTIFIER COLON COMPILER_ANNOTATION_KEYWORD;
- APP_DATA_STRUCTURE_KEYWORD : 'app-data-structure';
- APP_DATA_STRUCTURE : IDENTIFIER COLON APP_DATA_STRUCTURE_KEYWORD;
- DATA_STRUCTURE_KEYWORD : 'data-structure';
- DATA_STRUCTURE : IDENTIFIER COLON DATA_STRUCTURE_KEYWORD;
- DATA_STRUCTURE_KEY : IDENTIFIER COLON KEY_KEYWORD;
- APP_EXTENDED_KEYWORD : 'app-extended-name';
- APP_EXTENDED : IDENTIFIER COLON APP_EXTENDED_KEYWORD;
-
- // Lexer tokens to be skipped
- COMMENT
- : '/*' .*? '*/' -> channel(HIDDEN)
- ;
- WS : [ \r\t\u000C\n]+ -> channel(HIDDEN)
- ;
- LINE_COMMENT
- : '//' ~[\r\n]* '\r'? '\n' -> channel(HIDDEN)
- ;
-
- // Additional rules
- INTEGER : DIGIT+;
- DATE_ARG : DIGIT DIGIT DIGIT DIGIT '-' DIGIT DIGIT '-' DIGIT DIGIT;
- LEFT_CURLY_BRACE : '{';
- RIGHT_CURLY_BRACE : '}';
- IDENTIFIER : (ALPHA | '_')
- (ALPHA | DIGIT | '_' | '-' | '.')*;
- STMTEND : ';';
- DQUOTE : '"';
- COLON : ':';
- PLUS : '+';
- MINUS: '-';
-
- STRING : ((~( '\r' | '\n' | '\t' | ' ' | ';' | '{' | '"' | '\'')~( '\r' | '\n' | '\t' | ' ' | ';' | '{' )* ) | SUB_STRING );
-
- //Fragment rules
- fragment SUB_STRING : ('"' (ESC | ~["])*'"') | ('\'' (ESC | ~['])*'\'') ;
- fragment ESC : '\\' (["\\/bfnrt] | UNICODE) ;
- fragment UNICODE : 'u' HEX HEX HEX HEX ;
- fragment HEX : [0-9a-fA-F] ;
- fragment ALPHA : [A-Za-z];
- fragment DIGIT : [0-9];
- fragment URN : [u][r][n];
- fragment HTTP : [h][t][t][p];
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/ietfyang/IetfYangFileTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/ietfyang/IetfYangFileTest.java
deleted file mode 100644
index ac81198..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/ietfyang/IetfYangFileTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.ietfyang;
-
-import java.io.IOException;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.junit.Test;
-import org.onosproject.yangutils.linker.impl.YangLinkerManager;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-import org.onosproject.yangutils.plugin.manager.YangUtilManager;
-import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
-
-/**
- * Test cases for testing IETF YANG files.
- */
-public class IetfYangFileTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
- private final YangUtilManager utilManager = new YangUtilManager();
- private final YangLinkerManager yangLinkerManager = new YangLinkerManager();
-
- /**
- * Checks hierarchical intra with inter file type linking.
- * Reference: https://datatracker.ietf.org/doc/draft-zha-l3sm-l3vpn-onos-deployment
- */
- @Test
- public void l3vpnserviceyang()
- throws IOException, ParserException, MojoExecutionException {
-
- String searchDir = "src/test/resources/ietfyang/l3vpnservice";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.resolveDependenciesUsingLinker();
-
- String userDir = System.getProperty("user.dir");
- YangPluginConfig yangPluginConfig = new YangPluginConfig();
- yangPluginConfig.setCodeGenDir("target/ietfyang/l3vpnservice/");
-
- utilManager.translateToJava(yangPluginConfig);
-
- deleteDirectory(userDir + "/target/ietfyang/");
- }
-
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/CustomExceptionMatcher.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/CustomExceptionMatcher.java
deleted file mode 100644
index 44d0c67..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/CustomExceptionMatcher.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.parser.impl;
-
-import org.hamcrest.Description;
-import org.hamcrest.TypeSafeMatcher;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-
-/**
- * ExpectedException framework can use the Hamcrest matcher's to test
- * custom/extended exceptions. This class extends the type safe matcher to
- * define the custom exception matcher.
- */
-public final class CustomExceptionMatcher extends TypeSafeMatcher<ParserException> {
-
- private int actualLine;
- private final int expectedLine;
- private int actualCharPosition;
- private final int expectedCharPosition;
-
- /**
- * Customized exception matcher to match error location.
- *
- * @param line error line
- * @param charPosition error character position
- * @return customized exception matcher to match error location
- */
- public static CustomExceptionMatcher errorLocation(int line, int charPosition) {
- return new CustomExceptionMatcher(line, charPosition);
- }
-
- private CustomExceptionMatcher(int expectedLine, int expectedCharPosition) {
- this.expectedLine = expectedLine;
- this.expectedCharPosition = expectedCharPosition;
- }
-
- @Override
- protected boolean matchesSafely(final ParserException exception) {
- actualLine = exception.getLineNumber();
- actualCharPosition = exception.getCharPositionInLine();
- return ((actualLine == expectedLine) && (actualCharPosition == expectedCharPosition));
- }
-
- @Override
- public void describeTo(Description description) {
- description.appendText(" Error reported location ")
- .appendText("Line " + actualLine + ", " + "CharPosition " + actualCharPosition)
- .appendText(" instead of expected ")
- .appendText("Line " + expectedLine + ", " + "CharPosition " + expectedCharPosition);
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/TreeWalkListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/TreeWalkListenerTest.java
deleted file mode 100644
index 1056d98..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/TreeWalkListenerTest.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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.parser.impl;
-
-import java.io.IOException;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-
-/**
- * Test cases for testing tree walk listener functionality.
- */
-public class TreeWalkListenerTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- /**
- * Checks whether exception is thrown for ordered statement.
- */
- @Test
- public void processOrderedByStatement() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("YANG file error : \"ordered-by\" is not supported in current version, please check wiki" +
- " for YANG utils road map.");
- manager.getDataModel("src/test/resources/OrderedByStatement.yang");
- }
-
- /**
- * Checks whether exception is thrown for anyxml statement.
- */
- @Test
- public void processAnyXmlStatement() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("YANG file error : \"anyxml\" is not supported.");
- manager.getDataModel("src/test/resources/AnyxmlStatement.yang");
- }
-
- /**
- * Checks whether exception is thrown when extra brace is added in the EOF.
- */
- @Test
- public void processFileWithExtraBrace() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("mismatched input '}' expecting <EOF>");
- manager.getDataModel("src/test/resources/ProcessFileWithExtraBrace.yang");
- }
-
- /**
- * Checks whether exception is thrown when leaf is given after module ends.
- */
- @Test
- public void processFileWithExtraLeaf() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("mismatched input 'leaf' expecting <EOF>");
- manager.getDataModel("src/test/resources/ProcessFileWithExtraLeaf.yang");
- }
-
- /**
- * Checks whether exception is thrown when extra brace is added in between the EOF.
- */
- @Test
- public void processFileWithExtraBraceInBetween() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("mismatched input 'container' expecting <EOF>");
- manager.getDataModel("src/test/resources/ProcessFileWithExtraBraceInBetween.yang");
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/YangUtilsParserManagerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/YangUtilsParserManagerTest.java
deleted file mode 100644
index 9b3effc..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/YangUtilsParserManagerTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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.parser.impl;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-
-/**
- * Test case for testing YANG utils parser manager.
- */
-public class YangUtilsParserManagerTest {
-
- YangUtilsParserManager manager = new YangUtilsParserManager();
- File file;
- BufferedWriter out;
-
- @Before
- public void setUp() throws Exception {
- file = new File("demo.yang");
- out = new BufferedWriter(new FileWriter(file));
- }
- @After
- public void tearDown() throws Exception {
- file.delete();
- }
-
- /**
- * This test case checks whether the null pointer exception is generated
- * when the input YANG file is null.
- */
- @Test(expected = NullPointerException.class)
- public void getDataModelNullFileTest() throws IOException, ParserException {
- YangUtilsParserManager manager = new YangUtilsParserManager();
- YangNode node = manager.getDataModel(null);
- }
-
- /**
- * This test case checks whether the io exception is generated
- * when the input YANG file is non existent.
- */
- @Test(expected = ParserException.class)
- public void getDataModelNonExistentFileTest() throws IOException, ParserException {
-
- YangUtilsParserManager manager = new YangUtilsParserManager();
- YangNode node = manager.getDataModel("nonexistent.yang");
- }
-
- /**
- * This test case checks if the input YANG file is correct no exception
- * should be generated.
- */
- @Test
- public void getDataModelCorrectFileTest() throws IOException, ParserException {
-
- out.write("module ONOS {\n");
- out.write("yang-version 1;\n");
- out.write("namespace urn:ietf:params:xml:ns:yang:ietf-ospf;\n");
- out.write("prefix On;\n");
- out.write("}\n");
- out.close();
-
- YangNode node = manager.getDataModel("demo.yang");
- }
-
- /**
- * This test case checks if the input YANG file with wrong YANG constructs
- * than parser exception should be generated.
- */
- @Test(expected = ParserException.class)
- public void getDataModelIncorrectFileTest() throws IOException, ParserException {
-
- out.write("module ONOS {\n");
- out.write("yang-version 1\n");
- out.write("namespace urn:ietf:params:xml:ns:yang:ietf-ospf;\n");
- out.write("prefix On;\n");
- out.write("}\n");
- out.close();
-
- YangNode node = manager.getDataModel("demo.yang");
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/AugmentListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/AugmentListenerTest.java
deleted file mode 100644
index 146f410..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/AugmentListenerTest.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import java.io.IOException;
-import java.util.ListIterator;
-
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangAtomicPath;
-import org.onosproject.yangutils.datamodel.YangAugment;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-
-/**
- * Test cases for testing augment listener functionality.
- */
-public class AugmentListenerTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks valid augment statement.
- */
- @Test
- public void processValidAugmentStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ValidAugmentStatement.yang");
-
- assertThat(node instanceof YangModule, is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- YangAugment yangAugment = (YangAugment) yangNode.getChild();
- ListIterator<YangAtomicPath> absPathIterator = yangAugment.getTargetNode().listIterator();
- YangAtomicPath absPathIdentifier = absPathIterator.next();
- assertThat(absPathIdentifier.getNodeIdentifier().getPrefix(), is("if"));
- assertThat(absPathIdentifier.getNodeIdentifier().getName(), is("interfaces"));
-
- ListIterator<YangLeaf> leafIterator = yangAugment.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("ds0ChannelNumber"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("ChannelNumber"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.DERIVED));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/BaseFileListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/BaseFileListenerTest.java
deleted file mode 100644
index ee418c2..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/BaseFileListenerTest.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-/**
- * Test cases for testing base rule listener functionality.
- */
-public class BaseFileListenerTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- /**
- * Checks for exception if stack of parsable data is not empty at the entry
- * of yang base rule.
- */
- @Test
- public void processYangFileEntryNonEmptyStack() {
- thrown.expect(ParserException.class);
- thrown.expectMessage("Internal parser error detected: Invalid holder for yangbase before processing.");
-
- YangModule tmpModule = new YangModule();
- TreeWalkListener listener = new TreeWalkListener();
- listener.getParsedDataStack().push(tmpModule);
- GeneratedYangParser.YangfileContext ctx = null;
- BaseFileListener.processYangFileEntry(listener, ctx);
- }
-
- /**
- * Checks that exception shouldn't be generated if stack of parsable data is
- * empty at the entry of yang base rule.
- */
- @Test
- public void processYangFileEntryEmptyStack() {
-
- TreeWalkListener listener = new TreeWalkListener();
- GeneratedYangParser.YangfileContext ctx = null;
- BaseFileListener.processYangFileEntry(listener, ctx);
- }
-
- /**
- * Checks that exception should be generated if stack of parsable data is
- * not empty at the exit of yang base rule.
- */
- @Test
- public void processYangFileExitEmptyStack() {
- thrown.expect(ParserException.class);
- thrown.expectMessage("Internal parser error detected: Missing holder at yangbase after processing.");
-
- TreeWalkListener listener = new TreeWalkListener();
- GeneratedYangParser.YangfileContext ctx = null;
- BaseFileListener.processYangFileExit(listener, ctx);
- }
-
- /**
- * Checks that exception shouldn't be generated if stack of parsable data is
- * empty at the exit of yang base rule.
- */
- @Test
- public void processYangFileExitNonEmptyStack() {
-
- TreeWalkListener listener = new TreeWalkListener();
- GeneratedYangParser.YangfileContext ctx = null;
- BaseFileListener.processYangFileEntry(listener, ctx);
- }
-
- /**
- * Checks that after popping out the parsable node from stack it should be
- * empty.
- */
- @Test
- public void processYangFileExitStackErrorExtraEntryTest() {
- thrown.expect(ParserException.class);
- thrown.expectMessage("Internal parser error detected: Invalid holder for yangbase after processing.");
-
- YangModule tmpModule = new YangModule();
- YangModule tmpModule2 = new YangModule();
- TreeWalkListener listener = new TreeWalkListener();
- listener.getParsedDataStack().push(tmpModule);
- listener.getParsedDataStack().push(tmpModule2);
- GeneratedYangParser.YangfileContext ctx = null;
- BaseFileListener.processYangFileExit(listener, ctx);
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/BelongstoListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/BelongstoListenerTest.java
deleted file mode 100644
index 927a2d6..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/BelongstoListenerTest.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.CustomExceptionMatcher;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import java.io.IOException;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-
-/**
- * Test cases for testing belongsto listener functionality.
- */
-public class BelongstoListenerTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks if mandatory belongsto parameter "prefix" is not present.
- */
- @Test
- public void processBelongsToWithoutPrefix() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("mismatched input '}' expecting 'prefix'");
- thrown.expect(CustomExceptionMatcher.errorLocation(4, 0));
- YangNode node = manager.getDataModel("src/test/resources/BelongsToWithoutPrefix.yang");
- }
-
- /**
- * Checks that prefix must be present only once in belongsto.
- */
- @Test
- public void processBelongsToDualPrefix() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("mismatched input 'prefix' expecting '}'");
- thrown.expect(CustomExceptionMatcher.errorLocation(5, 0));
- YangNode node = manager.getDataModel("src/test/resources/BelongsToDualPrefix.yang");
- }
-
- /**
- * Checks if belongsto listener updates the date model tree.
- */
- @Test
- public void processBelongsToWithPrefix() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/BelongsToWithPrefix.yang");
- YangSubModule yangNode = (YangSubModule) node;
- assertThat(yangNode.getBelongsTo().getBelongsToModuleName(), is("ONOS"));
- }
-
- /**
- * Checks if mandatory parameter "belongsto" is present.
- */
- @Test
- public void processSubModuleWithoutBelongsTo() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("mismatched input '}' expecting 'belongs-to'");
- thrown.expect(CustomExceptionMatcher.errorLocation(3, 0));
- YangNode node = manager.getDataModel("src/test/resources/SubModuleWithoutBelongsTo.yang");
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/BitListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/BitListenerTest.java
deleted file mode 100644
index a4410a7..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/BitListenerTest.java
+++ /dev/null
@@ -1,360 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangBit;
-import org.onosproject.yangutils.datamodel.YangBits;
-import org.onosproject.yangutils.datamodel.YangDerivedInfo;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.datamodel.YangTypeDef;
-import org.onosproject.yangutils.datamodel.YangUnion;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-
-/**
- * Test cases for bit listener.
- */
-public class BitListenerTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks bit statement without position.
- */
- @Test
- public void processBitTypeStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/BitTypeStatement.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("mybits"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("bits"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.BITS));
- assertThat(((YangBits) leafInfo.getDataType().getDataTypeExtendedInfo()).getBitsName(),
- is("mybits"));
-
- // Check bit name map
- Map<String, YangBit> bitNameMap = ((YangBits) leafInfo.getDataType().getDataTypeExtendedInfo()).getBitNameMap();
- assertThat(bitNameMap.size(), is(3));
- for (Map.Entry<String, YangBit> element : bitNameMap.entrySet()) {
- String bitName = element.getKey();
- YangBit yangBit = element.getValue();
- if (bitName.equals("disable-nagle")) {
- assertThat(yangBit.getPosition(), is(0));
- } else if (bitName.equals("auto-sense-speed")) {
- assertThat(yangBit.getPosition(), is(1));
- } else if (bitName.equals("Ten-Mb-only")) {
- assertThat(yangBit.getPosition(), is(2));
- } else {
- throw new IOException("Invalid bit name: " + bitName);
- }
- }
-
- // Check bit position map
- Map<Integer, YangBit> bitPositionMap = ((YangBits) leafInfo.getDataType().getDataTypeExtendedInfo())
- .getBitPositionMap();
- assertThat(bitPositionMap.size(), is(3));
- for (Map.Entry<Integer, YangBit> element : bitPositionMap.entrySet()) {
- int position = element.getKey();
- YangBit yangBit = element.getValue();
- if (position == 0) {
- assertThat(yangBit.getBitName(), is("disable-nagle"));
- } else if (position == 1) {
- assertThat(yangBit.getBitName(), is("auto-sense-speed"));
- } else if (position == 2) {
- assertThat(yangBit.getBitName(), is("Ten-Mb-only"));
- } else {
- throw new IOException("Invalid bit position: " + position);
- }
- }
- }
-
- /**
- * Checks bit statement with typedef.
- */
- @Test
- public void processBitTypedefStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/BitTypedefStatement.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- YangTypeDef typedef = (YangTypeDef) yangNode.getChild();
- assertThat(typedef.getName(), is("type15"));
-
- YangType type = typedef.getTypeList().iterator().next();
- assertThat(type.getDataType(), is(YangDataTypes.BITS));
- assertThat(type.getDataTypeName(), is("bits"));
-
- // Check bit name map
- Map<String, YangBit> bitNameMap = ((YangBits) type.getDataTypeExtendedInfo()).getBitNameMap();
- assertThat(bitNameMap.size(), is(3));
- for (Map.Entry<String, YangBit> element : bitNameMap.entrySet()) {
- String bitName = element.getKey();
- YangBit yangBit = element.getValue();
- if (bitName.equals("disable-nagle")) {
- assertThat(yangBit.getPosition(), is(0));
- } else if (bitName.equals("auto-sense-speed")) {
- assertThat(yangBit.getPosition(), is(1));
- } else if (bitName.equals("Mb-only")) {
- assertThat(yangBit.getPosition(), is(2));
- } else {
- throw new IOException("Invalid bit name: " + bitName);
- }
- }
-
- // Check bit position map
- Map<Integer, YangBit> bitPositionMap = ((YangBits) type.getDataTypeExtendedInfo()).getBitPositionMap();
- assertThat(bitPositionMap.size(), is(3));
- for (Map.Entry<Integer, YangBit> element : bitPositionMap.entrySet()) {
- int position = element.getKey();
- YangBit yangBit = element.getValue();
- if (position == 0) {
- assertThat(yangBit.getBitName(), is("disable-nagle"));
- } else if (position == 1) {
- assertThat(yangBit.getBitName(), is("auto-sense-speed"));
- } else if (position == 2) {
- assertThat(yangBit.getBitName(), is("Mb-only"));
- } else {
- throw new IOException("Invalid bit position: " + position);
- }
- }
- }
-
- /**
- * Checks bit statement with typedef with referred leaf.
- */
- @Test
- public void processBitTypedefReferredLeafStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/BitTypedefReferredLeafStatement.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- YangTypeDef typedef = (YangTypeDef) yangNode.getChild();
- assertThat(typedef.getName(), is("topBits"));
-
- YangType type = typedef.getTypeList().iterator().next();
- assertThat(type.getDataType(), is(YangDataTypes.BITS));
- assertThat(type.getDataTypeName(), is("bits"));
-
- // Check bit name map
- Map<String, YangBit> bitNameMap = ((YangBits) type.getDataTypeExtendedInfo()).getBitNameMap();
- assertThat(bitNameMap.size(), is(3));
- for (Map.Entry<String, YangBit> element : bitNameMap.entrySet()) {
- String bitName = element.getKey();
- YangBit yangBit = element.getValue();
- if (bitName.equals("disable-nagle")) {
- assertThat(yangBit.getPosition(), is(0));
- } else if (bitName.equals("auto-sense-speed")) {
- assertThat(yangBit.getPosition(), is(1));
- } else if (bitName.equals("Mb-only")) {
- assertThat(yangBit.getPosition(), is(2));
- } else {
- throw new IOException("Invalid bit name: " + bitName);
- }
- }
-
- // Check bit position map
- Map<Integer, YangBit> bitPositionMap = ((YangBits) type.getDataTypeExtendedInfo()).getBitPositionMap();
- assertThat(bitPositionMap.size(), is(3));
- for (Map.Entry<Integer, YangBit> element : bitPositionMap.entrySet()) {
- int position = element.getKey();
- YangBit yangBit = element.getValue();
- if (position == 0) {
- assertThat(yangBit.getBitName(), is("disable-nagle"));
- } else if (position == 1) {
- assertThat(yangBit.getBitName(), is("auto-sense-speed"));
- } else if (position == 2) {
- assertThat(yangBit.getBitName(), is("Mb-only"));
- } else {
- throw new IOException("Invalid bit position: " + position);
- }
- }
-
- // Check leaf reffered typedef
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("myBits"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("topBits"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.DERIVED));
- YangType<YangDerivedInfo> typeDerived = (YangType<YangDerivedInfo>) leafInfo.getDataType();
- YangDerivedInfo derivedInfo = (YangDerivedInfo) typeDerived.getDataTypeExtendedInfo();
- YangTypeDef prevTypedef = (YangTypeDef) derivedInfo.getReferredTypeDef();
- assertThat(prevTypedef.getName(), is("topBits"));
- YangType topType = prevTypedef.getTypeList().iterator().next();
- assertThat(topType.getDataType(), is(YangDataTypes.BITS));
- assertThat(topType.getDataTypeName(), is("bits"));
- YangType<YangBits> typeBits = (YangType<YangBits>) topType;
- YangBits bits = typeBits.getDataTypeExtendedInfo();
-
- // Check bit name map
- bitNameMap = bits.getBitNameMap();
- assertThat(bitNameMap.size(), is(3));
- for (Map.Entry<String, YangBit> element : bitNameMap.entrySet()) {
- String bitName = element.getKey();
- YangBit yangBit = element.getValue();
- if (bitName.equals("disable-nagle")) {
- assertThat(yangBit.getPosition(), is(0));
- } else if (bitName.equals("auto-sense-speed")) {
- assertThat(yangBit.getPosition(), is(1));
- } else if (bitName.equals("Mb-only")) {
- assertThat(yangBit.getPosition(), is(2));
- } else {
- throw new IOException("Invalid bit name: " + bitName);
- }
- }
-
- // Check bit position map
- bitPositionMap = bits.getBitPositionMap();
- assertThat(bitPositionMap.size(), is(3));
- for (Map.Entry<Integer, YangBit> element : bitPositionMap.entrySet()) {
- int position = element.getKey();
- YangBit yangBit = element.getValue();
- if (position == 0) {
- assertThat(yangBit.getBitName(), is("disable-nagle"));
- } else if (position == 1) {
- assertThat(yangBit.getBitName(), is("auto-sense-speed"));
- } else if (position == 2) {
- assertThat(yangBit.getBitName(), is("Mb-only"));
- } else {
- throw new IOException("Invalid bit position: " + position);
- }
- }
- }
-
- /**
- * Checks bit statement with union.
- */
- @Test
- public void processBitUnionStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/BitUnionStatement.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("type15"));
-
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UNION));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("union"));
-
- YangUnion yangUnion = (YangUnion) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- List<YangType<?>> typeList = yangUnion.getTypeList();
- ListIterator<YangType<?>> typeListIterator = typeList.listIterator();
- YangType<?> yangType = typeListIterator.next();
-
- assertThat(yangType.getDataType(), is(YangDataTypes.BITS));
- assertThat(yangType.getDataTypeName(), is("bits"));
-
- // Check bit name map
- Map<String, YangBit> bitNameMap = ((YangBits) yangType.getDataTypeExtendedInfo()).getBitNameMap();
- assertThat(bitNameMap.size(), is(3));
- for (Map.Entry<String, YangBit> element : bitNameMap.entrySet()) {
- String bitName = element.getKey();
- YangBit yangBit = element.getValue();
- if (bitName.equals("disable-nagle")) {
- assertThat(yangBit.getPosition(), is(0));
- } else if (bitName.equals("auto-sense-speed")) {
- assertThat(yangBit.getPosition(), is(1));
- } else if (bitName.equals("Mb-only")) {
- assertThat(yangBit.getPosition(), is(2));
- } else {
- throw new IOException("Invalid bit name: " + bitName);
- }
- }
-
- // Check bit position map
- Map<Integer, YangBit> bitPositionMap = ((YangBits) yangType.getDataTypeExtendedInfo()).getBitPositionMap();
- assertThat(bitPositionMap.size(), is(3));
- for (Map.Entry<Integer, YangBit> element : bitPositionMap.entrySet()) {
- int position = element.getKey();
- YangBit yangBit = element.getValue();
- if (position == 0) {
- assertThat(yangBit.getBitName(), is("disable-nagle"));
- } else if (position == 1) {
- assertThat(yangBit.getBitName(), is("auto-sense-speed"));
- } else if (position == 2) {
- assertThat(yangBit.getBitName(), is("Mb-only"));
- } else {
- throw new IOException("Invalid bit position: " + position);
- }
- }
- }
-
- /**
- * Checks if enum with same name is not allowed.
- */
- @Test(expected = ParserException.class)
- public void processBitWithDuplicateName() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/BitWithDuplicateName.yang");
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/CaseListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/CaseListenerTest.java
deleted file mode 100644
index 9ebf0df..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/CaseListenerTest.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import java.io.IOException;
-import java.util.ListIterator;
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangAugment;
-import org.onosproject.yangutils.datamodel.YangCase;
-import org.onosproject.yangutils.datamodel.YangChoice;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-
-/**
- * Test cases for case listener.
- */
-public class CaseListenerTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks multiple case statement.
- */
- @Test
- public void processCaseStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/CaseStatement.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- YangContainer yangContainer = (YangContainer) yangNode.getChild();
- assertThat(yangContainer.getName(), is("food"));
-
- YangChoice yangChoice = (YangChoice) yangContainer.getChild();
- assertThat(yangChoice.getName(), is("snack"));
-
- YangCase yangCase1 = (YangCase) yangChoice.getChild();
- assertThat(yangCase1.getName(), is("sports-arena"));
-
- // Check whether leaf properties as set correctly.
- ListIterator<YangLeaf> leafIterator1 = yangCase1.getListOfLeaf().listIterator();
- YangLeaf leafInfo1 = leafIterator1.next();
-
- assertThat(leafInfo1.getName(), is("pretzel"));
-
- YangCase yangCase2 = (YangCase) yangCase1.getNextSibling();
- assertThat(yangCase2.getName(), is("late-night"));
-
- // Check whether leaf properties as set correctly.
- ListIterator<YangLeaf> leafIterator2 = yangCase2.getListOfLeaf().listIterator();
- YangLeaf leafInfo2 = leafIterator2.next();
-
- assertThat(leafInfo2.getName(), is("chocolate"));
- }
-
- /**
- * Checks duplicate case in choice.
- */
- @Test(expected = ParserException.class)
- public void processDuplicateCaseInChoice() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/DuplicateCaseInChoice.yang");
- }
-
- /**
- * Checks duplicate leaf at different hierarchy.
- */
- @Test(expected = ParserException.class)
- public void processDuplicateLeafInHierarchy() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/DuplicateLeafInHierarchy.yang");
- }
-
- /**
- * Checks duplicate leaf in different case within choice.
- */
- @Test(expected = ParserException.class)
- public void processDuplicateLeafInChoice() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/DuplicateLeafInChoice.yang");
- }
-
- /**
- * Checks same case within different choice.
- */
- @Test
- public void processCaseStatementSameEntryDifferentChoice() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/CaseStatementSameEntryDifferentChoice.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- YangContainer yangContainer = (YangContainer) yangNode.getChild();
- assertThat(yangContainer.getName(), is("food"));
-
- YangChoice yangChoice = (YangChoice) yangContainer.getChild();
- assertThat(yangChoice.getName(), is("snack"));
-
- YangCase yangCase1 = (YangCase) yangChoice.getChild();
- assertThat(yangCase1.getName(), is("sports-arena"));
-
- // Check whether leaf properties as set correctly.
- ListIterator<YangLeaf> leafIterator1 = yangCase1.getListOfLeaf().listIterator();
- YangLeaf leafInfo1 = leafIterator1.next();
-
- assertThat(leafInfo1.getName(), is("pretzel"));
-
- YangChoice yangChoice2 = (YangChoice) yangChoice.getNextSibling();
- assertThat(yangChoice2.getName(), is("lunch"));
-
- YangCase yangCase2 = (YangCase) yangChoice2.getChild();
- assertThat(yangCase2.getName(), is("sports-arena"));
-
- // Check whether leaf properties as set correctly.
- ListIterator<YangLeaf> leafIterator2 = yangCase2.getListOfLeaf().listIterator();
- YangLeaf leafInfo2 = leafIterator2.next();
-
- assertThat(leafInfo2.getName(), is("chocolate"));
- }
-
- /**
- * Checks case choice hierarchy.
- */
- @Test
- public void processCaseChoiceHierarchy() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/CaseChoiceHierarchy.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- YangContainer yangContainer = (YangContainer) yangNode.getChild();
- assertThat(yangContainer.getName(), is("food"));
-
- YangChoice yangChoice1 = (YangChoice) yangContainer.getChild();
- assertThat(yangChoice1.getName(), is("snack"));
-
- YangCase yangCase1 = (YangCase) yangChoice1.getChild();
- assertThat(yangCase1.getName(), is("sports-arena"));
-
- // Check whether leaf properties as set correctly.
- ListIterator<YangLeaf> leafIterator1 = yangCase1.getListOfLeaf().listIterator();
- YangLeaf leafInfo1 = leafIterator1.next();
-
- assertThat(leafInfo1.getName(), is("pretzel"));
-
- YangCase yangCase2 = (YangCase) yangCase1.getNextSibling();
- assertThat(yangCase2.getName(), is("late-night"));
-
- YangChoice yangChoice2 = (YangChoice) yangCase2.getChild();
- assertThat(yangChoice2.getName(), is("dinner"));
-
- YangCase yangCase3 = (YangCase) yangChoice2.getChild();
- assertThat(yangCase3.getName(), is("late-night"));
-
- // Check whether leaf properties as set correctly.
- ListIterator<YangLeaf> leafIterator2 = yangCase3.getListOfLeaf().listIterator();
- YangLeaf leafInfo2 = leafIterator2.next();
- assertThat(leafInfo2.getName(), is("beer"));
- }
-
- /**
- * Checks case substatement of augment.
- */
- @Test
- public void processCaseSubStatementOfAugment() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/CaseSubStatementOfAugment.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("event"));
-
- YangAugment augment = ((YangAugment) yangNode.getChild());
- assertThat(augment.getName(), is("/snmp:snmp/snmp:engine/snmp:listen/snmp:transport"));
-
- YangCase yangCase = ((YangCase) augment.getChild());
- assertThat(yangCase.getName(), is("tls"));
-
- YangCase yangCase1 = ((YangCase) yangCase.getNextSibling());
- assertThat(yangCase1.getName(), is("dtls"));
-
- YangContainer container = ((YangContainer) yangCase.getChild());
- assertThat(container.getName(), is("tls"));
- assertThat(container.getListOfLeaf().iterator().next().getName(), is("ip"));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ChoiceListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ChoiceListenerTest.java
deleted file mode 100644
index 9dcf448..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ChoiceListenerTest.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangChoice;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import java.io.IOException;
-
-/**
- * Test cases for choice listener.
- */
-public class ChoiceListenerTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks choice statement without body.
- */
- @Test
- public void processChoiceStatementWithoutBody() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ChoiceStatementWithoutBody.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- YangContainer yangContainer = (YangContainer) yangNode.getChild();
- assertThat(yangContainer.getName(), is("food"));
-
- YangChoice yangChoice = (YangChoice) yangContainer.getChild();
- assertThat(yangChoice.getName(), is("snack"));
- }
-
- /**
- * Checks choice statement with stmt end.
- */
- @Test
- public void processChoiceStatementWithStmtend() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ChoiceStatementWithStmtend.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- YangContainer yangContainer = (YangContainer) yangNode.getChild();
- assertThat(yangContainer.getName(), is("food"));
-
- YangChoice yangChoice = (YangChoice) yangContainer.getChild();
- assertThat(yangChoice.getName(), is("snack"));
- }
-
- /**
- * Checks choice statement duplicate entry.
- */
- @Test(expected = ParserException.class)
- public void processChoiceStatementDuplicateEntry() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ChoiceStatementDuplicateEntry.yang");
- }
-
- /**
- * Checks choice statement with same entry in two different container.
- */
- @Test
- public void processChoiceStatementSameEntryDifferentContainer() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ChoiceStatementSameEntryDifferentContainer.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- YangContainer yangContainer1 = (YangContainer) yangNode.getChild();
- assertThat(yangContainer1.getName(), is("food1"));
-
- YangChoice yangChoice1 = (YangChoice) yangContainer1.getChild();
- assertThat(yangChoice1.getName(), is("snack"));
-
- YangContainer yangContainer2 = (YangContainer) yangNode.getChild().getNextSibling();
- assertThat(yangContainer2.getName(), is("food2"));
-
- YangChoice yangChoice2 = (YangChoice) yangContainer2.getChild();
- assertThat(yangChoice2.getName(), is("snack"));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/CompilerAnnotationListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/CompilerAnnotationListenerTest.java
deleted file mode 100644
index cbc4009..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/CompilerAnnotationListenerTest.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import java.io.IOException;
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangAppDataStructure;
-import org.onosproject.yangutils.datamodel.YangCompilerAnnotation;
-import org.onosproject.yangutils.datamodel.YangDataStructure;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-
-/**
- * Test cases for compiler annotation listener.
- */
-public class CompilerAnnotationListenerTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks valid compiler annotation statements.
- */
- @Test
- public void processValidCompilerAnnotation() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ValidCompilerAnnotation.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("event"));
-
- YangCompilerAnnotation compilerAnnotation = yangNode.getCompilerAnnotationList()
- .iterator().next();
- assertThat(compilerAnnotation.getPrefix(), is("ca"));
- assertThat(compilerAnnotation.getPath(), is("/candidate-servers/server"));
-
- YangAppDataStructure appDataStructure = compilerAnnotation.getYangAppDataStructure();
- assertThat(appDataStructure.getPrefix(), is("abc"));
- assertThat(appDataStructure.getDataStructure(), is(YangDataStructure.MAP));
-
- assertThat(appDataStructure.getKeyList().iterator().next(), is("name"));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ConfigListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ConfigListenerTest.java
deleted file mode 100644
index 3a174a7..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ConfigListenerTest.java
+++ /dev/null
@@ -1,494 +0,0 @@
-/*
- * 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.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.YangContainer;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangLeafList;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangStatusType;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-
-/**
- * Test cases for config listener.
- */
-public class ConfigListenerTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks valid config statement.
- */
- @Test
- public void processConfigTrue() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ConfigTrue.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- // Check whether the Config value is set correctly.
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.isConfig(), is(true));
- }
-
- /**
- * Checks valid config statement.
- */
- @Test
- public void processConfigFalse() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ConfigFalse.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- // Check whether the Config value is set correctly.
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.isConfig(), is(false));
- }
-
- /**
- * Checks invalid config statement and expects parser exception.
- */
- @Test
- public void processConfigWithoutStatementEnd() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("missing ';' at '}'");
- YangNode node = manager.getDataModel("src/test/resources/ConfigWithoutStatementEnd.yang");
- }
-
- /**
- * Checks invalid config statement and expects parser exception.
- */
- @Test
- public void processConfigInvalidValue() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("YANG file error : config value invalid is not valid.");
- YangNode node = manager.getDataModel("src/test/resources/ConfigInvalidValue.yang");
- }
-
- /**
- * Checks invalid config statement and expects parser exception.
- */
- @Test
- public void processConfigEmptyValue() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("no viable alternative at input ';'");
- YangNode node = manager.getDataModel("src/test/resources/ConfigEmptyValue.yang");
- }
-
- /**
- * Checks config statement as sub-statement of container.
- */
- @Test
- public void processContainerSubStatementConfig() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatementConfig.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the config value is set correctly.
- YangContainer container = (YangContainer) yangNode.getChild();
- assertThat(container.getName(), is("valid"));
- assertThat(container.isConfig(), is(true));
-
- // Check whether leaf properties as set correctly.
- ListIterator<YangLeaf> leafIterator = container.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
- assertThat(leafInfo.getUnits(), is("\"seconds\""));
- assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
- assertThat(leafInfo.isMandatory(), is(true));
- assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
- assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
- }
-
- /**
- * Checks config statement as sub-statement of list.
- */
- @Test
- public void processListSubStatementConfig() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ListSubStatementConfig.yang");
-
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the list is child of module and config value is set.
- YangList yangList = (YangList) yangNode.getChild();
- assertThat(yangList.getName(), is("valid"));
- assertThat(yangList.isConfig(), is(true));
-
- // Check whether leaf properties as set correctly.
- ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
- assertThat(leafInfo.getUnits(), is("\"seconds\""));
- assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
- assertThat(leafInfo.isMandatory(), is(true));
- assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
- assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
- }
-
- /**
- * Checks valid config statement as sub-statement of leaf-list.
- */
- @Test
- public void processLeafListSubStatementConfig() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/LeafListSubStatementConfig.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList leafListInfo = leafListIterator.next();
-
- // Check whether config value is set correctly.
- assertThat(leafListInfo.getName(), is("invalid-interval"));
- assertThat(leafListInfo.isConfig(), is(true));
- }
-
- /**
- * Checks config statement's default Value.
- */
- @Test
- public void processConfigDefaultValue() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ConfigDefaultValue.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the config value is set correctly.
- YangContainer container = (YangContainer) yangNode.getChild();
- assertThat(container.getName(), is("valid"));
- assertThat(container.isConfig(), is(true));
-
- // Check whether leaf properties as set correctly.
- ListIterator<YangLeaf> leafIterator = container.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.isConfig(), is(true));
- }
-
- /**
- * Checks whether exception is throw when node's parent config set to false,
- * no node underneath it can have config set to true.
- */
- @Test
- public void processConfigFalseParentContainerChildLeafList() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("Internal parser error detected: Unhandled parsed data at container \"valid\" after "
- + "processing.\nError Information: If a container has \"config\" set to \"false\", no node underneath "
- + "it can have \"config\" set to \"true\".");
- YangNode node = manager.getDataModel("src/test/resources/ConfigFalseParentContainerChildLeafList.yang");
- }
-
- /**
- * Checks whether exception is throw when node's parent config set to false,
- * no node underneath it can have config set to true.
- */
- @Test
- public void processConfigFalseParentContainerChildLeaf() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("Internal parser error detected: Unhandled parsed data at container \"valid\" after "
- + "processing.\nError Information: If a container has \"config\" set to \"false\", no node underneath "
- + "it can have \"config\" set to \"true\".");
- YangNode node = manager.getDataModel("src/test/resources/ConfigFalseParentContainerChildLeaf.yang");
- }
-
- /**
- * Checks whether exception is throw when node's parent config set to false,
- * no node underneath it can have config set to true.
- */
- @Test
- public void processConfigFalseParentListChildLeafList() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("Internal parser error detected: Unhandled parsed data at list \"valid\" after"
- + " processing.\nError Information: If a list has \"config\" set to \"false\", no node underneath"
- + " it can have \"config\" set to \"true\".");
- YangNode node = manager.getDataModel("src/test/resources/ConfigFalseParentListChildLeafList.yang");
- }
-
- /**
- * Checks whether exception is throw when node's parent config set to false,
- * no node underneath it can have config set to true.
- */
- @Test
- public void processConfigFalseParentListChildLeaf() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("Internal parser error detected: Unhandled parsed data at list \"valid\" after"
- + " processing.\nError Information: If a list has \"config\" set to \"false\", no node underneath"
- + " it can have \"config\" set to \"true\".");
- YangNode node = manager.getDataModel("src/test/resources/ConfigFalseParentListChildLeaf.yang");
- }
-
- /**
- * Checks when config is not specified, the default is same as the parent's schema node's
- * config statement's value.
- */
- @Test
- public void processNoConfigContainerSubStatementContainer() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/NoConfigContainerSubStatementContainer.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the config value is set correctly.
- YangContainer container = (YangContainer) yangNode.getChild();
- assertThat(container.getName(), is("hello"));
- assertThat(container.isConfig(), is(true));
-
- YangNode containerNode = container.getChild();
- assertThat(containerNode instanceof YangContainer, is(true));
- YangContainer childContainer = (YangContainer) containerNode;
- assertThat(childContainer.getName(), is("valid"));
- assertThat(childContainer.isConfig(), is(true));
- }
-
- /**
- * Checks when config is not specified, the default is same as the parent's schema node's
- * config statement's value.
- */
- @Test
- public void processNoConfigContainerSubStatementLeafList() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/NoConfigContainerSubStatementLeafList.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the config value is set correctly.
- YangContainer container = (YangContainer) yangNode.getChild();
- assertThat(container.getName(), is("valid"));
- assertThat(container.isConfig(), is(true));
-
- ListIterator<YangLeafList> leafListIterator = container.getListOfLeafList().listIterator();
- YangLeafList leafListInfo = leafListIterator.next();
-
- // Check whether config value is set correctly.
- assertThat(leafListInfo.getName(), is("invalid-interval"));
- assertThat(leafListInfo.isConfig(), is(true));
-
- }
-
- /**
- * Checks when config is not specified, the default is same as the parent's schema node's
- * config statement's value.
- */
- @Test
- public void processNoConfigContainerSubStatementLeaf() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/NoConfigContainerSubStatementLeaf.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the config value is set correctly.
- YangContainer container = (YangContainer) yangNode.getChild();
- assertThat(container.getName(), is("valid"));
- assertThat(container.isConfig(), is(true));
-
- // Check whether leaf properties as set correctly.
- ListIterator<YangLeaf> leafIterator = container.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.isConfig(), is(true));
- }
-
- /**
- * Checks when config is not specified, the default is same as the parent's schema node's
- * config statement's value.
- */
- @Test
- public void processNoConfigContainerSubStatementList() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/NoConfigContainerSubStatementList.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the config value is set correctly.
- YangContainer container = (YangContainer) yangNode.getChild();
- assertThat(container.getName(), is("hello"));
- assertThat(container.isConfig(), is(true));
-
- YangNode listNode = container.getChild();
- assertThat(listNode instanceof YangList, is(true));
- YangList childList = (YangList) listNode;
- assertThat(childList.getName(), is("valid"));
- assertThat(childList.isConfig(), is(true));
-
- }
-
- /**
- * Checks when config is not specified, the default is same as the parent's schema node's
- * config statement's value.
- */
- @Test
- public void processNoConfigListSubStatementContainer() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/NoConfigListSubStatementContainer.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the config value is set correctly.
- YangList list1 = (YangList) yangNode.getChild();
- assertThat(list1.getName(), is("list1"));
- assertThat(list1.isConfig(), is(true));
-
- YangNode containerNode = list1.getChild();
- assertThat(containerNode instanceof YangContainer, is(true));
- YangContainer childContainer = (YangContainer) containerNode;
- assertThat(childContainer.getName(), is("container1"));
- assertThat(childContainer.isConfig(), is(true));
- }
-
- /**
- * Checks when config is not specified, the default is same as the parent's schema node's
- * config statement's value.
- */
- @Test
- public void processNoConfigListSubStatementLeaf() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/NoConfigListSubStatementLeaf.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the config value is set correctly.
- YangList list1 = (YangList) yangNode.getChild();
- assertThat(list1.getName(), is("valid"));
- assertThat(list1.isConfig(), is(true));
-
- // Check whether leaf properties as set correctly.
- ListIterator<YangLeaf> leafIterator = list1.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.isConfig(), is(true));
- }
-
- /**
- * Checks when config is not specified, the default is same as the parent's schema node's
- * config statement's value.
- */
- @Test
- public void processNoConfigListSubStatementList() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/NoConfigListSubStatementList.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the config value is set correctly.
- YangList list1 = (YangList) yangNode.getChild();
- assertThat(list1.getName(), is("valid"));
- assertThat(list1.isConfig(), is(true));
-
- YangNode listNode = list1.getChild();
- assertThat(listNode instanceof YangList, is(true));
- YangList childList = (YangList) listNode;
- assertThat(childList.getName(), is("list1"));
- assertThat(childList.isConfig(), is(true));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ContactListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ContactListenerTest.java
deleted file mode 100644
index 7c8c5e9..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ContactListenerTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import java.io.IOException;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-
-/**
- * Test cases for testing contact listener functionality.
- */
-public class ContactListenerTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks if contact listener updates the data model tree.
- */
- @Test
- public void processContactValidEntry() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ContactValidEntry.yang");
-
- // Checks for the contact value in data model tree.
- assertThat(((YangModule) node).getContact(), is("\"WG List: <mailto:spring@ietf.org>\nEditor: "
- + "Stephane Litkowski\n " + "<mailto:stephane.litkowski@orange.com>\""));
- }
-
- /**
- * Checks that contact must be present only once.
- */
- @Test(expected = ParserException.class)
- public void processContactDualEntryTest() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ContactDualEntryTest.yang");
-
- }
-
- /**
- * Checks that contact can have a string value without double quotes.
- */
- @Test
- public void processContactWithoutQuotes() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ContactWithoutQuotes.yang");
-
- // Checks for the contact value in data model tree.
- assertThat(((YangModule) node).getContact(), is("WG"));
- }
-
- /**
- * Checks if contact is not empty.
- */
- @Test(expected = ParserException.class)
- public void processContactWithEmptyString() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ContactWithEmptyString.yang");
- }
-
- /**
- * Checks that contact must be present after namespace.
- */
- @Test(expected = ParserException.class)
- public void processContactIncorrectOrder() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ContactIncorrectOrder.yang");
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ContainerListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ContainerListenerTest.java
deleted file mode 100644
index 2e13741..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ContainerListenerTest.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * 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.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.YangContainer;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangStatusType;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-
-/**
- * Test cases for testing container listener.
- */
-public class ContainerListenerTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks container statement as sub-statement of module.
- */
- @Test
- public void processModuleSubStatementContainer() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ModuleSubStatementContainer.yang");
-
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the container is child of module
- YangContainer yangContainer = (YangContainer) yangNode.getChild();
- assertThat(yangContainer.getName(), is("valid"));
- }
-
- /**
- * Checks if container identifier in module is duplicate.
- */
- @Test(expected = ParserException.class)
- public void processModuleDuplicateContainer() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ModuleDuplicateContainer.yang");
- }
-
- /**
- * Checks if container identifier in container is duplicate.
- */
- @Test(expected = ParserException.class)
- public void processContainerDuplicateContainer() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ContainerDuplicateContainer.yang");
- }
-
- /**
- * Checks if container identifier in list is duplicate.
- */
- @Test(expected = ParserException.class)
- public void processListDuplicateContainer() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ListDuplicateContainer.yang");
- }
-
- /**
- * Checks if container identifier collides with list at same level.
- */
- @Test(expected = ParserException.class)
- public void processDuplicateContainerAndList() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/DuplicateContainerAndList.yang");
- }
-
- /**
- * Checks container statement as sub-statement of container.
- */
- @Test
- public void processContainerSubStatementContainer() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatementContainer.yang");
-
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the container is child of module
- YangContainer yangContainer = (YangContainer) yangNode.getChild();
- assertThat(yangContainer.getName(), is("ospf"));
-
- // Check whether the container is child of container
- YangContainer yangContainer1 = (YangContainer) yangContainer.getChild();
- assertThat(yangContainer1.getName(), is("valid"));
- }
-
- /**
- * Checks container statement as sub-statement of list.
- */
- @Test
- public void processListSubStatementContainer() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ListSubStatementContainer.yang");
-
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the list is child of module
- YangList yangList1 = (YangList) yangNode.getChild();
- assertThat(yangList1.getName(), is("ospf"));
-
- ListIterator<String> keyList = yangList1.getKeyList().listIterator();
- assertThat(keyList.next(), is("process-id"));
-
- // Check whether the list is child of list
- YangContainer yangContainer = (YangContainer) yangList1.getChild();
- assertThat(yangContainer.getName(), is("interface"));
- }
-
- /**
- * Checks container with all its sub-statements.
- */
- @Test
- public void processContainerSubStatements() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatements.yang");
-
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the container is child of module
- YangContainer yangContainer = (YangContainer) yangNode.getChild();
-
- // Check whether container properties as set correctly.
- assertThat(yangContainer.getName(), is("ospf"));
-
- assertThat(yangContainer.isConfig(), is(true));
- assertThat(yangContainer.getPresence(), is("\"ospf logs\""));
- assertThat(yangContainer.getDescription(), is("\"container description\""));
- assertThat(yangContainer.getStatus(), is(YangStatusType.CURRENT));
- assertThat(yangContainer.getReference(), is("\"container reference\""));
-
- // Check whether leaf properties as set correctly.
- ListIterator<YangLeaf> leafIterator = yangContainer.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
- assertThat(leafInfo.getUnits(), is("\"seconds\""));
- assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
- assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
- }
-
- /**
- * Checks cardinality of sub-statements of container.
- */
- @Test
- public void processContainerSubStatementCardinality() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("YANG file error: \"reference\" is defined more than once in \"container valid\".");
- YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatementCardinality.yang");
- }
-
- /**
- * Checks container as root node.
- */
- @Test
- public void processContainerRootNode() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("no viable alternative at input 'container'");
- YangNode node = manager.getDataModel("src/test/resources/ContainerRootNode.yang");
- }
-
- /**
- * Checks invalid identifier for container statement.
- */
- @Test
- public void processContainerInvalidIdentifier() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("YANG file error : container name 1valid is not valid.");
- YangNode node = manager.getDataModel("src/test/resources/ContainerInvalidIdentifier.yang");
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/Decimal64ListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/Decimal64ListenerTest.java
deleted file mode 100644
index baab6c7..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/Decimal64ListenerTest.java
+++ /dev/null
@@ -1,628 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.onosproject.yangutils.datamodel.YangDecimal64;
-import org.onosproject.yangutils.datamodel.YangDerivedInfo;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangRangeRestriction;
-import org.onosproject.yangutils.datamodel.YangRangeInterval;
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.datamodel.YangTypeDef;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.linker.exceptions.LinkerException;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.util.ListIterator;
-
-/**
- * Test cases for decimal64 listener.
- */
-public class Decimal64ListenerTest {
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks decimal64 statement with fraction-digits.
- */
- @Test
- public void processDecimal64TypeStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/decimal64/Decimal64TypeStatement.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("validDecimal"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("decimal64"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.DECIMAL64));
- assertThat(((YangDecimal64) leafInfo.getDataType().getDataTypeExtendedInfo()).getFractionDigit(),
- is(2));
- }
-
- /**
- * Checks decimal64 statement with range statement.
- */
- @Test
- public void processDecimal64TypeWithRangeStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/decimal64/Decimal64TypeWithRangeStatement.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("validDecimal"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("decimal64"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.DECIMAL64));
- assertThat(((YangDecimal64) leafInfo.getDataType().getDataTypeExtendedInfo()).getFractionDigit(),
- is(8));
-
- YangRangeRestriction rangeRestriction = ((YangDecimal64<YangRangeRestriction>) leafInfo.getDataType()
- .getDataTypeExtendedInfo())
- .getRangeRestrictedExtendedInfo();
-
- ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
- .listIterator();
- YangRangeInterval rangeInterval = rangeListIterator.next();
- assertThat(((YangDecimal64) rangeInterval.getStartValue()).getValue().doubleValue(), is(-92233720368.54775808));
- assertThat(((YangDecimal64) rangeInterval.getEndValue()).getValue().doubleValue(), is(92233720368.54775807));
- }
-
- /**
- * Successful validation of decimal64 statement.
- */
- @Test
- public void processDecimal64ValueSuccessfulValidation() throws IOException, ParserException, DataModelException {
-
- YangNode node = manager.getDataModel("src/test/resources/decimal64/Decimal64TypeValidation.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
- YangDecimal64 decimal64 = (YangDecimal64) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- assertThat(leafInfo.getName(), is("validDecimal"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("decimal64"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.DECIMAL64));
- assertThat(decimal64.getFractionDigit(), is(18));
-
- decimal64.setValue(new BigDecimal(-9.223372036854775808));
- decimal64.validateDecimal64();
- decimal64.setValue(new BigDecimal(9.223372036854775807));
- decimal64.validateDecimal64();
- }
-
- /**
- * Failure validation of decimal64 statement.
- */
- @Test
- public void processDecimal64ValueFailureValidation() throws IOException, ParserException, DataModelException {
- thrown.expect(DataModelException.class);
- thrown.expectMessage("YANG file error : decimal64 validation failed.");
-
- YangNode node = manager.getDataModel("src/test/resources/decimal64/Decimal64TypeValidation.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
- YangDecimal64 decimal64 = (YangDecimal64) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- assertThat(leafInfo.getName(), is("validDecimal"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("decimal64"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.DECIMAL64));
- assertThat(decimal64.getFractionDigit(), is(18));
-
- decimal64.setValue(new BigDecimal(-92233720368547758.08));
- // validation should fail
- decimal64.validateDecimal64();
- }
-
- /**
- * Validation of invalid maximum value limit of fraction-digits.
- */
- @Test
- public void processDecimal64InvalidMaxFraction() throws IOException, ParserException, DataModelException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("YANG file error : fraction-digits value should be between 1 and 18.");
-
- manager.getDataModel("src/test/resources/decimal64/Decimal64TypeInvalidMaxValueFraction.yang");
- }
-
- /**
- * Validation of invalid (0) minimum value limit of fraction-digits.
- */
- @Test
- public void processDecimal64InvalidMinFraction1() throws IOException, ParserException, DataModelException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("YANG file error : fraction-digits value should be between 1 and 18.");
-
- manager.getDataModel("src/test/resources/decimal64/Decimal64TypeInvalidMinValueFraction1.yang");
- }
-
- /**
- * Validation of invalid (-1) minimum value limit of fraction-digits.
- */
- @Test
- public void processDecimal64InvalidMinFraction2() throws IOException, ParserException, DataModelException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("YANG file error : fraction-digits value should be between 1 and 18.");
-
- manager.getDataModel("src/test/resources/decimal64/Decimal64TypeInvalidMinValueFraction2.yang");
- }
-
- /**
- * Validation of decimal64 range statement.
- */
- @Test
- public void processDecimal64TypeWithMultiValueRangeStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/decimal64/Decimal64TypeWithMultiValueRangeStmnt.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("validDecimal"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("decimal64"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.DECIMAL64));
- assertThat(((YangDecimal64) leafInfo.getDataType().getDataTypeExtendedInfo()).getFractionDigit(),
- is(18));
-
- YangRangeRestriction rangeRestriction = ((YangDecimal64<YangRangeRestriction>) leafInfo.getDataType()
- .getDataTypeExtendedInfo())
- .getRangeRestrictedExtendedInfo();
-
- ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
- .listIterator();
- // range "1 .. 3.14 | 10 | 20..max";
- // check first range 1 .. 3.14
- YangRangeInterval rangeInterval = rangeListIterator.next();
- assertThat(((YangDecimal64) rangeInterval.getStartValue()).getValue().doubleValue(), is(-9.22));
- assertThat(((YangDecimal64) rangeInterval.getEndValue()).getValue().doubleValue(), is(7.22));
- // check second range 10
- rangeInterval = rangeListIterator.next();
- assertThat(((YangDecimal64) rangeInterval.getStartValue()).getValue().doubleValue(), is(8.0));
- assertThat(((YangDecimal64) rangeInterval.getEndValue()).getValue().doubleValue(), is(8.0));
- // check third range 20..max
- rangeInterval = rangeListIterator.next();
- assertThat(((YangDecimal64) rangeInterval.getStartValue()).getValue().doubleValue(), is(9.0));
- assertThat(((YangDecimal64) rangeInterval.getEndValue()).getValue().doubleValue(), is(9.223372036854776));
- }
-
- /**
- * Validation of decimal64 with invalid range.
- */
- @Test
- public void processDecimal64InvalidRange() throws IOException, ParserException, DataModelException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("YANG file error : range validation failed.");
-
- manager.getDataModel("src/test/resources/decimal64/Decimal64TypeInvalidRangeStmnt.yang");
- }
-
- /**
- * Validation of decimal64 without fraction-digits. Fraction-digits must be present for decimal64.
- */
- @Test
- public void processDecimal64WithoutFraction() throws IOException, ParserException, DataModelException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("YANG file error : a type decimal64 must have fraction-digits statement.");
-
- manager.getDataModel("src/test/resources/decimal64/Decimal64TypeWithoutFraction.yang");
- }
-
- /**
- * Checks decimal64 with typedef statement.
- */
- @Test
- public void processDecimal64TypedefStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/decimal64/Decimal64TypedefStatement.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("setFourDecimal"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("validDecimal"));
- YangType<YangDerivedInfo> derivedInfoType = (YangType<YangDerivedInfo>) leafInfo.getDataType();
- YangDerivedInfo derivedInfo = (YangDerivedInfo) derivedInfoType.getDataTypeExtendedInfo();
- YangTypeDef typedef = (YangTypeDef) derivedInfo.getReferredTypeDef();
- assertThat(typedef.getName(), is("validDecimal"));
-
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.DERIVED));
- YangType type = typedef.getTypeList().iterator().next();
- assertThat(type.getDataType(), is(YangDataTypes.DECIMAL64));
- assertThat(type.getDataTypeName(), is("decimal64"));
- YangType<YangDecimal64> decimal64Type = (YangType<YangDecimal64>) typedef.getTypeList().iterator().next();
- YangDecimal64 decimal64 = decimal64Type.getDataTypeExtendedInfo();
- assertThat(decimal64.getFractionDigit(), is(4));
- }
-
- /**
- * Checks decimal64 with multiple typedef statement.
- */
- @Test
- public void processDecimal64MultiTypedefStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/decimal64/Decimal64MultiTypedefStatement.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- // check leaf type
- assertThat(leafInfo.getName(), is("lowerDecimal"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("midDecimal"));
- YangType<YangDerivedInfo> derivedInfoType = (YangType<YangDerivedInfo>) leafInfo.getDataType();
- assertThat(derivedInfoType.getDataType(), is(YangDataTypes.DERIVED));
- YangDerivedInfo derivedInfo = (YangDerivedInfo) derivedInfoType.getDataTypeExtendedInfo();
-
- // check previous typedef
- YangTypeDef prevTypedef = (YangTypeDef) derivedInfo.getReferredTypeDef();
- assertThat(prevTypedef.getName(), is("midDecimal"));
- YangType type = prevTypedef.getTypeList().iterator().next();
- assertThat(type.getDataType(), is(YangDataTypes.DERIVED));
- derivedInfo = (YangDerivedInfo) type.getDataTypeExtendedInfo();
-
- // check top typedef
- YangTypeDef topTypedef = (YangTypeDef) derivedInfo.getReferredTypeDef();
- assertThat(topTypedef.getName(), is("topDecimal"));
- type = topTypedef.getTypeList().iterator().next();
- assertThat(type.getDataType(), is(YangDataTypes.DECIMAL64));
- assertThat(type.getDataTypeName(), is("decimal64"));
- YangType<YangDecimal64> decimal64Type = (YangType<YangDecimal64>) type;
- YangDecimal64 decimal64 = decimal64Type.getDataTypeExtendedInfo();
- assertThat(decimal64.getFractionDigit(), is(4));
- }
-
- /**
- * Checks decimal64 with multiple typedef with single range statement.
- * Range value in typedef statement.
- */
- @Test
- public void processDecimal64MultiTypedefRangeStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/decimal64/Decimal64MultiTypedefRangeStatement.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- // check leaf type
- assertThat(leafInfo.getName(), is("lowerDecimal"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("midDecimal"));
- YangType<YangDerivedInfo> derivedInfoType = (YangType<YangDerivedInfo>) leafInfo.getDataType();
- assertThat(derivedInfoType.getDataType(), is(YangDataTypes.DERIVED));
- YangDerivedInfo derivedInfo = (YangDerivedInfo) derivedInfoType.getDataTypeExtendedInfo();
-
- // Check range restriction
- YangRangeRestriction rangeRestriction = (YangRangeRestriction) derivedInfo.getResolvedExtendedInfo();
- ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
- .listIterator();
- YangRangeInterval rangeInterval = rangeListIterator.next();
- assertThat(((YangDecimal64) rangeInterval.getStartValue()).getValue().doubleValue(), is(1.0));
- assertThat(((YangDecimal64) rangeInterval.getEndValue()).getValue().doubleValue(), is(12.0));
-
- // check previous typedef
- YangTypeDef prevTypedef = (YangTypeDef) derivedInfo.getReferredTypeDef();
- assertThat(prevTypedef.getName(), is("midDecimal"));
- YangType type = prevTypedef.getTypeList().iterator().next();
- assertThat(type.getDataType(), is(YangDataTypes.DERIVED));
- derivedInfo = (YangDerivedInfo) type.getDataTypeExtendedInfo();
-
- // check top typedef
- YangTypeDef topTypedef = (YangTypeDef) derivedInfo.getReferredTypeDef();
- assertThat(topTypedef.getName(), is("topDecimal"));
- type = topTypedef.getTypeList().iterator().next();
- assertThat(type.getDataType(), is(YangDataTypes.DECIMAL64));
- assertThat(type.getDataTypeName(), is("decimal64"));
- YangType<YangDecimal64> decimal64Type = (YangType<YangDecimal64>) type;
- YangDecimal64 decimal64 = decimal64Type.getDataTypeExtendedInfo();
- assertThat(decimal64.getFractionDigit(), is(4));
-
- // Check range restriction
- rangeRestriction = (YangRangeRestriction) decimal64.getRangeRestrictedExtendedInfo();
- rangeListIterator = rangeRestriction.getAscendingRangeIntervals().listIterator();
- rangeInterval = rangeListIterator.next();
- assertThat(((YangDecimal64) rangeInterval.getStartValue()).getValue().doubleValue(), is(1.0));
- assertThat(((YangDecimal64) rangeInterval.getEndValue()).getValue().doubleValue(), is(12.0));
- }
-
- /**
- * Checks decimal64 with multiple typedef with single range statement.
- * Range value in leaf statement.
- */
- @Test
- public void processDecimal64MultiTypedefRangeInLeafStatement() throws IOException, ParserException {
-
- YangNode node = manager
- .getDataModel("src/test/resources/decimal64/Decimal64MultiTypedefRangeInLeafStatement.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- // check leaf type
- assertThat(leafInfo.getName(), is("lowerDecimal"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("midDecimal"));
- YangType<YangDerivedInfo> derivedInfoType = (YangType<YangDerivedInfo>) leafInfo.getDataType();
- assertThat(derivedInfoType.getDataType(), is(YangDataTypes.DERIVED));
- YangDerivedInfo derivedInfo = (YangDerivedInfo) derivedInfoType.getDataTypeExtendedInfo();
-
- // Check range restriction
- YangRangeRestriction rangeRestriction = (YangRangeRestriction) derivedInfo.getResolvedExtendedInfo();
- ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
- .listIterator();
- YangRangeInterval rangeInterval = rangeListIterator.next();
- assertThat(((YangDecimal64) rangeInterval.getStartValue()).getValue().doubleValue(), is(1.0));
- assertThat(((YangDecimal64) rangeInterval.getEndValue()).getValue().doubleValue(), is(12.0));
-
- // check previous typedef
- YangTypeDef prevTypedef = (YangTypeDef) derivedInfo.getReferredTypeDef();
- assertThat(prevTypedef.getName(), is("midDecimal"));
- YangType type = prevTypedef.getTypeList().iterator().next();
- assertThat(type.getDataType(), is(YangDataTypes.DERIVED));
- derivedInfo = (YangDerivedInfo) type.getDataTypeExtendedInfo();
-
- // check top typedef
- YangTypeDef topTypedef = (YangTypeDef) derivedInfo.getReferredTypeDef();
- assertThat(topTypedef.getName(), is("topDecimal"));
- type = topTypedef.getTypeList().iterator().next();
- assertThat(type.getDataType(), is(YangDataTypes.DECIMAL64));
- assertThat(type.getDataTypeName(), is("decimal64"));
- YangType<YangDecimal64> decimal64Type = (YangType<YangDecimal64>) type;
- YangDecimal64 decimal64 = decimal64Type.getDataTypeExtendedInfo();
- assertThat(decimal64.getFractionDigit(), is(4));
- }
-
- /**
- * Checks decimal64 with multiple typedef with multiple range statement.
- * Having more restricted range at leaf.
- */
- @Test
- public void processDecimal64MultiTypedefMultipleRangeStatement() throws IOException, ParserException {
-
- YangNode node = manager
- .getDataModel("src/test/resources/decimal64/Decimal64MultiTypedefMultiRangeStatement.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- // check leaf type
- assertThat(leafInfo.getName(), is("lowerDecimal"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("midDecimal"));
- YangType<YangDerivedInfo> derivedInfoType = (YangType<YangDerivedInfo>) leafInfo.getDataType();
- assertThat(derivedInfoType.getDataType(), is(YangDataTypes.DERIVED));
- YangDerivedInfo derivedInfo = (YangDerivedInfo) derivedInfoType.getDataTypeExtendedInfo();
-
- // Check range restriction
- YangRangeRestriction rangeRestriction = (YangRangeRestriction) derivedInfo.getResolvedExtendedInfo();
-
- ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
- .listIterator();
- YangRangeInterval rangeInterval = rangeListIterator.next();
- assertThat(((YangDecimal64) rangeInterval.getStartValue()).getValue().doubleValue(), is(4.0));
- assertThat(((YangDecimal64) rangeInterval.getEndValue()).getValue().doubleValue(), is(11.0));
-
- // check previous typedef
- YangTypeDef prevTypedef = (YangTypeDef) derivedInfo.getReferredTypeDef();
- assertThat(prevTypedef.getName(), is("midDecimal"));
- YangType type = prevTypedef.getTypeList().iterator().next();
- assertThat(type.getDataType(), is(YangDataTypes.DERIVED));
- derivedInfo = (YangDerivedInfo) type.getDataTypeExtendedInfo();
-
- // check top typedef
- YangTypeDef topTypedef = (YangTypeDef) derivedInfo.getReferredTypeDef();
- assertThat(topTypedef.getName(), is("topDecimal"));
- type = topTypedef.getTypeList().iterator().next();
- assertThat(type.getDataType(), is(YangDataTypes.DECIMAL64));
- assertThat(type.getDataTypeName(), is("decimal64"));
- YangType<YangDecimal64> decimal64Type = (YangType<YangDecimal64>) type;
- YangDecimal64 decimal64 = decimal64Type.getDataTypeExtendedInfo();
- assertThat(decimal64.getFractionDigit(), is(4));
-
- // Check range restriction
- rangeRestriction = (YangRangeRestriction) decimal64.getRangeRestrictedExtendedInfo();
- rangeListIterator = rangeRestriction.getAscendingRangeIntervals().listIterator();
- rangeInterval = rangeListIterator.next();
- assertThat(((YangDecimal64) rangeInterval.getStartValue()).getValue().doubleValue(), is(1.0));
- assertThat(((YangDecimal64) rangeInterval.getEndValue()).getValue().doubleValue(), is(12.0));
- }
-
- /**
- * Checks decimal64 with multiple typedef with multiple range statement.
- * But having more restricted range at top of typedef.
- */
- @Test
- public void processDecimal64MultiTypedefMultiInvalidRangeStatement() throws IOException, LinkerException {
- thrown.expect(LinkerException.class);
- thrown.expectMessage(" Range interval doesn't fall within the referred restriction ranges");
-
- manager.getDataModel("src/test/resources/decimal64/Decimal64MultiTypedefMultiInvalidRangeStatement.yang");
- }
-
- /**
- * Checks decimal64 with multiple typedef with max range statement.
- */
- @Test
- public void processDecimal64MultiTypedefWithMaxRange() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/decimal64/Decimal64MultiTypedefWithMaxRange.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- // check leaf type
- assertThat(leafInfo.getName(), is("lowerDecimal"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("midDecimal"));
- YangType<YangDerivedInfo> derivedInfoType = (YangType<YangDerivedInfo>) leafInfo.getDataType();
- assertThat(derivedInfoType.getDataType(), is(YangDataTypes.DERIVED));
- YangDerivedInfo derivedInfo = (YangDerivedInfo) derivedInfoType.getDataTypeExtendedInfo();
-
- // Check range restriction
- YangRangeRestriction rangeRestriction = (YangRangeRestriction) derivedInfo.getResolvedExtendedInfo();
-
- ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
- .listIterator();
- YangRangeInterval rangeInterval = rangeListIterator.next();
- assertThat(((YangDecimal64) rangeInterval.getStartValue()).getValue().doubleValue(), is(4.0));
- assertThat(((YangDecimal64) rangeInterval.getEndValue()).getValue().doubleValue(), is(12.0));
-
- // check previous typedef
- YangTypeDef prevTypedef = (YangTypeDef) derivedInfo.getReferredTypeDef();
- assertThat(prevTypedef.getName(), is("midDecimal"));
- YangType type = prevTypedef.getTypeList().iterator().next();
- assertThat(type.getDataType(), is(YangDataTypes.DERIVED));
- derivedInfo = (YangDerivedInfo) type.getDataTypeExtendedInfo();
-
- // check top typedef
- YangTypeDef topTypedef = (YangTypeDef) derivedInfo.getReferredTypeDef();
- assertThat(topTypedef.getName(), is("topDecimal"));
- type = topTypedef.getTypeList().iterator().next();
- assertThat(type.getDataType(), is(YangDataTypes.DECIMAL64));
- assertThat(type.getDataTypeName(), is("decimal64"));
- YangType<YangDecimal64> decimal64Type = (YangType<YangDecimal64>) type;
- YangDecimal64 decimal64 = decimal64Type.getDataTypeExtendedInfo();
- assertThat(decimal64.getFractionDigit(), is(4));
-
- // Check range restriction
- rangeRestriction = (YangRangeRestriction) decimal64.getRangeRestrictedExtendedInfo();
- rangeListIterator = rangeRestriction.getAscendingRangeIntervals().listIterator();
- rangeInterval = rangeListIterator.next();
- assertThat(((YangDecimal64) rangeInterval.getStartValue()).getValue().doubleValue(), is(1.0));
- assertThat(((YangDecimal64) rangeInterval.getEndValue()).getValue().doubleValue(), is(12.0));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/DefaultListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/DefaultListenerTest.java
deleted file mode 100644
index b65b948..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/DefaultListenerTest.java
+++ /dev/null
@@ -1,525 +0,0 @@
-/*
- * 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.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.YangDerivedInfo;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangChoice;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.datamodel.YangTypeDef;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.DataTypeException;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangInt64;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-
-/**
- * Test cases for testing default listener functionality.
- */
-public class DefaultListenerTest {
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks if default value is set correctly.
- */
- @Test
- public void processDefaultValueInLeafSubStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/default/DefaultValueInLeafSubStatement.yang");
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDefaultValueInString(), is("1"));
- }
-
- /**
- * Validates default invalid value in leaf.
- */
- @Test
- public void processDefaultInalueInLeafSubStatement() throws IOException, ParserException {
-
- thrown.expect(DataTypeException.class);
- thrown.expectMessage("YANG file error : Input value \"x\" is not a valid uint16.");
-
- manager.getDataModel("src/test/resources/default/DefaultInvalidValueInLeafSubStatement.yang");
- }
-
- /**
- * Validates default case value in choice statement.
- */
- @Test
- public void processDefaultCaseInChoiceSubStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/default/DefaultCaseInChoiceSubStatement.yang");
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- YangContainer yangContainer = (YangContainer) yangNode.getChild();
- assertThat(yangContainer.getName(), is("food"));
-
- YangChoice yangChoice = (YangChoice) yangContainer.getChild();
- assertThat(yangChoice.getName(), is("snack"));
- assertThat(yangChoice.getDefaultValueInString(), is("sports-arena"));
- }
-
- /**
- * Validates default invalide case in choice statement.
- */
- @Test
- public void processDefaultInvalidCaseInChoiceSubStatement() throws IOException, ParserException {
-
- thrown.expect(ParserException.class);
- thrown.expectMessage("Internal parser error detected: Invalid content in choice \"snack\" after processing.");
-
- manager.getDataModel("src/test/resources/default/DefaultInvalidValueInChoiceSubStmt.yang");
- }
-
- /**
- * Validates default value in typedef.
- */
- @Test
- public void processDefaultInTypedef() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/default/DefaultValueInTypeDef.yang");
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // check typedef
- YangTypeDef typedef = (YangTypeDef) yangNode.getChild();
- assertThat(typedef.getName(), is("topInt"));
- assertThat(typedef.getDefaultValueInString(), is("10"));
-
- YangType type = typedef.getTypeList().iterator().next();
- assertThat(type.getDataType(), is(YangDataTypes.INT64));
- assertThat(type.getDataTypeName(), is("int64"));
-
- // check leaf
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
- assertThat(leafInfo.getName(), is("myValue"));
-
- // Check leaf reffered typedef
- assertThat(leafInfo.getDataType().getDataTypeName(), is("topInt"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.DERIVED));
- YangType<YangDerivedInfo> typeDerived = (YangType<YangDerivedInfo>) leafInfo.getDataType();
- YangDerivedInfo derivedInfo = (YangDerivedInfo) typeDerived.getDataTypeExtendedInfo();
- YangTypeDef prevTypedef = (YangTypeDef) derivedInfo.getReferredTypeDef();
- assertThat(prevTypedef.getName(), is("topInt"));
- assertThat(prevTypedef.getDefaultValueInString(), is("10"));
- YangType topType = prevTypedef.getTypeList().iterator().next();
- assertThat(topType.getDataType(), is(YangDataTypes.INT64));
- assertThat(topType.getDataTypeName(), is("int64"));
- YangType<YangInt64> typeInt64 = (YangType<YangInt64>) topType;
- YangInt64 int64Obj = typeInt64.getDataTypeExtendedInfo();
- }
-
- /**
- * Validates invalid default value in typedef.
- */
- @Test
- public void processInvalidDefaultValueInTypdeDef() throws IOException, ParserException {
- thrown.expect(DataTypeException.class);
- thrown.expectMessage("YANG file error : Input value \"x\" is not a valid int64.");
-
- manager.getDataModel("src/test/resources/default/DefaultInvalidValueInTypeDef.yang");
- }
-
- /**
- * Validates default invalid value in typedef.
- */
- @Test
- public void processDefaultInvalidValueInTypedef() throws IOException, ParserException {
- thrown.expect(DataTypeException.class);
- thrown.expectMessage("YANG file error : Input value \"0\" is not a valid INT32");
-
- manager.getDataModel("src/test/resources/default/DefaultInvalidValueWithRangeInTypedef.yang");
- }
-
- /**
- * Validates default value decimal64 in leaf.
- */
- @Test
- public void processDefaultValueDecimal64InLeaf() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/default/DefaultValueDecimal64InLeaf.yang");
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // check leaf
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- // check the default value
- // This default value is verified by YangType.isValidValue() called from LeafListener.processLeafExit()
- assertThat(leafInfo.getName(), is("mydecimal"));
- assertThat(leafInfo.getDefaultValueInString(), is("5"));
- }
-
- /**
- * Validates default invalid value decimal64 in leaf.
- */
- @Test
- public void processDefaultInvalidValueDecimal64InLeaf() throws IOException, ParserException {
- thrown.expect(DataTypeException.class);
- thrown.expectMessage("YANG file error : Input value \"x\" is not a valid decimal64.");
-
- manager.getDataModel("src/test/resources/default/DefaultInvalidValueDecimal64InLeaf.yang");
- }
-
- /**
- * Validates default value string in leaf.
- */
- @Test
- public void processDefaultValueStringInLeaf() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/default/DefaultValueStringInLeaf.yang");
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // check leaf
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- // check the default value
- // This default value is verified by YangType.isValidValue() called from LeafListener.processLeafExit()
- assertThat(leafInfo.getName(), is("MyString"));
- assertThat(leafInfo.getDefaultValueInString(), is("2bB"));
- }
-
- /**
- * Validates default invalid value string in leaf.
- */
- @Test
- public void processDefaultInvalidValueStringInLeaf() throws IOException, ParserException {
- thrown.expect(DataTypeException.class);
- thrown.expectMessage("YANG file error : Input value \"2bB2bB\" is not a valid STRING");
-
- manager.getDataModel("src/test/resources/default/DefaultInvalidValueStringInLeaf.yang");
- }
-
- /**
- * Validates default value boolean in leaf.
- */
- @Test
- public void processDefaultValueBooleanInLeaf() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/default/DefaultValueBooleanInLeaf.yang");
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // check leaf
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- // check the default value
- // This default value is verified by YangType.isValidValue() called from LeafListener.processLeafExit()
- assertThat(leafInfo.getName(), is("myboolean"));
- assertThat(leafInfo.getDefaultValueInString(), is("true"));
- }
-
- /**
- * Validates default invalid value boolean in leaf.
- */
- @Test
- public void processDefaultInvalidValueBooleanInLeaf() throws IOException, ParserException {
- thrown.expect(DataTypeException.class);
- thrown.expectMessage("YANG file error : Input value \"yes\" is not a valid BOOLEAN");
-
- manager.getDataModel("src/test/resources/default/DefaultInvalidValueBooleanInLeaf.yang");
- }
-
- /**
- * Validates default value enumeration in leaf.
- */
- @Test
- public void processDefaultValueEnumberationInLeaf() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/default/DefaultValueEnumerationInLeaf.yang");
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // check leaf
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- // check the default value
- // This default value is verified by YangType.isValidValue() called from LeafListener.processLeafExit()
- assertThat(leafInfo.getName(), is("myenum"));
- assertThat(leafInfo.getDefaultValueInString(), is("one"));
- }
-
- /**
- * Validates default invalid value enumeration in leaf.
- */
- @Test
- public void processDefaultInvalidValueEnumberationInLeaf() throws IOException, ParserException {
- thrown.expect(DataTypeException.class);
- thrown.expectMessage("YANG file error : Input value \"xyz\" is not a valid ENUMERATION");
-
- manager.getDataModel("src/test/resources/default/DefaultInvalidValueEnumerationInLeaf.yang");
- }
-
- /**
- * Validates default value bits in leaf.
- */
- @Test
- public void processDefaultValueBitsInLeaf() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/default/DefaultValueBitsInLeaf.yang");
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // check leaf
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- // check the default value
- // This default value is verified by YangType.isValidValue() called from LeafListener.processLeafExit()
- assertThat(leafInfo.getName(), is("mybits"));
- assertThat(leafInfo.getDefaultValueInString(), is("auto-sense-speed"));
- }
-
- /**
- * Validates default invalid value bits in leaf.
- */
- @Test
- public void processDefaultInvalidValueBitsInLeaf() throws IOException, ParserException {
- thrown.expect(DataTypeException.class);
- thrown.expectMessage("YANG file error : Input value \"xyz\" is not a valid BITS");
-
- manager.getDataModel("src/test/resources/default/DefaultInvalidValueBitsInLeaf.yang");
- }
-
- /**
- * Validates default value binary in leaf.
- */
- @Test
- public void processDefaultValueBinaryInLeaf() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/default/DefaultValueBinaryInLeaf.yang");
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // check leaf
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- // check the default value
- // This default value is verified by YangType.isValidValue() called from LeafListener.processLeafExit()
- assertThat(leafInfo.getName(), is("message"));
- assertThat(leafInfo.getDefaultValueInString(), is("10010010"));
- }
-
- /**
- * Validates default invalid value binary in leaf.
- */
- @Test
- public void processDefaultInvlaidValueBinaryInLeaf() throws IOException, ParserException {
- thrown.expect(DataTypeException.class);
- thrown.expectMessage("YANG file error : Input value \"000\" is not a valid BINARY");
-
- manager.getDataModel("src/test/resources/default/DefaultInvalidValueBinaryInLeaf.yang");
- }
-
- /**
- * Validates default value empty in leaf.
- */
- @Test
- public void processDefaultValueEmptyInLeaf() throws IOException, ParserException {
- thrown.expect(DataTypeException.class);
- thrown.expectMessage("YANG file error : Input value \"something\" is not allowed for a data type EMPTY");
-
- manager.getDataModel("src/test/resources/default/DefaultValueEmptyInLeaf.yang");
- }
-
- /**
- * Validates default value union in leaf.
- */
- @Test
- public void processDefaultValueUnionInLeaf() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/default/DefaultValueUnionInLeaf.yang");
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // check leaf
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- // check the default value
- // This default value is verified by YangType.isValidValue() called from LeafListener.processLeafExit()
- assertThat(leafInfo.getName(), is("message"));
- assertThat(leafInfo.getDefaultValueInString(), is("unbounded"));
- }
-
- /**
- * Validates default invalid value union in leaf.
- */
- @Test
- public void processDefaultInvalidValueUnionInLeaf() throws IOException, ParserException {
- thrown.expect(DataTypeException.class);
- thrown.expectMessage("YANG file error : Input value \"xyz\" is not a valid UNION");
-
- manager.getDataModel("src/test/resources/default/DefaultInvalidValueUnionInLeaf.yang");
- }
-
- /**
- * Validates default value in multiple typedef.
- */
- @Test
- public void processDefaultInMultiTypedef() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/default/DefaultValueInMultiTypeDef.yang");
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // check typedef
- YangTypeDef typedef = (YangTypeDef) yangNode.getChild();
- assertThat(typedef.getName(), is("topInt"));
- assertThat(typedef.getDefaultValueInString(), is("10"));
-
- YangType type = typedef.getTypeList().iterator().next();
- assertThat(type.getDataType(), is(YangDataTypes.INT64));
- assertThat(type.getDataTypeName(), is("int64"));
-
- // check leaf
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
- assertThat(leafInfo.getName(), is("lowInt"));
-
- // check leaf type
- assertThat(leafInfo.getName(), is("lowInt"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("midInt"));
- YangType<YangDerivedInfo> derivedInfoType = (YangType<YangDerivedInfo>) leafInfo.getDataType();
- assertThat(derivedInfoType.getDataType(), is(YangDataTypes.DERIVED));
- YangDerivedInfo derivedInfo = (YangDerivedInfo) derivedInfoType.getDataTypeExtendedInfo();
-
- // check previous typedef
- YangTypeDef prevTypedef = (YangTypeDef) derivedInfo.getReferredTypeDef();
- assertThat(prevTypedef.getName(), is("midInt"));
- type = prevTypedef.getTypeList().iterator().next();
- assertThat(type.getDataType(), is(YangDataTypes.DERIVED));
- derivedInfo = (YangDerivedInfo) type.getDataTypeExtendedInfo();
-
- // check top typedef
- YangTypeDef topTypedef = (YangTypeDef) derivedInfo.getReferredTypeDef();
- assertThat(topTypedef.getName(), is("topInt"));
- assertThat(topTypedef.getDefaultValueInString(), is("10"));
- YangType topType = topTypedef.getTypeList().iterator().next();
- assertThat(topType.getDataType(), is(YangDataTypes.INT64));
- assertThat(topType.getDataTypeName(), is("int64"));
- YangType<YangInt64> typeInt64 = (YangType<YangInt64>) topType;
- YangInt64 int64Obj = typeInt64.getDataTypeExtendedInfo();
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/DescriptionListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/DescriptionListenerTest.java
deleted file mode 100644
index c01ad54..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/DescriptionListenerTest.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * 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.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.YangContainer;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangLeafList;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangStatusType;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-
-/**
- * Test cases for description listener.
- */
-public class DescriptionListenerTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks valid description statement.
- */
- @Test
- public void processDescriptionValidStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/DescriptionValidStatement.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- // Check whether the description is set correctly.
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
- }
-
- /**
- * Checks whether exception is thrown for invalid description statement.
- */
- @Test
- public void processDescriptionWithoutStatementEnd() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("extraneous input '}' expecting {';', '+'}");
- YangNode node = manager.getDataModel("src/test/resources/DescriptionWithoutStatementEnd.yang");
- }
-
- /**
- * Checks valid description statement as sub-statement of module.
- */
- @Test
- public void processModuleSubStatementDescription() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ModuleSubStatementDescription.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the description is set correctly.
- assertThat(yangNode.getDescription(), is("\"Interval before a route is declared invalid\""));
- }
-
- /**
- * Checks valid description statement as sub-statement of module.
- */
- @Test
- public void processDescriptionEmptyStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/DescriptionEmptyStatement.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the description is set correctly.
- assertThat(yangNode.getDescription(), is("\"\""));
- }
-
- /**
- * Checks valid description statement as sub-statement of revision.
- */
- @Test
- public void processRevisionSubStatementRevision() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/RevisionSubStatementRevision.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the description is set correctly.
- assertThat(yangNode.getDescription(), is("\"module description\""));
- assertThat(yangNode.getRevision().getDescription(), is("\"revision description\""));
- }
-
- /**
- * Checks description statement as sub-statement of container.
- */
- @Test
- public void processContainerSubStatementDescription() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatementDescription.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the description value is set correctly.
- YangContainer container = (YangContainer) yangNode.getChild();
- assertThat(container.getName(), is("valid"));
- assertThat(container.getDescription(), is("\"container description\""));
-
- // Check whether leaf properties as set correctly.
- ListIterator<YangLeaf> leafIterator = container.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
- assertThat(leafInfo.getUnits(), is("\"seconds\""));
- assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
- assertThat(leafInfo.isMandatory(), is(true));
- assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
- assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
- }
-
- /**
- * Checks description statement as sub-statement of list.
- */
- @Test
- public void processListSubStatementDescription() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ListSubStatementDescription.yang");
-
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the list is child of module and description value is set correctly.
- YangList yangList = (YangList) yangNode.getChild();
- assertThat(yangList.getName(), is("valid"));
- assertThat(yangList.isConfig(), is(true));
- assertThat(yangList.getDescription(), is("\"list description\""));
-
- // Check whether leaf properties as set correctly.
- ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
- assertThat(leafInfo.getUnits(), is("\"seconds\""));
- assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
- assertThat(leafInfo.isMandatory(), is(true));
- assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
- assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
- }
-
- /**
- * Checks valid description statement as sub-statement of leaf-list.
- */
- @Test
- public void processLeafListSubStatementDescription() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/LeafListSubStatementDescription.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList leafListInfo = leafListIterator.next();
-
- // Check whether description value is set correctly.
- assertThat(leafListInfo.getName(), is("invalid-interval"));
- assertThat(leafListInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/EnumListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/EnumListenerTest.java
deleted file mode 100644
index d5f6645..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/EnumListenerTest.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.datamodel.YangEnum;
-import org.onosproject.yangutils.datamodel.YangEnumeration;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.ListIterator;
-import java.util.SortedSet;
-
-/**
- * Test cases for enum listener.
- */
-public class EnumListenerTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks enum statement without value.
- */
- @Test
- public void processEnumTypeStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/EnumTypeStatement.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("speed"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("enumeration"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.ENUMERATION));
- assertThat(((YangEnumeration) leafInfo.getDataType().getDataTypeExtendedInfo()).getName(),
- is("speed_enum"));
-
- SortedSet<YangEnum> enumSet = ((YangEnumeration) leafInfo.getDataType().getDataTypeExtendedInfo()).getEnumSet();
- for (YangEnum tmp : enumSet) {
- if (tmp.getNamedValue().equals("10m")) {
- assertThat(tmp.getValue(), is(0));
- } else if (tmp.getNamedValue().equals("100m")) {
- assertThat(tmp.getValue(), is(1));
- } else if (tmp.getNamedValue().equals("auto")) {
- assertThat(tmp.getValue(), is(2));
- }
- }
- }
-
- /**
- * Checks if enum with same name is not allowed.
- */
- @Test(expected = ParserException.class)
- public void processEnumWithDuplicateName() throws IOException, ParserException {
- YangNode node = manager.getDataModel("src/test/resources/EnumWithDuplicateName.yang");
- }
-
- /**
- * Checks enum boundary value.
- */
- @Test
- public void processEnumBoundaryValue() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("YANG file error : value value 21474836472147483647 is not valid.");
- YangNode node = manager.getDataModel("src/test/resources/EnumBoundaryValue.yang");
- }
-
- /**
- * Checks whether exception is thrown if value is not specified following max enum value.
- */
- @Test
- public void processEnumMaxNextValue() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("YANG file error : "
- + "An enum value MUST be specified for enum substatements following the one"
- + "with the current highest value");
- YangNode node = manager.getDataModel("src/test/resources/EnumMaxNextValue.yang");
- }
-
- /**
- * Checks enum values stored are sorted.
- */
- @Test
- public void processEnumSorted() throws IOException, ParserException {
- YangNode node = manager.getDataModel("src/test/resources/EnumSorted.yang");
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("ifType"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("enumeration"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.ENUMERATION));
- assertThat(((YangEnumeration) leafInfo.getDataType().getDataTypeExtendedInfo()).getName(),
- is("ifType_enum"));
-
- SortedSet<YangEnum> enumSet = ((YangEnumeration) leafInfo.getDataType().getDataTypeExtendedInfo()).getEnumSet();
- Iterator<YangEnum> enumIterator = enumSet.iterator();
- assertThat(enumIterator.next().getNamedValue(), is("five"));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ErrorAppTagListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ErrorAppTagListenerTest.java
deleted file mode 100644
index a367942..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ErrorAppTagListenerTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangMust;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangAppErrorInfo;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import java.io.IOException;
-import java.util.List;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-
-/**
- * Test-cases for testing error app tag message listener functionality.
- */
-public class ErrorAppTagListenerTest {
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks if error app tag message is default updated in the data model.
- */
- @Test
- public void processContainerSubStatementErrorDefaultAppTag() throws IOException, ParserException {
- YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatementErrorDefaultAppTag.yang");
-
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("ErrorAppTag"));
-
- YangContainer yangContainer = (YangContainer) yangNode.getChild();
- assertThat(yangContainer.getName(), is("interface"));
-
- String expectedConstraint = "ifType != 'ethernet' or (ifType = 'ethernet' and ifMTU = 1500)";
- List<YangMust> mustConstraintList = yangContainer.getListOfMust();
- assertThat(mustConstraintList.iterator().next().getConstraint(), is(expectedConstraint));
-
- YangAppErrorInfo yangAppErrorInfo = mustConstraintList.iterator().next().getAppErrorInfo();
- assertThat(yangAppErrorInfo.getGetErrorAppTag(), is("must-violation"));
- assertThat(yangAppErrorInfo.getGetErrorTag(), is("operation-failed"));
- }
-
- /**
- * Checks if error app tag message listener updates the data model.
- */
- @Test
- public void processContainerSubStatementErrorAppTag() throws IOException, ParserException {
- YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatementErrorAppTag.yang");
-
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("ErrorAppTag"));
-
- YangContainer yangContainer = (YangContainer) yangNode.getChild();
- assertThat(yangContainer.getName(), is("interface"));
-
- String expectedConstraint = "ifType != 'ethernet' or (ifType = 'ethernet' and ifMTU = 1500)";
- List<YangMust> mustConstraintList = yangContainer.getListOfMust();
- assertThat(mustConstraintList.iterator().next().getConstraint(), is(expectedConstraint));
-
- YangAppErrorInfo yangAppErrorInfo = mustConstraintList.iterator().next().getAppErrorInfo();
- assertThat(yangAppErrorInfo.getGetErrorAppTag(), is("An ethernet MTU must be 1500"));
- assertThat(yangAppErrorInfo.getGetErrorTag(), is("operation-failed"));
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ErrorMessageListnerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ErrorMessageListnerTest.java
deleted file mode 100644
index bf53292..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ErrorMessageListnerTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangMust;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangAppErrorInfo;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import java.io.IOException;
-import java.util.List;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-
-/**
- * Test-cases for testing error message listener functionality.
- */
-public class ErrorMessageListnerTest {
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks if error message listener updates the data model.
- */
- @Test
- public void processContainerSubStatementErrorMessage() throws IOException, ParserException {
- YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatementErrorMessage.yang");
-
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("ErrorMessage"));
-
- YangContainer yangContainer = (YangContainer) yangNode.getChild();
- assertThat(yangContainer.getName(), is("interface"));
-
- String expectedConstraint = "ifType != 'ethernet' or (ifType = 'ethernet' and ifMTU = 1500)";
- List<YangMust> mustConstraintList = yangContainer.getListOfMust();
- assertThat(mustConstraintList.iterator().next().getConstraint(), is(expectedConstraint));
-
- YangAppErrorInfo yangAppErrorInfo = mustConstraintList.iterator().next().getAppErrorInfo();
- assertThat(yangAppErrorInfo.getGetErrorMessage(), is("An ethernet MTU must be 1500"));
- assertThat(yangAppErrorInfo.getGetErrorTag(), is("operation-failed"));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ExtensionListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ExtensionListenerTest.java
deleted file mode 100644
index d5c3c83..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ExtensionListenerTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import java.io.IOException;
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangExtension;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-
-/**
- * Test cases for testing extension listener.
- */
-public class ExtensionListenerTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks extension statement as sub-statement of module.
- */
- @Test
- public void processValidExtensionStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ValidExtensionStatement.yang");
-
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("ietf-yang-compiler-annotation"));
-
- YangExtension extension = yangNode.getExtensionList().iterator().next();
- assertThat(extension.getName(), is("compiler-annotation"));
- assertThat(extension.getArgumentName(), is("target"));
- assertThat(extension.getDescription(), is("\"This extension allows for defining compiler annotations\""));
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/GroupingListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/GroupingListenerTest.java
deleted file mode 100644
index acd0c8a..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/GroupingListenerTest.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import java.io.IOException;
-import java.util.ListIterator;
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangGrouping;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangStatusType;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-
-/**
- * Test cases for testing grouping listener.
- */
-public class GroupingListenerTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks grouping statement inside module.
- */
- @Test
- public void processGroupingInModule() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/GroupingInModule.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- YangGrouping yangGrouping = (YangGrouping) yangNode.getChild();
- assertThat(yangGrouping.getName(), is("endpoint"));
-
- ListIterator<YangLeaf> leafIterator = yangGrouping.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("address"));
- }
-
- /**
- * Checks grouping statement inside container.
- */
- @Test
- public void processGroupingInContainer() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/GroupingInContainer.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- YangContainer yangContainer = (YangContainer) yangNode.getChild();
- assertThat(yangContainer.getName(), is("valid"));
-
- YangGrouping yangGrouping = (YangGrouping) yangContainer.getChild();
- assertThat(yangGrouping.getName(), is("endpoint"));
-
- ListIterator<YangLeaf> leafIterator = yangGrouping.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("address"));
- }
-
- /**
- * Checks grouping statement inside list.
- */
- @Test
- public void processGroupingInList() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/GroupingInList.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- YangList yangList = (YangList) yangNode.getChild();
- assertThat(yangList.getName(), is("valid"));
-
- YangGrouping yangGrouping = (YangGrouping) yangList.getChild();
- assertThat(yangGrouping.getName(), is("endpoint"));
-
- ListIterator<YangLeaf> leafIterator = yangGrouping.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("address"));
- }
-
- /**
- * Checks grouping with attributes.
- */
- @Test
- public void processGroupingAttributes() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/GroupingAttributes.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- YangList yangList = (YangList) yangNode.getChild();
- assertThat(yangList.getName(), is("valid"));
-
- YangGrouping yangGrouping = (YangGrouping) yangList.getChild();
- assertThat(yangGrouping.getName(), is("endpoint"));
- assertThat(yangGrouping.getStatus(), is(YangStatusType.CURRENT));
- assertThat(yangGrouping.getReference(), is("\"RFC 6020\""));
- assertThat(yangGrouping.getDescription(), is("\"grouping under test\""));
-
- ListIterator<YangLeaf> leafIterator = yangGrouping.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("address"));
- }
-
- /**
- * Checks duplicate grouping in list.
- */
- @Test(expected = ParserException.class)
- public void processDuplicateGroupingInList() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/DuplicateGroupingInList.yang");
- }
-
- /**
- * Checks duplicate grouping in container.
- */
- @Test (expected = ParserException.class)
- public void processDuplicateGroupingInContainer() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/DuplicateGroupingInContainer.yang");
- }
-
- /**
- * Checks duplicate grouping in module.
- */
- @Test (expected = ParserException.class)
- public void processDuplicateGroupingInModule() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/DuplicateGroupingInModule.yang");
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/IdentityListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/IdentityListenerTest.java
deleted file mode 100644
index b0ae937..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/IdentityListenerTest.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.onosproject.yangutils.datamodel.YangIdentity;
-import org.onosproject.yangutils.datamodel.YangIdentityRef;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangLeafList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.datamodel.YangTypeDef;
-import org.onosproject.yangutils.datamodel.utils.ResolvableStatus;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import java.io.IOException;
-import java.util.ListIterator;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-
-/**
- * Test case for identity listener.
- */
-public class IdentityListenerTest {
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks for updating datamodel for identity/identityref.
- */
- @Test
- public void processIdentityrefType() throws IOException, ParserException {
-
- YangNode node = manager
- .getDataModel("src/test/resources/IdentityListener.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("IdentityListener"));
-
- YangIdentity yangIdentity = (YangIdentity) yangNode.getChild();
- assertThat(yangIdentity.getName(), is("tunnel"));
-
- yangIdentity = (YangIdentity) yangNode.getChild().getNextSibling();
- assertThat(yangIdentity.getName(), is("tunnel-type"));
-
- yangIdentity = (YangIdentity) yangNode.getChild().getNextSibling().getNextSibling();
- assertThat(yangIdentity.getName(), is("ref-address-family"));
-
- yangIdentity = (YangIdentity) yangNode.getChild().getNextSibling().getNextSibling()
- .getNextSibling();
- assertThat(yangIdentity.getName(), is("ipv4-address-family"));
- assertThat(yangIdentity.getBaseNode().getBaseIdentifier().getName(), is("ref-address-family"));
- assertThat(yangIdentity.getBaseNode().getReferredIdentity().getName(), is("ref-address-family"));
-
- yangIdentity = (YangIdentity) yangNode.getChild().getNextSibling().getNextSibling()
- .getNextSibling().getNextSibling();
- assertThat(yangIdentity.getName(), is("ipv6-address-family"));
- assertThat(yangIdentity.getBaseNode().getBaseIdentifier().getName(), is("ref-address-family"));
- assertThat(yangIdentity.getBaseNode().getReferredIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentity.getBaseNode().getResolvableStatus(), is(ResolvableStatus.RESOLVED));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("tunnel"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("identityref"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.IDENTITYREF));
- YangIdentityRef yangIdentityRef = (YangIdentityRef) leafInfo.getDataType().getDataTypeExtendedInfo();
- assertThat(yangIdentityRef.getName(), is("ref-address-family"));
- assertThat(yangIdentityRef.getBaseIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentityRef.getReferredIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentityRef.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
-
- ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList leafListInfo = leafListIterator.next();
-
- // Check whether the information in the leaf is correct.
- assertThat(leafListInfo.getName(), is("network-ref"));
- assertThat(leafListInfo.getDataType().getDataTypeName(), is("identityref"));
- assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.IDENTITYREF));
- yangIdentityRef = (YangIdentityRef) (leafListInfo.getDataType().getDataTypeExtendedInfo());
-
- // Check whether identityref type got resolved.
- assertThat(yangIdentityRef.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
- }
-
- /**
- * Checks for updating datamodel for intrafile resolution identity/identityref.
- */
- @Test
- public void processIntraIdentityrefType() throws IOException, ParserException {
-
- YangNode node = manager
- .getDataModel("src/test/resources/IdentityIntraFile.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("IdentityIntraFile"));
-
- YangIdentity yangIdentity = (YangIdentity) yangNode.getChild();
- assertThat(yangIdentity.getName(), is("ipv4-address-family"));
- assertThat(yangIdentity.getBaseNode().getBaseIdentifier().getName(), is("ref-address-family"));
- assertThat(yangIdentity.getBaseNode().getResolvableStatus(), is(ResolvableStatus.INTRA_FILE_RESOLVED));
- }
-
- /**
- * Checks for updating datamodel for identityref used in tydedef.
- */
- @Test
- public void processIdentityTypedefStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/IdentityTypedef.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- YangIdentity yangIdentity = (YangIdentity) yangNode.getChild();
- assertThat(yangIdentity.getName(), is("tunnel"));
-
- YangTypeDef typedef = (YangTypeDef) yangNode.getChild().getNextSibling();
- assertThat(typedef.getName(), is("type15"));
-
- YangType type = typedef.getTypeList().iterator().next();
- assertThat(type.getDataType(), is(YangDataTypes.IDENTITYREF));
- assertThat(type.getDataTypeName(), is("identityref"));
-
- YangIdentityRef identityRef = (YangIdentityRef) type.getDataTypeExtendedInfo();
- assertThat(identityRef.getName(), is("tunnel"));
- assertThat(identityRef.getBaseIdentity().getName(), is("tunnel"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("tunnel-value"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("identityref"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.IDENTITYREF));
- YangIdentityRef yangIdentityRef = (YangIdentityRef) leafInfo.getDataType().getDataTypeExtendedInfo();
- assertThat(yangIdentityRef.getName(), is("tunnel"));
- assertThat(yangIdentityRef.getBaseIdentity().getName(), is("tunnel"));
- assertThat(yangIdentityRef.getReferredIdentity().getName(), is("tunnel"));
- assertThat(yangIdentityRef.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
- }
-
- /**
- * Checks for updating datamodel for unresolved status of identityref used in tydedef.
- */
- @Test
- public void processIdentityUnresolvedTypedefStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/IdentityTypedefUnresolved.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- YangIdentity yangIdentity = (YangIdentity) yangNode.getChild();
- assertThat(yangIdentity.getName(), is("tunnel"));
-
- YangTypeDef typedef = (YangTypeDef) yangNode.getChild().getNextSibling();
- assertThat(typedef.getName(), is("type15"));
-
- YangType type = typedef.getTypeList().iterator().next();
- assertThat(type.getDataType(), is(YangDataTypes.IDENTITYREF));
- assertThat(type.getDataTypeName(), is("identityref"));
-
- YangIdentityRef identityRef = (YangIdentityRef) type.getDataTypeExtendedInfo();
- assertThat(identityRef.getName(), is("tunnel"));
- assertThat(identityRef.getBaseIdentity().getName(), is("tunnel"));
- assertThat(identityRef.getResolvableStatus(), is(ResolvableStatus.UNRESOLVED));
-
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ImportListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ImportListenerTest.java
deleted file mode 100644
index b52da4a..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ImportListenerTest.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import java.io.IOException;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-
-/**
- * Test cases for testing import listener functionality.
- */
-public class ImportListenerTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
- private static final String DATE_FORMAT = "yyyy-MM-dd";
- private final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATE_FORMAT);
-
- /**
- * Checks if mandatory parameter prefix is present in import.
- */
- @Test(expected = ParserException.class)
- public void processImportWithoutPrefix() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ImportWithoutPrefix.yang");
- }
-
- /**
- * Checks that prefix must be present only once in import.
- */
- @Test(expected = ParserException.class)
- public void processImportWithDualPrefix() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ImportWithDualPrefix.yang");
- }
-
- /**
- * Checks for the correct order of prefix in import.
- */
- @Test(expected = ParserException.class)
- public void processImportInvalidOrder() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ImportInvalidOrder.yang");
- }
-
- /**
- * Checks if import listener updates the data model tree.
- */
- @Test
- public void processImportValidEntry() throws IOException, ParserException, ParseException {
-
- YangNode node = manager.getDataModel("src/test/resources/ImportValidEntry.yang");
-
- // Checks for the revision value in data model tree.
- assertThat(((YangModule) node).getImportList().get(0).getRevision(), is(simpleDateFormat.parse("2015-02-03")));
- // Checks for the prefix id in data model tree.
- assertThat(((YangModule) node).getImportList().get(0).getPrefixId(), is("On2"));
- // Checks for the module name in data model tree.
- assertThat(((YangModule) node).getImportList().get(0).getModuleName(), is("ietf"));
- }
-
- /**
- * Checks if optional parameter revision is not mandatory in import.
- */
- @Test
- public void processImportWithoutRevision() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ImportWithoutRevision.yang");
-
- // Checks for the prefix id in data model tree.
- assertThat(((YangModule) node).getImportList().get(0).getPrefixId(), is("On2"));
- // Checks for the module name in data model tree.
- assertThat(((YangModule) node).getImportList().get(0).getModuleName(), is("ietf"));
- }
-
- /**
- * Checks if multiple imports are allowed.
- */
- @Test()
- public void processImportMultipleInstance() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ImportMultipleInstance.yang");
-
- // Checks for the prefix id in data model tree.
- assertThat(((YangModule) node).getImportList().get(0).getPrefixId(), is("On2"));
- // Checks for the module name in data model tree.
- assertThat(((YangModule) node).getImportList().get(0).getModuleName(), is("ietf"));
-
- // Checks for the prefix id in data model tree.
- assertThat(((YangModule) node).getImportList().get(1).getPrefixId(), is("On3"));
- // Checks for the module name in data model tree.
- assertThat(((YangModule) node).getImportList().get(1).getModuleName(), is("itut"));
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/IncludeListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/IncludeListenerTest.java
deleted file mode 100644
index e2bb239..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/IncludeListenerTest.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import java.io.IOException;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-
-/**
- * Test cases for testing include listener functionality.
- */
-public class IncludeListenerTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
- private static final String DATE_FORMAT = "yyyy-MM-dd";
- private final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATE_FORMAT);
-
- /**
- * Checks if include listener with ; is valid and updates the data
- * model tree.
- */
- @Test
- public void processIncludeWithStmtend() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/IncludeWithStmtend.yang");
-
- // Checks for the sub module name in data model tree.
- assertThat(((YangModule) node).getIncludeList().get(0).getSubModuleName(), is("itut"));
- }
-
- /**
- * Checks if include listener with braces and without revision date is valid
- * and updates the data model tree.
- */
- @Test
- public void processIncludeWithEmptyBody() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/IncludeWithEmptyBody.yang");
-
- // Checks for the sub module name in data model tree.
- assertThat(((YangModule) node).getIncludeList().get(0).getSubModuleName(), is("itut"));
- }
-
- /**
- * Checks if include listener with braces and with revision date is valid
- * and updates the data model tree.
- */
- @Test
- public void processIncludeWithDate() throws IOException, ParserException, ParseException {
-
- YangNode node = manager.getDataModel("src/test/resources/IncludeWithDate.yang");
-
- // Checks for the sub module name in data model tree.
- assertThat(((YangModule) node).getIncludeList().get(0).getSubModuleName(), is("itut"));
- assertThat(((YangModule) node).getIncludeList().get(0).getRevision(), is(simpleDateFormat.parse("2016-02-03")));
- }
-
- /**
- * Checks if include has more than one occurrence.
- */
- @Test
- public void processIncludeMultiInstance() throws IOException, ParserException, ParseException {
-
- YangNode node = manager.getDataModel("src/test/resources/IncludeMultiInstance.yang");
-
- // Checks for the sub module name in data model tree.
- assertThat(((YangModule) node).getIncludeList().get(0).getSubModuleName(), is("itut"));
- assertThat(((YangModule) node).getIncludeList().get(0).getRevision(), is(simpleDateFormat.parse("2016-02-03")));
- assertThat(((YangModule) node).getIncludeList().get(1).getSubModuleName(), is("sdn"));
- assertThat(((YangModule) node).getIncludeList().get(1).getRevision(), is(simpleDateFormat.parse("2014-02-03")));
- }
-
- /**
- * Checks if include and import can come in any order.
- */
- @Test
- public void processIncludeImportAnyOrder() throws IOException, ParserException, ParseException {
-
- YangNode node = manager.getDataModel("src/test/resources/IncludeImportAnyOrder.yang");
-
- // Checks for the sub module name in data model tree.
- assertThat(((YangModule) node).getIncludeList().get(0).getSubModuleName(), is("itut"));
- assertThat(((YangModule) node).getIncludeList().get(0).getRevision(), is(simpleDateFormat.parse("2016-02-03")));
- assertThat(((YangModule) node).getIncludeList().get(1).getSubModuleName(), is("sdn"));
- assertThat(((YangModule) node).getIncludeList().get(1).getRevision(), is(simpleDateFormat.parse("2014-02-03")));
- }
-
- /**
- * Checks if syntax of Include is not correct.
- */
- @Test(expected = ParserException.class)
- public void processIncludeInvalidSyntax() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/IncludeInvalidSyntax.yang");
- }
-
- /**
- * Checks if syntax of revision date in Include is not correct.
- */
- @Test(expected = ParserException.class)
- public void processIncludeInvalidDateSyntax() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/IncludeInvalidDateSyntax.yang");
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/InputListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/InputListenerTest.java
deleted file mode 100644
index 9000235..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/InputListenerTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import java.io.IOException;
-import java.util.ListIterator;
-
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangRpc;
-import org.onosproject.yangutils.datamodel.YangInput;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangTypeDef;
-import org.onosproject.yangutils.datamodel.YangStatusType;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-
-/**
- * Test cases for testing Input listener functionality.
- */
-public class InputListenerTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks input statements with data definition statements as sub-statements.
- */
- @Test
- public void processInputStatementWithDataDefinition() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/InputStatementWithDataDefinition.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("rock"));
-
- YangRpc yangRpc = (YangRpc) yangNode.getChild();
- assertThat(yangRpc.getName(), is("activate-software-image"));
-
- YangInput yangInput = (YangInput) yangRpc.getChild();
- assertThat(yangInput.getName(), is("activate-software-image_input"));
- ListIterator<YangLeaf> leafIterator = yangInput.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("image-name"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
-
- YangList yangList = (YangList) yangInput.getChild();
- assertThat(yangList.getName(), is("ospf"));
- assertThat(yangList.getKeyList().contains("invalid-interval"), is(true));
- assertThat(yangList.isConfig(), is(true));
- assertThat(yangList.getMaxElements().getMaxElement(), is(10));
- assertThat(yangList.getMinElements().getMinElement(), is(3));
- leafIterator = yangList.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
-
- YangContainer yangContainer = (YangContainer) yangList.getNextSibling();
- assertThat(yangContainer.getName(), is("isis"));
-
- leafIterator = yangContainer.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
- }
-
- /**
- * Checks input statements with type-def statement as sub-statements.
- */
- @Test
- public void processInputStatementWithTypedef() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/InputStatementWithTypedef.yang");
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("rock"));
-
- YangRpc yangRpc = (YangRpc) yangNode.getChild();
- assertThat(yangRpc.getName(), is("activate-software-image"));
-
- YangInput yangInput = (YangInput) yangRpc.getChild();
- assertThat(yangInput.getName(), is("activate-software-image_input"));
- YangTypeDef typeDef = (YangTypeDef) yangInput.getChild();
- assertThat(typeDef.getName(), is("my-type"));
- assertThat(typeDef.getStatus(), is(YangStatusType.DEPRECATED));
- assertThat(typeDef.getTypeDefBaseType().getDataType(), is(YangDataTypes.INT32));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/KeyListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/KeyListenerTest.java
deleted file mode 100644
index 5134f27..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/KeyListenerTest.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.junit.rules.ExpectedException;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.ListIterator;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-
-/**
- * Test cases for key listener.
- */
-public class KeyListenerTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks key statement as sub-statement of list.
- */
- @Test
- public void processListSubStatementKey() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ListSubStatementKey.yang");
-
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the list is child of module
- YangList yangList = (YangList) yangNode.getChild();
- assertThat(yangList.getName(), is("valid"));
-
- ListIterator<String> keyList = yangList.getKeyList().listIterator();
- assertThat(keyList.next(), is("invalid-interval"));
- }
-
- /**
- * Check multiple key values.
- */
- @Test
- public void processMultipleKeyValues() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/MultipleKeyValues.yang");
-
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the list is child of module
- YangList yangList = (YangList) yangNode.getChild();
- assertThat(yangList.getName(), is("valid"));
-
- List<String> keyList = yangList.getKeyList();
- assertThat(keyList.contains("ospf"), is(true));
- assertThat(keyList.contains("isis"), is(true));
- }
-
- /**
- * Checks key statement without statement end.
- */
- @Test
- public void processKeyWithoutStatementEnd() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("mismatched input 'leaf' expecting {';', '+'}");
- YangNode node = manager.getDataModel("src/test/resources/KeyWithoutStatementEnd.yang");
- }
-
- /**
- * Checks key values are set correctly.
- */
- @Test
- public void processConfigFalseNoKey() throws IOException, ParserException {
- YangNode node = manager.getDataModel("src/test/resources/ConfigFalseNoKey.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the list is child of module
- YangList yangList = (YangList) yangNode.getChild();
- assertThat(yangList.getName(), is("valid"));
- }
-
- /**
- * Checks key values are set correctly.
- */
- @Test
- public void processConfigFalseValidKeyValidLeaf() throws IOException, ParserException {
- YangNode node = manager.getDataModel("src/test/resources/ConfigFalseValidKeyValidLeaf.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the list is child of module
- YangList yangList = (YangList) yangNode.getChild();
- assertThat(yangList.getName(), is("valid"));
-
- ListIterator<String> keyList = yangList.getKeyList().listIterator();
- assertThat(keyList.next(), is("invalid-interval"));
- }
-
- /**
- * Checks whether exception is thrown when list's config is set to true and there is no key.
- */
- @Test
- public void processConfigTrueNoKey() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("A list must have atleast one key leaf if config is true");
- YangNode node = manager.getDataModel("src/test/resources/ConfigTrueNoKey.yang");
- }
-
- /**
- * Checks whether exception is thrown when list's config is set to true and there is no leaf.
- */
- @Test
- public void processConfigTrueNoleafNoLeafList() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("A list must have atleast one key leaf if config is true");
- YangNode node = manager.getDataModel("src/test/resources/ConfigTrueNoleafNoLeafList.yang");
- }
-
- /**
- * Checks key values are set correctly.
- */
- @Test
- public void processConfigTrueValidKeyValidLeaf() throws IOException, ParserException {
- YangNode node = manager.getDataModel("src/test/resources/ConfigTrueValidKeyValidLeaf.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the list is child of module
- YangList yangList = (YangList) yangNode.getChild();
- assertThat(yangList.getName(), is("valid"));
-
- ListIterator<String> keyList = yangList.getKeyList().listIterator();
- assertThat(keyList.next(), is("invalid-interval"));
- }
-
- /**
- * Checks key values are set correctly.
- */
- @Test
- public void processKeyWithUsesInList() throws IOException, ParserException {
- YangNode node = manager.getDataModel("src/test/resources/KeyWithUsesInList.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the list is child of module
- YangList yangList = (YangList) yangNode.getChild().getNextSibling();
- assertThat(yangList.getName(), is("valid"));
-
- ListIterator<String> keyList = yangList.getKeyList().listIterator();
- assertThat(keyList.next(), is("invalid-interval"));
- }
-
- /**
- * Checks whether exception is thrown when key leaf identifier is not found in list.
- */
- @Test
- public void processInvalidLeafIdentifier() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("An identifier, in key, must refer to a child leaf of the list");
- YangNode node = manager.getDataModel("src/test/resources/InvalidLeafIdentifier.yang");
- }
-
- /**
- * Checks whether exception is thrown when key leaf is of type empty.
- */
- @Test
- public void processKeyLeafTypeEmpty() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("A leaf that is part of the key must not be the built-in type \"empty\".");
- YangNode node = manager.getDataModel("src/test/resources/KeyLeafTypeEmpty.yang");
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListenerTest.java
deleted file mode 100644
index 083bf81..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListenerTest.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * 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.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.YangContainer;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.datamodel.YangLeafList;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangStatusType;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-
-/**
- * Test cases for testing leaf-list listener.
- */
-public class LeafListListenerTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks all the values of leaf-list sub-statements are set correctly.
- */
- @Test
- public void processLeafListSubStatements() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/LeafListSubStatements.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList leafListInfo = leafListIterator.next();
-
- assertThat(leafListInfo.getName(), is("invalid-interval"));
- assertThat(leafListInfo.getDataType().getDataTypeName(), is("uint16"));
- assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
- assertThat(leafListInfo.getUnits(), is("\"seconds\""));
- assertThat(leafListInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
- assertThat(leafListInfo.isConfig(), is(true));
- assertThat(leafListInfo.getMaxElements().getMaxElement(), is(3));
- assertThat(leafListInfo.getStatus(), is(YangStatusType.CURRENT));
- assertThat(leafListInfo.getReference(), is("\"RFC 6020\""));
- }
-
- /**
- * Checks whether exception is thrown when leaf-list identifier starts with
- * digit.
- */
- @Test
- public void processLeafListInvalidIdentifier() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("YANG file error : leaf-list name 1invalid-interval is not valid.");
- YangNode node = manager.getDataModel("src/test/resources/LeafListInvalidIdentifier.yang");
- }
-
- /**
- * Checks whether exception is thrown when leaf-list keyword is incorrect.
- */
- @Test(expected = ParserException.class)
- public void processLeafListInvalidStatement() throws IOException, ParserException {
- YangNode node = manager.getDataModel("src/test/resources/LeafListInvalidStatement.yang");
- }
-
- /**
- * Checks whether exception is thrown when leaf-list keyword without Left
- * brace as per grammar.
- */
- @Test
- public void processLeafListWithoutLeftBrace() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("missing '{' at 'type'");
- YangNode node = manager.getDataModel("src/test/resources/LeafListWithoutLeftBrace.yang");
- }
-
- /**
- * Checks whether exception is thrown when config statement cardinality is
- * not as per grammar.
- */
- @Test
- public void processLeafListConfigInvalidCardinality() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("YANG file error: \"config\" is defined more than once in \"leaf-list " +
- "invalid-interval\".");
- YangNode node = manager.getDataModel("src/test/resources/LeafListConfigInvalidCardinality.yang");
- }
-
- /**
- * Checks whether exception is thrown when units statement cardinality is
- * not as per grammar.
- */
- @Test
- public void processLeafListUnitsInvalidCardinality() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("YANG file error: \"units\" is defined more than once in \"leaf-list invalid-interval\"");
- YangNode node = manager.getDataModel("src/test/resources/LeafListUnitsInvalidCardinality.yang");
- }
-
- /**
- * Checks leaf-list statement as sub-statement of container.
- */
- @Test
- public void processContainerSubStatementLeafList() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatementLeafList.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- //Check whether the container is child of module.
- YangContainer container = (YangContainer) yangNode.getChild();
- assertThat(container.getName(), is("valid"));
-
- // Check whether leaf-list properties as set correctly.
- ListIterator<YangLeafList> leafListIterator = container.getListOfLeafList().listIterator();
- YangLeafList leafListInfo = leafListIterator.next();
-
- assertThat(leafListInfo.getName(), is("invalid-interval"));
- assertThat(leafListInfo.getDataType().getDataTypeName(), is("uint16"));
- assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
- assertThat(leafListInfo.getUnits(), is("\"seconds\""));
- assertThat(leafListInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
- assertThat(leafListInfo.isConfig(), is(true));
- assertThat(leafListInfo.getMinElements().getMinElement(), is(1));
- assertThat(leafListInfo.getMaxElements().getMaxElement(), is(2147483647));
- assertThat(leafListInfo.getStatus(), is(YangStatusType.CURRENT));
- assertThat(leafListInfo.getReference(), is("\"RFC 6020\""));
- }
-
- /**
- * Checks leaf-list statement as sub-statement of list.
- */
- @Test
- public void processListSubStatementLeafList() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ListSubStatementLeafList.yang");
-
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the list is child of module
- YangList yangList = (YangList) yangNode.getChild();
- assertThat(yangList.getName(), is("valid"));
-
- // Check whether leaf-list properties as set correctly.
- ListIterator<YangLeafList> leafListIterator = yangList.getListOfLeafList().listIterator();
- YangLeafList leafListInfo = leafListIterator.next();
-
- assertThat(leafListInfo.getName(), is("invalid-interval"));
- assertThat(leafListInfo.getDataType().getDataTypeName(), is("uint16"));
- assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
- assertThat(leafListInfo.getUnits(), is("\"seconds\""));
- assertThat(leafListInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
- assertThat(leafListInfo.isConfig(), is(true));
-
- assertThat(leafListInfo.getStatus(), is(YangStatusType.CURRENT));
- assertThat(leafListInfo.getReference(), is("\"RFC 6020\""));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListenerTest.java
deleted file mode 100644
index 9bbd0f5..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListenerTest.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * 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.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.YangContainer;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangStatusType;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-
-/**
- * Test cases for testing leaf listener.
- */
-public class LeafListenerTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks all the values of leaf sub-statements are set correctly.
- */
- @Test
- public void processLeafSubStatements() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/LeafSubStatements.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
- assertThat(leafInfo.getUnits(), is("\"seconds\""));
- assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
- assertThat(leafInfo.isConfig(), is(true));
- assertThat(leafInfo.isMandatory(), is(true));
- assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
- assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
- }
-
- /**
- * Checks whether exception is thrown when leaf identifier starts with
- * digit.
- */
- @Test
- public void processLeafInvalidIdentifier() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("YANG file error : leaf name 1invalid-interval is not valid.");
- YangNode node = manager.getDataModel("src/test/resources/LeafInvalidIdentifier.yang");
- }
-
- /**
- * Checks whether exception is thrown when leaf keyword without Left brace
- * as per grammar.
- */
- @Test
- public void processLeafWithoutLeftBrace() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("missing '{' at 'type'");
- YangNode node = manager.getDataModel("src/test/resources/LeafWithoutLeftBrace.yang");
- }
-
- /**
- * Checks whether exception is thrown when config statement cardinality is
- * not as per grammar.
- */
- @Test
- public void processLeafConfigInvalidCardinality() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("YANG file error: \"config\" is defined more than once in \"leaf invalid-interval\".");
- YangNode node = manager.getDataModel("src/test/resources/LeafConfigInvalidCardinality.yang");
- }
-
- /**
- * Checks whether exception is thrown when mandatory statement cardinality
- * is not as per grammar.
- */
- @Test
- public void processLeafMandatoryInvalidCardinality() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("YANG file error: \"mandatory\" is defined more than once in \"leaf invalid-interval\".");
- YangNode node = manager.getDataModel("src/test/resources/LeafMandatoryInvalidCardinality.yang");
- }
-
- /**
- * Checks leaf statement as sub-statement of container.
- */
- @Test
- public void processContainerSubStatementLeaf() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatementLeaf.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- //Check whether the container is child of module.
- YangContainer container = (YangContainer) yangNode.getChild();
- assertThat(container.getName(), is("valid"));
-
- // Check whether leaf properties as set correctly.
- ListIterator<YangLeaf> leafIterator = container.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
- assertThat(leafInfo.getUnits(), is("\"seconds\""));
- assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
- assertThat(leafInfo.isConfig(), is(true));
- assertThat(leafInfo.isMandatory(), is(true));
- assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
- assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
- }
-
- /**
- * Checks duplicate leaf statement as sub-statement of module.
- */
- @Test(expected = ParserException.class)
- public void processModuleWithDuplicateLeaf() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ModuleWithDuplicateLeaf.yang");
- }
-
- /**
- * Checks duplicate leaf statement as sub-statement of container.
- */
- @Test(expected = ParserException.class)
- public void processContainerWithDuplicateLeaf() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ContainerWithDuplicateLeaf.yang");
- }
-
- /**
- * Checks duplicate leaf statement as sub-statement of list.
- */
- @Test(expected = ParserException.class)
- public void processListWithDuplicateLeaf() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ListWithDuplicateLeaf.yang");
- }
-
- /**
- * Checks leaf statement as sub-statement of list.
- */
- @Test
- public void processListSubStatementLeaf() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ListSubStatementLeaf.yang");
-
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the list is child of module
- YangList yangList = (YangList) yangNode.getChild();
- assertThat(yangList.getName(), is("valid"));
-
- // Check whether leaf properties as set correctly.
- ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
- assertThat(leafInfo.getUnits(), is("\"seconds\""));
- assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
- assertThat(leafInfo.isConfig(), is(true));
- assertThat(leafInfo.isMandatory(), is(true));
- assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
- assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LengthRestrictionListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LengthRestrictionListenerTest.java
deleted file mode 100644
index a67aa53..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LengthRestrictionListenerTest.java
+++ /dev/null
@@ -1,333 +0,0 @@
-/*
- * Copyright 2016 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.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.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangLeafList;
-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;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangUint64;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-
-/**
- * Test cases for length restriction listener.
- */
-public class LengthRestrictionListenerTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks valid length statement as sub-statement of leaf statement.
- */
- @Test
- public void processValidLengthStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ValidLengthStatement.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
- YangStringRestriction stringRestriction = (YangStringRestriction) leafInfo
- .getDataType().getDataTypeExtendedInfo();
- YangRangeRestriction lengthRestriction = stringRestriction.getLengthRestriction();
-
- ListIterator<YangRangeInterval> lengthListIterator = lengthRestriction.getAscendingRangeIntervals()
- .listIterator();
-
- YangRangeInterval rangeInterval = lengthListIterator.next();
-
- assertThat(((YangUint64) rangeInterval.getStartValue()).getValue(), is(BigInteger.valueOf(0)));
- assertThat(((YangUint64) rangeInterval.getEndValue()).getValue(), is(BigInteger.valueOf(100)));
- }
-
- /**
- * Checks valid length statement as sub-statement of leaf-list.
- */
- @Test
- public void processLengthStatementInsideLeafList() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/LengthStatementInsideLeafList.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList leafListInfo = leafListIterator.next();
-
- assertThat(leafListInfo.getName(), is("invalid-interval"));
- assertThat(leafListInfo.getDataType().getDataTypeName(), is("string"));
- assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
- YangStringRestriction stringRestriction = (YangStringRestriction) leafListInfo
- .getDataType().getDataTypeExtendedInfo();
- YangRangeRestriction lengthRestriction = stringRestriction.getLengthRestriction();
-
- ListIterator<YangRangeInterval> lengthListIterator = lengthRestriction.getAscendingRangeIntervals()
- .listIterator();
-
- YangRangeInterval rangeInterval = lengthListIterator.next();
- assertThat(((YangUint64) rangeInterval.getStartValue()).getValue(), is(BigInteger.valueOf(1)));
- assertThat(((YangUint64) rangeInterval.getEndValue()).getValue(), is(BigInteger.valueOf(100)));
- }
-
- /**
- * Checks valid length statement as sub-statement of typedef.
- */
- @Test
- public void processLengthStatementInsideTypeDef() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/LengthStatementInsideTypeDef.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- YangTypeDef typedef = (YangTypeDef) yangNode.getChild();
- YangStringRestriction stringRestriction = (YangStringRestriction) typedef.getTypeDefBaseType()
- .getDataTypeExtendedInfo();
-
- YangRangeRestriction lengthRestriction = stringRestriction.getLengthRestriction();
- ListIterator<YangRangeInterval> lengthListIterator = lengthRestriction.getAscendingRangeIntervals()
- .listIterator();
- YangRangeInterval rangeInterval = lengthListIterator.next();
- assertThat(((YangUint64) rangeInterval.getStartValue()).getValue(), is(BigInteger.valueOf(1)));
- assertThat(((YangUint64) rangeInterval.getEndValue()).getValue(), is(BigInteger.valueOf(100)));
- }
-
- /**
- * Checks valid length statement as sub-statement of binary statement.
- */
- @Test
- public void processValidBinaryLengthStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ValidBinaryLengthStatement.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("message"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("binary"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.BINARY));
- YangRangeRestriction lengthRestriction = (YangRangeRestriction) leafInfo
- .getDataType().getDataTypeExtendedInfo();
-
- ListIterator<YangRangeInterval> lengthListIterator = lengthRestriction.getAscendingRangeIntervals()
- .listIterator();
-
- YangRangeInterval rangeInterval = lengthListIterator.next();
-
- assertThat(((YangUint64) rangeInterval.getStartValue()).getValue(), is(BigInteger.valueOf(4)));
- assertThat(((YangUint64) rangeInterval.getEndValue()).getValue(), is(BigInteger.valueOf(4)));
- }
-
- /**
- * Checks length statement with invalid type.
- */
- @Test
- public void processLengthWithInvalidType() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("YANG file error : length name \"1..100\" can be used to restrict the built-in type" +
- " string/binary or types derived from string/binary.");
- YangNode node = manager.getDataModel("src/test/resources/LengthWithInvalidType.yang");
- }
-
- /**
- * Checks length statement with only start interval.
- */
- @Test
- public void processLengthWithOneInterval() throws IOException, ParserException {
-
-
- YangNode node = manager.getDataModel("src/test/resources/LengthWithOneInterval.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList leafListInfo = leafListIterator.next();
-
- assertThat(leafListInfo.getName(), is("invalid-interval"));
- assertThat(leafListInfo.getDataType().getDataTypeName(), is("string"));
- assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
- YangStringRestriction stringRestriction = (YangStringRestriction) leafListInfo
- .getDataType().getDataTypeExtendedInfo();
- YangRangeRestriction lengthRestriction = stringRestriction.getLengthRestriction();
-
- ListIterator<YangRangeInterval> lengthListIterator = lengthRestriction.getAscendingRangeIntervals()
- .listIterator();
-
- YangRangeInterval rangeInterval = lengthListIterator.next();
- assertThat(((YangUint64) rangeInterval.getStartValue()).getValue(), is(BigInteger.valueOf(1)));
- assertThat(((YangUint64) rangeInterval.getEndValue()).getValue(), is(BigInteger.valueOf(1)));
- }
-
- /**
- * Checks length statement with min and max.
- */
- @Test
- public void processLengthWithMinMax() throws IOException, ParserException {
-
-
- YangNode node = manager.getDataModel("src/test/resources/LengthWithMinMax.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList leafListInfo = leafListIterator.next();
-
- assertThat(leafListInfo.getName(), is("invalid-interval"));
- assertThat(leafListInfo.getDataType().getDataTypeName(), is("string"));
- assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
- YangStringRestriction stringRestriction = (YangStringRestriction) leafListInfo
- .getDataType().getDataTypeExtendedInfo();
- YangRangeRestriction lengthRestriction = stringRestriction.getLengthRestriction();
-
- ListIterator<YangRangeInterval> lengthListIterator = lengthRestriction.getAscendingRangeIntervals()
- .listIterator();
-
- YangRangeInterval rangeInterval = lengthListIterator.next();
- assertThat(((YangUint64) rangeInterval.getStartValue()).getValue(), is(BigInteger.valueOf(0)));
- assertThat(((YangUint64) rangeInterval.getEndValue()).getValue(), is(new BigInteger("18446744073709551615")));
- }
-
- /**
- * Checks length statement with invalid integer pattern.
- */
- @Test
- public void processLengthWithInvalidIntegerPattern() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("YANG file error : Input value \"a\" is not a valid uint64.");
- YangNode node = manager.getDataModel("src/test/resources/LengthWithInvalidIntegerPattern.yang");
- }
-
- /**
- * Checks length statement with invalid interval.
- */
- @Test
- public void processLengthWithInvalidInterval() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("YANG file error : 18446744073709551617 is greater than maximum value" +
- " 18446744073709551615.");
- YangNode node = manager.getDataModel("src/test/resources/LengthWithInvalidInterval.yang");
- }
-
- /**
- * Checks valid length substatements.
- */
- @Test
- public void processLengthSubStatements() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/LengthSubStatements.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
- YangStringRestriction stringRestriction = (YangStringRestriction) leafInfo
- .getDataType().getDataTypeExtendedInfo();
- YangRangeRestriction lengthRestriction = stringRestriction.getLengthRestriction();
-
- assertThat(lengthRestriction.getDescription(), is("\"length description\""));
- assertThat(lengthRestriction.getReference(), is("\"length reference\""));
-
- ListIterator<YangRangeInterval> lengthListIterator = lengthRestriction.getAscendingRangeIntervals()
- .listIterator();
-
- YangRangeInterval rangeInterval = lengthListIterator.next();
-
- assertThat(((YangUint64) rangeInterval.getStartValue()).getValue(), is(BigInteger.valueOf(0)));
- assertThat(((YangUint64) rangeInterval.getEndValue()).getValue(), is(BigInteger.valueOf(100)));
- }
-
- /**
- * Checks whether space can be allowed when length statement is present.
- */
- @Test
- public void processLengthStatementWithSpace() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/LengthStatementWithSpace.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
- YangStringRestriction stringRestriction = (YangStringRestriction) leafInfo
- .getDataType().getDataTypeExtendedInfo();
- YangRangeRestriction lengthRestriction = stringRestriction.getLengthRestriction();
-
- ListIterator<YangRangeInterval> lengthListIterator = lengthRestriction.getAscendingRangeIntervals()
- .listIterator();
-
- YangRangeInterval rangeInterval = lengthListIterator.next();
-
- assertThat(((YangUint64) rangeInterval.getStartValue()).getValue(), is(BigInteger.valueOf(0)));
- assertThat(((YangUint64) rangeInterval.getEndValue()).getValue(), is(BigInteger.valueOf(100)));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ListListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ListListenerTest.java
deleted file mode 100644
index 7c0dae6..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ListListenerTest.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * 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.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.YangContainer;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangStatusType;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-
-/**
- * Test cases for testing list listener.
- */
-public class ListListenerTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks list statement as sub-statement of module.
- */
- @Test
- public void processModuleSubStatementList() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ModuleSubStatementList.yang");
-
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the list is child of module
- YangList yangList = (YangList) yangNode.getChild();
- assertThat(yangList.getName(), is("valid"));
-
- ListIterator<String> keyList = yangList.getKeyList().listIterator();
- assertThat(keyList.next(), is("invalid-interval"));
- }
-
- /**
- * Checks list statement as sub-statement of container.
- */
- @Test
- public void processContainerSubStatementList() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatementList.yang");
-
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the container is child of module
- YangContainer yangContainer = (YangContainer) yangNode.getChild();
- assertThat(yangContainer.getName(), is("ospf"));
-
- // Check whether the list is child of container
- YangList yangList = (YangList) yangContainer.getChild();
- assertThat(yangList.getName(), is("valid"));
- assertThat(yangList.getKeyList().contains("invalid-interval"), is(true));
- }
-
- /**
- * Checks list statement as sub-statement of list.
- */
- @Test
- public void processListSubStatementList() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ListSubStatementList.yang");
-
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the list is child of module
- YangList yangList1 = (YangList) yangNode.getChild();
- assertThat(yangList1.getName(), is("ospf"));
- assertThat(yangList1.getKeyList().contains("process-id"), is(true));
-
- // Check whether the list is child of list
- YangList yangList = (YangList) yangList1.getChild();
- assertThat(yangList.getName(), is("valid"));
- assertThat(yangList.getKeyList().contains("invalid-interval"), is(true));
- }
-
- /**
- * Checks list with all its sub-statements.
- */
- @Test
- public void processListSubStatements() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ListSubStatements.yang");
-
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the list is child of module
- YangList yangList = (YangList) yangNode.getChild();
-
- // Check whether list properties as set correctly.
- assertThat(yangList.getName(), is("ospf"));
- assertThat(yangList.getKeyList().contains("invalid-interval"), is(true));
-
- assertThat(yangList.isConfig(), is(true));
- assertThat(yangList.getMaxElements().getMaxElement(), is(10));
- assertThat(yangList.getMinElements().getMinElement(), is(3));
- assertThat(yangList.getDescription(), is("\"list description\""));
- assertThat(yangList.getStatus(), is(YangStatusType.CURRENT));
- assertThat(yangList.getReference(), is("\"list reference\""));
-
- // Check whether leaf properties as set correctly.
- ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
- assertThat(leafInfo.getUnits(), is("\"seconds\""));
- assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
- assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
- }
-
- /**
- * Checks cardinality of sub-statements of list.
- */
- @Test
- public void processListSubStatementsCardinality() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("YANG file error: \"reference\" is defined more than once in \"list valid\".");
- YangNode node = manager.getDataModel("src/test/resources/ListSubStatementsCardinality.yang");
- }
-
- /**
- * Checks list statement without child.
- */
- @Test
- public void processListStatementWithoutChild() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("YANG file error: Missing \"data-def-substatements\" in \"list valid\".");
- YangNode node = manager.getDataModel("src/test/resources/ListStatementWithoutChild.yang");
- }
-
- /**
- * Checks list as root node.
- */
- @Test
- public void processListAsRootNode() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("no viable alternative at input 'list'");
- YangNode node = manager.getDataModel("src/test/resources/ListAsRootNode.yang");
- }
-
- /**
- * Checks invalid identifier for list statement.
- */
- @Test
- public void processListInvalidIdentifier() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("YANG file error : list name 1valid is not valid.");
- YangNode node = manager.getDataModel("src/test/resources/ListInvalidIdentifier.yang");
- }
-
- /**
- * Checks list with identifier name as enum.
- */
- @Test
- public void processListWithIdentifierNameEnum() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ListWithIdentifierNameEnum.yang");
-
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the list is child of module
- YangList yangList = (YangList) yangNode.getChild();
- assertThat(yangList.getName(), is("enumList"));
- assertThat(yangList.getKeyList().contains("enum"), is(true));
- YangLeaf leaf = yangList.getListOfLeaf().iterator().next();
- assertThat(leaf.getName(), is("enum"));
- assertThat(leaf.getDataType().getDataType(), is(YangDataTypes.ENUMERATION));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MandatoryListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MandatoryListenerTest.java
deleted file mode 100644
index fef5599..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MandatoryListenerTest.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * 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.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.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-
-/**
- * Test case for mandatory listener.
- */
-public class MandatoryListenerTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks valid mandatory with value true statement.
- */
- @Test
- public void processMandatoryTrue() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/MandatoryTrue.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- // Check whether the mandatory value is set correctly.
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.isMandatory(), is(true));
- }
-
- /**
- * Checks valid mandatory with value false statement.
- */
- @Test
- public void processMandatoryFalse() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/MandatoryFalse.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- // Check whether the mandatory value is set correctly.
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.isMandatory(), is(false));
- }
-
- /**
- * Checks default value of mandatory statement.
- */
- @Test
- public void processMandatoryDefaultValue() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/MandatoryDefaultValue.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- // Check whether the mandatory value is set correctly.
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.isMandatory(), is(false));
- }
-
- /**
- * Checks invalid of mandatory statement and expects exception.
- */
- @Test
- public void processMandatoryEmptyStatement() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("no viable alternative at input ';'");
- YangNode node = manager.getDataModel("src/test/resources/MandatoryEmptyStatement.yang");
- }
-
- /**
- * Checks invalid mandatory statement(without statement end) and expects
- * exception.
- */
- @Test
- public void processMandatoryWithoutStatementEnd() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("missing ';' at '}'");
- YangNode node = manager.getDataModel("src/test/resources/MandatoryWithoutStatementEnd.yang");
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MaxElementsListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MaxElementsListenerTest.java
deleted file mode 100644
index ab47d2c..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MaxElementsListenerTest.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * 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.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.YangLeafList;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-
-/**
- * Test cases for testing max-elements listener.
- */
-public class MaxElementsListenerTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks max-elements as sub-statements of leaf-list.
- */
- @Test
- public void processLeafListSubStatementMaxElements() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/LeafListSubStatementMaxElements.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList leafListInfo = leafListIterator.next();
-
- assertThat(leafListInfo.getName(), is("invalid-interval"));
- assertThat(leafListInfo.getMaxElements().getMaxElement(), is(3));
- }
-
- /**
- * Checks max-elements as sub-statements of list.
- */
- @Test
- public void processListSubStatementMaxElements() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ListSubStatementMaxElements.yang");
-
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the list is child of module
- YangList yangList = (YangList) yangNode.getChild();
- assertThat(yangList.getName(), is("valid"));
- assertThat(yangList.getMaxElements().getMaxElement(), is(3));
- }
-
- /**
- * Checks whether exception is thrown when max-elements statement without
- * statement end is given as input.
- */
- @Test
- public void processMaxElementsWithoutStatementEnd() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("missing ';' at 'description'");
- YangNode node = manager.getDataModel("src/test/resources/MaxElementsWithoutStatementEnd.yang");
- }
-
- /**
- * Checks whether exception is thrown when max-elements cardinality is not
- * as per the grammar.
- */
- @Test
- public void processMaxElementsCardinality() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("YANG file error: \"max-elements\" is defined more than once in \"leaf-list " +
- "invalid-interval\".");
- YangNode node = manager.getDataModel("src/test/resources/MaxElementsCardinality.yang");
- }
-
- /**
- * Checks unbounded value of max-elements statement.
- */
- @Test
- public void processMaxElementsUnbounded() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/MaxElementsUnbounded.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList leafListInfo = leafListIterator.next();
-
- assertThat(leafListInfo.getName(), is("invalid-interval"));
- assertThat(leafListInfo.getMaxElements().getMaxElement(), is(2147483647));
- }
-
- /**
- * Checks default value of max-elements statement.
- */
- @Test
- public void processMaxElementsDefaultValue() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/MaxElementsDefaultValue.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList leafListInfo = leafListIterator.next();
-
- assertThat(leafListInfo.getName(), is("invalid-interval"));
- assertThat(leafListInfo.getMaxElements().getMaxElement(), is(2147483647));
- }
-
- /**
- * Checks whether exception is thrown when invalid min-elements value is
- * given as input.
- */
- @Test
- public void processMaxElementsMaxValue() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("YANG file error : max-elements value 77777777777777777777777 is not valid.");
- YangNode node = manager.getDataModel("src/test/resources/MaxElementsMaxValue.yang");
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MinElementsListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MinElementsListenerTest.java
deleted file mode 100644
index fcf6c39..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MinElementsListenerTest.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * 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.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.YangLeafList;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-
-/**
- * Test cases for testing min-elements listener.
- */
-public class MinElementsListenerTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks min-elements as sub-statements of leaf-list.
- */
- @Test
- public void processLeafListSubStatementMinElements() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/LeafListSubStatementMinElements.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList leafListInfo = leafListIterator.next();
-
- assertThat(leafListInfo.getName(), is("invalid-interval"));
- assertThat(leafListInfo.getMinElements().getMinElement(), is(3));
- }
-
- /**
- * Checks min-elements as sub-statements of list.
- */
- @Test
- public void processListSubStatementMinElements() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ListSubStatementMinElements.yang");
-
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the list is child of module
- YangList yangList = (YangList) yangNode.getChild();
- assertThat(yangList.getName(), is("valid"));
- assertThat(yangList.getMinElements().getMinElement(), is(3));
- }
-
- /**
- * Checks whether exception is thrown when invalid min-elements value is
- * given as input.
- */
- @Test
- public void processMinElementsInvalidValue() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("YANG file error : min-elements value asd is not valid.");
- YangNode node = manager.getDataModel("src/test/resources/MinElementsInvalidValue.yang");
- }
-
- /**
- * Checks whether exception is thrown when invalid min-elements value is
- * given as input.
- */
- @Test
- public void processMinElementsMaxValue() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("YANG file error : min-elements value 77777777777777777777777 is not valid.");
- YangNode node = manager.getDataModel("src/test/resources/MinElementsMaxValue.yang");
- }
-
- /**
- * Checks whether exception is thrown when min-elements statement without
- * statement end is given as input.
- */
- @Test
- public void processMinElementsWithoutStatementEnd() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("missing ';' at 'description'");
- YangNode node = manager.getDataModel("src/test/resources/MinElementsWithoutStatementEnd.yang");
- }
-
- /**
- * Checks whether exception is thrown when min-elements cardinality is not
- * as per the grammar.
- */
- @Test
- public void processMinElementsInvalidCardinality() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("YANG file error: \"min-elements\" is defined more than once in \"leaf-list " +
- "invalid-interval\".");
- YangNode node = manager.getDataModel("src/test/resources/MinElementsInvalidCardinality.yang");
- }
-
- /**
- * Checks min-element's default value.
- */
- @Test
- public void processMinElementsDefaultValue() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/MinElementsDefaultValue.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList leafListInfo = leafListIterator.next();
-
- assertThat(leafListInfo.getName(), is("invalid-interval"));
- assertThat(leafListInfo.getMinElements().getMinElement(), is(0));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ModuleListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ModuleListenerTest.java
deleted file mode 100644
index f77050a..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ModuleListenerTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import java.io.IOException;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-
-/**
- * Test cases for testing module listener functionality.
- */
-public class ModuleListenerTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- /**
- * Checks if module listener updates the data model root node.
- */
- @Test
- public void processModuleValidEntry() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ModuleValidEntry.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
- }
-
- /**
- * Checks if module name is set correctly.
- */
- @Test(expected = ParserException.class)
- public void processModuleInvalidEntryTest() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ModuleWithInvalidIdentifier.yang");
- }
-
- /**
- * Checks whether exception is thrown when module length is greater than 64 characters.
- */
- @Test
- public void processModuleInvalidIdentifierLength() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("YANG file error : module name Testttttttttttttttttttttttttttttttttttttttttttttttttttt" +
- "tttttttttt is greater than 64 characters.");
- YangNode node = manager.getDataModel("src/test/resources/ModuleInvalidIdentifierLength.yang");
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MustListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MustListenerTest.java
deleted file mode 100644
index 2649d4d..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MustListenerTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangMust;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.ListIterator;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-
-/**
- * Test cases for testing must listener functionality.
- */
-public class MustListenerTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks if must listener updates the data model.
- */
- @Test
- public void processContainerSubStatementMust() throws IOException, ParserException {
- YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatementMust.yang");
-
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- YangContainer yangContainer = (YangContainer) yangNode.getChild();
- assertThat(yangContainer.getName(), is("interface"));
-
- String expectedConstraint = "ifType != 'ethernet' or (ifType = 'ethernet' and ifMTU = 1500)";
- List<YangMust> mustConstraintList = yangContainer.getListOfMust();
- assertThat(mustConstraintList.iterator().next().getConstraint(), is(expectedConstraint));
- }
-
- /**
- * Checks if must listener updates the data model.
- */
- @Test
- public void processLeafSubStatementMust() throws IOException, ParserException {
- YangNode node = manager.getDataModel("src/test/resources/LeafSubStatementMust.yang");
-
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getListOfMust().iterator().next().getConstraint(), is("ifType != 'ethernet'"));
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/NamespaceListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/NamespaceListenerTest.java
deleted file mode 100644
index 0f35705..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/NamespaceListenerTest.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import java.io.IOException;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-
-/**
- * Test cases for testing namespace listener functionality.
- */
-public class NamespaceListenerTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks that value of namespace shouldn't have invalid spaces.
- */
- @Test(expected = ParserException.class)
- public void processNamespaceWithInvalidSpaces() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/NamespaceWithInvalidSpaces.yang");
- }
-
- /**
- * Checks if namespace with double quotes is allowed.
- */
- @Test()
- public void processNamespaceInDoubleQuotes() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/NamespaceInDoubleQuotes.yang");
-
- // Checks for the version value in data model tree.
- assertThat(((YangModule) node).getNameSpace().getUri(), is("\"urn:ietf:params:xml:ns:yang:ietf-ospf\""));
- }
-
- /**
- * Checks if namespace without double quotes is allowed.
- */
- @Test()
- public void processNamespaceWithoutQuotes() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/NamespaceWithoutQuotes.yang");
-
- // Checks for the version value in data model tree.
- assertThat(((YangModule) node).getNameSpace().getUri(), is("urn:ietf:params:xml:ns:yang:ietf-ospf"));
- }
-
- /**
- * Checks if namespace is present only once.
- */
- @Test(expected = ParserException.class)
- public void processNamespaceDualEntry() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/NamespaceDualEntry.yang");
- }
-
- /**
- * Checks if mandatory parameter namespace is present.
- */
- @Test(expected = ParserException.class)
- public void processNamespaceNoEntryTest() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/NamespaceNoEntryTest.yang");
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/NotificationListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/NotificationListenerTest.java
deleted file mode 100644
index 7da2468..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/NotificationListenerTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import java.io.IOException;
-import java.util.ListIterator;
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangNotification;
-import org.onosproject.yangutils.datamodel.YangStatusType;
-import org.onosproject.yangutils.datamodel.YangTypeDef;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-
-/**
- * Test cases for testing notification listener functionality.
- */
-public class NotificationListenerTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks valid notification statement.
- */
- @Test
- public void processValidNotificationStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ValidNotificationStatement.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("rock"));
-
- YangNotification yangNotification = (YangNotification) yangNode.getChild();
- assertThat(yangNotification.getName(), is("link-failure"));
- assertThat(yangNotification.getDescription(), is("\"A link failure has been detected\""));
- assertThat(yangNotification.getStatus(), is(YangStatusType.DEPRECATED));
- assertThat(yangNotification.getReference(), is("\"reference\""));
-
- YangTypeDef typeDef = (YangTypeDef) yangNotification.getChild();
- assertThat(typeDef.getName(), is("my-type"));
- assertThat(typeDef.getStatus(), is(YangStatusType.DEPRECATED));
-
- ListIterator<YangLeaf> leafIterator = yangNotification.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("if-name"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/OrganizationListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/OrganizationListenerTest.java
deleted file mode 100644
index e9098d3..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/OrganizationListenerTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import java.io.IOException;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-
-/**
- * Test cases for testing organization listener functionality.
- */
-public class OrganizationListenerTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks if organization listener updates the data model tree.
- */
- @Test
- public void processOrganizationValidEntry() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/OrganizationValidEntry.yang");
-
- // Checks for the version value in data model tree.
- assertThat(((YangModule) node).getOrganization(), is("\"IETF SPRING Working Group\""));
- }
-
- /**
- * Checks that organization must be present only once.
- */
- @Test(expected = ParserException.class)
- public void processOrganizationDualEntry() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/OrganizationDualEntry.yang");
- }
-
- /**
- * Checks if organization entry syntax is correct.
- */
- @Test(expected = ParserException.class)
- public void processOrganizationMissingValue() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/OrganizationMissingValue.yang");
- }
-
- /**
- * Checks if organization and namespace is present in correct order.
- */
- @Test(expected = ParserException.class)
- public void processOrganizationInvalidOrder() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/OrganizationInvalidOrder.yang");
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/OutputListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/OutputListenerTest.java
deleted file mode 100644
index e31f4c4..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/OutputListenerTest.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import java.io.IOException;
-import java.util.ListIterator;
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangOutput;
-import org.onosproject.yangutils.datamodel.YangRpc;
-import org.onosproject.yangutils.datamodel.YangStatusType;
-import org.onosproject.yangutils.datamodel.YangTypeDef;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-
-/**
- * Test cases for testing output listener functionality.
- */
-public class OutputListenerTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks output statements with data definition statements as sub-statements.
- */
- @Test
- public void processOutputStatementWithDataDefinition() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/OutputStatementWithDataDefinition.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("rock"));
-
- YangRpc yangRpc = (YangRpc) yangNode.getChild();
- assertThat(yangRpc.getName(), is("activate-software-image"));
-
- YangOutput yangOutput = (YangOutput) yangRpc.getChild();
- assertThat(yangOutput.getName(), is("activate-software-image_output"));
- ListIterator<YangLeaf> leafIterator = yangOutput.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("image-name"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
-
- YangList yangList = (YangList) yangOutput.getChild();
- assertThat(yangList.getName(), is("ospf"));
- assertThat(yangList.getKeyList().contains("invalid-interval"), is(true));
- assertThat(yangList.isConfig(), is(true));
- assertThat(yangList.getMaxElements().getMaxElement(), is(10));
- assertThat(yangList.getMinElements().getMinElement(), is(3));
- leafIterator = yangList.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
-
- YangContainer yangContainer = (YangContainer) yangList.getNextSibling();
- assertThat(yangContainer.getName(), is("isis"));
-
- leafIterator = yangContainer.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
- }
-
- /**
- * Checks output statements with type-def statement as sub-statements.
- */
- @Test
- public void processOutputStatementWithTypedef() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/OutputStatementWithTypedef.yang");
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("rock"));
-
- YangRpc yangRpc = (YangRpc) yangNode.getChild();
- assertThat(yangRpc.getName(), is("activate-software-image"));
-
- YangOutput yangOutput = (YangOutput) yangRpc.getChild();
- assertThat(yangOutput.getName(), is("activate-software-image_output"));
- YangTypeDef typeDef = (YangTypeDef) yangOutput.getChild();
- assertThat(typeDef.getName(), is("my-type"));
- assertThat(typeDef.getStatus(), is(YangStatusType.DEPRECATED));
- assertThat(typeDef.getName(), is("my-type"));
- assertThat(typeDef.getStatus(), is(YangStatusType.DEPRECATED));
- assertThat(typeDef.getTypeDefBaseType().getDataType(), is(YangDataTypes.INT32));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/PatternRestrictionListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/PatternRestrictionListenerTest.java
deleted file mode 100644
index c861efa..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/PatternRestrictionListenerTest.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Copyright 2016 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.parser.impl.listeners;
-
-import java.io.IOException;
-import java.util.ListIterator;
-
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangLeafList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangPatternRestriction;
-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;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-
-/**
- * Test cases for pattern restriction listener.
- */
-public class PatternRestrictionListenerTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks valid pattern statement as sub-statement of leaf statement.
- */
- @Test
- public void processValidPatternStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ValidPatternStatement.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
- YangStringRestriction stringRestriction = (YangStringRestriction) leafInfo
- .getDataType().getDataTypeExtendedInfo();
- ListIterator<String> patternListIterator = stringRestriction.getPatternRestriction()
- .getPatternList().listIterator();
- assertThat(patternListIterator.next(), is("[a-zA-Z]"));
- }
-
- /**
- * Checks valid pattern statement as sub-statement of leaf-list.
- */
- @Test
- public void processPatternStatementInsideLeafList() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/PatternStatementInsideLeafList.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList leafListInfo = leafListIterator.next();
-
- assertThat(leafListInfo.getName(), is("invalid-interval"));
- assertThat(leafListInfo.getDataType().getDataTypeName(), is("string"));
- assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
- YangStringRestriction stringRestriction = (YangStringRestriction) leafListInfo
- .getDataType().getDataTypeExtendedInfo();
- ListIterator<String> patternListIterator = stringRestriction.getPatternRestriction()
- .getPatternList().listIterator();
- assertThat(patternListIterator.next(), is("[a-zA-Z]"));
- }
-
- /**
- * Checks valid pattern statement as sub-statement of typedef.
- */
- @Test
- public void processPatternStatementInsideTypeDef() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/PatternStatementInsideTypeDef.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- YangTypeDef typedef = (YangTypeDef) yangNode.getChild();
- YangStringRestriction stringRestriction = (YangStringRestriction) typedef.getTypeDefBaseType()
- .getDataTypeExtendedInfo();
-
- YangPatternRestriction yangPatternRestriction = stringRestriction.getPatternRestriction();
- assertThat(yangPatternRestriction.getPatternList().listIterator().next(), is("[a-zA-Z]"));
- }
-
- /**
- * Checks valid multiple pattern statements.
- */
- @Test
- public void processMultiplePatternStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/MultiplePatternStatement.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList leafListInfo = leafListIterator.next();
-
- assertThat(leafListInfo.getName(), is("invalid-interval"));
- assertThat(leafListInfo.getDataType().getDataTypeName(), is("string"));
- assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
- YangStringRestriction stringRestriction = (YangStringRestriction) leafListInfo
- .getDataType().getDataTypeExtendedInfo();
- ListIterator<String> patternListIterator = stringRestriction.getPatternRestriction()
- .getPatternList().listIterator();
- assertThat(patternListIterator.next(), is("[a-zA-Z]"));
- }
-
- /**
- * Checks valid pattern statement with plus symbol in pattern.
- */
- @Test
- public void processPatternStatementWithPlus() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/PatternStatementWithPlus.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList leafListInfo = leafListIterator.next();
-
- assertThat(leafListInfo.getName(), is("invalid-interval"));
- assertThat(leafListInfo.getDataType().getDataTypeName(), is("string"));
- assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
- YangStringRestriction stringRestriction = (YangStringRestriction) leafListInfo
- .getDataType().getDataTypeExtendedInfo();
- ListIterator<String> patternListIterator = stringRestriction.getPatternRestriction()
- .getPatternList().listIterator();
- assertThat(patternListIterator.next(), is("-[0-9]+|[0-9]+"));
- }
-
- /**
- * Checks valid pattern substatement.
- */
- @Test
- public void processPatternSubStatements() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/PatternSubStatements.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
- YangStringRestriction stringRestriction = (YangStringRestriction) leafInfo
- .getDataType().getDataTypeExtendedInfo();
- assertThat(stringRestriction.getDescription(), is("\"pattern description\""));
- assertThat(stringRestriction.getReference(), is("\"pattern reference\""));
- ListIterator<String> patternListIterator = stringRestriction.getPatternRestriction()
- .getPatternList().listIterator();
- assertThat(patternListIterator.next(), is("[a-zA-Z]"));
- }
-
- /**
- * Checks invalid pattern sub-statement.
- */
- @Test(expected = ParserException.class)
- public void processInvalidPatternSubStatements() throws IOException, ParserException {
- YangNode node = manager.getDataModel("src/test/resources/InvalidPatternSubStatements.yang");
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/PositionListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/PositionListenerTest.java
deleted file mode 100644
index 7b59894..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/PositionListenerTest.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangBit;
-import org.onosproject.yangutils.datamodel.YangBits;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import java.io.IOException;
-import java.util.ListIterator;
-import java.util.Map;
-
-/**
- * Test cases for position listener.
- */
-public class PositionListenerTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks explicitly configured value.
- */
- @Test
- public void processPositionStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/PositionStatement.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("mybits"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("bits"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.BITS));
- assertThat(((YangBits) leafInfo.getDataType().getDataTypeExtendedInfo()).getBitsName(),
- is("mybits"));
-
- // Check bit name map
- Map<String, YangBit> bitNameMap = ((YangBits) leafInfo.getDataType().getDataTypeExtendedInfo()).getBitNameMap();
- assertThat(bitNameMap.size(), is(3));
- for (Map.Entry<String, YangBit> element : bitNameMap.entrySet()) {
- String bitName = element.getKey();
- YangBit yangBit = element.getValue();
- if (bitName.equals("disable-nagle")) {
- assertThat(yangBit.getPosition(), is(0));
- } else if (bitName.equals("auto-sense-speed")) {
- assertThat(yangBit.getPosition(), is(1));
- } else if (bitName.equals("Ten-Mb-only")) {
- assertThat(yangBit.getPosition(), is(2));
- } else {
- throw new IOException("Invalid bit name: " + bitName);
- }
- }
-
- // Check bit position map
- Map<Integer, YangBit> bitPositionMap = ((YangBits) leafInfo.getDataType().getDataTypeExtendedInfo())
- .getBitPositionMap();
- assertThat(bitPositionMap.size(), is(3));
- for (Map.Entry<Integer, YangBit> element : bitPositionMap.entrySet()) {
- int position = element.getKey();
- YangBit yangBit = element.getValue();
- if (position == 0) {
- assertThat(yangBit.getBitName(), is("disable-nagle"));
- } else if (position == 1) {
- assertThat(yangBit.getBitName(), is("auto-sense-speed"));
- } else if (position == 2) {
- assertThat(yangBit.getBitName(), is("Ten-Mb-only"));
- } else {
- throw new IOException("Invalid bit position: " + position);
- }
- }
- }
-
- /**
- * Checks position value with double quotes.
- */
- @Test
- public void processPositionWithDoubleQuotes() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/PositionWithDoubleQuotes.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("mybits"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("bits"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.BITS));
- assertThat(((YangBits) leafInfo.getDataType().getDataTypeExtendedInfo()).getBitsName(),
- is("mybits"));
-
- // Check bit name map
- Map<String, YangBit> bitNameMap = ((YangBits) leafInfo.getDataType().getDataTypeExtendedInfo()).getBitNameMap();
- assertThat(bitNameMap.size(), is(3));
- for (Map.Entry<String, YangBit> element : bitNameMap.entrySet()) {
- String bitName = element.getKey();
- YangBit yangBit = element.getValue();
- if (bitName.equals("disable-nagle")) {
- assertThat(yangBit.getPosition(), is(0));
- } else if (bitName.equals("auto-sense-speed")) {
- assertThat(yangBit.getPosition(), is(1));
- } else if (bitName.equals("Ten-Mb-only")) {
- assertThat(yangBit.getPosition(), is(2));
- } else {
- throw new IOException("Invalid bit name: " + bitName);
- }
- }
-
- // Check bit position map
- Map<Integer, YangBit> bitPositionMap = ((YangBits) leafInfo.getDataType().getDataTypeExtendedInfo())
- .getBitPositionMap();
- assertThat(bitPositionMap.size(), is(3));
- for (Map.Entry<Integer, YangBit> element : bitPositionMap.entrySet()) {
- int position = element.getKey();
- YangBit yangBit = element.getValue();
- if (position == 0) {
- assertThat(yangBit.getBitName(), is("disable-nagle"));
- } else if (position == 1) {
- assertThat(yangBit.getBitName(), is("auto-sense-speed"));
- } else if (position == 2) {
- assertThat(yangBit.getBitName(), is("Ten-Mb-only"));
- } else {
- throw new IOException("Invalid bit position: " + position);
- }
- }
- }
-
- /**
- * Checks explicit value and auto generated value.
- */
- @Test
- public void processPositionImplicitAndExplicit() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/PositionImplicitAndExplicit.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("mybits"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("bits"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.BITS));
- assertThat(((YangBits) leafInfo.getDataType().getDataTypeExtendedInfo()).getBitsName(),
- is("mybits"));
-
- // Check bit name map
- Map<String, YangBit> bitNameMap = ((YangBits) leafInfo.getDataType().getDataTypeExtendedInfo()).getBitNameMap();
- assertThat(bitNameMap.size(), is(3));
- for (Map.Entry<String, YangBit> element : bitNameMap.entrySet()) {
- String bitName = element.getKey();
- YangBit yangBit = element.getValue();
- if (bitName.equals("disable-nagle")) {
- assertThat(yangBit.getPosition(), is(0));
- } else if (bitName.equals("auto-sense-speed")) {
- assertThat(yangBit.getPosition(), is(1));
- } else if (bitName.equals("Ten-Mb-only")) {
- assertThat(yangBit.getPosition(), is(2));
- } else {
- throw new IOException("Invalid bit name: " + bitName);
- }
- }
-
- // Check bit position map
- Map<Integer, YangBit> bitPositionMap = ((YangBits) leafInfo.getDataType().getDataTypeExtendedInfo())
- .getBitPositionMap();
- assertThat(bitPositionMap.size(), is(3));
- for (Map.Entry<Integer, YangBit> element : bitPositionMap.entrySet()) {
- int position = element.getKey();
- YangBit yangBit = element.getValue();
- if (position == 0) {
- assertThat(yangBit.getBitName(), is("disable-nagle"));
- } else if (position == 1) {
- assertThat(yangBit.getBitName(), is("auto-sense-speed"));
- } else if (position == 2) {
- assertThat(yangBit.getBitName(), is("Ten-Mb-only"));
- } else {
- throw new IOException("Invalid bit position: " + position);
- }
- }
- }
-
- /**
- * Checks explicit value should not be repeated.
- */
- @Test(expected = ParserException.class)
- public void processPositionDuplication() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/PositionDuplication.yang");
- }
-
- /**
- * Checks explicit or auto generated value should not be repeated.
- */
- @Test(expected = ParserException.class)
- public void processPositionImplicitAndExplicitDuplication() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/PositionImplicitAndExplicitDuplication.yang");
- }
-
- /**
- * Checks if negative value of position is not allowed.
- */
- @Test(expected = ParserException.class)
- public void processPositionNegativeValue() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/PositionNegativeValue.yang");
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/PrefixListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/PrefixListenerTest.java
deleted file mode 100644
index ef89a78..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/PrefixListenerTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import java.io.IOException;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-
-/**
- * Test cases for testing prefix listener functionality.
- */
-public class PrefixListenerTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks if value of prefix is correct.
- */
- @Test(expected = ParserException.class)
- public void processPrefixInvalidValue() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/PrefixInvalidValue.yang");
- }
-
- /**
- * Checks if prefix listener updates the data model tree.
- */
- @Test
- public void processPrefixValidEntry() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/PrefixValidEntry.yang");
-
- // Checks for the version value in data model tree.
- assertThat(((YangModule) node).getPrefix(), is("On"));
- }
-
- /**
- * Checks prefix value with double quotes.
- */
- @Test
- public void processPrefixWithDoubleQuotes() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/PrefixWithDoubleQuotes.yang");
- assertThat(((YangModule) node).getPrefix(), is("On"));
- }
-
- /**
- * Checks that prefix should be present just once.
- */
- @Test(expected = ParserException.class)
- public void processPrefixDualEntry() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/PrefixDualEntry.yang");
- }
-
- /**
- * Checks if prefix syntax is followed.
- */
- @Test(expected = ParserException.class)
- public void processPrefixMissingValue() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/PrefixMissingValue.yang");
- }
-
- /**
- * Checks that exception should be reported if prefix is missing.
- */
- @Test(expected = ParserException.class)
- public void processPrefixOrder() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/PrefixOrder.yang");
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/PresenceListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/PresenceListenerTest.java
deleted file mode 100644
index 2d0e376..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/PresenceListenerTest.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.junit.rules.ExpectedException;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import java.io.IOException;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.nullValue;
-
-/**
- * Test cases for presence listener.
- */
-public class PresenceListenerTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks presence statement as sub-statement of container.
- */
- @Test
- public void processContainerSubStatementPresence() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatementPresence.yang");
-
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the list is child of module
- YangContainer yangContainer = (YangContainer) yangNode.getChild();
- assertThat(yangContainer.getName(), is("valid"));
- assertThat(yangContainer.getPresence(), is("\"invalid\""));
- }
-
- /**
- * checks default value of presence statement.
- */
- @Test
- public void processPresenceDefaultValue() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/PresenceDefaultValue.yang");
-
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the list is child of module
- YangContainer yangContainer = (YangContainer) yangNode.getChild();
- assertThat(yangContainer.getName(), is("valid"));
- assertThat(yangContainer.getPresence(), is(nullValue()));
- }
-
- /**
- * Checks presence statement without statement end.
- */
- @Test
- public void processPresenceWithoutStatementEnd() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("mismatched input 'leaf' expecting {';', '+'}");
- YangNode node = manager.getDataModel("src/test/resources/PresenceWithoutStatementEnd.yang");
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/RangeRestrictionListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/RangeRestrictionListenerTest.java
deleted file mode 100644
index 0725d49..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/RangeRestrictionListenerTest.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * 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.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.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangLeafList;
-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.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangInt32;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-
-/**
- * Test cases for range restriction listener.
- */
-public class RangeRestrictionListenerTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks valid range statement as sub-statement of leaf statement.
- */
- @Test
- public void processValidRangeStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ValidRangeStatement.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("int32"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.INT32));
- YangRangeRestriction rangeRestriction = (YangRangeRestriction) leafInfo
- .getDataType().getDataTypeExtendedInfo();
-
- ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
- .listIterator();
- YangRangeInterval rangeInterval = rangeListIterator.next();
- assertThat(((YangInt32) rangeInterval.getStartValue()).getValue(), is(1));
- assertThat(((YangInt32) rangeInterval.getEndValue()).getValue(), is(4));
- }
-
- /**
- * Checks valid range statement as sub-statement of leaf-list.
- */
- @Test
- public void processRangeStatementInsideLeafList() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/RangeStatementInsideLeafList.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList leafListInfo = leafListIterator.next();
-
- assertThat(leafListInfo.getName(), is("invalid-interval"));
- assertThat(leafListInfo.getDataType().getDataTypeName(), is("int32"));
- assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.INT32));
- YangRangeRestriction rangeRestriction = (YangRangeRestriction) leafListInfo
- .getDataType().getDataTypeExtendedInfo();
-
- ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
- .listIterator();
- YangRangeInterval rangeInterval = rangeListIterator.next();
-
- assertThat(((YangInt32) rangeInterval.getStartValue()).getValue(), is(1));
- assertThat(((YangInt32) rangeInterval.getEndValue()).getValue(), is(4));
- }
-
- /**
- * Checks valid range statement with one interval.
- */
- @Test
- public void processRangeWithOneInterval() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/RangeWithOneInterval.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList leafListInfo = leafListIterator.next();
-
- assertThat(leafListInfo.getName(), is("invalid-interval"));
- assertThat(leafListInfo.getDataType().getDataTypeName(), is("int32"));
- assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.INT32));
- YangRangeRestriction rangeRestriction = (YangRangeRestriction) leafListInfo
- .getDataType().getDataTypeExtendedInfo();
-
- ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
- .listIterator();
- YangRangeInterval rangeInterval = rangeListIterator.next();
-
- assertThat(((YangInt32) rangeInterval.getStartValue()).getValue(), is(1));
- assertThat(((YangInt32) rangeInterval.getEndValue()).getValue(), is(1));
- }
-
- /**
- * Checks valid range statement with min and max.
- */
- @Test
- public void processRangeWithMinMax() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/RangeWithMinMax.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList leafListInfo = leafListIterator.next();
-
- assertThat(leafListInfo.getName(), is("invalid-interval"));
- assertThat(leafListInfo.getDataType().getDataTypeName(), is("int32"));
- assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.INT32));
- YangRangeRestriction rangeRestriction = (YangRangeRestriction) leafListInfo
- .getDataType().getDataTypeExtendedInfo();
-
- ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
- .listIterator();
- YangRangeInterval rangeInterval = rangeListIterator.next();
-
- assertThat(((YangInt32) rangeInterval.getStartValue()).getValue(), is(-2147483648));
- assertThat(((YangInt32) rangeInterval.getEndValue()).getValue(), is(2147483647));
- }
-
- /**
- * Checks valid range statement with invalid integer pattern.
- */
- @Test
- public void processRangeWithInvalidIntegerPattern() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("YANG file error : Input value \"a\" is not a valid int32.");
- YangNode node = manager.getDataModel("src/test/resources/RangeWithInvalidIntegerPattern.yang");
- }
-
- /**
- * Checks valid range statement with description.
- */
- @Test
- public void processRangeSubStatements() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/RangeSubStatements.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("int32"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.INT32));
- YangRangeRestriction rangeRestriction = (YangRangeRestriction) leafInfo
- .getDataType().getDataTypeExtendedInfo();
-
- assertThat(rangeRestriction.getDescription(), is("\"range description\""));
- assertThat(rangeRestriction.getReference(), is("\"range reference\""));
-
- ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
- .listIterator();
- YangRangeInterval rangeInterval = rangeListIterator.next();
- assertThat(((YangInt32) rangeInterval.getStartValue()).getValue(), is(1));
- assertThat(((YangInt32) rangeInterval.getEndValue()).getValue(), is(4));
- assertThat(((YangInt32) rangeInterval.getEndValue()).getValue(), is(4));
- }
-
- /**
- * Checks whether space can be allowed when range statement is present.
- */
- @Test
- public void processRangeStatementWithSpace() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/RangeStatementWithSpace.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("int32"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.INT32));
- YangRangeRestriction rangeRestriction = (YangRangeRestriction) leafInfo
- .getDataType().getDataTypeExtendedInfo();
-
- ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
- .listIterator();
- YangRangeInterval rangeInterval = rangeListIterator.next();
- assertThat(((YangInt32) rangeInterval.getStartValue()).getValue(), is(1));
- assertThat(((YangInt32) rangeInterval.getEndValue()).getValue(), is(4));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ReferenceListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ReferenceListenerTest.java
deleted file mode 100644
index 8a8d02a..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ReferenceListenerTest.java
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * 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.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.YangContainer;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangLeafList;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangStatusType;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-
-/**
- * Test case for reference listener.
- */
-public class ReferenceListenerTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks valid reference statement.
- */
- @Test
- public void processReferenceStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ReferenceStatement.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- // Check whether the reference is set correctly.
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
- }
-
- /**
- * Checks whether exception is thrown for invalid reference statement.
- */
- @Test
- public void processReferenceWithoutStatementEnd() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("mismatched input '}' expecting {';', '+'}");
- YangNode node = manager.getDataModel("src/test/resources/ReferenceWithoutStatementEnd.yang");
- }
-
- /**
- * Checks valid reference statement under module.
- */
- @Test
- public void processModuleSubStatementReference() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ModuleSubStatementReference.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the reference is set correctly.
- assertThat(yangNode.getReference(), is("\"RFC 6020\""));
- }
-
- /**
- * Checks valid reference statement under module.
- */
- @Test
- public void processReferenceEmptyStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ReferenceEmptyStatement.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the reference is set correctly.
- assertThat(yangNode.getReference(), is("\"\""));
- }
-
- /**
- * Checks valid reference statement as sub-statement of revision.
- */
- @Test
- public void processRevisionSubStatementReference() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/RevisionSubStatementReference.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the reference is set correctly.
- assertThat(yangNode.getRevision().getReference(), is("\"revision reference\""));
- }
-
- /**
- * Checks reference statement as sub-statement of container.
- */
- @Test
- public void processContainerSubStatementReference() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatementReference.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the reference value is set correctly.
- YangContainer container = (YangContainer) yangNode.getChild();
- assertThat(container.getName(), is("valid"));
- assertThat(container.getReference(), is("\"container reference\""));
-
- // Check whether leaf properties as set correctly.
- ListIterator<YangLeaf> leafIterator = container.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
- assertThat(leafInfo.getUnits(), is("\"seconds\""));
- assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
- assertThat(leafInfo.isMandatory(), is(true));
- assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
- assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
- }
-
- /**
- * Checks reference statement as sub-statement of list.
- */
- @Test
- public void processListSubStatementReference() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ListSubStatementReference.yang");
-
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the list is child of module and description value is set correctly.
- YangList yangList = (YangList) yangNode.getChild();
- assertThat(yangList.getName(), is("valid"));
- assertThat(yangList.isConfig(), is(true));
- assertThat(yangList.getReference(), is("\"list reference\""));
-
- // Check whether leaf properties as set correctly.
- ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
- assertThat(leafInfo.getUnits(), is("\"seconds\""));
- assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
- assertThat(leafInfo.isMandatory(), is(true));
- assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
- assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
- }
-
- /**
- * Checks valid reference statement as sub-statement of leaf-list.
- */
- @Test
- public void processLeafListSubStatementReference() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/LeafListSubStatementReference.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList leafListInfo = leafListIterator.next();
-
- // Check whether description value is set correctly.
- assertThat(leafListInfo.getName(), is("invalid-interval"));
- assertThat(leafListInfo.getReference(), is("\"RFC 6020\""));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/RequireInstanceListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/RequireInstanceListenerTest.java
deleted file mode 100644
index 70bb875..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/RequireInstanceListenerTest.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * 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.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.YangContainer;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangLeafRef;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-/**
- * Test cases for require-instance listener.
- */
-public class RequireInstanceListenerTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks require-statement with true as status.
- */
- @Test
- public void processRequireInstanceTrue() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/RequireInstanceTrue.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("PathListener"));
-
- YangContainer container = (YangContainer) yangNode.getChild().getNextSibling();
- ListIterator<YangLeaf> leafIterator = container.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- // Check whether the require-instance value is set correctly in leafref.
- assertThat(leafInfo.getName(), is("ifname"));
- YangLeafRef yangLeafRef = (YangLeafRef) leafInfo.getDataType().getDataTypeExtendedInfo();
- assertThat(yangLeafRef.getRequireInstance(), is(true));
- }
-
- /**
- * Checks require-statement with false as status.
- */
- @Test
- public void processRequireInstanceFalse() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/RequireInstanceFalse.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("PathListener"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- // Check whether the require-instance value is set correctly in instance-identifier.
- assertThat(leafInfo.getName(), is("admin-status"));
-
- YangType type = leafInfo.getDataType();
-
- assertThat(type.getDataType(), is(YangDataTypes.INSTANCE_IDENTIFIER));
- boolean status = ((YangType<Boolean>) type).getDataTypeExtendedInfo();
-
- assertThat(status, is(false));
- }
-
- /**
- * Checks require-statement default value when its not there in YANG under instance-identifier.
- */
- @Test
- public void processRequireInstanceDefaultValueInInstanceIdentifier() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/RequireInstanceDefaultValueInInstanceIdentifier.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("PathListener"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- // Check whether the require-instance value is set correctly in instance-identifier.
- assertThat(leafInfo.getName(), is("admin-status"));
-
- YangType type = leafInfo.getDataType();
-
- assertThat(type.getDataType(), is(YangDataTypes.INSTANCE_IDENTIFIER));
-
- boolean status = ((YangType<Boolean>) type).getDataTypeExtendedInfo();
- assertThat(status, is(true));
- }
-
- /**
- * Checks require-statement default value when its not there in YANG under leafref.
- */
- @Test
- public void processRequireInstanceDefaultValueForLeafref() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/RequireInstanceDefaultValueForLeafref.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("PathListener"));
-
- YangContainer container = (YangContainer) yangNode.getChild().getNextSibling();
- ListIterator<YangLeaf> leafIterator = container.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- // Check whether the require-instance value is set correctly in leafref.
- assertThat(leafInfo.getName(), is("ifname"));
- YangLeafRef yangLeafRef = (YangLeafRef) leafInfo.getDataType().getDataTypeExtendedInfo();
- assertThat(yangLeafRef.getRequireInstance(), is(true));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/RevisionDateListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/RevisionDateListenerTest.java
deleted file mode 100644
index 8a00480..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/RevisionDateListenerTest.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import java.io.IOException;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-
-/**
- * Test cases for testing revision date listener functionality.
- */
-public class RevisionDateListenerTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
- private static final String DATE_FORMAT = "yyyy-MM-dd";
- private final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATE_FORMAT);
-
- /**
- * Checks if revision date syntax is correct in include.
- */
- @Test(expected = ParserException.class)
- public void processRevisionDateInvalidSyntaxAtInclude() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/RevisionDateInvalidSyntaxAtInclude.yang");
- }
-
- /**
- * Checks if revision date syntax is correct in import.
- */
- @Test(expected = ParserException.class)
- public void processRevisionDateInvalidSyntaxAtImport() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/RevisionDateInvalidSyntaxAtImport.yang");
- }
-
- /**
- * Checks revision date in quotes inside include.
- */
- @Test
- public void processRevisionDateInQuotesAtInclude() throws IOException, ParserException, ParseException {
-
- YangNode node = manager.getDataModel("src/test/resources/RevisionDateInQuotesAtInclude.yang");
- // Checks for the version value in data model tree.
- assertThat(((YangModule) node).getImportList().get(0).getRevision(), is(simpleDateFormat.parse("2015-02-03")));
- assertThat(((YangModule) node).getIncludeList().get(0).getRevision(), is(simpleDateFormat.parse("2016-02-03")));
- assertThat(((YangModule) node).getIncludeList().get(1).getRevision(), is(simpleDateFormat.parse("2014-02-03")));
- }
-
- /**
- * Checks revision date in quotes inside import.
- */
- @Test
- public void processRevisionDateInQuotesAtImport() throws IOException, ParserException, ParseException {
-
- YangNode node = manager.getDataModel("src/test/resources/RevisionDateInQuotesAtImport.yang");
- // Checks for the version value in data model tree.
- assertThat(((YangModule) node).getImportList().get(0).getRevision(), is(simpleDateFormat.parse("2015-02-03")));
- assertThat(((YangModule) node).getIncludeList().get(0).getRevision(), is(simpleDateFormat.parse("2016-02-03")));
- assertThat(((YangModule) node).getIncludeList().get(1).getRevision(), is(simpleDateFormat.parse("2014-02-03")));
- }
-
- /**
- * Checks if revision date follows YYYY-MM-DD format.
- */
- @Test(expected = ParserException.class)
- public void processRevisionDateInvalidFormat() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/RevisionDateInvalidFormat.yang");
- }
-
- /**
- * Checks if revision date is correct.
- */
- @Test(expected = ParserException.class)
- public void processRevisionDateInvalid() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/RevisionDateInvalid.yang");
- }
-
- /**
- * Checks if revision date listener updates the data model tree.
- */
- @Test
- public void processRevisionDateValidEntry() throws IOException, ParserException, ParseException {
-
- YangNode node = manager.getDataModel("src/test/resources/RevisionDateValidEntry.yang");
-
- // Checks for the version value in data model tree.
- assertThat(((YangModule) node).getImportList().get(0).getRevision(), is(simpleDateFormat.parse("2015-02-03")));
- assertThat(((YangModule) node).getIncludeList().get(0).getRevision(), is(simpleDateFormat.parse("2016-02-03")));
- assertThat(((YangModule) node).getIncludeList().get(1).getRevision(), is(simpleDateFormat.parse("2014-02-03")));
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/RevisionListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/RevisionListenerTest.java
deleted file mode 100644
index fbeacc8..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/RevisionListenerTest.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import java.io.IOException;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.notNullValue;
-import static org.junit.Assert.assertThat;
-
-/**
- * Test cases for testing revision listener functionality.
- */
-public class RevisionListenerTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
- private static final String DATE_FORMAT = "yyyy-MM-dd";
- private final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATE_FORMAT);
-
- /**
- * Checks if revision doesn't have optional parameters "revision and
- * description".
- */
- @Test
- public void processRevisionNoOptionalParameter() throws IOException, ParserException, ParseException {
-
- YangNode node = manager.getDataModel("src/test/resources/RevisionNoOptionalParameter.yang");
- // Checks for the version value in data model tree.
- assertThat(((YangModule) node).getRevision().getRevDate(), is(simpleDateFormat.parse("2016-02-03")));
- }
-
- /**
- * Checks if the syntax of revision is correct.
- */
- @Test(expected = ParserException.class)
- public void processRevisionInValidSyntax() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/RevisionInValidSyntax.yang");
- }
-
- /**
- * Checks if the correct order is followed.
- */
- @Test(expected = ParserException.class)
- public void processRevisionInValidOrder() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/RevisionInValidOrder.yang");
- }
-
- /**
- * Checks the revision with current date is created for empty revision statement.
- */
- @Test
- public void processWithoutRevision() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/RevisionAbsence.yang");
- assertThat(((YangModule) node).getRevision().getRevDate(), notNullValue());
- }
-
- /**
- * Checks latest date is stored when there are multiple revisions.
- */
- @Test
- public void processWithMultipleRevision() throws IOException, ParserException, ParseException {
-
- YangNode node = manager.getDataModel("src/test/resources/MultipleRevision.yang");
- assertThat(((YangModule) node).getRevision().getRevDate(), is(simpleDateFormat.parse("2013-07-15")));
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/RpcListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/RpcListenerTest.java
deleted file mode 100644
index 5e1f2cb..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/RpcListenerTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import java.io.IOException;
-
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangRpc;
-import org.onosproject.yangutils.datamodel.YangTypeDef;
-import org.onosproject.yangutils.datamodel.YangStatusType;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-
-/**
- * Test cases for testing Rpc listener functionality.
- */
-public class RpcListenerTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks valid rpc statements.
- */
- @Test
- public void processValidRpcStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ValidRpcStatement.yang");
-
- assertThat((node instanceof YangModule), is(true));
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("rock"));
-
- YangRpc yangRpc = (YangRpc) yangNode.getChild();
- assertThat(yangRpc.getName(), is("rock-the-house"));
- assertThat(yangRpc.getDescription(), is("\"description\""));
- assertThat(yangRpc.getReference(), is("\"reference\""));
- assertThat(yangRpc.getStatus(), is(YangStatusType.CURRENT));
-
- YangTypeDef typeDef = (YangTypeDef) yangRpc.getChild();
- assertThat(typeDef.getName(), is("my-type"));
- assertThat(typeDef.getStatus(), is(YangStatusType.DEPRECATED));
- assertThat(typeDef.getTypeDefBaseType().getDataType(), is(YangDataTypes.INT32));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ShortCaseListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ShortCaseListenerTest.java
deleted file mode 100644
index 132f7f4..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ShortCaseListenerTest.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangCase;
-import org.onosproject.yangutils.datamodel.YangChoice;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import java.io.IOException;
-
-/**
- * Test cases for short case listener.
- */
-public class ShortCaseListenerTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks short case listener with container.
- */
- @Test
- public void processShortCaseListenerWithContainer() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ShortCaseListenerWithContainer.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- YangContainer yangContainer = (YangContainer) yangNode.getChild();
- assertThat(yangContainer.getName(), is("food"));
-
- YangChoice yangChoice = (YangChoice) yangContainer.getChild();
- assertThat(yangChoice.getName(), is("snack"));
-
- YangCase yangCase = (YangCase) yangChoice.getChild();
- assertThat(yangCase.getName(), is("sports-arena"));
-
- YangContainer yangContainer1 = (YangContainer) yangCase.getChild();
- assertThat(yangContainer1.getName(), is("sports-arena"));
- }
-
- /**
- * Checks short case listener with list.
- */
- @Test
- public void processShortCaseListenerWithList() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ShortCaseListenerWithList.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- YangContainer yangContainer = (YangContainer) yangNode.getChild();
- assertThat(yangContainer.getName(), is("food"));
-
- YangChoice yangChoice = (YangChoice) yangContainer.getChild();
- assertThat(yangChoice.getName(), is("snack"));
-
- YangCase yangCase = (YangCase) yangChoice.getChild();
- assertThat(yangCase.getName(), is("sports-arena"));
-
- YangList yangList = (YangList) yangCase.getChild();
- assertThat(yangList.getName(), is("sports-arena"));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/StatusListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/StatusListenerTest.java
deleted file mode 100644
index 6d97bb8..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/StatusListenerTest.java
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * 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.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.YangContainer;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangLeafList;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangStatusType;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-
-/**
- * Test cases for status listener.
- */
-public class StatusListenerTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks valid status statement.
- */
- @Test
- public void processStatusStatementCurrent() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/StatusStatementCurrent.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- // Check whether the status is set correctly.
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
- }
-
- /**
- * Checks valid status statement.
- */
- @Test
- public void processStatusStatementDeprecated() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/StatusStatementDeprecated.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- // Check whether the status is set correctly.
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getStatus(), is(YangStatusType.DEPRECATED));
- }
-
- /**
- * Checks valid status statement.
- */
- @Test
- public void processStatusStatementObsolete() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/StatusStatementObsolete.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- // Check whether the status is set correctly.
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getStatus(), is(YangStatusType.OBSOLETE));
- }
-
- /**
- * Checks whether exception is thrown for invalid status statement.
- */
- @Test
- public void processStatusWithoutStatementEnd() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("missing ';' at '}'");
- YangNode node = manager.getDataModel("src/test/resources/StatusWithoutStatementEnd.yang");
- }
-
- /**
- * Checks whether exception is thrown for invalid status statement.
- */
- @Test
- public void processStatusInvalidValue() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("YANG file error : status invalid is not valid.");
- YangNode node = manager.getDataModel("src/test/resources/StatusInvalidValue.yang");
- }
-
- /**
- * Checks status statement as sub-statement of container.
- */
- @Test
- public void processContainerSubStatementStatus() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatementStatus.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether status is set correctly.
- YangContainer container = (YangContainer) yangNode.getChild();
- assertThat(container.getName(), is("valid"));
- assertThat(container.isConfig(), is(true));
- assertThat(container.getStatus(), is(YangStatusType.OBSOLETE));
-
- // Check whether leaf properties as set correctly.
- ListIterator<YangLeaf> leafIterator = container.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
- assertThat(leafInfo.getUnits(), is("\"seconds\""));
- assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
- assertThat(leafInfo.isMandatory(), is(true));
- assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
- assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
- }
-
- /**
- * Checks status statement as sub-statement of list.
- */
- @Test
- public void processListSubStatementStatus() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ListSubStatementStatus.yang");
-
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the list is child of module and status is set.
- YangList yangList = (YangList) yangNode.getChild();
- assertThat(yangList.getName(), is("valid"));
- assertThat(yangList.isConfig(), is(true));
- assertThat(yangList.getStatus(), is(YangStatusType.CURRENT));
-
- // Check whether leaf properties as set correctly.
- ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
- assertThat(leafInfo.getUnits(), is("\"seconds\""));
- assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
- assertThat(leafInfo.isMandatory(), is(true));
- assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
- assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
- }
-
- /**
- * Checks valid status statement as sub-statement of leaf-list.
- */
- @Test
- public void processLeafListSubStatementStatus() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/LeafListSubStatementStatus.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList leafListInfo = leafListIterator.next();
-
- // Check whether status is set correctly.
- assertThat(leafListInfo.getName(), is("invalid-interval"));
- assertThat(leafListInfo.isConfig(), is(true));
- assertThat(leafListInfo.getStatus(), is(YangStatusType.CURRENT));
- }
-
- /**
- * Checks default value of status statement.
- */
- @Test
- public void processStatusDefaultValue() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/StatusDefaultValue.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList leafListInfo = leafListIterator.next();
-
- // Check whether status is set correctly.
- assertThat(leafListInfo.getName(), is("invalid-interval"));
- assertThat(leafListInfo.isConfig(), is(true));
- assertThat(leafListInfo.getStatus(), is(YangStatusType.CURRENT));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/SubModuleListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/SubModuleListenerTest.java
deleted file mode 100644
index 6a53cbe..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/SubModuleListenerTest.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import java.io.IOException;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.notNullValue;
-import static org.junit.Assert.assertThat;
-
-/**
- * Test cases for testing submodule listener functionality.
- */
-public class SubModuleListenerTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks if the sub module listeners updates the data model tree.
- */
- @Test
- public void processSubModuleValidEntry() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/SubModuleValidEntry.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangSubModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.SUB_MODULE_NODE));
-
- YangSubModule yangNode = (YangSubModule) node;
- // Check whether the module name is set correctly.
- assertThat(yangNode.getName(), is("Test"));
- // Checks for the version value in data model tree.
- assertThat(yangNode.getVersion(), is((byte) 1));
- // Checks identifier of belongsto in data model tree.
- assertThat(yangNode.getBelongsTo().getBelongsToModuleName(), is("ONOS"));
- // Checks for the version value in data model tree.
- assertThat(yangNode.getBelongsTo().getPrefix(), is("On1"));
- }
-
- /**
- * Checks if the yang version and belongs to can come in any order in sub
- * module.
- */
- @Test
- public void processSubModuleOrder() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/SubModuleOrder.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangSubModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.SUB_MODULE_NODE));
-
- YangSubModule yangNode = (YangSubModule) node;
- // Check whether the module name is set correctly.
- assertThat(yangNode.getName(), is("Test"));
- // Checks for the version value in data model tree.
- assertThat(yangNode.getVersion(), is((byte) 1));
- // Checks identifier of belongsto in data model tree.
- assertThat(yangNode.getBelongsTo().getBelongsToModuleName(), is("ONOS"));
- // Checks for the version value in data model tree.
- assertThat(yangNode.getBelongsTo().getPrefix(), is("On1"));
- }
-
- /**
- * Checks if yang version is optional.
- */
- @Test
- public void processSubModuleWithoutVersion() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/SubModuleWithoutVersion.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangSubModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.SUB_MODULE_NODE));
-
- YangSubModule yangNode = (YangSubModule) node;
- // Check whether the module name is set correctly.
- assertThat(yangNode.getName(), is("Test"));
- // Checks identifier of belongsto in data model tree.
- assertThat(yangNode.getBelongsTo().getBelongsToModuleName(), is("ONOS"));
- // Checks for the version value in data model tree.
- assertThat(yangNode.getBelongsTo().getPrefix(), is("On1"));
- //Checks the revision with current date is created for empty revision statement.
- assertThat(((YangSubModule) node).getRevision().getRevDate(), notNullValue());
- }
-
- /**
- * Checks if sub module name is correct.
- */
- @Test(expected = ParserException.class)
- public void processSubModuleInvalidName() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/SubModuleInvalidName.yang");
- }
-
- /**
- * Checks if sub module has invalid modules construct eg namespace.
- */
- @Test(expected = ParserException.class)
- public void processSubModuleWithNamespace() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/SubModuleWithNamespace.yang");
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/TypeListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/TypeListenerTest.java
deleted file mode 100644
index b6b497a..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/TypeListenerTest.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * 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.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.YangContainer;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangLeafList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-
-/**
- * Test case for type listener.
- */
-public class TypeListenerTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks derived statement without contraints.
- */
- @Test
- public void processDerivedTypeStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/DerivedTypeStatement.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.DERIVED));
- }
-
- /**
- * Checks valid yang data type.
- */
- @Test
- public void processIntegerTypeStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/IntegerTypeStatement.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
- }
-
- /**
- * Checks type for leaf-list.
- */
- @Test
- public void processLeafListSubStatementType() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/LeafListSubStatementType.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList leafListInfo = leafListIterator.next();
-
- assertThat(leafListInfo.getName(), is("invalid-interval"));
- assertThat(leafListInfo.getDataType().getDataTypeName(), is("uint16"));
- assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
- }
-
- /**
- * Checks for type instance-identifier.
- */
- @Test
- public void processInstanceIdentifierType() throws IOException, ParserException {
-
- YangNode node = manager
- .getDataModel("src/test/resources/InstanceIdentifierListener.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
- YangContainer container = (YangContainer) yangNode.getChild();
- ListIterator<YangLeaf> leafIterator = container.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("instance-identifier"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.INSTANCE_IDENTIFIER));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/UnionListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/UnionListenerTest.java
deleted file mode 100644
index 1fe7218..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/UnionListenerTest.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.ListIterator;
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangLeafList;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.datamodel.YangUnion;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-
-/**
- * Test cases for testing union listener.
- */
-public class UnionListenerTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks union when type is in leaf.
- */
- @Test
- public void processUnionWhenTypeInLeaf() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/UnionWhenTypeInLeaf.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- YangList yangList = (YangList) yangNode.getChild();
- assertThat(yangList.getName(), is("valid"));
-
- ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
-
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UNION));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("union"));
-
- YangUnion yangUnion = (YangUnion) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- List<YangType<?>> typeList = yangUnion.getTypeList();
- ListIterator<YangType<?>> typeListIterator = typeList.listIterator();
- YangType<?> yangType = typeListIterator.next();
-
- assertThat(yangType.getDataTypeName(), is("int32"));
- assertThat(yangType.getDataType(), is(YangDataTypes.INT32));
-
- YangType<?> yangTypeEnum = typeListIterator.next();
-
- assertThat(yangTypeEnum.getDataTypeName(), is("enumeration"));
- assertThat(yangTypeEnum.getDataType(), is(YangDataTypes.ENUMERATION));
- }
-
- /**
- * Checks union when type is in leaflist.
- */
- @Test
- public void processUnionWhenTypeInLeafList() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/UnionWhenTypeInLeafList.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- YangList yangList = (YangList) yangNode.getChild();
- assertThat(yangList.getName(), is("valid"));
-
- ListIterator<YangLeafList> leafListIterator = yangList.getListOfLeafList().listIterator();
- YangLeafList leafListInfo = leafListIterator.next();
-
- assertThat(leafListInfo.getName(), is("invalid-interval"));
-
- assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.UNION));
- assertThat(leafListInfo.getDataType().getDataTypeName(), is("union"));
-
- YangUnion yangUnion = (YangUnion) leafListInfo.getDataType().getDataTypeExtendedInfo();
-
- List<YangType<?>> typeList = yangUnion.getTypeList();
- ListIterator<YangType<?>> typeListIterator = typeList.listIterator();
- YangType<?> yangType = typeListIterator.next();
-
- assertThat(yangType.getDataTypeName(), is("int32"));
- assertThat(yangType.getDataType(), is(YangDataTypes.INT32));
-
- YangType<?> yangTypeEnum = typeListIterator.next();
-
- assertThat(yangTypeEnum.getDataTypeName(), is("enumeration"));
- assertThat(yangTypeEnum.getDataType(), is(YangDataTypes.ENUMERATION));
- }
-
- /**
- * Checks union with empty type.
- */
- @Test (expected = ParserException.class)
- public void processUnionWithEmptyType() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/UnionWithEmptyType.yang");
- }
-
- /**
- * Checks whether type union has atleast one type statement.
- */
- @Test (expected = ParserException.class)
- public void processUnionWithoutChild() throws IOException, ParserException {
- manager.getDataModel("src/test/resources/UnionWithoutChild.yang");
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/UniqueListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/UniqueListenerTest.java
deleted file mode 100644
index 95ee043..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/UniqueListenerTest.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import java.io.IOException;
-import java.util.ListIterator;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-
-/**
- * Test cases for unique listener.
- */
-public class UniqueListenerTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks unique statement as sub-statement of list.
- */
- @Test
- public void processListSubStatementUnique() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ListSubStatementUnique.yang");
-
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the list is child of module
- YangList yangList = (YangList) yangNode.getChild();
- assertThat(yangList.getName(), is("valid"));
- assertThat(yangList.getUniqueList().listIterator().next(), is("invalid-interval"));
- }
-
- /**
- * Check multiple unique values.
- */
- @Test
- public void processMultipleUniqueValues() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/MultipleUniqueValues.yang");
-
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether the list is child of module
- YangList yangList = (YangList) yangNode.getChild();
- assertThat(yangList.getName(), is("valid"));
- ListIterator<String> listIterator;
- String list;
- listIterator = yangList.getUniqueList().listIterator();
- list = listIterator.next();
- assertThat(list, is("ospf"));
- list = listIterator.next();
- assertThat(list, is("isis"));
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/UnitsListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/UnitsListenerTest.java
deleted file mode 100644
index fe2bed1..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/UnitsListenerTest.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * 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.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.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangLeafList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangStatusType;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.nullValue;
-import static org.hamcrest.core.Is.is;
-
-/**
- * Test cases for units listener.
- */
-public class UnitsListenerTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks valid units statement.
- */
- @Test
- public void processUnitsStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/UnitsStatement.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat(node instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- // Check whether units value is set correctly.
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getUnits(), is("\"seconds\""));
- }
-
- /**
- * Checks invalid units statement(without statement end).
- */
- @Test
- public void processUnitsWithoutStatementEnd() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("mismatched input '}' expecting {';', '+'}");
- YangNode node = manager.getDataModel("src/test/resources/UnitsWithoutStatementEnd.yang");
- }
-
- /**
- * Checks order of units statement in leaf.
- */
- @Test
- public void processUnitsStatementOrder() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/UnitsStatementOrder.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat(node instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- // Check whether leaf properties is set correctly.
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
- assertThat(leafInfo.getUnits(), is("\"seconds\""));
- assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
- assertThat(leafInfo.isConfig(), is(true));
- assertThat(leafInfo.isMandatory(), is(true));
- assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
- assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
- }
-
- /**
- * Checks the default value of unit statement.
- */
- @Test
- public void processUnitsDefaultValue() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/UnitsDefaultValue.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat(node instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getUnits(), is(nullValue()));
- }
-
- /**
- * Checks invalid occurance of units statement as sub-statement of leaf.
- */
- @Test
- public void processUnitsStatementCardinality() throws IOException, ParserException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("YANG file error: \"units\" is defined more than once in \"leaf invalid-interval\".");
- YangNode node = manager.getDataModel("src/test/resources/UnitsStatementCardinality.yang");
- }
-
- /**
- * Checks valid units statement as sub-statement of leaf-list.
- */
- @Test
- public void processLeafListSubStatementUnits() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/LeafListSubStatementUnits.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat(node instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList leafListInfo = leafListIterator.next();
-
- // Check whether units value is set correctly.
- assertThat(leafListInfo.getName(), is("invalid-interval"));
- assertThat(leafListInfo.getUnits(), is("\"seconds\""));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/UsesListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/UsesListenerTest.java
deleted file mode 100644
index a20c43e..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/UsesListenerTest.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import java.io.IOException;
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangGrouping;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangStatusType;
-import org.onosproject.yangutils.datamodel.YangUses;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-
-/**
- * Test cases for testing uses listener.
- */
-public class UsesListenerTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks uses statement inside module.
- */
- @Test
- public void processUsesInModule() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/UsesInModule.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- YangGrouping yangGrouping = (YangGrouping) yangNode.getChild();
- assertThat(yangGrouping.getName(), is("endpoint"));
-
- YangUses yangUses = (YangUses) yangGrouping.getNextSibling();
- assertThat(yangUses.getName(), is("endpoint"));
- }
-
- /**
- * Checks uses statement inside container.
- */
- @Test
- public void processUsesInContainer() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/UsesInContainer.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- YangGrouping yangGrouping = (YangGrouping) yangNode.getChild();
- assertThat(yangGrouping.getName(), is("endpoint"));
-
- YangContainer yangContainer = (YangContainer) yangGrouping.getNextSibling();
- assertThat(yangContainer.getName(), is("valid"));
-
- YangUses yangUses = (YangUses) yangContainer.getChild();
- assertThat(yangUses.getName(), is("endpoint"));
-
- // Check attributes associated with uses.
- assertThat(yangUses.getStatus(), is(YangStatusType.CURRENT));
- assertThat(yangUses.getReference(), is("\"RFC 6020\""));
- assertThat(yangUses.getDescription(), is("\"grouping under test\""));
- }
-
- /**
- * Checks uses statement inside list.
- */
- @Test
- public void processUsesInList() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/UsesInList.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- YangGrouping yangGrouping = (YangGrouping) yangNode.getChild();
- assertThat(yangGrouping.getName(), is("endpoint"));
-
- YangList yangList = (YangList) yangGrouping.getNextSibling();
- assertThat(yangList.getName(), is("valid"));
-
- YangUses yangUses = (YangUses) yangList.getChild();
- assertThat(yangUses.getName(), is("endpoint"));
-
- // Check attributes associated with uses.
- assertThat(yangUses.getStatus(), is(YangStatusType.CURRENT));
- assertThat(yangUses.getReference(), is("\"RFC 6020\""));
- assertThat(yangUses.getDescription(), is("\"grouping under test\""));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ValueListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ValueListenerTest.java
deleted file mode 100644
index 20497e0..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ValueListenerTest.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.datamodel.YangEnum;
-import org.onosproject.yangutils.datamodel.YangEnumeration;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import java.io.IOException;
-import java.util.ListIterator;
-import java.util.Set;
-
-/**
- * Test cases for value listener.
- */
-public class ValueListenerTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks explicitly configured value.
- */
- @Test
- public void processValueStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ValueStatement.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("speed"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("enumeration"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.ENUMERATION));
- assertThat(((YangEnumeration) leafInfo.getDataType().getDataTypeExtendedInfo()).getName(),
- is("speed_enum"));
-
- Set<YangEnum> enumSet = ((YangEnumeration) leafInfo.getDataType().getDataTypeExtendedInfo()).getEnumSet();
- for (YangEnum tmp : enumSet) {
- if (tmp.getNamedValue().equals("10m")) {
- assertThat(tmp.getValue(), is(10));
- } else if (tmp.getNamedValue().equals("100m")) {
- assertThat(tmp.getValue(), is(100));
- } else if (tmp.getNamedValue().equals("auto")) {
- assertThat(tmp.getValue(), is(1000));
- }
- }
- }
-
- /**
- * Checks explicitly configured negative value.
- */
- @Test
- public void processValueStatementWithNegativeValue() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ValueStatementWithNegativeValue.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("speed"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("enumeration"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.ENUMERATION));
- assertThat(((YangEnumeration) leafInfo.getDataType().getDataTypeExtendedInfo()).getName(),
- is("speed_enum"));
-
- Set<YangEnum> enumSet = ((YangEnumeration) leafInfo.getDataType().getDataTypeExtendedInfo()).getEnumSet();
- for (YangEnum tmp : enumSet) {
- if (tmp.getNamedValue().equals("10m")) {
- assertThat(tmp.getValue(), is(-2));
- } else if (tmp.getNamedValue().equals("100m")) {
- assertThat(tmp.getValue(), is(-1));
- } else if (tmp.getNamedValue().equals("auto")) {
- assertThat(tmp.getValue(), is(0));
- }
- }
- }
-
- /**
- * Checks explicitly configured value with double quotes.
- */
- @Test
- public void processValueStatementWithQuotes() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ValueStatementWithQuotes.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("speed"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("enumeration"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.ENUMERATION));
- assertThat(((YangEnumeration) leafInfo.getDataType().getDataTypeExtendedInfo()).getName(),
- is("speed_enum"));
-
- Set<YangEnum> enumSet = ((YangEnumeration) leafInfo.getDataType().getDataTypeExtendedInfo()).getEnumSet();
- for (YangEnum tmp : enumSet) {
- if (tmp.getNamedValue().equals("10m")) {
- assertThat(tmp.getValue(), is(10));
- } else if (tmp.getNamedValue().equals("100m")) {
- assertThat(tmp.getValue(), is(100));
- } else if (tmp.getNamedValue().equals("auto")) {
- assertThat(tmp.getValue(), is(1000));
- }
- }
- }
-
- /**
- * Checks explicit value and auto generated value.
- */
- @Test
- public void processValueAndAutoStatement() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ValueAndAutoStatement.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("speed"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("enumeration"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.ENUMERATION));
- assertThat(((YangEnumeration) leafInfo.getDataType().getDataTypeExtendedInfo()).getName(),
- is("speed_enum"));
-
- Set<YangEnum> enumSet = ((YangEnumeration) leafInfo.getDataType().getDataTypeExtendedInfo()).getEnumSet();
- for (YangEnum tmp : enumSet) {
- if (tmp.getNamedValue().equals("10m")) {
- assertThat(tmp.getValue(), is(10));
- } else if (tmp.getNamedValue().equals("100m")) {
- assertThat(tmp.getValue(), is(11));
- } else if (tmp.getNamedValue().equals("auto")) {
- assertThat(tmp.getValue(), is(1000));
- }
- }
- }
-
- /**
- * Checks explicit value should not be repeated.
- */
- @Test(expected = ParserException.class)
- public void processValueDuplication() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ValueDuplication.yang");
- }
-
- /**
- * Checks explicit or auto generated value should not be repeated.
- */
- @Test(expected = ParserException.class)
- public void processValueExplicitAndAutoDuplication() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ValueExplicitAndAutoDuplication.yang");
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/VersionListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/VersionListenerTest.java
deleted file mode 100644
index 3d9de83..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/VersionListenerTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import java.io.IOException;
-
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-
-/**
- * Test cases for testing version listener functionality.
- */
-public class VersionListenerTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks if value of version is correct.
- */
- @Test(expected = ParserException.class)
- public void processVersionInvalidValue() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/VersionInvalidValue.yang");
- }
-
- /**
- * Checks if version listener updates the data model tree.
- */
- @Test
- public void processVersionValidEntry() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/VersionValidEntry.yang");
-
- // Checks for the version value in data model tree.
- assertThat(((YangModule) node).getVersion(), is((byte) 1));
- }
-
- /**
- * Checks version in double quotes.
- */
- @Test
- public void processValidVersionWithDoubleQuotes() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ValidVersionWithDoubleQuotes.yang");
-
- // Checks for the version value in data model tree.
- assertThat(((YangModule) node).getVersion(), is((byte) 1));
- }
-
- /**
- * Checks if version which is optional paramater is not present.
- */
- @Test
- public void processVersionNotPresent() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/VersionNotPresent.yang");
-
- // Checks for the version value in data model tree.
- assertThat(((YangModule) node).getVersion(), is((byte) 1));
- }
-
- /**
- * Checks that version should be present only once.
- */
- @Test(expected = ParserException.class)
- public void processVersionDualEntry() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/VersionDualEntry.yang");
- }
-
- /**
- * Checks if version can appear in any order in module header.
- */
- @Test
- public void processVersionOrder() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/VersionOrder.yang");
-
- // Checks for the version value in data model tree.
- assertThat(((YangModule) node).getVersion(), is((byte) 1));
- }
-
- /**
- * Checks if sytax of version entry is not correct.
- */
- @Test(expected = ParserException.class)
- public void processVersionInvalidSyntax() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/VersionInvalidSyntax.yang");
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/WhenListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/WhenListenerTest.java
deleted file mode 100644
index fadbc01..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/WhenListenerTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.parser.impl.listeners;
-
-import java.io.IOException;
-import java.util.ListIterator;
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-
-/**
- * Test cases for testing when listener functionality.
- */
-public class WhenListenerTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks if when listener updates the data model.
- */
- @Test
- public void processContainerSubStatementWhen() throws IOException, ParserException {
- YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatementWhen.yang");
-
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- YangList yangList = (YangList) yangNode.getChild();
- String expectedConstraint = "../switching-capability = 'TDM'";
- assertThat(yangList.getName(), is("interface-switching-capability"));
- assertThat(yangList.getWhen().getCondition(), is(expectedConstraint));
-
- YangContainer container = (YangContainer) yangList.getNextSibling();
- assertThat(container.getName(), is("time-division-multiplex-capable"));
- assertThat(container.getWhen().getCondition(), is(expectedConstraint));
- }
-
- /**
- * Checks if when listener updates the data model.
- */
- @Test
- public void processLeafSubStatementWhen() throws IOException, ParserException {
- YangNode node = manager.getDataModel("src/test/resources/LeafSubStatementWhen.yang");
-
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getWhen().getCondition(), is("ifType != 'ethernet'"));
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/parseutils/AugmentListnerUtilTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/parseutils/AugmentListnerUtilTest.java
deleted file mode 100644
index 3cf6eaa..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/parseutils/AugmentListnerUtilTest.java
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- * 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.parser.impl.parseutils;
-
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangNodeIdentifier;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-import static org.onosproject.yangutils.parser.impl.parserutils.AugmentListenerUtil.clearOccurrenceCount;
-import static org.onosproject.yangutils.parser.impl.parserutils.AugmentListenerUtil.createValidNameForAugment;
-import static org.onosproject.yangutils.parser.impl.parserutils.AugmentListenerUtil.getAugmentJavaFileNameList;
-import static org.onosproject.yangutils.parser.impl.parserutils.AugmentListenerUtil.updateNameWhenHasMultipleOuccrrence;
-
-/**
- * Unit test case for augment listener utility.
- */
-public class AugmentListnerUtilTest {
-
- private static final String TEST1 = "test1Node";
- private static final String PARENT_PREFIX = "if";
- private static final String NODE_PREFIX = "rf";
-
- private static final String TEST1_AUGMENTED_NAME_WITHOUT_PREFIX = "AugmentedTest1Node";
- private static final String TEST1_AUGMENTED_NAME_WITHOUT_PREFIX_MULTI1 = "AugmentedTest1Node1";
- private static final String TEST1_AUGMENTED_NAME_WITHOUT_PREFIX_MULTI2 = "AugmentedTest1Node2";
- private static final String TEST1_AUGMENTED_NAME_WITHOUT_PREFIX_MULTI3 = "AugmentedTest1Node3";
-
- private static final String TEST1_AUGMENTED_NAME_WITH_PREFIX = "AugmentedRfTest1Node";
- private static final String TEST1_AUGMENTED_NAME_WITH_PREFIX_MULTI1 = "AugmentedRfTest1Node1";
- private static final String TEST1_AUGMENTED_NAME_WITH_PREFIX_MULTI2 = "AugmentedRfTest1Node2";
- private static final String TEST1_AUGMENTED_NAME_WITH_PREFIX_MULTI3 = "AugmentedRfTest1Node3";
-
- private static String testString = "";
-
- /**
- * Unit test case when parent's prefix is present and one occurrence of augment node to update same target node.
- */
- @Test
- public void testForAugmentNameWhenOneOuccrrenceWithParentPrefix() {
- clearData();
- testString = createValidNameForAugment(getStubNodeIdetifierWithParentPrefix(),
- isPrefixPresent(getStubNodeIdetifierWithParentPrefix()));
- assertThat(true, is(testString.equals(TEST1_AUGMENTED_NAME_WITHOUT_PREFIX)));
- }
-
- /**
- * Unit test case when no prefix and one occurrence of augment node to update same target node.
- */
- @Test
- public void testForAugmentNameWhenOneOuccrrenceWithNoPrefix() {
- clearData();
- testString = createValidNameForAugment(getStubNodeIdetifierWithNoPrefix(),
- isPrefixPresent(getStubNodeIdetifierWithNoPrefix()));
- assertThat(true, is(testString.equals(TEST1_AUGMENTED_NAME_WITHOUT_PREFIX)));
- }
-
- /**
- * Unit test case when different prefix then parent is present and
- * one occurrence of augment node to update same target node.
- */
- @Test
- public void testForAugmentNameWhenOneOuccrrenceWithDiffPrefix() {
- clearData();
- testString = createValidNameForAugment(getStubNodeIdetifierWithDiffPrefix(),
- isPrefixPresent(getStubNodeIdetifierWithDiffPrefix()));
- assertThat(true, is(testString.equals(TEST1_AUGMENTED_NAME_WITH_PREFIX)));
- }
-
- /**
- * Unit test case when parent's prefix is present and two occurrence of augment node to update
- * same target node is present.
- */
- @Test
- public void testForAugmentNameWhenTwoOuccrrenceWithParentPrefix() {
- clearData();
-
- createValidNameForAugment(getStubNodeIdetifierWithParentPrefix(),
- isPrefixPresent(getStubNodeIdetifierWithParentPrefix()));
- testString = updateNameWhenHasMultipleOuccrrence(getStubNodeIdetifierWithParentPrefix(),
- isPrefixPresent(getStubNodeIdetifierWithParentPrefix()));
-
- assertThat(true, is(testString.equals(TEST1_AUGMENTED_NAME_WITHOUT_PREFIX_MULTI2)));
- }
-
- /**
- * Unit test case when no prefix and two occurrence of augment node to update
- * same target node is present.
- */
- @Test
- public void testForAugmentNameWhenTwoOuccrrenceWithNoPrefix() {
- clearData();
-
- createValidNameForAugment(getStubNodeIdetifierWithNoPrefix(),
- isPrefixPresent(getStubNodeIdetifierWithNoPrefix()));
- testString = updateNameWhenHasMultipleOuccrrence(getStubNodeIdetifierWithNoPrefix(),
- isPrefixPresent(getStubNodeIdetifierWithNoPrefix()));
- assertThat(true, is(testString.equals(TEST1_AUGMENTED_NAME_WITHOUT_PREFIX_MULTI2)));
- }
-
- /**
- * Unit test case when different prefix then parent is present and
- * two occurrence of augment node to update same target node is present.
- */
- @Test
- public void testForAugmentNameWhenTwoOuccrrenceWithDiffPrefix() {
- clearData();
-
- createValidNameForAugment(getStubNodeIdetifierWithDiffPrefix(),
- isPrefixPresent(getStubNodeIdetifierWithDiffPrefix()));
- testString = updateNameWhenHasMultipleOuccrrence(getStubNodeIdetifierWithDiffPrefix(),
- isPrefixPresent(getStubNodeIdetifierWithDiffPrefix()));
- assertThat(true, is(testString.equals(TEST1_AUGMENTED_NAME_WITH_PREFIX_MULTI2)));
- }
-
- /**
- * Unit test case when parent prefix and three occurrence of augment node to update
- * same target node is present.
- */
- @Test
- public void testForAugmentNameWhenThreeOuccrrenceWithParentPrefix() {
- clearData();
-
- createValidNameForAugment(getStubNodeIdetifierWithParentPrefix(),
- isPrefixPresent(getStubNodeIdetifierWithParentPrefix()));
- updateNameWhenHasMultipleOuccrrence(getStubNodeIdetifierWithParentPrefix(),
- isPrefixPresent(getStubNodeIdetifierWithParentPrefix()));
-
- testString = updateNameWhenHasMultipleOuccrrence(getStubNodeIdetifierWithParentPrefix(),
- isPrefixPresent(getStubNodeIdetifierWithParentPrefix()));
- assertThat(true, is(testString.equals(TEST1_AUGMENTED_NAME_WITHOUT_PREFIX_MULTI3)));
- }
-
- /**
- * Unit test case when no prefix and three occurrence of augment node to update
- * same target node is present.
- */
- @Test
- public void testForAugmentNameWhenThreeOuccrrenceNoPrefix() {
- clearData();
-
- createValidNameForAugment(getStubNodeIdetifierWithNoPrefix(),
- isPrefixPresent(getStubNodeIdetifierWithNoPrefix()));
- updateNameWhenHasMultipleOuccrrence(getStubNodeIdetifierWithNoPrefix(),
- isPrefixPresent(getStubNodeIdetifierWithNoPrefix()));
-
- testString = updateNameWhenHasMultipleOuccrrence(getStubNodeIdetifierWithNoPrefix(),
- isPrefixPresent(getStubNodeIdetifierWithNoPrefix()));
- assertThat(true, is(testString.equals(TEST1_AUGMENTED_NAME_WITHOUT_PREFIX_MULTI3)));
- }
-
- /**
- * Unit test case when different prefix and three occurrence of augment node to update
- * same target node is present.
- */
- @Test
- public void testForAugmentNameWhenThreeOuccrrenceWithDiffPrefix() {
- clearData();
-
- createValidNameForAugment(getStubNodeIdetifierWithDiffPrefix(),
- isPrefixPresent(getStubNodeIdetifierWithDiffPrefix()));
- updateNameWhenHasMultipleOuccrrence(getStubNodeIdetifierWithDiffPrefix(),
- isPrefixPresent(getStubNodeIdetifierWithDiffPrefix()));
-
- testString = updateNameWhenHasMultipleOuccrrence(getStubNodeIdetifierWithDiffPrefix(),
- isPrefixPresent(getStubNodeIdetifierWithDiffPrefix()));
- assertThat(true, is(testString.equals(TEST1_AUGMENTED_NAME_WITH_PREFIX_MULTI3)));
- }
-
- /**
- * Unit test case for when three occurrence is there and parent prefix is present,
- * all the names need to be updated in list.
- */
- @Test
- public void testForPreviousNamesGotUpdatedWhenParentPrefix() {
- clearData();
-
- createValidNameForAugment(getStubNodeIdetifierWithParentPrefix(),
- isPrefixPresent(getStubNodeIdetifierWithParentPrefix()));
- updateNameWhenHasMultipleOuccrrence(getStubNodeIdetifierWithParentPrefix(),
- isPrefixPresent(getStubNodeIdetifierWithParentPrefix()));
- updateNameWhenHasMultipleOuccrrence(getStubNodeIdetifierWithParentPrefix(),
- isPrefixPresent(getStubNodeIdetifierWithParentPrefix()));
-
- testString = getAugmentJavaFileNameList().get(0);
- assertThat(true, is(testString.equals(TEST1_AUGMENTED_NAME_WITHOUT_PREFIX_MULTI1)));
-
- testString = getAugmentJavaFileNameList().get(1);
- assertThat(true, is(testString.equals(TEST1_AUGMENTED_NAME_WITHOUT_PREFIX_MULTI2)));
-
- testString = getAugmentJavaFileNameList().get(2);
- assertThat(true, is(testString.equals(TEST1_AUGMENTED_NAME_WITHOUT_PREFIX_MULTI3)));
- }
-
- /**
- * Unit test case for when three occurrence is there and no prefix is present,
- * all the names need to be updated in list.
- */
- @Test
- public void testForPreviousNamesGotUpdatedWhenNoPrefix() {
- clearData();
-
- createValidNameForAugment(getStubNodeIdetifierWithNoPrefix(),
- isPrefixPresent(getStubNodeIdetifierWithNoPrefix()));
- updateNameWhenHasMultipleOuccrrence(getStubNodeIdetifierWithNoPrefix(),
- isPrefixPresent(getStubNodeIdetifierWithNoPrefix()));
- updateNameWhenHasMultipleOuccrrence(getStubNodeIdetifierWithNoPrefix(),
- isPrefixPresent(getStubNodeIdetifierWithNoPrefix()));
-
- testString = getAugmentJavaFileNameList().get(0);
- assertThat(true, is(testString.equals(TEST1_AUGMENTED_NAME_WITHOUT_PREFIX_MULTI1)));
-
- testString = getAugmentJavaFileNameList().get(1);
- assertThat(true, is(testString.equals(TEST1_AUGMENTED_NAME_WITHOUT_PREFIX_MULTI2)));
-
- testString = getAugmentJavaFileNameList().get(2);
- assertThat(true, is(testString.equals(TEST1_AUGMENTED_NAME_WITHOUT_PREFIX_MULTI3)));
- }
-
- /**
- * Unit test case for when three occurrence is there and different prefix is present,
- * all the names need to be updated in list.
- */
- @Test
- public void testForPreviousNamesGotUpdatedWhenDifferentPrefix() {
- clearData();
-
- createValidNameForAugment(getStubNodeIdetifierWithDiffPrefix(),
- isPrefixPresent(getStubNodeIdetifierWithDiffPrefix()));
- updateNameWhenHasMultipleOuccrrence(getStubNodeIdetifierWithDiffPrefix(),
- isPrefixPresent(getStubNodeIdetifierWithDiffPrefix()));
- updateNameWhenHasMultipleOuccrrence(getStubNodeIdetifierWithDiffPrefix(),
- isPrefixPresent(getStubNodeIdetifierWithDiffPrefix()));
-
- testString = getAugmentJavaFileNameList().get(0);
- assertThat(true, is(testString.equals(TEST1_AUGMENTED_NAME_WITH_PREFIX_MULTI1)));
-
- testString = getAugmentJavaFileNameList().get(1);
- assertThat(true, is(testString.equals(TEST1_AUGMENTED_NAME_WITH_PREFIX_MULTI2)));
-
- testString = getAugmentJavaFileNameList().get(2);
- assertThat(true, is(testString.equals(TEST1_AUGMENTED_NAME_WITH_PREFIX_MULTI3)));
- }
-
- /**
- * Returns stub node identifier when parent prefix is used.
- *
- * @param name name of node
- * @param prefix prefix of node
- * @return node identifier for node
- */
- private YangNodeIdentifier getStubNodeIdetifierWithParentPrefix() {
- YangNodeIdentifier nodeId = new YangNodeIdentifier();
- nodeId.setName(TEST1);
- nodeId.setPrefix(PARENT_PREFIX);
- return nodeId;
- }
-
- /**
- * Returns stub node identifier when no prefix is used.
- *
- * @param name name of node
- * @param prefix prefix of node
- * @return node identifier for node
- */
- private YangNodeIdentifier getStubNodeIdetifierWithNoPrefix() {
- YangNodeIdentifier nodeId = new YangNodeIdentifier();
- nodeId.setName(TEST1);
- nodeId.setPrefix(null);
- return nodeId;
- }
-
- /**
- * Returns stub node identifier when different prefix is used.
- *
- * @param name name of node
- * @param prefix prefix of node
- * @return node identifier for node
- */
- private YangNodeIdentifier getStubNodeIdetifierWithDiffPrefix() {
- YangNodeIdentifier nodeId = new YangNodeIdentifier();
- nodeId.setName(TEST1);
- nodeId.setPrefix(NODE_PREFIX);
- return nodeId;
- }
-
- /**
- * Returns true if a prefix is present and it is not equals to parents prefix.
- *
- * @param nodeId YANG node identifier
- * @param parentsPrefix parent's prefix
- * @return true if a prefix is present and it is not equals to parents prefix
- */
- private static boolean isPrefixPresent(YangNodeIdentifier nodeId) {
- return nodeId.getPrefix() != null && nodeId.getPrefix() != PARENT_PREFIX;
- }
-
- /**
- * Clears list of names and occurrence count after each test case.
- */
- private void clearData() {
- getAugmentJavaFileNameList().clear();
- clearOccurrenceCount();
- }
-
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/parseutils/ListenerErrorMessageConstructionTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/parseutils/ListenerErrorMessageConstructionTest.java
deleted file mode 100644
index bcfaf20..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/parseutils/ListenerErrorMessageConstructionTest.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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.parser.impl.parseutils;
-
-import org.junit.Test;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.CONTACT_DATA;
-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;
-
-/**
- * Test case for testing listener error message construction util.
- */
-public class ListenerErrorMessageConstructionTest {
-
- /**
- * Checks for error message construction with parsable data type name.
- */
- @Test
- public void checkErrorMsgConstructionWithName() {
-
- // Create an test error message
- String testErrorMessage = constructListenerErrorMessage(INVALID_HOLDER, CONTACT_DATA, "Test Instance", ENTRY);
-
- // Check message.
- assertThat(testErrorMessage, is("Internal parser error detected: Invalid holder for contact "
- + "\"Test Instance\" before processing."));
- }
-
- /**
- * Checks for error message construction without parsable data type name.
- */
- @Test
- public void checkErrorMsgConstructionWithoutName() {
-
- // Create an test error message
- String testErrorMessage = constructListenerErrorMessage(INVALID_HOLDER, CONTACT_DATA, "Test Instance", ENTRY);
-
- // Check message.
- assertThat(testErrorMessage,
- is("Internal parser error detected: Invalid holder for contact \"Test Instance\""
- + " before processing."));
- }
-
- /**
- * Checks for extended error message construction with parsable data type
- * name.
- */
- @Test
- public void checkExtendedErrorMsgConstructionWithName() {
-
- // Create an test error message
- String testErrorMessage = constructExtendedListenerErrorMessage(INVALID_HOLDER, CONTACT_DATA,
- "Test Instance", ENTRY,
- "Extended Information");
-
- // Check message.
- assertThat(testErrorMessage,
- is("Internal parser error detected: Invalid holder for contact \"Test Instance\""
- + " before processing.\n" + "Error Information: Extended Information"));
- }
-
- /**
- * Checks for extended error message construction without parsable data type
- * name.
- */
- @Test
- public void checkExtendedErrorMsgConstructionWithoutName() {
-
- // Create an test error message
- String testErrorMessage = constructExtendedListenerErrorMessage(INVALID_HOLDER, CONTACT_DATA, "", ENTRY,
- "Extended Information");
-
- // Check message.
- assertThat(testErrorMessage, is("Internal parser error detected: Invalid holder for contact"
- + " before processing.\n" + "Error Information: Extended Information"));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/parseutils/ListenerUtilTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/parseutils/ListenerUtilTest.java
deleted file mode 100644
index c29b126..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/parseutils/ListenerUtilTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.parser.impl.parseutils;
-
-import java.io.IOException;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-/**
- * Test case for testing listener util.
- */
-public class ListenerUtilTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks whether exception is thrown when identifier starts with xml.
- */
- @Test
- public void validateIdentifierStartsWithXml() throws IOException {
- thrown.expect(ParserException.class);
- thrown.expectMessage("YANG file error : module identifier xMlTest must not start" +
- " with (('X'|'x') ('M'|'m') ('L'|'l'))");
- manager.getDataModel("src/test/resources/InValidIdentifierXML.yang");
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/parseutils/ListenerValidationTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/parseutils/ListenerValidationTest.java
deleted file mode 100644
index ce347d6..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/parseutils/ListenerValidationTest.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * 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.parser.impl.parseutils;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.onosproject.yangutils.datamodel.YangRevision;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.TreeWalkListener;
-
-import static org.onosproject.yangutils.datamodel.utils.YangConstructType.YANGBASE_DATA;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsEmpty;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-
-/**
- * Test case for testing listener validation util.
- */
-public class ListenerValidationTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- /**
- * Checks for exception in case parsable stack is empty while validating for
- * not empty scenario.
- */
- @Test
- public void validateStackIsNotEmptyForEmptyStack() {
-
- String expectedError = constructListenerErrorMessage(MISSING_HOLDER, YANGBASE_DATA, "", EXIT);
-
- // Get the exception occurred during parsing.
- thrown.expect(ParserException.class);
- thrown.expectMessage(expectedError);
-
- // Create test walker and assign test error to it.
- TreeWalkListener testWalker = new TreeWalkListener();
-
- checkStackIsNotEmpty(testWalker, MISSING_HOLDER, YANGBASE_DATA, "", EXIT);
- }
-
- /**
- * Checks if there is no exception in case parsable stack is not empty while
- * validating for not empty scenario.
- */
- @Test
- public void validateStackIsNotEmptyForNonEmptyStack() {
-
- // Create test walker and assign test error to it.
- TreeWalkListener testWalker = new TreeWalkListener();
-
- // Create a temporary node of parsable.
- YangRevision tmpNode = new YangRevision();
- testWalker.getParsedDataStack().push(tmpNode);
-
- checkStackIsNotEmpty(testWalker, MISSING_HOLDER, YANGBASE_DATA, "", EXIT);
- }
-
- /**
- * Checks for exception in case parsable stack is not empty while validating
- * for empty scenario.
- */
- @Test
- public void validateStackIsEmptyForNonEmptyStack() {
-
- String expectedError = constructListenerErrorMessage(MISSING_HOLDER, YANGBASE_DATA, "", EXIT);
-
- // Get the exception occurred during parsing.
- thrown.expect(ParserException.class);
- thrown.expectMessage(expectedError);
-
- // Create test walker and assign test error to it.
- TreeWalkListener testWalker = new TreeWalkListener();
-
- // Create a temporary node of parsable.
- YangRevision tmpNode = new YangRevision();
- testWalker.getParsedDataStack().push(tmpNode);
-
- checkStackIsEmpty(testWalker, MISSING_HOLDER, YANGBASE_DATA, "", EXIT);
- }
-
- /**
- * Checks if there is no exception in case parsable stack is empty while
- * validating for empty scenario.
- */
- @Test
- public void validateStackIsEmptyForEmptyStack() {
-
- // Create test walker and assign test error to it.
- TreeWalkListener testWalker = new TreeWalkListener();
-
- checkStackIsEmpty(testWalker, MISSING_HOLDER, YANGBASE_DATA, "", EXIT);
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/parseutils/ParseTreeErrorListenerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/parseutils/ParseTreeErrorListenerTest.java
deleted file mode 100644
index 4489e77..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/parser/impl/parseutils/ParseTreeErrorListenerTest.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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.parser.impl.parseutils;
-
-import org.antlr.v4.runtime.ANTLRFileStream;
-import org.antlr.v4.runtime.ANTLRInputStream;
-import org.antlr.v4.runtime.CommonTokenStream;
-import org.antlr.v4.runtime.tree.ParseTree;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangLexer;
-import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.CustomExceptionMatcher;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-import org.onosproject.yangutils.parser.impl.parserutils.ParseTreeErrorListener;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.IOException;
-
-/**
- * Test case for testing parse tree error listener.
- */
-public class ParseTreeErrorListenerTest {
-
- YangUtilsParserManager manager = new YangUtilsParserManager();
- File file;
- BufferedWriter out;
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- /**
- * Checks that no exception is generated for YANG file with valid syntax.
- */
- @Test
- public void checkValidYangFileForNoSyntaxError() throws IOException {
-
- ANTLRInputStream input = new ANTLRFileStream("src/test/resources/YangFileWithoutSyntaxError.yang");
-
- // Create a lexer that feeds off of input char stream.
- GeneratedYangLexer lexer = new GeneratedYangLexer(input);
- // Create a buffer of tokens pulled from the lexer.
- CommonTokenStream tokens = new CommonTokenStream(lexer);
- // Create a parser that feeds off the tokens buffer.
- GeneratedYangParser parser = new GeneratedYangParser(tokens);
- // Remove console error listener.
- parser.removeErrorListeners();
- // Create instance of customized error listener.
- ParseTreeErrorListener parseTreeErrorListener = new ParseTreeErrorListener();
- // Add customized error listener to catch errors during parsing.
- parser.addErrorListener(parseTreeErrorListener);
- // Begin parsing YANG file and generate parse tree.
- ParseTree tree = parser.yangfile();
- }
-
- /**
- * Checks that exception is generated for YANG file with invalid syntax.
- */
- @Test
- public void checkInvalidYangFileForSyntaxError() throws IOException {
-
- // Get the exception occurred during parsing.
- thrown.expect(ParserException.class);
- thrown.expect(CustomExceptionMatcher.errorLocation(3, 0));
- thrown.expectMessage("no viable alternative at input 'yang-version 1\\nnamespace'");
-
- ANTLRInputStream input = new ANTLRFileStream("src/test/resources/YangFileWithSyntaxError.yang");
-
- // Create a lexer that feeds off of input char stream.
- GeneratedYangLexer lexer = new GeneratedYangLexer(input);
- // Create a buffer of tokens pulled from the lexer.
- CommonTokenStream tokens = new CommonTokenStream(lexer);
- // Create a parser that feeds off the tokens buffer.
- GeneratedYangParser parser = new GeneratedYangParser(tokens);
- // Remove console error listener.
- parser.removeErrorListeners();
- // Create instance of customized error listener.
- ParseTreeErrorListener parseTreeErrorListener = new ParseTreeErrorListener();
- // Add customized error listener to catch errors during parsing.
- parser.addErrorListener(parseTreeErrorListener);
- // Begin parsing YANG file and generate parse tree.
- ParseTree tree = parser.yangfile();
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/AugmentTranslatorTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/AugmentTranslatorTest.java
deleted file mode 100644
index fc4c6b1..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/AugmentTranslatorTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.plugin.manager;
-
-import java.io.IOException;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
-
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
-
-/**
- * Unit test case for augment translator.
- */
-public class AugmentTranslatorTest {
-
- private final YangUtilManager utilManager = new YangUtilManager();
-
- /**
- * Checks augment translation should not result in any exception.
- *
- * @throws MojoExecutionException
- */
- @Test
- public void processAugmentTranslator() throws IOException, ParserException, MojoExecutionException {
-
- String searchDir = "src/test/resources/augmentTranslator";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- utilManager.resolveDependenciesUsingLinker();
-
- YangPluginConfig yangPluginConfig = new YangPluginConfig();
- yangPluginConfig.setCodeGenDir("target/augmentTranslator/");
- utilManager.translateToJava(yangPluginConfig);
-
- deleteDirectory("target/augmentTranslator1/");
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/ChoiceCaseTranslatorTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/ChoiceCaseTranslatorTest.java
deleted file mode 100644
index ef179ff..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/ChoiceCaseTranslatorTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.plugin.manager;
-
-import java.io.IOException;
-
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-
-import static org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorUtil.generateJavaCode;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
-
-/**
- * Unit tests for choice-case translator.
- */
-public final class ChoiceCaseTranslatorTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks choice-case translation should not result in any exception.
- */
- @Test
- public void processChoiceCaseTranslator() throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/ChoiceCaseTranslator.yang");
-
- YangPluginConfig yangPluginConfig = new YangPluginConfig();
- yangPluginConfig.setCodeGenDir("target/ChoiceCaseTestGenFile/");
-
- generateJavaCode(node, yangPluginConfig);
-
- deleteDirectory("target/ChoiceCaseTestGenFile/");
- }
- // TODO enhance the test cases, after having a framework of translator test.
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/EnumTranslatorTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/EnumTranslatorTest.java
deleted file mode 100644
index 1a16f2a..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/EnumTranslatorTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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.plugin.manager;
-
-import java.io.IOException;
-
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-
-import static org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorUtil.generateJavaCode;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
-
-/**
- * Unit test case for enum translator.
- */
-public final class EnumTranslatorTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks enum translation should not result in any exception.
- */
- @Test
- public void processEnumTranslator()
- throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/EnumTranslator.yang");
-
- YangPluginConfig yangPluginConfig = new YangPluginConfig();
- yangPluginConfig.setCodeGenDir("target/EnumTestGenFile/");
-
- generateJavaCode(node, yangPluginConfig);
-
- deleteDirectory("target/EnumTestGenFile/");
- }
- // TODO enhance the test cases, after having a framework of translator test.
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileIdentityLinkingTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileIdentityLinkingTest.java
deleted file mode 100644
index 6c29c28..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileIdentityLinkingTest.java
+++ /dev/null
@@ -1,655 +0,0 @@
-/*
- * 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.plugin.manager;
-
-import java.io.IOException;
-import java.util.ListIterator;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.onosproject.yangutils.datamodel.YangIdentity;
-import org.onosproject.yangutils.datamodel.YangIdentityRef;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangLeafList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.datamodel.YangTypeDef;
-import org.onosproject.yangutils.datamodel.utils.ResolvableStatus;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.linker.exceptions.LinkerException;
-import org.onosproject.yangutils.linker.impl.YangLinkerManager;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-import static org.onosproject.yangutils.datamodel.YangNodeType.MODULE_NODE;
-import static org.onosproject.yangutils.linker.impl.YangLinkerUtils.updateFilePriority;
-
-/**
- * Test cases for testing inter file linking for identity.
- */
-public class InterFileIdentityLinkingTest {
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- private final YangUtilManager utilManager = new YangUtilManager();
- private final YangLinkerManager yangLinkerManager = new YangLinkerManager();
-
- /**
- * Checks inter file feature linking with imported file.
- */
- @Test
- public void processIdentityInImportedFile()
- throws IOException, ParserException, MojoExecutionException {
-
- String searchDir = "src/test/resources/interfileidentityimport";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
-
- YangNode selfNode = null;
- YangNode refNode1 = null;
- YangNode refNode2 = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- for (YangNode rootNode : utilManager.getYangNodeSet()) {
- if (rootNode.getName().equals("IdentityIntraFile")) {
- selfNode = rootNode;
- } else if (rootNode.getName().equals("IdentityInModule")) {
- refNode1 = rootNode;
- } else {
- refNode2 = rootNode;
- }
- }
-
- // Check whether the data model tree returned is of type module.
- assertThat(selfNode instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("IdentityIntraFile"));
-
- YangIdentity yangIdentity = (YangIdentity) yangNode.getChild();
- assertThat(yangIdentity.getName(), is("ipv4-address-family"));
- assertThat(yangIdentity.getBaseNode().getBaseIdentifier().getName(), is("ref-address-family"));
- assertThat(yangIdentity.getBaseNode().getReferredIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentity.getBaseNode().getResolvableStatus(), is(ResolvableStatus.RESOLVED));
-
- yangIdentity = (YangIdentity) yangNode.getChild().getNextSibling();
- assertThat(yangIdentity.getName(), is("ipv6-address-family"));
- assertThat(yangIdentity.getBaseNode().getBaseIdentifier().getName(), is("ref-address-family"));
- assertThat(yangIdentity.getBaseNode().getReferredIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentity.getBaseNode().getResolvableStatus(), is(ResolvableStatus.RESOLVED));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("tunnel"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("identityref"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.IDENTITYREF));
- YangIdentityRef yangIdentityRef = (YangIdentityRef) leafInfo.getDataType().getDataTypeExtendedInfo();
- assertThat(yangIdentityRef.getName(), is("ref-address-family"));
- assertThat(yangIdentityRef.getBaseIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentityRef.getReferredIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentityRef.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
-
- ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList leafListInfo = leafListIterator.next();
-
- // Check whether the information in the leaf is correct.
- assertThat(leafListInfo.getName(), is("network-ref"));
- assertThat(leafListInfo.getDataType().getDataTypeName(), is("identityref"));
- assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.IDENTITYREF));
- yangIdentityRef = (YangIdentityRef) (leafListInfo.getDataType().getDataTypeExtendedInfo());
- assertThat(yangIdentityRef.getBaseIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentityRef.getReferredIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentityRef.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
-
- }
-
- /**
- * Checks inter file feature linking with included file.
- */
- @Test
- public void processIdentityInIncludedFile()
- throws IOException, ParserException, MojoExecutionException {
-
- String searchDir = "src/test/resources/interfileidentityinlude";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
-
- YangNode selfNode = null;
- YangNode refNode1 = null;
- YangNode refNode2 = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Carry out linking of sub module with module.
- yangLinkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- // Add references to include list.
- yangLinkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- for (YangNode rootNode : utilManager.getYangNodeSet()) {
- if (rootNode.getName().equals("syslog3")) {
- selfNode = rootNode;
- } else if (rootNode.getName().equals("syslog4")) {
- refNode1 = rootNode;
- } else {
- refNode2 = rootNode;
- }
- }
-
- // Check whether the data model tree returned is of type module.
- assertThat(selfNode instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("syslog3"));
-
- YangIdentity yangIdentity = (YangIdentity) yangNode.getChild();
- assertThat(yangIdentity.getName(), is("ipv4-address-family"));
- assertThat(yangIdentity.getBaseNode().getBaseIdentifier().getName(), is("ref-address-family"));
- assertThat(yangIdentity.getBaseNode().getReferredIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentity.getBaseNode().getResolvableStatus(), is(ResolvableStatus.RESOLVED));
-
- yangIdentity = (YangIdentity) yangNode.getChild().getNextSibling();
- assertThat(yangIdentity.getName(), is("ipv6-address-family"));
- assertThat(yangIdentity.getBaseNode().getBaseIdentifier().getName(), is("ref-address-family"));
- assertThat(yangIdentity.getBaseNode().getReferredIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentity.getBaseNode().getResolvableStatus(), is(ResolvableStatus.RESOLVED));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("tunnel"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("identityref"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.IDENTITYREF));
- YangIdentityRef yangIdentityRef = (YangIdentityRef) leafInfo.getDataType().getDataTypeExtendedInfo();
- assertThat(yangIdentityRef.getName(), is("ref-address-family"));
- assertThat(yangIdentityRef.getBaseIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentityRef.getReferredIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentityRef.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
-
- ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList leafListInfo = leafListIterator.next();
-
- // Check whether the information in the leaf is correct.
- assertThat(leafListInfo.getName(), is("network-ref"));
- assertThat(leafListInfo.getDataType().getDataTypeName(), is("identityref"));
- assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.IDENTITYREF));
- yangIdentityRef = (YangIdentityRef) (leafListInfo.getDataType().getDataTypeExtendedInfo());
- assertThat(yangIdentityRef.getBaseIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentityRef.getReferredIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentityRef.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
- }
-
- /**
- * Checks inter file feature linking with imported file with dependency.
- */
- @Test
- public void processIdentityInImportedFileWithDependency()
- throws IOException, ParserException, MojoExecutionException {
-
- String searchDir = "src/test/resources/interfileidentityimportdependency";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
-
- YangNode selfNode = null;
- YangNode refNode1 = null;
- YangNode refNode2 = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- for (YangNode rootNode : utilManager.getYangNodeSet()) {
- if (rootNode.getName().equals("syslog1")) {
- selfNode = rootNode;
- } else if (rootNode.getName().equals("syslog2")) {
- refNode1 = rootNode;
- } else {
- refNode2 = rootNode;
- }
- }
-
- // Check whether the data model tree returned is of type module.
- assertThat(selfNode instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("syslog1"));
-
- YangIdentity yangIdentity = (YangIdentity) yangNode.getChild();
- assertThat(yangIdentity.getName(), is("ipv4-address-family"));
- assertThat(yangIdentity.getBaseNode().getBaseIdentifier().getName(), is("ref-address-family"));
- assertThat(yangIdentity.getBaseNode().getReferredIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentity.getBaseNode().getResolvableStatus(), is(ResolvableStatus.RESOLVED));
-
- yangIdentity = (YangIdentity) yangNode.getChild().getNextSibling();
- assertThat(yangIdentity.getName(), is("ipv6-address-family"));
- assertThat(yangIdentity.getBaseNode().getBaseIdentifier().getName(), is("ref-address-family"));
- assertThat(yangIdentity.getBaseNode().getReferredIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentity.getBaseNode().getResolvableStatus(), is(ResolvableStatus.RESOLVED));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("tunnel"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("identityref"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.IDENTITYREF));
- YangIdentityRef yangIdentityRef = (YangIdentityRef) leafInfo.getDataType().getDataTypeExtendedInfo();
- assertThat(yangIdentityRef.getName(), is("ref-address-family"));
- assertThat(yangIdentityRef.getBaseIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentityRef.getReferredIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentityRef.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
-
- ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList leafListInfo = leafListIterator.next();
-
- // Check whether the information in the leaf is correct.
- assertThat(leafListInfo.getName(), is("network-ref"));
- assertThat(leafListInfo.getDataType().getDataTypeName(), is("identityref"));
- assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.IDENTITYREF));
- yangIdentityRef = (YangIdentityRef) (leafListInfo.getDataType().getDataTypeExtendedInfo());
- assertThat(yangIdentityRef.getBaseIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentityRef.getReferredIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentityRef.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
- }
-
- /**
- * Checks inter file feature linking with included file with dependency.
- */
- @Test
- public void processIdentityInIncludedFileWithDependency()
- throws IOException, ParserException, MojoExecutionException {
-
- String searchDir = "src/test/resources/interfileidentityincludedependency";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
-
- YangNode selfNode = null;
- YangNode refNode1 = null;
- YangNode refNode2 = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Carry out linking of sub module with module.
- yangLinkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
-
- // Add references to include list.
- yangLinkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- for (YangNode rootNode : utilManager.getYangNodeSet()) {
- if (rootNode.getName().equals("syslog1")) {
- selfNode = rootNode;
- } else if (rootNode.getName().equals("syslog2")) {
- refNode1 = rootNode;
- } else {
- refNode2 = rootNode;
- }
- }
-
- // Check whether the data model tree returned is of type module.
- assertThat(selfNode instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("syslog1"));
-
- YangIdentity yangIdentity = (YangIdentity) yangNode.getChild();
- assertThat(yangIdentity.getName(), is("ipv4-address-family"));
- assertThat(yangIdentity.getBaseNode().getBaseIdentifier().getName(), is("ref-address-family"));
- assertThat(yangIdentity.getBaseNode().getReferredIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentity.getBaseNode().getResolvableStatus(), is(ResolvableStatus.RESOLVED));
-
- yangIdentity = (YangIdentity) yangNode.getChild().getNextSibling();
- assertThat(yangIdentity.getName(), is("ipv6-address-family"));
- assertThat(yangIdentity.getBaseNode().getBaseIdentifier().getName(), is("ref-address-family"));
- assertThat(yangIdentity.getBaseNode().getReferredIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentity.getBaseNode().getResolvableStatus(), is(ResolvableStatus.RESOLVED));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("tunnel"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("identityref"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.IDENTITYREF));
- YangIdentityRef yangIdentityRef = (YangIdentityRef) leafInfo.getDataType().getDataTypeExtendedInfo();
- assertThat(yangIdentityRef.getName(), is("ref-address-family"));
- assertThat(yangIdentityRef.getBaseIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentityRef.getReferredIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentityRef.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
-
- ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList leafListInfo = leafListIterator.next();
-
- // Check whether the information in the leaf is correct.
- assertThat(leafListInfo.getName(), is("network-ref"));
- assertThat(leafListInfo.getDataType().getDataTypeName(), is("identityref"));
- assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.IDENTITYREF));
- yangIdentityRef = (YangIdentityRef) (leafListInfo.getDataType().getDataTypeExtendedInfo());
- assertThat(yangIdentityRef.getBaseIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentityRef.getReferredIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentityRef.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
- }
-
- /**
- * Checks inter file feature linking with imported file with dependency
- * feature undefined.
- */
- @Test
- public void processIdentityInImportedFileWithDependencyUndefined()
- throws IOException, LinkerException, MojoExecutionException {
- thrown.expect(LinkerException.class);
- thrown.expectMessage("YANG file error: Unable to find base identity for given base");
-
- String searchDir = "src/test/resources/interfileidentityimportdependencyUndefined";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
-
- YangNode selfNode = null;
- YangNode refNode1 = null;
- YangNode refNode2 = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
- }
-
- /**
- * Checks inter file feature linking with included file with dependency
- * feature undefined.
- */
- @Test
- public void processIdentityInIncludedFileWithDependencyUndefined()
- throws IOException, LinkerException, MojoExecutionException {
- thrown.expect(LinkerException.class);
- thrown.expectMessage("YANG file error: Unable to find base identity for given base");
-
- String searchDir = "src/test/resources/interfileidentityincludedependencyUndefined";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Carry out linking of sub module with module.
- yangLinkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- // Add references to include list.
- yangLinkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
-
- // Update the priority for all the files.
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
- }
-
- /**
- * Checks inter file feature linking with imported file.
- */
- @Test
- public void processIdentityTypedefUnresolvedInImportedFile()
- throws IOException, ParserException, MojoExecutionException {
-
- String searchDir = "src/test/resources/interfileidentitytypedef";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
-
- YangNode selfNode = null;
- YangNode refNode1 = null;
- YangNode refNode2 = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- for (YangNode rootNode : utilManager.getYangNodeSet()) {
- if (rootNode.getName().equals("IdentityIntraFile")) {
- selfNode = rootNode;
- } else if (rootNode.getName().equals("IdentityInModule")) {
- refNode1 = rootNode;
- } else {
- refNode2 = rootNode;
- }
- }
- // Check whether the data model tree returned is of type module.
- assertThat(selfNode instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("IdentityIntraFile"));
-
- YangIdentity yangIdentity = (YangIdentity) yangNode.getChild();
- assertThat(yangIdentity.getName(), is("ipv4-address-family"));
- assertThat(yangIdentity.getBaseNode().getBaseIdentifier().getName(), is("ref-address-family"));
- assertThat(yangIdentity.getBaseNode().getReferredIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentity.getBaseNode().getResolvableStatus(), is(ResolvableStatus.RESOLVED));
-
- yangIdentity = (YangIdentity) yangNode.getChild().getNextSibling();
- assertThat(yangIdentity.getName(), is("ipv6-address-family"));
- assertThat(yangIdentity.getBaseNode().getBaseIdentifier().getName(), is("ref-address-family"));
- assertThat(yangIdentity.getBaseNode().getReferredIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentity.getBaseNode().getResolvableStatus(), is(ResolvableStatus.RESOLVED));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("tunnel"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("identityref"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.IDENTITYREF));
- YangIdentityRef yangIdentityRef = (YangIdentityRef) leafInfo.getDataType().getDataTypeExtendedInfo();
- assertThat(yangIdentityRef.getName(), is("ref-address-family"));
- assertThat(yangIdentityRef.getBaseIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentityRef.getReferredIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentityRef.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
-
- ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList leafListInfo = leafListIterator.next();
-
- // Check whether the information in the leaf is correct.
- assertThat(leafListInfo.getName(), is("network-ref"));
- assertThat(leafListInfo.getDataType().getDataTypeName(), is("identityref"));
- assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.IDENTITYREF));
- yangIdentityRef = (YangIdentityRef) (leafListInfo.getDataType().getDataTypeExtendedInfo());
- // Check whether leafref type got resolved.
- assertThat(yangIdentityRef.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
-
- YangTypeDef typedef = (YangTypeDef) yangNode.getChild().getNextSibling().getNextSibling();
- assertThat(typedef.getName(), is("type15"));
-
- YangType type = typedef.getTypeList().iterator().next();
- assertThat(type.getDataType(), is(YangDataTypes.IDENTITYREF));
- assertThat(type.getDataTypeName(), is("identityref"));
-
- YangIdentityRef identityRef = (YangIdentityRef) type.getDataTypeExtendedInfo();
- assertThat(identityRef.getName(), is("ref-address-family"));
- assertThat(identityRef.getBaseIdentity().getName(), is("ref-address-family"));
- assertThat(identityRef.getResolvableStatus(), is(ResolvableStatus.UNRESOLVED));
- }
-
- /**
- * Checks inter file feature linking with imported file.
- */
- @Test
- public void processIdentityTypedefInImportedFile()
- throws IOException, ParserException, MojoExecutionException {
-
- String searchDir = "src/test/resources/interfileidentitytypedef";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
-
- YangNode selfNode = null;
- YangNode refNode1 = null;
- YangNode refNode2 = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- for (YangNode rootNode : utilManager.getYangNodeSet()) {
- if (rootNode.getName().equals("IdentityTypedef")) {
- selfNode = rootNode;
- } else if (rootNode.getName().equals("IdentityInModule")) {
- refNode1 = rootNode;
- } else {
- refNode2 = rootNode;
- }
- }
-
- // Check whether the data model tree returned is of type module.
- assertThat(selfNode instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("IdentityTypedef"));
-
- YangIdentity yangIdentity = (YangIdentity) yangNode.getChild();
- assertThat(yangIdentity.getName(), is("ipv4-address-family"));
- assertThat(yangIdentity.getBaseNode().getBaseIdentifier().getName(), is("ref-address-family"));
- assertThat(yangIdentity.getBaseNode().getReferredIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentity.getBaseNode().getResolvableStatus(), is(ResolvableStatus.RESOLVED));
-
- yangIdentity = (YangIdentity) yangNode.getChild().getNextSibling();
- assertThat(yangIdentity.getName(), is("ipv6-address-family"));
- assertThat(yangIdentity.getBaseNode().getBaseIdentifier().getName(), is("ref-address-family"));
- assertThat(yangIdentity.getBaseNode().getReferredIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentity.getBaseNode().getResolvableStatus(), is(ResolvableStatus.RESOLVED));
-
- YangTypeDef typedef = (YangTypeDef) yangNode.getChild().getNextSibling().getNextSibling();
- assertThat(typedef.getName(), is("type15"));
-
- YangType type = typedef.getTypeList().iterator().next();
- assertThat(type.getDataType(), is(YangDataTypes.IDENTITYREF));
- assertThat(type.getDataTypeName(), is("identityref"));
-
- YangIdentityRef identityRef = (YangIdentityRef) type.getDataTypeExtendedInfo();
- assertThat(identityRef.getName(), is("ref-address-family"));
- assertThat(identityRef.getBaseIdentity().getName(), is("ref-address-family"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("tunnel"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("identityref"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.IDENTITYREF));
- YangIdentityRef yangIdentityRef = (YangIdentityRef) leafInfo.getDataType().getDataTypeExtendedInfo();
- assertThat(yangIdentityRef.getName(), is("ref-address-family"));
- assertThat(yangIdentityRef.getBaseIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentityRef.getReferredIdentity().getName(), is("ref-address-family"));
- assertThat(yangIdentityRef.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
-
- ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList leafListInfo = leafListIterator.next();
-
- // Check whether the information in the leaf is correct.
- assertThat(leafListInfo.getName(), is("network-ref"));
- assertThat(leafListInfo.getDataType().getDataTypeName(), is("identityref"));
- assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.IDENTITYREF));
- yangIdentityRef = (YangIdentityRef) (leafListInfo.getDataType().getDataTypeExtendedInfo());
- // Check whether leafref type got resolved.
- assertThat(yangIdentityRef.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileIfFeatureLinkingTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileIfFeatureLinkingTest.java
deleted file mode 100644
index 4f914ab..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileIfFeatureLinkingTest.java
+++ /dev/null
@@ -1,468 +0,0 @@
-/*
- * 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.plugin.manager;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.ListIterator;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangFeature;
-import org.onosproject.yangutils.datamodel.YangIfFeature;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.linker.impl.YangLinkerManager;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-import static org.onosproject.yangutils.datamodel.YangNodeType.MODULE_NODE;
-import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.INTRA_FILE_RESOLVED;
-import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.RESOLVED;
-import static org.onosproject.yangutils.linker.impl.YangLinkerUtils.updateFilePriority;
-
-/**
- * Test cases for testing inter file linking.
- */
-public class InterFileIfFeatureLinkingTest {
-
- private final YangUtilManager utilManager = new YangUtilManager();
- private final YangLinkerManager yangLinkerManager = new YangLinkerManager();
-
- /**
- * Checks inter file feature linking with imported file.
- */
- @Test
- public void processFeatureInImportedFile()
- throws IOException, ParserException, MojoExecutionException {
-
- String searchDir = "src/test/resources/interfilefeatureimport";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
-
- YangNode selfNode = null;
- YangNode refNode1 = null;
- YangNode refNode2 = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- for (YangNode rootNode : utilManager.getYangNodeSet()) {
- if (rootNode.getName().equals("syslog1")) {
- selfNode = rootNode;
- } else if (rootNode.getName().equals("syslog2")) {
- refNode1 = rootNode;
- } else {
- refNode2 = rootNode;
- }
- }
- // Check whether the data model tree returned is of type module.
- assertThat(selfNode instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("syslog1"));
-
- ListIterator<YangFeature> featureIterator = yangNode.getFeatureList().listIterator();
- YangFeature feature = featureIterator.next();
- assertThat(feature.getName(), is("frr-te"));
-
- YangIfFeature ifFeature = feature.getIfFeatureList().iterator().next();
- assertThat(ifFeature.getName().getName(), is("p2mp-te"));
- assertThat(ifFeature.getName().getPrefix(), is("sys2"));
- assertThat(ifFeature.getResolvableStatus(), is(RESOLVED));
-
- YangContainer container = (YangContainer) selfNode.getChild();
- assertThat(container.getName(), is("speed"));
- YangLeaf leaf = container.getListOfLeaf().iterator().next();
- assertThat(leaf.getName(), is("local-storage-limit"));
-
- List<YangIfFeature> ifFeatureList = leaf.getIfFeatureList();
- ifFeature = ifFeatureList.iterator().next();
- assertThat(ifFeature.getName().getName(), is("frr-te"));
- assertThat(ifFeature.getResolvableStatus(), is(RESOLVED));
- }
-
- /**
- * Checks inter file feature linking with included file.
- */
- @Test
- public void processFeatureInIncludedFile()
- throws IOException, ParserException, MojoExecutionException {
-
- String searchDir = "src/test/resources/interfilefeatureinclude";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
-
- YangNode selfNode = null;
- YangNode refNode1 = null;
- YangNode refNode2 = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Carry out linking of sub module with module.
- yangLinkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- // Add references to include list.
- yangLinkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- for (YangNode rootNode : utilManager.getYangNodeSet()) {
- if (rootNode.getName().equals("syslog3")) {
- selfNode = rootNode;
- } else if (rootNode.getName().equals("syslog4")) {
- refNode1 = rootNode;
- } else {
- refNode2 = rootNode;
- }
- }
-
- // Check whether the data model tree returned is of type module.
- assertThat(selfNode instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("syslog3"));
-
- ListIterator<YangFeature> featureIterator = yangNode.getFeatureList().listIterator();
- YangFeature feature = featureIterator.next();
- assertThat(feature.getName(), is("frr-te"));
-
- YangIfFeature ifFeature = feature.getIfFeatureList().iterator().next();
- assertThat(ifFeature.getName().getName(), is("p2mp-te"));
- assertThat(ifFeature.getResolvableStatus(), is(RESOLVED));
-
- YangContainer container = (YangContainer) selfNode.getChild();
- assertThat(container.getName(), is("speed"));
- YangLeaf leaf = container.getListOfLeaf().iterator().next();
- assertThat(leaf.getName(), is("local-storage-limit"));
-
- List<YangIfFeature> ifFeatureList = leaf.getIfFeatureList();
- ifFeature = ifFeatureList.iterator().next();
- assertThat(ifFeature.getName().getName(), is("frr-te"));
- assertThat(ifFeature.getResolvableStatus(), is(RESOLVED));
- }
-
- /**
- * Checks inter file feature linking with imported file with dependency.
- */
- @Test
- public void processFeatureInImportedFileWithDependency()
- throws IOException, ParserException, MojoExecutionException {
-
- String searchDir = "src/test/resources/interfilefeatureimportdependency";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
-
- YangNode selfNode = null;
- YangNode refNode1 = null;
- YangNode refNode2 = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- // Update the priority for all the files.
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- for (YangNode rootNode : utilManager.getYangNodeSet()) {
- if (rootNode.getName().equals("syslog1")) {
- selfNode = rootNode;
- } else if (rootNode.getName().equals("syslog2")) {
- refNode1 = rootNode;
- } else {
- refNode2 = rootNode;
- }
- }
-
- // Check whether the data model tree returned is of type module.
- assertThat(selfNode instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("syslog1"));
-
- ListIterator<YangFeature> featureIterator = yangNode.getFeatureList().listIterator();
- YangFeature feature = featureIterator.next();
- assertThat(feature.getName(), is("frr-te"));
-
- YangIfFeature ifFeature = feature.getIfFeatureList().iterator().next();
- assertThat(ifFeature.getName().getName(), is("p2mp-te"));
- assertThat(ifFeature.getName().getPrefix(), is("sys2"));
- assertThat(ifFeature.getResolvableStatus(), is(RESOLVED));
-
- YangContainer container = (YangContainer) selfNode.getChild();
- assertThat(container.getName(), is("speed"));
- YangLeaf leaf = container.getListOfLeaf().iterator().next();
- assertThat(leaf.getName(), is("local-storage-limit"));
-
- List<YangIfFeature> ifFeatureList = leaf.getIfFeatureList();
- ifFeature = ifFeatureList.iterator().next();
- assertThat(ifFeature.getName().getName(), is("frr-te"));
- assertThat(ifFeature.getResolvableStatus(), is(RESOLVED));
- }
-
- /**
- * Checks inter file feature linking with included file with dependency.
- */
- @Test
- public void processFeatureInIncludedFileWithDependency()
- throws IOException, ParserException, MojoExecutionException {
-
- String searchDir = "src/test/resources/interfilefeatureincludedependency";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
-
- YangNode selfNode = null;
- YangNode refNode1 = null;
- YangNode refNode2 = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Carry out linking of sub module with module.
- yangLinkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
-
- // Add references to include list.
- yangLinkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- for (YangNode rootNode : utilManager.getYangNodeSet()) {
- if (rootNode.getName().equals("syslog1")) {
- selfNode = rootNode;
- } else if (rootNode.getName().equals("syslog2")) {
- refNode1 = rootNode;
- } else {
- refNode2 = rootNode;
- }
- }
-
- // Check whether the data model tree returned is of type module.
- assertThat(selfNode instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("syslog1"));
-
- ListIterator<YangFeature> featureIterator = yangNode.getFeatureList().listIterator();
- YangFeature feature = featureIterator.next();
- assertThat(feature.getName(), is("frr-te"));
-
- YangIfFeature ifFeature = feature.getIfFeatureList().iterator().next();
- assertThat(ifFeature.getName().getName(), is("p2mp-te"));
- assertThat(ifFeature.getResolvableStatus(), is(RESOLVED));
-
- YangContainer container = (YangContainer) selfNode.getChild();
- assertThat(container.getName(), is("speed"));
- YangLeaf leaf = container.getListOfLeaf().iterator().next();
- assertThat(leaf.getName(), is("local-storage-limit"));
-
- List<YangIfFeature> ifFeatureList = leaf.getIfFeatureList();
- ifFeature = ifFeatureList.iterator().next();
- assertThat(ifFeature.getName().getName(), is("frr-te"));
- assertThat(ifFeature.getResolvableStatus(), is(RESOLVED));
- }
-
- /**
- * Checks inter file feature linking with imported file with dependency
- * feature undefined.
- */
- @Test
- public void processFeatureInImportedFileWithDependencyUndefined()
- throws IOException, ParserException, MojoExecutionException {
-
- String searchDir = "src/test/resources/interfilefeatureimportdependencyUndefined";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
-
- YangNode selfNode = null;
- YangNode refNode1 = null;
- YangNode refNode2 = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- for (YangNode rootNode : utilManager.getYangNodeSet()) {
- if (rootNode.getName().equals("syslog1")) {
- selfNode = rootNode;
- } else if (rootNode.getName().equals("syslog2")) {
- refNode1 = rootNode;
- } else {
- refNode2 = rootNode;
- }
- }
-
- // Check whether the data model tree returned is of type module.
- assertThat(selfNode instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("syslog1"));
-
- ListIterator<YangFeature> featureIterator = yangNode.getFeatureList().listIterator();
- YangFeature feature = featureIterator.next();
- assertThat(feature.getName(), is("frr-te"));
-
- YangIfFeature ifFeature = feature.getIfFeatureList().iterator().next();
- assertThat(ifFeature.getName().getName(), is("p2mp-te"));
- assertThat(ifFeature.getName().getPrefix(), is("sys2"));
- assertThat(ifFeature.getResolvableStatus(), is(INTRA_FILE_RESOLVED));
-
- YangContainer container = (YangContainer) selfNode.getChild();
- assertThat(container.getName(), is("speed"));
- YangLeaf leaf = container.getListOfLeaf().iterator().next();
- assertThat(leaf.getName(), is("local-storage-limit"));
-
- List<YangIfFeature> ifFeatureList = leaf.getIfFeatureList();
- ifFeature = ifFeatureList.iterator().next();
- assertThat(ifFeature.getName().getName(), is("frr-te"));
- assertThat(ifFeature.getResolvableStatus(), is(INTRA_FILE_RESOLVED));
- }
-
- /**
- * Checks inter file feature linking with included file with dependency
- * feature undefined.
- */
- @Test
- public void processFeatureInIncludedFileWithDependencyUndefined()
- throws IOException, ParserException, MojoExecutionException {
-
- String searchDir = "src/test/resources/interfilefeatureincludedependencyUndefined";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
-
- YangNode selfNode = null;
- YangNode refNode1 = null;
- YangNode refNode2 = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Carry out linking of sub module with module.
- yangLinkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- // Add references to include list.
- yangLinkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- for (YangNode rootNode : utilManager.getYangNodeSet()) {
- if (rootNode.getName().equals("syslog1")) {
- selfNode = rootNode;
- } else if (rootNode.getName().equals("syslog2")) {
- refNode1 = rootNode;
- } else {
- refNode2 = rootNode;
- }
- }
-
- // Check whether the data model tree returned is of type module.
- assertThat(selfNode instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("syslog1"));
-
- ListIterator<YangFeature> featureIterator = yangNode.getFeatureList().listIterator();
- YangFeature feature = featureIterator.next();
- assertThat(feature.getName(), is("frr-te"));
-
- YangIfFeature ifFeature = feature.getIfFeatureList().iterator().next();
- assertThat(ifFeature.getName().getName(), is("p2mp-te"));
- assertThat(ifFeature.getResolvableStatus(), is(INTRA_FILE_RESOLVED));
-
- YangContainer container = (YangContainer) selfNode.getChild();
- assertThat(container.getName(), is("speed"));
- YangLeaf leaf = container.getListOfLeaf().iterator().next();
- assertThat(leaf.getName(), is("local-storage-limit"));
-
- List<YangIfFeature> ifFeatureList = leaf.getIfFeatureList();
- ifFeature = ifFeatureList.iterator().next();
- assertThat(ifFeature.getName().getName(), is("frr-te"));
- assertThat(ifFeature.getResolvableStatus(), is(INTRA_FILE_RESOLVED));
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileLeafrefLinkingTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileLeafrefLinkingTest.java
deleted file mode 100644
index dd1029e..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileLeafrefLinkingTest.java
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- * 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.plugin.manager;
-
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.ListIterator;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangLeafRef;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.linker.impl.YangLinkerManager;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-import static org.onosproject.yangutils.datamodel.YangNodeType.MODULE_NODE;
-import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.RESOLVED;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.LEAFREF;
-import static org.onosproject.yangutils.linker.impl.YangLinkerUtils.updateFilePriority;
-
-/**
- * Test cases for testing leafref inter file linking.
- */
-public class InterFileLeafrefLinkingTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- private final YangUtilManager utilManager = new YangUtilManager();
- private final YangLinkerManager yangLinkerManager = new YangLinkerManager();
-
- /**
- * Checks inter file leafref linking.
- */
- @Test
- public void processInterFileLeafrefLinking()
- throws IOException, ParserException, MojoExecutionException {
-
- String searchDir = "src/test/resources/leafreflinker/interfile/interfileleafrefwithimport";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- YangNode refNode = null;
- YangNode selfNode = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("module1")) {
- selfNode = rootNode;
- refNode = yangNodeIterator.next();
- } else {
- refNode = rootNode;
- selfNode = yangNodeIterator.next();
- }
-
- // Check whether the data model tree returned is of type module.
- assertThat(selfNode instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("module1"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
- assertThat(leafInfo.getDataType().getDataType(), is(LEAFREF));
-
- // Check whether the data model tree returned is of type module.
- assertThat(refNode instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(refNode.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode1 = (YangModule) refNode;
- assertThat(yangNode1.getName(), is("module2"));
- YangLeaf leafInfo1 = yangNode1.getListOfLeaf().listIterator().next();
-
- YangLeafRef leafref = (YangLeafRef) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- assertThat(leafref.getReferredLeafOrLeafList(), is(leafInfo1));
- assertThat(leafref.getResolvableStatus(), is(RESOLVED));
-
- assertThat(leafref.getEffectiveDataType().getDataType(),
- is(YangDataTypes.STRING));
- }
-
- /**
- * Checks inter file resolution when leafref from grouping refers to other file.
- */
- @Test
- public void processInterFileLeafrefFromGroupingRefersToOtherFile()
- throws IOException, ParserException {
-
- String searchDir = "src/test/resources/leafreflinker/interfile/interfileleafreffromgroupingreferstootherfile";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- YangNode selfNode = null;
- YangNode refNode = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("module1")) {
- selfNode = rootNode;
- refNode = yangNodeIterator.next();
- } else {
- refNode = rootNode;
- selfNode = yangNodeIterator.next();
- }
-
- // Check whether the data model tree returned is of type module.
- assertThat(selfNode instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("module1"));
-
- YangList list = (YangList) yangNode.getChild().getChild();
- ListIterator<YangLeaf> leafIterator = list.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("link-tp"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
- assertThat(leafInfo.getDataType().getDataType(), is(LEAFREF));
-
- YangLeafRef leafref = (YangLeafRef) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- YangLeaf leafInfo2 = (YangLeaf) leafref.getReferredLeafOrLeafList();
- assertThat(leafref.getReferredLeafOrLeafList(), is(leafInfo2));
- assertThat(leafref.getResolvableStatus(), is(RESOLVED));
-
- assertThat(leafref.getEffectiveDataType().getDataType(),
- is(YangDataTypes.STRING));
- }
-
- /**
- * Checks inter file resolution when leafref from grouping with prefix is changed properly during cloning.
- */
- @Test
- public void processInterFileLeafrefFromGroupingWithPrefixIsCloned()
- throws IOException, ParserException {
-
- String searchDir = "src/test/resources/leafreflinker/interfile/leafrefInGroupingWithPrefix";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- YangNode selfNode = null;
- YangNode refNode = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("LeafrefInGroupingOfModule1")) {
- selfNode = rootNode;
- refNode = yangNodeIterator.next();
- } else {
- refNode = rootNode;
- selfNode = yangNodeIterator.next();
- }
-
- // Check whether the data model tree returned is of type module.
- assertThat(selfNode instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("LeafrefInGroupingOfModule1"));
-
- // Check whether the module name is set correctly.
- YangModule yangNode1 = (YangModule) refNode;
- assertThat(yangNode1.getName(), is("GroupingCopiedInModule2"));
-
- YangContainer yangContainer = (YangContainer) yangNode1.getChild();
-
- ListIterator<YangLeaf> leafIterator = yangContainer.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("network-ref"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
- assertThat(leafInfo.getDataType().getDataType(), is(LEAFREF));
-
- YangLeafRef leafref = (YangLeafRef) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- YangLeaf leafInfo2 = (YangLeaf) leafref.getReferredLeafOrLeafList();
- assertThat(leafref.getReferredLeafOrLeafList(), is(leafInfo2));
- assertThat(leafref.getResolvableStatus(), is(RESOLVED));
-
- assertThat(leafref.getEffectiveDataType().getDataType(),
- is(YangDataTypes.STRING));
- }
-
- /**
- * Checks inter file resolution when leafref from grouping with prefix is changed properly during cloning with
- * multi reference.
- */
- @Test
- public void processInterFileLeafrefFromGroupingWithPrefixIsClonedMultiReference()
- throws IOException, ParserException {
-
- String searchDir = "src/test/resources/leafreflinker/interfile/leafrefInGroupingWithPrefixAndManyReference";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- YangNode selfNode = null;
- YangNode refNode = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("ietf-network")) {
- selfNode = rootNode;
- refNode = yangNodeIterator.next();
- } else {
- refNode = rootNode;
- selfNode = yangNodeIterator.next();
- }
-
- // Check whether the data model tree returned is of type module.
- assertThat(selfNode instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("ietf-network"));
-
- // Check whether the module name is set correctly.
- YangModule yangNode1 = (YangModule) refNode;
- assertThat(yangNode1.getName(), is("ietf-te-topology"));
-
- YangContainer yangContainer = (YangContainer) yangNode1.getChild().getNextSibling();
- ListIterator<YangLeaf> leafIterator;
- YangLeaf leafInfo;
-
- leafIterator = yangContainer.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
- leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("node-ref"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
- assertThat(leafInfo.getDataType().getDataType(), is(LEAFREF));
-
- YangLeafRef leafref = (YangLeafRef) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- YangLeaf leafInfo2 = (YangLeaf) leafref.getReferredLeafOrLeafList();
- assertThat(leafref.getReferredLeafOrLeafList(), is(leafInfo2));
- assertThat(leafref.getResolvableStatus(), is(RESOLVED));
-
- assertThat(leafref.getEffectiveDataType().getDataType(),
- is(YangDataTypes.DERIVED));
-
- leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("network-ref"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
- assertThat(leafInfo.getDataType().getDataType(), is(LEAFREF));
-
- YangLeafRef leafref1 = (YangLeafRef) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- YangLeaf leafInfo4 = (YangLeaf) leafref1.getReferredLeafOrLeafList();
- assertThat(leafref1.getReferredLeafOrLeafList(), is(leafInfo4));
- assertThat(leafref1.getResolvableStatus(), is(RESOLVED));
-
- assertThat(leafref1.getEffectiveDataType().getDataType(),
- is(YangDataTypes.DERIVED));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileLinkingTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileLinkingTest.java
deleted file mode 100644
index d899e67..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileLinkingTest.java
+++ /dev/null
@@ -1,929 +0,0 @@
-/*
- * 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.plugin.manager;
-
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.onosproject.yangutils.datamodel.YangAugment;
-import org.onosproject.yangutils.datamodel.YangChoice;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangDerivedInfo;
-import org.onosproject.yangutils.datamodel.YangGrouping;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangTypeDef;
-import org.onosproject.yangutils.datamodel.YangUses;
-import org.onosproject.yangutils.datamodel.utils.ResolvableStatus;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.linker.impl.YangLinkerManager;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-import static org.onosproject.yangutils.datamodel.YangNodeType.MODULE_NODE;
-import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.RESOLVED;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.DERIVED;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.STRING;
-import static org.onosproject.yangutils.linker.impl.YangLinkerUtils.updateFilePriority;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
-
-/**
- * Test cases for testing inter file linking.
- */
-public class InterFileLinkingTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
- private final YangUtilManager utilManager = new YangUtilManager();
- private final YangLinkerManager yangLinkerManager = new YangLinkerManager();
-
- /**
- * Checks inter file type linking.
- */
- @Test
- public void processInterFileTypeLinking()
- throws IOException, ParserException, MojoExecutionException {
-
- String searchDir = "src/test/resources/interfiletype";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
-
- YangNode refNode = null;
- YangNode selfNode = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("module1")) {
- selfNode = rootNode;
- refNode = yangNodeIterator.next();
- } else {
- refNode = rootNode;
- selfNode = yangNodeIterator.next();
- }
-
- // Check whether the data model tree returned is of type module.
- assertThat(selfNode instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("module1"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
- assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
-
- assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
- is((YangTypeDef) refNode.getChild()));
-
- assertThat(leafInfo.getDataType().getResolvableStatus(), is(RESOLVED));
-
- YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- // Check for the effective built-in type.
- assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
-
- // Check for the restriction.
- assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
- assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue()));
- }
-
- /**
- * Checks inter file uses linking.
- */
- @Test
- public void processInterFileUsesLinking()
- throws IOException, ParserException, MojoExecutionException {
-
- String searchDir = "src/test/resources/interfileuses";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
-
- YangNode refNode = null;
- YangNode selfNode = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("module1")) {
- selfNode = rootNode;
- refNode = yangNodeIterator.next();
- } else {
- refNode = rootNode;
- selfNode = yangNodeIterator.next();
- }
-
- // Check whether the data model tree returned is of type module.
- assertThat(selfNode instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("module1"));
-
- ListIterator<YangLeaf> leafIterator;
- YangLeaf leafInfo;
-
- // Check whether grouping is the sibling of module's child.
- assertThat(refNode.getChild() instanceof YangGrouping, is(true));
-
- YangGrouping grouping = (YangGrouping) refNode.getChild();
- leafIterator = grouping.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
-
- // 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().getDataType(), is(YangDataTypes.STRING));
-
- // Check whether uses is module's child.
- assertThat(yangNode.getChild() instanceof YangUses, is(true));
- YangUses uses = (YangUses) yangNode.getChild();
-
- // Check whether uses get resolved.
- assertThat(uses.getResolvableStatus(),
- is(ResolvableStatus.RESOLVED));
- }
-
- /**
- * Checks inter file type linking with include list.
- */
- @Test
- public void processInterFileTypeLinkingWithIncludeList()
- throws IOException, ParserException, MojoExecutionException {
-
- String searchDir = "src/test/resources/interfiletypewithinclude";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
-
- YangNode refNode = null;
- YangNode selfNode = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Carry out linking of sub module with module.
- yangLinkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
-
- // Add reference to include list.
- yangLinkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("module1")) {
- selfNode = rootNode;
- refNode = yangNodeIterator.next();
- } else {
- refNode = rootNode;
- selfNode = yangNodeIterator.next();
- }
-
- // Check whether the data model tree returned is of type module.
- assertThat(selfNode instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("module1"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
- assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
-
- assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
- is((YangTypeDef) refNode.getChild()));
-
- assertThat(leafInfo.getDataType().getResolvableStatus(), is(RESOLVED));
-
- YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- // Check for the effective built-in type.
- assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
-
- // Check for the restriction.
- assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
- assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue()));
- }
-
- /**
- * Checks inter file uses linking with include list.
- */
- @Test
- public void processInterFileUsesLinkingWithInclude()
- throws IOException, ParserException, MojoExecutionException {
-
- String searchDir = "src/test/resources/interfileuseswithinclude";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
-
- YangNode refNode = null;
- YangNode selfNode = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Carry out linking of sub module with module.
- yangLinkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
-
- // Add reference to include list.
- yangLinkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("module1")) {
- selfNode = rootNode;
- refNode = yangNodeIterator.next();
- } else {
- refNode = rootNode;
- selfNode = yangNodeIterator.next();
- }
-
- // Check whether the data model tree returned is of type module.
- assertThat(selfNode instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("module1"));
-
- ListIterator<YangLeaf> leafIterator;
- YangLeaf leafInfo;
-
- // Check whether grouping is the sibling of module's child.
- assertThat(refNode.getChild() instanceof YangGrouping, is(true));
-
- YangGrouping grouping = (YangGrouping) refNode.getChild();
- leafIterator = grouping.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
-
- // 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().getDataType(), is(YangDataTypes.STRING));
-
- // Check whether uses is module's child.
- assertThat(yangNode.getChild() instanceof YangUses, is(true));
- YangUses uses = (YangUses) yangNode.getChild();
-
- // Check whether uses get resolved.
- assertThat(uses.getResolvableStatus(),
- is(ResolvableStatus.RESOLVED));
- }
-
- /**
- * Checks inter file type linking with revision.
- */
- @Test
- public void processInterFileTypeLinkingWithRevision()
- throws IOException, ParserException, MojoExecutionException {
-
- String searchDir = "src/test/resources/interfiletypewithrevision";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
-
- YangNode refNode = null;
- YangNode selfNode = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("module1")) {
- selfNode = rootNode;
- refNode = yangNodeIterator.next();
- } else {
- refNode = rootNode;
- selfNode = yangNodeIterator.next();
- }
-
- // Check whether the data model tree returned is of type module.
- assertThat(selfNode instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("module1"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
- assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
-
- assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
- is((YangTypeDef) refNode.getChild()));
-
- assertThat(leafInfo.getDataType().getResolvableStatus(), is(RESOLVED));
-
- YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- // Check for the effective built-in type.
- assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
-
- // Check for the restriction.
- assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
- assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue()));
- }
-
- /**
- * Checks inter file type linking with revision in name.
- */
- @Test
- public void processInterFileTypeLinkingWithRevisionInName()
- throws IOException, ParserException, MojoExecutionException {
-
- String searchDir = "src/test/resources/interfiletypewithrevisioninname";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
-
- YangNode refNode = null;
- YangNode selfNode = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("module1")) {
- selfNode = rootNode;
- refNode = yangNodeIterator.next();
- } else {
- refNode = rootNode;
- selfNode = yangNodeIterator.next();
- }
-
- // Check whether the data model tree returned is of type module.
- assertThat(selfNode instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("module1"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
- assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
-
- assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
- is((YangTypeDef) refNode.getChild()));
-
- assertThat(leafInfo.getDataType().getResolvableStatus(), is(RESOLVED));
-
- YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- // Check for the effective built-in type.
- assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
-
- // Check for the restriction.
- assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
- assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue()));
- }
-
- /**
- * Checks hierarchical inter file type linking.
- */
- @Test
- public void processHierarchicalInterFileTypeLinking()
- throws IOException, ParserException, MojoExecutionException {
-
- String searchDir = "src/test/resources/hierarchicalinterfiletype";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
-
- YangNode refNode1 = null;
- YangNode refNode2 = null;
- YangNode selfNode = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- for (YangNode rootNode : utilManager.getYangNodeSet()) {
- if (rootNode.getName().equals("ietf-network-topology")) {
- selfNode = rootNode;
- } else if (rootNode.getName().equals("ietf-network")) {
- refNode1 = rootNode;
- } else {
- refNode2 = rootNode;
- }
- }
-
- // Check whether the data model tree returned is of type module.
- assertThat(selfNode instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("ietf-network-topology"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("source-node"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("node-id"));
- assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
-
- assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
- is((YangTypeDef) refNode1.getChild()));
-
- assertThat(leafInfo.getDataType().getResolvableStatus(), is(RESOLVED));
-
- YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- // Check for the effective built-in type.
- assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
-
- // Check for the restriction.
- assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
- assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue()));
- }
-
- /**
- * Checks hierarchical intra with inter file type linking.
- */
- @Test
- public void processHierarchicalIntraWithInterFileTypeLinking()
- throws IOException, ParserException, MojoExecutionException {
-
- String searchDir = "src/test/resources/hierarchicalintrawithinterfiletype";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
-
- YangNode refNode1 = null;
- YangNode selfNode = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- for (YangNode rootNode : utilManager.getYangNodeSet()) {
- if (rootNode.getName().equals("ietf-network")) {
- selfNode = rootNode;
- } else if (rootNode.getName().equals("ietf-inet-types")) {
- refNode1 = rootNode;
- }
- }
-
- // Check whether the data model tree returned is of type module.
- assertThat(selfNode instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("ietf-network"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("node-ref"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("node-id"));
- assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
-
- assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
- is((YangTypeDef) selfNode.getChild()));
-
- assertThat(leafInfo.getDataType().getResolvableStatus(), is(RESOLVED));
-
- YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- // Check for the effective built-in type.
- assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
-
- // Check for the restriction.
- assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
- assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue()));
- }
-
- /**
- * Checks hierarchical intra with inter file type linking.
- */
- @Test
- public void interFileWithUsesReferringType()
- throws IOException, ParserException, MojoExecutionException {
-
- String searchDir = "src/test/resources/interfilewithusesreferringtype";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.resolveDependenciesUsingLinker();
-
- YangPluginConfig yangPluginConfig = new YangPluginConfig();
- yangPluginConfig.setCodeGenDir("target/interfilewithusesreferringtype/");
-
- utilManager.translateToJava(yangPluginConfig);
-
- deleteDirectory("target/interfilewithusesreferringtype/");
-
- }
-
- /**
- * Checks hierarchical intra with inter file type linking.
- */
- @Test
- public void file1UsesFile2TypeDefFile3Type()
- throws IOException, ParserException, MojoExecutionException {
-
- String searchDir = "src/test/resources/file1UsesFile2TypeDefFile3Type";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.resolveDependenciesUsingLinker();
-
- YangPluginConfig yangPluginConfig = new YangPluginConfig();
- yangPluginConfig.setCodeGenDir("target/file1UsesFile2TypeDefFile3Type/");
-
- utilManager.translateToJava(yangPluginConfig);
-
- deleteDirectory("target/file1UsesFile2TypeDefFile3Type/");
-
- }
-
- /**
- * Checks hierarchical intra with inter file type linking.
- */
- @Test
- public void interFileIetf()
- throws IOException, ParserException, MojoExecutionException {
-
- String searchDir = "src/test/resources/interfileietf";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.resolveDependenciesUsingLinker();
-
- YangPluginConfig yangPluginConfig = new YangPluginConfig();
- yangPluginConfig.setCodeGenDir("target/interfileietf/");
-
- utilManager.translateToJava(yangPluginConfig);
-
- deleteDirectory("target/interfileietf/");
-
- }
-
- /**
- * Checks hierarchical intra with inter file type linking.
- */
- @Test
- public void usesInContainer()
- throws IOException, ParserException, MojoExecutionException {
-
- String searchDir = "src/test/resources/usesInContainer";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.resolveDependenciesUsingLinker();
-
- YangPluginConfig yangPluginConfig = new YangPluginConfig();
- yangPluginConfig.setCodeGenDir("target/usesInContainer/");
-
- utilManager.translateToJava(yangPluginConfig);
-
- deleteDirectory("target/usesInContainer/");
-
- }
-
- /**
- * Checks hierarchical intra with inter file type linking.
- */
- @Test
- public void groupingNodeSameAsModule()
- throws IOException, ParserException, MojoExecutionException {
-
- String searchDir = "src/test/resources/groupingNodeSameAsModule";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.resolveDependenciesUsingLinker();
-
- YangPluginConfig yangPluginConfig = new YangPluginConfig();
- yangPluginConfig.setCodeGenDir("target/groupingNodeSameAsModule/");
-
- utilManager.translateToJava(yangPluginConfig);
-
- deleteDirectory("target/groupingNodeSameAsModule/");
-
- }
-
- /**
- * Checks priority of the file.
- */
- @Test
- public void interFilePriority()
- throws IOException, ParserException, MojoExecutionException {
-
- String searchDir = "src/test/resources/interfilepriority";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.resolveDependenciesUsingLinker();
-
- YangNode selfNode = null;
- YangNode refNode1 = null;
- YangNode refNode2 = null;
-
- for (YangNode rootNode : utilManager.getYangNodeSet()) {
- if (rootNode.getName().equals("module1")) {
- selfNode = rootNode;
- } else if (rootNode.getName().equals("module2")) {
- refNode1 = rootNode;
- } else {
- refNode2 = rootNode;
- }
- }
-
- // Check whether the data model tree returned is of type module.
- assertThat(selfNode instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("module1"));
- assertThat(yangNode.getPriority(), is(2));
-
- // Check whether the data model tree returned is of type module.
- assertThat(refNode1 instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(refNode1.getNodeType(), is(MODULE_NODE));
-
- YangModule referredNode1 = (YangModule) refNode1;
- assertThat(referredNode1.getName(), is("module2"));
- assertThat(referredNode1.getPriority(), is(3));
- }
-
- /**
- * Checks contents of uses are copied as child of grouping.
- */
- @Test
- public void usesInsideChildOfGrouping()
- throws IOException, ParserException, MojoExecutionException {
-
- String searchDir = "src/test/resources/usesInsideChildOfGrouping";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.resolveDependenciesUsingLinker();
-
- YangNode selfNode = null;
- YangNode refNode1 = null;
-
- for (YangNode rootNode : utilManager.getYangNodeSet()) {
- if (rootNode.getName().equals("ietf-network")) {
- selfNode = rootNode;
- } else if (rootNode.getName().equals("ietf-te-topology")) {
- refNode1 = rootNode;
- }
- }
-
- // Check whether the data model tree returned is of type module.
- assertThat(selfNode instanceof YangModule, is(true));
- assertThat(selfNode.getNodeType(), is(MODULE_NODE));
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("ietf-network"));
-
- YangModule refNode = (YangModule) refNode1;
- assertThat(refNode.getName(), is("ietf-te-topology"));
-
- YangAugment augment = ((YangAugment) refNode.getChild().getNextSibling().
- getNextSibling().getNextSibling().getNextSibling());
- assertThat(augment.getName(), is("/nw:networks/nw:network/nw:node"));
-
- YangUses uses = ((YangUses) augment.getChild());
- YangContainer container = ((YangContainer) uses.getNextSibling());
- assertThat(container.getName(), is("te"));
-
- container = ((YangContainer) container.getChild());
- assertThat(container.getName(), is("config"));
-
- uses = ((YangUses) container.getChild().getNextSibling());
- assertThat(uses.getName(), is("te-node-config-attributes"));
-
- YangContainer container1 = ((YangContainer) uses.getNextSibling());
- assertThat(container1.getName(), is("te-node-attributes"));
-
- uses = ((YangUses) container1.getChild());
- assertThat(uses.getName(), is("te-node-connectivity-matrix"));
-
- YangList list = ((YangList) uses.getNextSibling());
- assertThat(list.getName(), is("connectivity-matrix"));
- }
-
- /**
- * Checks contents of uses are copied as child of grouping.
- */
- @Test
- public void interFileUsesInsideChildOfGrouping()
- throws IOException, ParserException, MojoExecutionException {
-
- String searchDir = "src/test/resources/interFileUsesInsideChildOfGrouping";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.resolveDependenciesUsingLinker();
-
- YangNode selfNode = null;
- YangNode refNode1 = null;
-
- for (YangNode rootNode : utilManager.getYangNodeSet()) {
- if (rootNode.getName().equals("ietf-network")) {
- selfNode = rootNode;
- } else if (rootNode.getName().equals("ietf-te-topology")) {
- refNode1 = rootNode;
- }
- }
-
- // Check whether the data model tree returned is of type module.
- assertThat(selfNode instanceof YangModule, is(true));
- assertThat(selfNode.getNodeType(), is(MODULE_NODE));
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("ietf-network"));
-
- YangModule refNode = (YangModule) refNode1;
- assertThat(refNode.getName(), is("ietf-te-topology"));
-
- YangAugment augment = ((YangAugment) refNode.getChild().getNextSibling().
- getNextSibling().getNextSibling().getNextSibling().getNextSibling());
- assertThat(augment.getName(), is("/nw:networks/nw:network/nt:link"));
-
- YangUses uses = ((YangUses) augment.getChild());
- assertThat(uses.getResolvableStatus(), is(RESOLVED));
- YangContainer container = ((YangContainer) uses.getNextSibling());
- assertThat(container.getName(), is("te"));
-
- container = ((YangContainer) container.getChild());
- assertThat(container.getName(), is("config"));
-
- uses = ((YangUses) container.getChild().getNextSibling());
- assertThat(uses.getName(), is("te-link-config-attributes"));
- assertThat(uses.getResolvableStatus(), is(RESOLVED));
-
- YangContainer container1 = ((YangContainer) uses.getNextSibling());
- assertThat(container1.getName(), is("te-link-attributes"));
-
- container = ((YangContainer) container1.getChild());
- assertThat(container.getName(), is("underlay"));
-
- uses = ((YangUses) container.getChild());
- assertThat(uses.getName(), is("te-link-underlay-attributes"));
- assertThat(uses.getResolvableStatus(), is(RESOLVED));
-
- container = ((YangContainer) uses.getNextSibling());
- assertThat(container.getName(), is("underlay-primary-path"));
-
- YangList yangList = ((YangList) container.getChild());
- assertThat(yangList.getName(), is("path-element"));
-
- uses = ((YangUses) yangList.getChild());
- assertThat(uses.getName(), is("te-path-element"));
- assertThat(uses.getResolvableStatus(), is(RESOLVED));
-
- uses = ((YangUses) uses.getNextSibling());
- assertThat(uses.getName(), is("explicit-route-subobject"));
- assertThat(uses.getResolvableStatus(), is(RESOLVED));
-
- YangChoice choice = ((YangChoice) uses.getNextSibling());
- assertThat(choice.getName(), is("type"));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterJarLinkerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterJarLinkerTest.java
deleted file mode 100644
index 900aca9..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterJarLinkerTest.java
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
- * 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.plugin.manager;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Set;
-import java.util.jar.JarEntry;
-import java.util.jar.JarOutputStream;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.project.MavenProject;
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangDerivedInfo;
-import org.onosproject.yangutils.datamodel.YangGrouping;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.RESOLVED;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.DERIVED;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.STRING;
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.parseJarFile;
-import static org.onosproject.yangutils.plugin.manager.YangPluginUtils.serializeDataModel;
-import static org.onosproject.yangutils.utils.UtilConstants.SLASH;
-import static org.onosproject.yangutils.utils.UtilConstants.TEMP;
-import static org.onosproject.yangutils.utils.UtilConstants.YANG_RESOURCES;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
-
-/**
- * Unit test case for inter jar linker.
- */
-public class InterJarLinkerTest {
-
- private final YangUtilManager utilManager = new YangUtilManager();
-
- private static final String TARGET = "target/interJarFileLinking/";
- private static final String YANG_FILES_DIR = "src/test/resources/interJarFileLinking/yangFiles/";
- private static final String TARGET_RESOURCE_PATH = SLASH + TEMP + SLASH + YANG_RESOURCES + SLASH;
- private static final String JAR_FILE_NAME = "onlab-test-1.7.0-SNAPSHOT.jar";
- private static final String SER_FILE_NAME = "portPair.ser";
-
- private static final String FLOW_CLASSIFIER_FOLDER = "target/interJarFileLinking/org/onosproject"
- + "/yang/gen/v1/sfc/flowclassifier/rev20160524";
- private static final String PORT_PAIR_FOLDER = "target/interJarFileLinking/org/onosproject"
- + "/yang/gen/v1/sfc/portpair/rev20160524";
- private static final String FLOW_CLASSIFIER_MANAGER = FLOW_CLASSIFIER_FOLDER + SLASH + "FlowClassifierManager.java";
-
- /**
- * Unit test case for a single jar dependency.
- *
- * @throws IOException when fails to do IO operations
- * @throws MojoExecutionException when fails to do mojo operations
- */
- @Test
- public void processSingleJarLinking()
- throws IOException, MojoExecutionException {
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(YANG_FILES_DIR));
-
- int size1 = utilManager.getYangFileInfoSet().size();
- utilManager.parseYangFileInfoSet();
-
- provideTestJarFile();
- utilManager.setYangFileInfoSet(removeFileInfoFromSet(utilManager.getYangFileInfoSet()));
-
- for (String file : getListOfTestJar(TARGET)) {
- addInterJarRootNodes(file);
- }
-
- utilManager.resolveDependenciesUsingLinker();
-
- int size2 = utilManager.getYangFileInfoSet().size();
- assertThat(true, is(size1 != size2));
- assertThat(true, is(parseFileInfoSet(utilManager.getYangFileInfoSet().iterator())));
-
- deleteDirectory(TARGET);
- deleteTestSerFile();
- }
-
- /**
- * Unit test case for a multiple jar dependency.
- *
- * @throws IOException when fails to do IO operations
- * @throws MojoExecutionException when fails to do mojo operations
- */
- @Test
- public void processMultipleJarLinking()
- throws IOException, MojoExecutionException {
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(YANG_FILES_DIR));
-
- int size1 = utilManager.getYangFileInfoSet().size();
- utilManager.parseYangFileInfoSet();
-
- provideTestJarFile();
- utilManager.setYangFileInfoSet(removeFileInfoFromSet(utilManager.getYangFileInfoSet()));
- for (String file : getListOfTestJar(TARGET)) {
- addInterJarRootNodes(file);
- }
-
- utilManager.resolveDependenciesUsingLinker();
- int size2 = utilManager.getYangFileInfoSet().size();
- assertThat(true, is(size1 != size2));
- assertThat(true, is(parseFileInfoSet(utilManager.getYangFileInfoSet().iterator())));
- assertThat(true, is(parseFileInfoSet(utilManager.getYangFileInfoSet().iterator())));
-
- /*
- * grouping flow-classifier {
- * container flow-classifier {
- * leaf id {
- * type flow-classifier-id;
- * }
- *
- * leaf tenant-id {
- * type port-pair:tenant-id;
- * }
- * .
- * .
- * .
- *
- */
-
- Iterator<YangFileInfo> yangFileInfoIterator = utilManager.getYangFileInfoSet().iterator();
-
- YangFileInfo yangFileInfo = yangFileInfoIterator.next();
-
- while (yangFileInfoIterator.hasNext()) {
- if (yangFileInfo.getRootNode().getName().equals("flow-classifier")) {
- break;
- }
- yangFileInfo = yangFileInfoIterator.next();
- }
-
- YangNode node = yangFileInfo.getRootNode();
- node = node.getChild();
- while (node != null) {
- if (node instanceof YangGrouping) {
- break;
- }
- node = node.getNextSibling();
- }
-
- node = node.getChild();
- ListIterator<YangLeaf> leafIterator = ((YangContainer) node).getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("id"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("flow-classifier-id"));
- assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
-
- leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("tenant-id"));
- assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
-
- assertThat(true, is(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef()
- .getName().equals("tenant-id")));
-
- assertThat(leafInfo.getDataType().getResolvableStatus(), is(RESOLVED));
-
- YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- // Check for the effective built-in type.
- assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
-
- YangPluginConfig yangPluginConfig = new YangPluginConfig();
- yangPluginConfig.setCodeGenDir(TARGET);
-
- utilManager.translateToJava(yangPluginConfig);
-
- testIfFlowClassifierFilesExists();
- testIfPortPairFileDoesNotExist();
- deleteDirectory(TARGET);
- deleteTestSerFile();
- }
-
- /**
- * Test if flow classifier code is generated.
- */
- private void testIfFlowClassifierFilesExists() {
- File folder = new File(System.getProperty("user.dir") + SLASH + FLOW_CLASSIFIER_FOLDER);
- File file = new File(System.getProperty("user.dir") + SLASH + FLOW_CLASSIFIER_MANAGER);
- assertThat(true, is(folder.exists()));
- assertThat(false, is(file.exists()));
- }
-
- /**
- * Tests if port pair code is not generated.
- */
- private void testIfPortPairFileDoesNotExist() {
- File folder = new File(System.getProperty("user.dir") + SLASH + PORT_PAIR_FOLDER);
- assertThat(false, is(folder.exists()));
- }
-
- /**
- * Need to remove port-pair YANG file info from the set so , serialized file info can be
- * tested.
- *
- * @param fileInfoSet YANG file info set
- * @return updated file info set
- */
- private Set<YangFileInfo> removeFileInfoFromSet(Set<YangFileInfo> fileInfoSet) {
- String portPairFile = System.getProperty("user.dir") + SLASH + YANG_FILES_DIR + "portpair.yang";
- for (YangFileInfo fileInfo : fileInfoSet) {
- if (fileInfo.getYangFileName().equals(portPairFile)) {
- fileInfoSet.remove(fileInfo);
- return fileInfoSet;
- }
- }
- return fileInfoSet;
- }
-
- /**
- * Provides test jar files for linker.
- *
- * @throws IOException when fails to do IO operations
- */
- private void provideTestJarFile() throws IOException {
-
- MavenProject project = new MavenProject();
- serializeDataModel(TARGET, utilManager.getYangFileInfoSet(), project, false);
- createTestJar();
- }
-
- /**
- * Deletes serialized file.
- */
- private void deleteTestSerFile() {
- File ser = new File(System.getProperty("user.dir") + SLASH + YANG_FILES_DIR + SER_FILE_NAME);
- ser.delete();
- }
-
- /**
- * Parses file info list and returns true if file info list contains the serialized file info.
- *
- * @param yangFileInfoIterator file info list iterator
- * @return true if present
- */
- private boolean parseFileInfoSet(Iterator<YangFileInfo> yangFileInfoIterator) {
- YangFileInfo yangFileInfo = yangFileInfoIterator.next();
- while (yangFileInfoIterator.hasNext()) {
- if (yangFileInfo.getRootNode().getName().equals("port-pair")) {
- return true;
- } else if (yangFileInfo.getRootNode().getName().equals("flow-classifier")) {
- return true;
- }
- yangFileInfo = yangFileInfoIterator.next();
- }
- return false;
-
- }
-
- /**
- * Returns list of test jar files.
- *
- * @param searchdir search directory
- * @return list of test jar files
- */
- private List<String> getListOfTestJar(String searchdir) {
- List<String> jarFiles = new ArrayList<>();
-
- File directory = new File(searchdir + "/");
- File[] files = directory.listFiles();
-
- for (File file : files) {
- if (!file.isDirectory()) {
- jarFiles.add(file.toString());
- }
- }
-
- return jarFiles;
- }
-
- /**
- * Adds data model nodes of jar to file info set.
- *
- * @param jarFile jar file name
- * @throws IOException when fails to do IO operations
- */
- private void addInterJarRootNodes(String jarFile) throws IOException {
- try {
- List<YangNode> interJarResolvedNodes = parseJarFile(jarFile, TARGET);
-
- for (YangNode node : interJarResolvedNodes) {
- YangFileInfo dependentFileInfo = new YangFileInfo();
- node.setToTranslate(false);
- dependentFileInfo.setRootNode(node);
- dependentFileInfo.setForTranslator(false);
- dependentFileInfo.setYangFileName(node.getName());
- utilManager.getYangFileInfoSet().add(dependentFileInfo);
- }
- } catch (IOException e) {
- throw new IOException("failed to resolve in interjar scenario.");
- }
- }
-
- /**
- * Creates a temporary test jar files.
- */
- private void createTestJar() {
-
- File file = new File(TARGET + TARGET_RESOURCE_PATH);
- File[] files = file.listFiles();
- String[] source = new String[files.length];
-
- for (int i = 0; i < files.length; i++) {
- source[i] = files[i].toString();
- }
- byte[] buf = new byte[1024];
-
- try {
- String target = TARGET + JAR_FILE_NAME;
- JarOutputStream out = new JarOutputStream(new FileOutputStream(target));
- for (String element : source) {
- FileInputStream in = new FileInputStream(element);
- out.putNextEntry(new JarEntry(element));
- int len;
- while ((len = in.read(buf)) > 0) {
- out.write(buf, 0, len);
- }
- out.closeEntry();
- in.close();
- }
- out.close();
- } catch (IOException e) {
- }
- }
-
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/IntraFileIfFeatureLinkingTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/IntraFileIfFeatureLinkingTest.java
deleted file mode 100644
index 179d57d..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/IntraFileIfFeatureLinkingTest.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * 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.plugin.manager;
-
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangFeature;
-import org.onosproject.yangutils.datamodel.YangIfFeature;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangSubModule;
-import org.onosproject.yangutils.datamodel.utils.ResolvableStatus;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import java.io.IOException;
-import java.util.List;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-
-/**
- * Test cases for testing if-feature intra file linking.
- */
-public class IntraFileIfFeatureLinkingTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks self resolution when feature defined in same file.
- */
- @Test
- public void processSelfFileLinkingWithFeature()
- throws IOException, ParserException {
-
- YangNode node = manager
- .getDataModel("src/test/resources/SelfFileLinkingWithFeature.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("syslog"));
-
- List<YangFeature> featureList = yangNode.getFeatureList();
- YangFeature feature = featureList.iterator().next();
- assertThat(feature.getName(), is("local-storage"));
-
- YangContainer container = (YangContainer) yangNode.getChild();
- assertThat(container.getName(), is("speed"));
-
- List<YangLeaf> listOfLeaf = container.getListOfLeaf();
- YangLeaf leaf = listOfLeaf.iterator().next();
- assertThat(leaf.getName(), is("local-storage-limit"));
-
- List<YangIfFeature> ifFeatureList = leaf.getIfFeatureList();
- YangIfFeature ifFeature = ifFeatureList.iterator().next();
- assertThat(ifFeature.getName().getName(), is("local-storage"));
- assertThat(ifFeature.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
- }
-
- /**
- * Checks self resolution when feature is undefined.
- */
- @Test
- public void processSelfFileLinkingWithFeatureUndefined()
- throws IOException, ParserException {
-
- YangNode node = manager
- .getDataModel("src/test/resources/SelfFileLinkingWithFeatureUndefined.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("syslog"));
-
- YangContainer container = (YangContainer) yangNode.getChild();
- assertThat(container.getName(), is("speed"));
-
- List<YangLeaf> listOfLeaf = container.getListOfLeaf();
- YangLeaf leaf = listOfLeaf.iterator().next();
- assertThat(leaf.getName(), is("local-storage-limit"));
-
- List<YangIfFeature> ifFeatureList = leaf.getIfFeatureList();
- YangIfFeature ifFeature = ifFeatureList.iterator().next();
- assertThat(ifFeature.getName().getName(), is("local-storage"));
- assertThat(ifFeature.getResolvableStatus(), is(ResolvableStatus.INTRA_FILE_RESOLVED));
- }
-
- /**
- * Checks self resolution of feature with multiple dependency.
- */
- @Test
- public void processSelfFileLinkingWithMultipleDependency() throws IOException, ParserException {
- YangNode node = manager
- .getDataModel("src/test/resources/SelfFileLinkingWithMultipleDependency.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("syslog"));
-
- List<YangFeature> featureList = yangNode.getFeatureList();
- YangFeature feature = featureList.iterator().next();
- assertThat(feature.getName(), is("p2mp-te"));
-
- YangContainer container = (YangContainer) yangNode.getChild();
- assertThat(container.getName(), is("speed"));
-
- List<YangLeaf> listOfLeaf = container.getListOfLeaf();
- YangLeaf leaf = listOfLeaf.iterator().next();
- assertThat(leaf.getName(), is("local-storage-limit"));
-
- List<YangIfFeature> ifFeatureList = leaf.getIfFeatureList();
- YangIfFeature ifFeature = ifFeatureList.iterator().next();
- assertThat(ifFeature.getName().getName(), is("frr-te"));
- assertThat(ifFeature.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
- }
-
- /**
- * Checks self resolution of feature with multiple dependency undefined.
- */
- @Test
- public void processSelfFileLinkingWithMultipleDependencyUnresolved() throws IOException, ParserException {
- YangNode node = manager
- .getDataModel("src/test/resources/SelfFileLinkingWithMultipleDependencyUnresolved.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("syslog"));
-
- List<YangFeature> featureList = yangNode.getFeatureList();
- YangFeature feature = featureList.iterator().next();
- assertThat(feature.getName(), is("frr-te"));
-
- YangContainer container = (YangContainer) yangNode.getChild();
- assertThat(container.getName(), is("speed"));
-
- List<YangLeaf> listOfLeaf = container.getListOfLeaf();
- YangLeaf leaf = listOfLeaf.iterator().next();
- assertThat(leaf.getName(), is("local-storage-limit"));
-
- List<YangIfFeature> ifFeatureList = leaf.getIfFeatureList();
- YangIfFeature ifFeature = ifFeatureList.iterator().next();
- assertThat(ifFeature.getName().getName(), is("frr-te"));
- assertThat(ifFeature.getResolvableStatus(), is(ResolvableStatus.INTRA_FILE_RESOLVED));
- }
-
- /**
- * Checks self resolution when feature is defined in same file in submodule.
- */
- @Test
- public void processSelfFileLinkingWithFeatureInSubModule()
- throws IOException, ParserException {
-
- YangNode node = manager
- .getDataModel("src/test/resources/SelfFileLinkingWithFeatureInSubModule.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangSubModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.SUB_MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangSubModule yangNode = (YangSubModule) node;
- assertThat(yangNode.getName(), is("syslog"));
-
- List<YangFeature> featureList = yangNode.getFeatureList();
- YangFeature feature = featureList.iterator().next();
- assertThat(feature.getName(), is("local-storage"));
-
- YangContainer container = (YangContainer) yangNode.getChild();
- assertThat(container.getName(), is("speed"));
-
- List<YangLeaf> listOfLeaf = container.getListOfLeaf();
- YangLeaf leaf = listOfLeaf.iterator().next();
- assertThat(leaf.getName(), is("local-storage-limit"));
-
- List<YangIfFeature> ifFeatureList = leaf.getIfFeatureList();
- YangIfFeature ifFeature = ifFeatureList.iterator().next();
- assertThat(ifFeature.getName().getName(), is("local-storage"));
- assertThat(ifFeature.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/IntraFileLeafrefLinkingTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/IntraFileLeafrefLinkingTest.java
deleted file mode 100644
index 82ad492..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/IntraFileLeafrefLinkingTest.java
+++ /dev/null
@@ -1,1986 +0,0 @@
-/*
- * 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.plugin.manager;
-
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.onosproject.yangutils.datamodel.YangAtomicPath;
-import org.onosproject.yangutils.datamodel.YangAugment;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangFeature;
-import org.onosproject.yangutils.datamodel.YangIfFeature;
-import org.onosproject.yangutils.datamodel.YangInput;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangLeafList;
-import org.onosproject.yangutils.datamodel.YangLeafRef;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangPathArgType;
-import org.onosproject.yangutils.datamodel.YangPathOperator;
-import org.onosproject.yangutils.datamodel.YangPathPredicate;
-import org.onosproject.yangutils.datamodel.YangRelativePath;
-import org.onosproject.yangutils.datamodel.utils.ResolvableStatus;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.linker.exceptions.LinkerException;
-import org.onosproject.yangutils.linker.impl.YangLinkerManager;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.nullValue;
-import static org.onosproject.yangutils.datamodel.YangNodeType.MODULE_NODE;
-import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.RESOLVED;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.LEAFREF;
-import static org.onosproject.yangutils.linker.impl.YangLinkerUtils.updateFilePriority;
-
-/**
- * Test cases for testing leafref intra file linking.
- */
-public class IntraFileLeafrefLinkingTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- private final YangUtilManager utilManager = new YangUtilManager();
- private final YangLinkerManager yangLinkerManager = new YangLinkerManager();
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks self resolution when leafref under module refers to leaf in container.
- */
- @Test
- public void processSelfResolutionWhenLeafrefReferToContainerLeaf()
- throws IOException, ParserException {
-
- String searchDir = "src/test/resources/leafreflinker/intrafile/simpleleafref";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- YangNode selfNode = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("SelfResolutionWhenLeafrefReferToContainerLeaf")) {
- selfNode = rootNode;
- }
-
- // Check whether the data model tree returned is of type module.
- assertThat((selfNode instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("SelfResolutionWhenLeafrefReferToContainerLeaf"));
-
- ListIterator<YangLeaf> leafIterator;
- YangLeaf leafInfo;
-
- leafIterator = yangNode.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
-
- // Check whether the information in the leaf is correct.
- assertThat(leafInfo.getName(), is("network-ref"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
- YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
-
- // Check whether leafref type got resolved.
- assertThat(leafref.getResolvableStatus(),
- is(ResolvableStatus.RESOLVED));
-
- // Check the effective type for the leaf.
- assertThat(leafref.getEffectiveDataType().getDataType(),
- is(YangDataTypes.UINT8));
- }
-
- /**
- * Checks self resolution when leafref under module refers to leaf in input of rpc.
- */
- @Test
- public void processSelfResolutionWhenLeafrefInModuleReferToLeafInInputOfRpc()
- throws IOException, ParserException {
-
- String searchDir = "src/test/resources/leafreflinker/intrafile/leafrefwithrpc";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- YangNode selfNode = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("SelfResolutionWhenLeafrefInModuleReferToLeafInInputOfRpc")) {
- selfNode = rootNode;
- }
-
- // Check whether the data model tree returned is of type module.
- assertThat((selfNode instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("SelfResolutionWhenLeafrefInModuleReferToLeafInInputOfRpc"));
-
- ListIterator<YangLeaf> leafIterator;
- YangLeaf leafInfo;
-
- leafIterator = yangNode.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
-
- // Check whether the information in the leaf is correct.
- assertThat(leafInfo.getName(), is("network-ref"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
- YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
-
- // Check whether leafref type got resolved.
- assertThat(leafref.getResolvableStatus(),
- is(ResolvableStatus.RESOLVED));
-
- // Check the effective type for the leaf.
- assertThat(leafref.getEffectiveDataType().getDataType(),
- is(YangDataTypes.UINT8));
- }
-
- /**
- * Checks self resolution when leafref under module refers to grouping rpc with input as name.
- * Rpc has input child also. So here the node search must be done by taking input node.
- * TODO: When path has RPC's input but grouping & typedef with the same name occurs.
- */
- @Ignore
- public void processSelfResolutionWhenLeafrefInModuleReferToGroupingWithInputInRpc()
- throws IOException, ParserException {
-
- String searchDir = "src/test/resources/leafreflinker/intrafile/leafrefwithrpcandgrouping";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- YangNode selfNode = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("SelfResolutionWhenLeafrefInModuleReferToGroupingWithInputInRpc")) {
- selfNode = rootNode;
- }
-
- // Check whether the data model tree returned is of type module.
- assertThat((selfNode instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("SelfResolutionWhenLeafrefInModuleReferToGroupingWithInputInRpc"));
-
- ListIterator<YangLeaf> leafIterator;
- YangLeaf leafInfo;
-
- leafIterator = yangNode.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
-
- // Check whether the information in the leaf is correct.
- assertThat(leafInfo.getName(), is("network-ref"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
- YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
-
- // Check whether leafref type got resolved.
- assertThat(leafref.getResolvableStatus(),
- is(ResolvableStatus.RESOLVED));
-
- // Check the effective type for the leaf.
- assertThat(leafref.getEffectiveDataType().getDataType(),
- is(YangDataTypes.UINT8));
- }
-
- /**
- * Checks self resolution when leafref under module refers to grouping under module.
- * Grouping/typedef cannot be referred.
- */
- @Test
- public void processSelfResolutionWhenLeafrefInModuleReferToGrouping()
- throws IOException, ParserException {
-
- thrown.expect(LinkerException.class);
- thrown.expectMessage(
- "YANG file error: The target node, in the leafref path /networks/network-id, is invalid.");
-
- String searchDir = "src/test/resources/leafreflinker/intrafile/invalidscenerioforgrouping";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
- }
-
- /**
- * Checks self resolution error scenerio where leafref is without path.
- */
- @Test
- public void processSelfResolutionWhenLeafrefDoesntHavePath()
- throws IOException, ParserException {
-
- thrown.expect(ParserException.class);
- thrown.expectMessage(
- "YANG file error : a type leafref must have one path statement.");
- YangNode node = manager
- .getDataModel("src/test/resources/SelfResolutionWhenLeafrefDoesntHavePath.yang");
- }
-
- /**
- * Checks self resolution when leafref under module refers to invalid node.
- */
- @Test
- public void processSelfResolutionWhenLeafrefInModuleReferToInvalidNode()
- throws IOException, ParserException {
-
- thrown.expect(LinkerException.class);
- thrown.expectMessage(
- "YANG file error: Unable to find base leaf/leaf-list for given leafref path /define/network-id");
- String searchDir = "src/test/resources/leafreflinker/intrafile/invalidsceneriowithinvalidnode";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
- }
-
- /**
- * Checks self resolution when leafref under module refers to invalid node.
- * Inter file linking also has to be done to know the error message.
- */
- @Test
- public void processSelfResolutionWhenLeafrefIsInDeepTreeAndLeafIsInModuleWithReferredTypeUnion()
- throws IOException, ParserException {
-
- String searchDir = "src/test/resources/leafreflinker/intrafile/leafreflinking";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- YangNode selfNode = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("Test")) {
- selfNode = rootNode;
- }
-
- // Check whether the data model tree returned is of type module.
- assertThat((selfNode instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("Test"));
-
- YangContainer containerParent = (YangContainer) yangNode.getChild().getChild().getChild();
- ListIterator<YangLeaf> leafIterator;
- YangLeaf leafInfo;
-
- leafIterator = containerParent.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
-
- // Check whether the information in the leaf is correct.
- assertThat(leafInfo.getName(), is("name"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
- YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
-
- // Check whether leafref type got resolved.
- assertThat(leafref.getResolvableStatus(),
- is(ResolvableStatus.RESOLVED));
-
- // Check the effective type for the leaf.
- assertThat(leafref.getEffectiveDataType().getDataType(),
- is(YangDataTypes.UNION));
- }
-
- /**
- * Checks self resolution when leafref of leaf-list under module refers to leaf in container.
- */
- @Test
- public void processSelfResolutionWhenLeafrefReferToContainerLeafList()
- throws IOException, ParserException {
-
- String searchDir = "src/test/resources/leafreflinker/intrafile/leafrefreferingtoleaflist";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- YangNode selfNode = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("ietf-network")) {
- selfNode = rootNode;
- }
-
- // Check whether the data model tree returned is of type module.
- assertThat((selfNode instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("ietf-network"));
-
- ListIterator<YangLeafList> leafListIterator;
- YangLeafList leafListInfo;
-
- leafListIterator = yangNode.getListOfLeafList().listIterator();
- leafListInfo = leafListIterator.next();
-
- // Check whether the information in the leaf is correct.
- assertThat(leafListInfo.getName(), is("network-ref"));
- assertThat(leafListInfo.getDataType().getDataTypeName(), is("leafref"));
- assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
- YangLeafRef leafref = (YangLeafRef) (leafListInfo.getDataType().getDataTypeExtendedInfo());
-
- // Check whether leafref type got resolved.
- assertThat(leafref.getResolvableStatus(),
- is(ResolvableStatus.RESOLVED));
-
- // Check the effective type for the leaf.
- assertThat(leafref.getEffectiveDataType().getDataType(),
- is(YangDataTypes.UINT8));
- }
-
- /**
- * Checks self resolution when leafref of leaf-list under module refers to leaf-list in input of rpc.
- */
- @Test
- public void processSelfResolutionWhenLeafrefInModuleReferToLeafListInInputOfRpc()
- throws IOException, ParserException {
-
- String searchDir = "src/test/resources/leafreflinker/intrafile/leafreftoinputinrpc";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- YangNode selfNode = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("ietf-network")) {
- selfNode = rootNode;
- }
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("ietf-network"));
-
- ListIterator<YangLeafList> leafListIterator;
- YangLeafList leafListInfo;
-
- leafListIterator = yangNode.getListOfLeafList().listIterator();
- leafListInfo = leafListIterator.next();
-
- // Check whether the information in the leaf is correct.
- assertThat(leafListInfo.getName(), is("network-ref"));
- assertThat(leafListInfo.getDataType().getDataTypeName(), is("leafref"));
- assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
- YangLeafRef leafref = (YangLeafRef) (leafListInfo.getDataType().getDataTypeExtendedInfo());
-
- // Check whether leafref type got resolved.
- assertThat(leafref.getResolvableStatus(),
- is(ResolvableStatus.RESOLVED));
-
- // Check the effective type for the leaf.
- assertThat(leafref.getEffectiveDataType().getDataType(),
- is(YangDataTypes.UINT8));
- }
-
- /**
- * Checks self resolution when leafref of leaf-list under module refers to invalid node.
- * Inter file linking also has to be done to know the error message.
- */
- @Test
- public void processSelfResolutionWhenLeafrefIsInDeepTreeAndLeafListIsInModuleWithReferredTypeEnumeration()
- throws IOException, ParserException {
-
- String searchDir = "src/test/resources/leafreflinker/intrafile/leafrefwithrefleafderived";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- YangNode selfNode = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("Test")) {
- selfNode = rootNode;
- }
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
-
- assertThat(yangNode.getName(), is("Test"));
-
- YangContainer containerParent = (YangContainer) yangNode.getChild().getChild().getChild();
- ListIterator<YangLeafList> leafListListIterator;
- YangLeafList leafListInfo;
-
- leafListListIterator = containerParent.getListOfLeafList().listIterator();
- leafListInfo = leafListListIterator.next();
-
- // Check whether the information in the leaf is correct.
- assertThat(leafListInfo.getName(), is("name"));
- assertThat(leafListInfo.getDataType().getDataTypeName(), is("leafref"));
- assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
- YangLeafRef leafref = (YangLeafRef) (leafListInfo.getDataType().getDataTypeExtendedInfo());
-
- // Check whether leafref type got resolved.
- assertThat(leafref.getResolvableStatus(),
- is(ResolvableStatus.RESOLVED));
-
- // Check the effective type for the leaf.
- assertThat(leafref.getEffectiveDataType().getDataType(),
- is(YangDataTypes.ENUMERATION));
- }
-
- /**
- * Checks the error scenerio when the referred node is not a leaf or leaf-list.
- */
- @Test
- public void processSelfResolutionWhenLeafrefDoesNotReferToLeafOrLeafList()
- throws IOException, ParserException {
-
- thrown.expect(LinkerException.class);
- thrown.expectMessage(
- "YANG file error: Unable to find base leaf/leaf-list for given leafref path /networks");
- String searchDir = "src/test/resources/leafreflinker/intrafile/invalidsceneriowithnorefleaf";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
- }
-
- /**
- * Checks self resolution when leafref of leaf-list under module refers to leaf in container.
- */
- @Test
- public void processSelfResolutionWhenLeafrefInTypedefReferToContainer()
- throws IOException, ParserException {
- String searchDir = "src/test/resources/leafreflinker/intrafile/leafrefintypedef";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- YangNode selfNode = null;
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("ietf-network")) {
- selfNode = rootNode;
- }
- // Check whether the data model tree returned is of type module.
- assertThat((selfNode instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("ietf-network"));
-
- YangContainer yangContainer = (YangContainer) yangNode.getChild();
- ListIterator<YangLeaf> leafIterator;
- YangLeaf leafInfo;
- leafIterator = yangContainer.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
-
- // Check whether the information in the leaf is correct under grouping.
- assertThat(leafInfo.getName(), is("network-id"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
-
- YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
-
- // Check whether leafref type got resolved.
- assertThat(leafref.getResolvableStatus(),
- is(ResolvableStatus.RESOLVED));
-
- // Check the effective type for the leaf.
- assertThat(leafref.getEffectiveDataType().getDataType(),
- is(YangDataTypes.UINT8));
- }
-
- /**
- * Checks self resolution when leafref of leaf-list under module refers to leaf-list in input of rpc.
- */
- @Test
- public void processSelfResolutionWhenLeafrefInTypedefModuleReferToLeafListInInputOfRpc()
- throws IOException, ParserException {
-
- String searchDir = "src/test/resources/leafreflinker/intrafile/leafreftorpcinputleaflist";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- YangNode selfNode = null;
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("ietf-network")) {
- selfNode = rootNode;
- }
- // Check whether the data model tree returned is of type module.
- assertThat((selfNode instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("ietf-network"));
-
- YangInput yangInput = (YangInput) yangNode.getChild().getChild();
-
- ListIterator<YangLeafList> leafListIterator;
- YangLeafList yangLeafListInfo;
- leafListIterator = yangInput.getListOfLeafList().listIterator();
- yangLeafListInfo = leafListIterator.next();
-
- // Check whether the information in the leaf is correct under grouping.
- assertThat(yangLeafListInfo.getName(), is("network-id"));
- assertThat(yangLeafListInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
-
- YangLeafRef leafref = (YangLeafRef) (yangLeafListInfo.getDataType().getDataTypeExtendedInfo());
-
- // Check whether leafref type got resolved.
- assertThat(leafref.getResolvableStatus(),
- is(ResolvableStatus.RESOLVED));
-
- // Check the effective type for the leaf.
- assertThat(leafref.getEffectiveDataType().getDataType(),
- is(YangDataTypes.UINT8));
- }
-
- /**
- * Checks self resolution when leafref of leaf-list under module refers to invalid node.
- * Inter file linking also has to be done to know the error message.
- */
- @Test
- public void processSelfResolutionWhenLeafrefInTypedefIsInDeepTreeAndLeafListIsInModuleWithReferredTypeEnumeration()
- throws IOException, ParserException {
-
- String searchDir = "src/test/resources/leafreflinker/intrafile/leafreftoleafrefwithtypedef";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- YangNode selfNode = null;
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("Test")) {
- selfNode = rootNode;
- }
- // Check whether the data model tree returned is of type module.
- assertThat((selfNode instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("Test"));
-
- YangContainer yangContainer = (YangContainer) yangNode.getChild().getChild().getChild().getNextSibling();
-
- ListIterator<YangLeaf> leafIterator;
- YangLeaf yangLeafInfo;
- leafIterator = yangContainer.getListOfLeaf().listIterator();
- yangLeafInfo = leafIterator.next();
-
- // Check whether the information in the leaf is correct under grouping.
- assertThat(yangLeafInfo.getName(), is("interval"));
- assertThat(yangLeafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
-
- YangLeafRef leafref = (YangLeafRef) (yangLeafInfo.getDataType().getDataTypeExtendedInfo());
-
- // Check whether leafref type got resolved.
- assertThat(leafref.getResolvableStatus(),
- is(ResolvableStatus.RESOLVED));
-
- // Check the effective type for the leaf.
- assertThat(leafref.getEffectiveDataType().getDataType(),
- is(YangDataTypes.ENUMERATION));
- }
-
- /**
- * Checks self resolution when grouping and uses are siblings.
- * Grouping followed by uses.
- */
- @Test
- public void processSelfResolutionWhenLeafrefRefersAnotherLeafref()
- throws IOException, ParserException {
-
- String searchDir = "src/test/resources/leafreflinker/intrafile/leafreftoleafref";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- YangNode selfNode = null;
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("ietf-network")) {
- selfNode = rootNode;
- }
- // Check whether the data model tree returned is of type module.
- assertThat((selfNode instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("ietf-network"));
-
- ListIterator<YangLeaf> leafIterator;
- YangLeaf leafInfo;
-
- //YangGrouping grouping = (YangGrouping) yangNode.getChild().getNextSibling();
- leafIterator = yangNode.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
-
- // Check whether the information in the leaf is correct under grouping.
- assertThat(leafInfo.getName(), is("network-ref"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
- YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
-
- assertThat(leafref.getResolvableStatus(),
- is(ResolvableStatus.RESOLVED));
-
- assertThat(leafref.getEffectiveDataType().getDataType(),
- is(YangDataTypes.UINT8));
- }
-
- /**
- * Checks self resolution when leafref refers to many other leafref.
- */
- @Test
- public void processSelfResolutionWhenLeafrefReferToMultipleLeafref()
- throws IOException, ParserException {
-
- String searchDir = "src/test/resources/leafreflinker/intrafile/leafreftomultileafref";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- YangNode selfNode = null;
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("Test")) {
- selfNode = rootNode;
- }
- // Check whether the data model tree returned is of type module.
- assertThat((selfNode instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("Test"));
-
- YangContainer containerInModule = (YangContainer) yangNode.getChild().getNextSibling();
- YangContainer containerInList = (YangContainer) containerInModule.getChild().getChild();
-
- ListIterator<YangLeaf> leafIterator;
- YangLeaf leafInfo;
-
- leafIterator = containerInList.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
-
- // Check whether the information in the leaf is correct under grouping.
- assertThat(leafInfo.getName(), is("remove"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
- YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
-
- assertThat(leafref.getResolvableStatus(),
- is(ResolvableStatus.RESOLVED));
-
- assertThat(leafref.getEffectiveDataType().getDataType(),
- is(YangDataTypes.ENUMERATION));
- }
-
- /**
- * Checks self resolution when grouping and uses are siblings.
- * Grouping followed by uses.
- */
- @Test
- public void processSelfResolutionWhenLeafrefRefersAnotherDerivedType()
- throws IOException, ParserException {
-
- String searchDir = "src/test/resources/leafreflinker/intrafile/leafreftoderivedtype";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- YangNode selfNode = null;
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("ietf-network")) {
- selfNode = rootNode;
- }
- // Check whether the data model tree returned is of type module.
- assertThat((selfNode instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("ietf-network"));
-
- ListIterator<YangLeaf> leafIterator;
- YangLeaf leafInfo;
-
- //YangGrouping grouping = (YangGrouping) yangNode.getChild().getNextSibling();
- leafIterator = yangNode.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
-
- // Check whether the information in the leaf is correct under grouping.
- assertThat(leafInfo.getName(), is("network-ref"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
- YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
-
- assertThat(leafref.getResolvableStatus(),
- is(ResolvableStatus.RESOLVED));
-
- assertThat(leafref.getEffectiveDataType().getDataType(),
- is(YangDataTypes.DERIVED));
- }
-
- /**
- * Checks self resolution when leafref refers to many other leafref.
- */
- @Test
- public void processSelfResolutionWhenLeafrefReferToMultipleTypedef()
- throws IOException, ParserException {
-
- String searchDir = "src/test/resources/leafreflinker/intrafile/leafreftomultitypedef";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- YangNode selfNode = null;
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("Test")) {
- selfNode = rootNode;
- }
- // Check whether the data model tree returned is of type module.
- assertThat((selfNode instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("Test"));
-
- YangContainer containerInModule = (YangContainer) yangNode.getChild().getNextSibling();
- YangContainer containerInList = (YangContainer) containerInModule.getChild().getChild();
-
- ListIterator<YangLeaf> leafIterator;
- YangLeaf leafInfo;
-
- leafIterator = containerInList.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
-
- // Check whether the information in the leaf is correct under grouping.
- assertThat(leafInfo.getName(), is("remove"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
- YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
-
- assertThat(leafref.getResolvableStatus(),
- is(ResolvableStatus.RESOLVED));
-
- assertThat(leafref.getEffectiveDataType().getDataType(),
- is(YangDataTypes.DERIVED));
- }
-
- /**
- * Checks self resolution when leafref refers to many other leaf with derived type
- * which in turn referring to another leaf.
- */
- @Test
- public void processSelfResolutionWhenLeafrefReferToDerivedTypeReferringToLeafWithLeafref()
- throws IOException, ParserException {
-
- String searchDir = "src/test/resources/leafreflinker/intrafile/leafreftotypedefwithleafref";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- YangNode selfNode = null;
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("Test")) {
- selfNode = rootNode;
- }
- // Check whether the data model tree returned is of type module.
- assertThat((selfNode instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("Test"));
-
- YangContainer containerInModule = (YangContainer) yangNode.getChild().getNextSibling();
- YangContainer containerInList = (YangContainer) containerInModule.getChild().getChild();
-
- ListIterator<YangLeaf> leafIterator;
- YangLeaf leafInfo;
-
- leafIterator = containerInList.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
-
- // Check whether the information in the leaf is correct under grouping.
- assertThat(leafInfo.getName(), is("remove"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
- YangLeafRef leafref = (YangLeafRef) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- assertThat(leafref.getResolvableStatus(),
- is(ResolvableStatus.RESOLVED));
-
- assertThat(leafref.getEffectiveDataType().getDataType(),
- is(YangDataTypes.ENUMERATION));
- }
-
- /**
- * Checks self resolution when leafref under module refers to leaf in container with relative path.
- */
- @Test
- public void processSelfResolutionWhenLeafrefReferToContainerLeafRelPath()
- throws IOException, ParserException {
-
- String searchDir = "src/test/resources/leafreflinker/intrafile/relativepath/simpleleafref";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- YangNode selfNode = null;
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("ietf-network")) {
- selfNode = rootNode;
- }
- // Check whether the data model tree returned is of type module.
- assertThat((selfNode instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("ietf-network"));
-
- ListIterator<YangLeaf> leafIterator;
- YangLeaf leafInfo;
-
- leafIterator = yangNode.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
-
- // Check whether the information in the leaf is correct.
- assertThat(leafInfo.getName(), is("network-ref"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
- YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
-
- // Check whether leafref type got resolved.
- assertThat(leafref.getResolvableStatus(),
- is(ResolvableStatus.RESOLVED));
-
- // Check the effective type for the leaf.
- assertThat(leafref.getEffectiveDataType().getDataType(),
- is(YangDataTypes.UINT8));
- }
-
- /**
- * Checks self resolution when leafref under module refers to grouping rpc with input as name.
- * Rpc has input child also. So here the node search must be done by taking input node using relative path.
- */
- @Ignore
- public void processSelfResolutionWhenLeafrefInModuleReferToGroupingWithInputInRpcRelPath()
- throws IOException, ParserException {
-
- String searchDir = "src/test/resources/leafreflinker/intrafile/relativepath/leafreftoinputwithgroupinginrpc";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- YangNode selfNode = null;
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("ietf-network")) {
- selfNode = rootNode;
- }
- // Check whether the data model tree returned is of type module.
- assertThat((selfNode instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("ietf-network"));
-
- ListIterator<YangLeaf> leafIterator;
- YangLeaf leafInfo;
-
- leafIterator = yangNode.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
-
- // Check whether the information in the leaf is correct.
- assertThat(leafInfo.getName(), is("network-ref"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
- YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
-
- // Check whether leafref type got resolved.
- assertThat(leafref.getResolvableStatus(),
- is(ResolvableStatus.RESOLVED));
-
- // Check the effective type for the leaf.
- assertThat(leafref.getEffectiveDataType().getDataType(),
- is(YangDataTypes.UINT8));
- }
-
- /**
- * Checks self resolution when leafref under module refers to invalid root node with relative path.
- */
- @Test
- public void processSelfResolutionWhenLeafrefInModuleReferToInvalidRootNodeRelPath()
- throws IOException, ParserException {
-
- thrown.expect(LinkerException.class);
- thrown.expectMessage(
- "YANG file error: The target node, in the leafref path ../../../define/network-id, is invalid.");
- String searchDir = "src/test/resources/leafreflinker/intrafile/relativepath/invalidrelativeancestoraccess";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
- }
-
- /**
- * Checks self resolution when leafref under module refers to invalid node.
- * Inter file linking also has to be done to know the error message with relative path.
- */
- @Test
- public void processSelfResolutionWhenLeafrefInModuleReferToInvalidNodeRelPath()
- throws IOException, ParserException {
-
-
- thrown.expect(LinkerException.class);
- thrown.expectMessage(
- "YANG file error: Unable to find base leaf/leaf-list for given leafref path ../define/network-id");
- String searchDir = "src/test/resources/leafreflinker/intrafile/relativepath/invalidnode";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- //Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
- }
-
- /**
- * Checks self resolution when leafref of leaf-list under module refers to leaf in container with relative path.
- */
- @Test
- public void processSelfResolutionWhenLeafrefInTypedefReferToContainerRelPath()
- throws IOException, ParserException {
-
- String searchDir = "src/test/resources/leafreflinker/intrafile/relativepath/leafrefintypedef";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- YangNode selfNode = null;
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("ietf-network")) {
- selfNode = rootNode;
- }
- // Check whether the data model tree returned is of type module.
- assertThat((selfNode instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("ietf-network"));
- ListIterator<YangLeaf> leafIterator;
- YangLeaf leafInfo;
- YangContainer yangContainer = (YangContainer) yangNode.getChild();
- leafIterator = yangContainer.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
-
- // Check whether the information in the leaf is correct under grouping.
- assertThat(leafInfo.getName(), is("network-id"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
-
- YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
-
- // Check whether leafref type got resolved.
- assertThat(leafref.getResolvableStatus(),
- is(ResolvableStatus.RESOLVED));
-
- // Check the effective type for the leaf.
- assertThat(leafref.getEffectiveDataType().getDataType(),
- is(YangDataTypes.UINT8));
- }
-
- /**
- * Checks self resolution when leafref refers to many other leafref with relative path.
- */
- @Test
- public void processSelfResolutionWhenLeafrefReferToMultipleLeafrefRelPath()
- throws IOException, ParserException {
-
- String searchDir = "src/test/resources/leafreflinker/intrafile/relativepath/leafreftomultileafref";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- YangNode selfNode = null;
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("Test")) {
- selfNode = rootNode;
- }
- // Check whether the data model tree returned is of type module.
- assertThat((selfNode instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("Test"));
-
- YangContainer containerInModule = (YangContainer) yangNode.getChild().getNextSibling();
- YangContainer containerInList = (YangContainer) containerInModule.getChild().getChild();
-
- ListIterator<YangLeaf> leafIterator;
- YangLeaf leafInfo;
-
- leafIterator = containerInList.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
-
- // Check whether the information in the leaf is correct under grouping.
- assertThat(leafInfo.getName(), is("remove"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
- YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
-
- assertThat(leafref.getResolvableStatus(),
- is(ResolvableStatus.RESOLVED));
-
- assertThat(leafref.getEffectiveDataType().getDataType(),
- is(YangDataTypes.ENUMERATION));
- }
-
- /**
- * Checks self resolution when leafref refers to many other leaf with derived type
- * which in turn referring to another leaf with relative type.
- */
- @Test
- public void processSelfResolutionWhenLeafrefReferToDerivedTypeReferringToLeafWithLeafrefRelType()
- throws IOException, ParserException {
-
- String searchDir = "src/test/resources/leafreflinker/intrafile/relativepath/leafreftotypedef";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- YangNode selfNode = null;
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("Test")) {
- selfNode = rootNode;
- }
- // Check whether the data model tree returned is of type module.
- assertThat((selfNode instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("Test"));
-
- YangContainer containerInModule = (YangContainer) yangNode.getChild().getNextSibling();
- YangContainer containerInList = (YangContainer) containerInModule.getChild().getChild();
-
- ListIterator<YangLeaf> leafIterator;
- YangLeaf leafInfo;
-
- leafIterator = containerInList.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
-
- // Check whether the information in the leaf is correct under grouping.
- assertThat(leafInfo.getName(), is("remove"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
- YangLeafRef leafref = (YangLeafRef) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- assertThat(leafref.getResolvableStatus(),
- is(ResolvableStatus.RESOLVED));
-
- assertThat(leafref.getEffectiveDataType().getDataType(),
- is(YangDataTypes.ENUMERATION));
- }
-
- /**
- * Checks the valid scenerios of path argument having proper setters.
- */
- @Test
- public void processPathArgumentStatement()
- throws IOException, ParserException {
-
- String searchDir = "src/test/resources/leafreflinker/intrafile/relativepath/pathlistener";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- YangNode selfNode = null;
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("PathListener")) {
- selfNode = rootNode;
- }
- // Check whether the data model tree returned is of type module.
- assertThat((selfNode instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("PathListener"));
- YangList listInModule = (YangList) yangNode.getChild();
-
- YangContainer containerInModule = (YangContainer) yangNode.getChild().getNextSibling();
- ListIterator<YangLeaf> leafIterator;
- YangLeaf leafInfo;
-
- YangLeaf leafNameInList = listInModule.getListOfLeaf().listIterator().next();
-
- leafIterator = containerInModule.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
-
- // Check whether the information in the leaf is correct under grouping.
- assertThat(leafInfo.getName(), is("ifname"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
- YangLeafRef leafref = (YangLeafRef) leafInfo.getDataType().getDataTypeExtendedInfo();
- assertThat(leafref.getPathType(), is(YangPathArgType.ABSOLUTE_PATH));
-
- YangRelativePath relativePathForName = leafref.getRelativePath();
- assertThat(relativePathForName.getAncestorNodeCount(), is(2));
- List<YangAtomicPath> absPathForName = relativePathForName.getAtomicPathList();
- Iterator<YangAtomicPath> absPathIteratorForName = absPathForName.listIterator();
- YangAtomicPath abspathForName = absPathIteratorForName.next();
- assertThat(abspathForName.getNodeIdentifier().getName(), is("interface"));
- assertThat(abspathForName.getNodeIdentifier().getPrefix(), is("test"));
- YangAtomicPath abspath1 = absPathIteratorForName.next();
- assertThat(abspath1.getNodeIdentifier().getName(), is("name"));
- assertThat(abspath1.getNodeIdentifier().getPrefix(), is("test"));
-
- YangLeaf leafInfo1 = leafIterator.next();
- // Check whether the information in the leaf is correct under grouping.
- assertThat(leafInfo1.getName(), is("status"));
- assertThat(leafInfo1.getDataType().getDataTypeName(), is("leafref"));
- assertThat(leafInfo1.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
-
- YangLeafRef leafref1 = (YangLeafRef) leafInfo1.getDataType().getDataTypeExtendedInfo();
- assertThat(leafref1.getPathType(), is(YangPathArgType.ABSOLUTE_PATH));
-
- List<YangAtomicPath> absolutePathList = leafref1.getAtomicPath();
- Iterator<YangAtomicPath> absPathIterator = absolutePathList.listIterator();
- YangAtomicPath abspath = absPathIterator.next();
- assertThat(abspath.getNodeIdentifier().getName(), is("interface"));
- assertThat(abspath.getNodeIdentifier().getPrefix(), is("test"));
-
- List<YangPathPredicate> pathPredicateList = abspath.getPathPredicatesList();
- Iterator<YangPathPredicate> pathPredicate = pathPredicateList.listIterator();
- YangPathPredicate pathPredicate1 = pathPredicate.next();
- assertThat(pathPredicate1.getNodeIdentifier().getName(), is("name"));
- assertThat(pathPredicate1.getNodeIdentifier().getPrefix(), nullValue());
- assertThat(pathPredicate1.getRightRelativePath().getAncestorNodeCount(), is(1));
- assertThat(pathPredicate1.getPathOperator(), is(YangPathOperator.EQUALTO));
- assertThat(pathPredicate1.getRightRelativePath().getAtomicPathList().listIterator().next().getNodeIdentifier()
- .getName(), is("ifname"));
- //TODO : Fill the path predicates
-// assertThat(pathPredicate1.getLeftAxisNode(), is(leafNameInList));
-// assertThat(pathPredicate1.getRightAxisNode(), is(leafInfo));
- }
-
- /**
- * Checks inter file resolution when leafref refers to multiple leafrefs through many files.
- */
- @Test
- public void processInterFileLeafrefRefersToMultipleLeafrefInMultipleFiles()
- throws IOException, ParserException {
-
- String searchDir = "src/test/resources/leafreflinker/interfile" +
- "/interfileleafrefreferstomultipleleafrefinmultiplefiles";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- YangNode refNode1 = null;
- YangNode refNode2 = null;
- YangNode selfNode = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- for (YangNode rootNode : utilManager.getYangNodeSet()) {
- if (rootNode.getName().equals("ietf-network-topology")) {
- selfNode = rootNode;
- } else if (rootNode.getName().equals("ietf-network")) {
- refNode1 = rootNode;
- } else {
- refNode2 = rootNode;
- }
- }
- // Check whether the data model tree returned is of type module.
- assertThat(selfNode instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("ietf-network-topology"));
-
- YangList list = (YangList) yangNode.getChild().getChild();
- ListIterator<YangLeaf> leafIterator = list.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("link-tp"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
- assertThat(leafInfo.getDataType().getDataType(), is(LEAFREF));
-
- YangLeafRef leafref = (YangLeafRef) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- YangLeaf leafInfo2 = (YangLeaf) leafref.getReferredLeafOrLeafList();
- assertThat(leafref.getReferredLeafOrLeafList(), is(leafInfo2));
- assertThat(leafref.getResolvableStatus(), is(RESOLVED));
-
- assertThat(leafref.getEffectiveDataType().getDataType(),
- is(YangDataTypes.STRING));
- }
-
-
- /**
- * Checks addition of if-feature list to leafref.
- */
- @Test
- public void processSelfFileLinkingWithFeatureReferredByLeafref()
- throws IOException, ParserException {
-
- String searchDir = "src/test/resources/leafreflinker/iffeatuinleafref/simpleleafrefwithiffeature";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- YangNode selfNode = null;
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("syslog")) {
- selfNode = rootNode;
- }
- // Check whether the data model tree returned is of type module.
- assertThat((selfNode instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("syslog"));
-
- List<YangFeature> featureList = yangNode.getFeatureList();
- YangFeature feature = featureList.iterator().next();
- assertThat(feature.getName(), is("local-storage"));
-
- YangContainer container = (YangContainer) yangNode.getChild();
- assertThat(container.getName(), is("speed"));
-
- List<YangLeaf> listOfLeaf = container.getListOfLeaf();
- YangLeaf leaf = listOfLeaf.iterator().next();
- assertThat(leaf.getName(), is("local-storage-limit"));
-
- List<YangIfFeature> ifFeatureList = leaf.getIfFeatureList();
- YangIfFeature ifFeature = ifFeatureList.iterator().next();
- assertThat(ifFeature.getName().getName(), is("local-storage"));
- assertThat(ifFeature.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
-
- ListIterator<YangLeaf> listOfLeafInModule = yangNode.getListOfLeaf().listIterator();
- YangLeaf yangLeaf = listOfLeafInModule.next();
- assertThat(yangLeaf.getName(), is("storage-value"));
-
- YangLeafRef leafRef = (YangLeafRef) yangLeaf.getDataType().getDataTypeExtendedInfo();
-
- assertThat(leafRef.getEffectiveDataType().getDataType(), is(YangDataTypes.UINT64));
-
- List<YangIfFeature> ifFeatureListInLeafref = leafRef.getIfFeatureList();
- YangIfFeature ifFeatureInLeafref = ifFeatureListInLeafref.iterator().next();
- assertThat(ifFeatureInLeafref.getName().getName(), is("local-storage"));
- assertThat(ifFeatureInLeafref.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
- }
-
- /**
- * Checks addition of if-feature list to leafref when referred leaf is again having leafref in it.
- */
- @Test
- public void processSelfFileLinkingWithFeatureReferredByMultiLeafref()
- throws IOException, ParserException {
-
- String searchDir = "src/test/resources/leafreflinker/iffeatuinleafref/featurebymultileafref";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- YangNode selfNode = null;
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("syslog")) {
- selfNode = rootNode;
- }
- // Check whether the data model tree returned is of type module.
- assertThat((selfNode instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("syslog"));
-
- List<YangFeature> featureList = yangNode.getFeatureList();
- YangFeature feature = featureList.iterator().next();
- assertThat(feature.getName(), is("local-storage"));
-
- YangContainer container = (YangContainer) yangNode.getChild();
- assertThat(container.getName(), is("speed"));
-
- List<YangLeaf> listOfLeaf = container.getListOfLeaf();
- YangLeaf leaf = listOfLeaf.iterator().next();
- assertThat(leaf.getName(), is("local-storage-limit"));
-
- List<YangIfFeature> ifFeatureList = leaf.getIfFeatureList();
- YangIfFeature ifFeature = ifFeatureList.iterator().next();
- assertThat(ifFeature.getName().getName(), is("local-storage"));
- assertThat(ifFeature.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
-
- ListIterator<YangLeaf> listOfLeafInModule = yangNode.getListOfLeaf().listIterator();
- YangLeaf yangLeaf = listOfLeafInModule.next();
- assertThat(yangLeaf.getName(), is("storage-value"));
-
- YangLeafRef leafRef = (YangLeafRef) yangLeaf.getDataType().getDataTypeExtendedInfo();
-
- assertThat(leafRef.getEffectiveDataType().getDataType(), is(YangDataTypes.UINT64));
-
- List<YangIfFeature> ifFeatureListInLeafref = leafRef.getIfFeatureList();
- YangIfFeature ifFeatureInLeafref = ifFeatureListInLeafref.iterator().next();
-
- assertThat(ifFeatureInLeafref.getName().getName(), is("main-storage"));
- assertThat(ifFeatureInLeafref.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
-
- YangIfFeature ifFeatureInLeafref1 = ifFeatureListInLeafref.iterator().next();
-
- assertThat(ifFeatureInLeafref1.getName().getName(), is("main-storage"));
- assertThat(ifFeatureInLeafref1.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
- }
-
- /**
- * Checks self resolution when leafref in grouping is copied to augment.
- */
- @Test
- public void processSelfResolutionWhenLeafrefInGroupingIsUnderAugment()
- throws IOException, ParserException {
-
- String searchDir = "src/test/resources/leafreflinker/intrafile/leafrefInAugment";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- YangNode selfNode = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("topology")) {
- selfNode = rootNode;
- }
-
- // Check whether the data model tree returned is of type module.
- assertThat((selfNode instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("topology"));
-
- ListIterator<YangLeaf> leafIterator;
- YangLeaf leafInfo;
-
- YangAugment augment = (YangAugment) yangNode.getChild().getNextSibling();
-
- YangList list = (YangList) augment.getChild().getChild().getChild().getChild().getChild();
-
- leafIterator = list.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
-
- // Check whether the information in the leaf is correct.
- assertThat(leafInfo.getName(), is("src-tp-ref"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
- YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
-
- // Check whether leafref type got resolved.
- assertThat(leafref.getResolvableStatus(),
- is(ResolvableStatus.RESOLVED));
-
- // Check the effective type for the leaf.
- assertThat(leafref.getEffectiveDataType().getDataType(),
- is(YangDataTypes.UINT8));
- }
-
- /**
- * Checks self resolution when leafref under grouping's uses.
- */
- @Test
- public void processSelfResolutionWhenLeafrefUnderGroupingUses()
- throws IOException, ParserException {
-
- String searchDir = "src/test/resources/leafreflinker/intrafile/leafrefinusesundergrouping";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- YangNode selfNode = null;
- YangNode refNode = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("ietf-network")) {
- selfNode = rootNode;
- refNode = yangNodeIterator.next();
- } else {
- refNode = rootNode;
- selfNode = yangNodeIterator.next();
- }
-
- // Check whether the data model tree returned is of type module.
- assertThat(selfNode instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("ietf-network"));
-
- // Check whether the module name is set correctly.
- YangModule yangNode1 = (YangModule) refNode;
- assertThat(yangNode1.getName(), is("network"));
-
- YangContainer yangContainer = (YangContainer) yangNode.getChild().getNextSibling().getNextSibling();
- assertThat(yangContainer.getName(), is("fine"));
-
- YangContainer yangContainer1 = (YangContainer) yangContainer.getChild().getNextSibling();
- assertThat(yangContainer1.getName(), is("hi"));
-
- ListIterator<YangLeaf> leafIterator;
- YangLeaf leafInfo;
-
- leafIterator = yangContainer1.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
-
- // Check whether the information in the leaf is correct.
- assertThat(leafInfo.getName(), is("network-id-ref"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
- YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
-
- // Check whether leafref type got resolved.
- assertThat(leafref.getResolvableStatus(),
- is(ResolvableStatus.RESOLVED));
-
- // Check the effective type for the leaf.
- assertThat(leafref.getEffectiveDataType().getDataType(),
- is(YangDataTypes.DERIVED));
- }
-
- /**
- * Checks self resolution when leafref under typedef refers to the node where it is used.
- */
- @Test
- public void processSelfResolutionWhenLeafrefInTypedefIsUsedInSameReferredNode()
- throws IOException, ParserException {
-
- String searchDir = "src/test/resources/leafreflinker/intrafile/leafrefintypedefwithsamereferpath";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- YangNode selfNode = null;
-
- // Create YANG node set
- yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet());
-
- // Add references to import list.
- yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- updateFilePriority(utilManager.getYangNodeSet());
-
- // Carry out inter-file linking.
- yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator();
-
- YangNode rootNode = yangNodeIterator.next();
-
- if (rootNode.getName().equals("typedef")) {
- selfNode = rootNode;
- }
-
- // Check whether the data model tree returned is of type module.
- assertThat((selfNode instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) selfNode;
- assertThat(yangNode.getName(), is("typedef"));
-
- ListIterator<YangLeaf> leafIterator;
- YangLeaf leafInfo;
-
- YangContainer yangContainer = (YangContainer) yangNode.getChild().getNextSibling();
-
- leafIterator = yangContainer.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
-
- // Check whether the information in the leaf is correct.
- assertThat(leafInfo.getName(), is("reference"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
- YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
-
- // Check whether leafref type got resolved.
- assertThat(leafref.getResolvableStatus(),
- is(ResolvableStatus.RESOLVED));
-
- // Check the effective type for the leaf.
- assertThat(leafref.getEffectiveDataType().getDataType(),
- is(YangDataTypes.UINT8));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/IntraFileTypeLinkingTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/IntraFileTypeLinkingTest.java
deleted file mode 100644
index a9fcdd2..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/IntraFileTypeLinkingTest.java
+++ /dev/null
@@ -1,565 +0,0 @@
-/*
- * 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.plugin.manager;
-
-import java.io.IOException;
-import java.util.ListIterator;
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangDerivedInfo;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangTypeDef;
-import org.onosproject.yangutils.linker.exceptions.LinkerException;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.BINARY;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.DERIVED;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.INT32;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.STRING;
-import static org.onosproject.yangutils.datamodel.YangNodeType.MODULE_NODE;
-import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.INTRA_FILE_RESOLVED;
-import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.RESOLVED;
-
-/**
- * Test cases for testing "type" intra file linking.
- */
-public class IntraFileTypeLinkingTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks self resolution when typedef and leaf using type are siblings.
- */
- @Test
- public void processSelfResolutionWhenTypeAndTypedefAtRootLevel()
- throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/SelfResolutionWhenTypeAndTypedefAtRootLevel.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat(node instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
- assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
-
- assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
- is((YangTypeDef) node.getChild()));
-
- assertThat(leafInfo.getDataType().getResolvableStatus(), is(RESOLVED));
-
- YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- // Check for the effective built-in type.
- assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
-
- // Check for the restriction.
- assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
- assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue()));
- }
-
- /**
- * Checks self resolution when typedef and leaf using type are at different
- * level where typedef is at the root.
- */
- @Test
- public void processSelfFileLinkingTypedefAtRootTypeTwoLevelInHierarchy()
- throws IOException, ParserException {
-
- YangNode node =
- manager.getDataModel("src/test/resources/SelfFileLinkingTypedefAtRootTypeTwoLevelInHierarchy.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- YangContainer yangContainer = (YangContainer) node.getChild().getNextSibling();
-
- YangList yangList = (YangList) yangContainer.getChild();
-
- ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
- assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
-
- assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
- is((YangTypeDef) node.getChild()));
-
- assertThat(leafInfo.getDataType().getResolvableStatus(), is(RESOLVED));
-
- YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- // Check for the effective built-in type.
- assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
-
- // Check for the restriction.
- assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
- assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue()));
- }
-
- /**
- * Checks self resolution when typedef and leaf using type are at different
- * level where typedef is at the root and defined after parent holder
- * of type.
- */
- @Test
- public void processSelfFileLinkingTypedefAtRootIsAfterContainerHavingType()
- throws IOException, ParserException {
-
- YangNode node =
- manager.getDataModel("src/test/resources/SelfFileLinkingTypedefAtRootIsAfterContainerHavingType.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- YangContainer yangContainer = (YangContainer) node.getChild();
-
- YangList yangList = (YangList) yangContainer.getChild();
-
- ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
- assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
-
- assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
- is((YangTypeDef) node.getChild().getNextSibling()));
-
- assertThat(leafInfo.getDataType().getResolvableStatus(), is(RESOLVED));
-
- YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- // Check for the effective built-in type.
- assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
-
- // Check for the restriction.
- assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
- assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue()));
- }
-
- /**
- * Checks self resolution when typedef and leaf using type are at different
- * level where typedef is at the level of root+1 and defined after parent
- * holder of type.
- */
- @Test
- public void processSelfFileLinkingTypedefAtMiddleLevelAfterParentHolder()
- throws IOException, ParserException {
-
- YangNode node =
- manager.getDataModel("src/test/resources/SelfFileLinkingTypedefAtMiddleLevelAfterParentHolder.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- YangContainer yangContainer = (YangContainer) node.getChild();
-
- YangList yangList = (YangList) yangContainer.getChild();
-
- ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
- assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
-
- assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
- is((YangTypeDef) yangContainer.getChild().getNextSibling()));
-
- assertThat(leafInfo.getDataType().getResolvableStatus(), is(RESOLVED));
-
- YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- // Check for the effective built-in type.
- assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
-
- // Check for the restriction.
- assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
- assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue()));
- }
-
- /**
- * Checks self resolution when typedef hierarchical references are present.
- */
- @Test
- public void processSelfFileLinkingWithTypdefHierarchicalReference()
- throws IOException, ParserException {
-
- YangNode node =
- manager.getDataModel("src/test/resources/SelfFileLinkingWithTypdefHierarchicalReference.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- YangContainer yangContainer = (YangContainer) node.getChild().getNextSibling();
-
- YangList yangList = (YangList) yangContainer.getChild();
-
- ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("FirstClass"));
- assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
-
- assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
- is((YangTypeDef) yangList.getChild()));
- assertThat(leafInfo.getDataType().getResolvableStatus(),
- is(RESOLVED));
-
- YangTypeDef typeDef1 = (YangTypeDef) yangList.getChild();
-
- assertThat(((YangDerivedInfo<?>) typeDef1.getTypeDefBaseType().getDataTypeExtendedInfo()).getReferredTypeDef(),
- is((YangTypeDef) yangContainer.getChild().getNextSibling()));
- assertThat(typeDef1.getTypeDefBaseType().getResolvableStatus(),
- is(RESOLVED));
-
- YangTypeDef typeDef2 = (YangTypeDef) yangContainer.getChild().getNextSibling();
-
- assertThat(((YangDerivedInfo<?>) typeDef2.getTypeDefBaseType().getDataTypeExtendedInfo()).getReferredTypeDef(),
- is((YangTypeDef) node.getChild()));
- assertThat(typeDef2.getTypeDefBaseType().getResolvableStatus(),
- is(RESOLVED));
-
- YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- // Check for the effective built-in type.
- assertThat(derivedInfo.getEffectiveBuiltInType(), is(INT32));
-
- // Check for the restriction.
- assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
- assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue()));
- }
-
- /**
- * Checks self resolution when typedef hierarchical references are present
- * with last type is unresolved.
- */
- @Test
- public void processSelfFileLinkingWithTypdefHierarchicalRefUnresolved()
- throws IOException, ParserException {
-
- YangNode node =
- manager.getDataModel("src/test/resources/SelfFileLinkingWithTypdefHierarchicalRefUnresolved.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- YangContainer yangContainer = (YangContainer) node.getChild().getNextSibling();
-
- YangList yangList = (YangList) yangContainer.getChild();
-
- ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("FirstClass"));
- assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
-
- assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
- is((YangTypeDef) yangList.getChild()));
- assertThat(leafInfo.getDataType().getResolvableStatus(),
- is(INTRA_FILE_RESOLVED));
-
- YangTypeDef typeDef1 = (YangTypeDef) yangList.getChild();
-
- assertThat(((YangDerivedInfo<?>) typeDef1.getTypeDefBaseType().getDataTypeExtendedInfo()).getReferredTypeDef(),
- is((YangTypeDef) yangContainer.getChild().getNextSibling()));
- assertThat(typeDef1.getTypeDefBaseType().getResolvableStatus(),
- is(INTRA_FILE_RESOLVED));
-
- YangTypeDef typeDef2 = (YangTypeDef) yangContainer.getChild().getNextSibling();
-
- assertThat(((YangDerivedInfo<?>) typeDef2.getTypeDefBaseType().getDataTypeExtendedInfo()).getReferredTypeDef(),
- is((YangTypeDef) node.getChild()));
- assertThat(typeDef2.getTypeDefBaseType().getResolvableStatus(),
- is(INTRA_FILE_RESOLVED));
-
- YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- // Check for the effective built-in type.
- assertThat(derivedInfo.getEffectiveBuiltInType(), is(nullValue()));
-
- // Check for the restriction.
- assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
- assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue()));
- }
-
- /**
- * Checks self resolution when type uses prefix of self module.
- */
- @Test
- public void processSelfFileLinkingWithTypeWithSelfModulePrefix()
- throws IOException, ParserException {
-
- YangNode node =
- manager.getDataModel("src/test/resources/SelfFileLinkingWithTypeWithSelfModulePrefix.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- YangContainer yangContainer = (YangContainer) node.getChild().getNextSibling();
-
- YangList yangList = (YangList) yangContainer.getChild();
-
- ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("FirstClass"));
- assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
-
- assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
- is((YangTypeDef) yangList.getChild()));
- assertThat(leafInfo.getDataType().getResolvableStatus(),
- is(RESOLVED));
-
- YangTypeDef typeDef1 = (YangTypeDef) yangList.getChild();
-
- assertThat(((YangDerivedInfo<?>) typeDef1.getTypeDefBaseType().getDataTypeExtendedInfo()).getReferredTypeDef(),
- is((YangTypeDef) yangContainer.getChild().getNextSibling()));
- assertThat(typeDef1.getTypeDefBaseType().getResolvableStatus(),
- is(RESOLVED));
-
- YangTypeDef typeDef2 = (YangTypeDef) yangContainer.getChild().getNextSibling();
-
- assertThat(((YangDerivedInfo<?>) typeDef2.getTypeDefBaseType().getDataTypeExtendedInfo()).getReferredTypeDef(),
- is((YangTypeDef) node.getChild()));
- assertThat(typeDef2.getTypeDefBaseType().getResolvableStatus(),
- is(RESOLVED));
-
- YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- // Check for the effective built-in type.
- assertThat(derivedInfo.getEffectiveBuiltInType(), is(INT32));
-
- // Check for the restriction.
- assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
- assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue()));
- }
-
- /**
- * Checks self resolution when some type uses prefix of self module
- * some uses external prefix.
- */
- @Test
- public void processSelfFileLinkingWithTypeWithSelfAndExternalPrefixMix()
- throws IOException, ParserException {
-
- YangNode node =
- manager.getDataModel("src/test/resources/SelfFileLinkingWithTypeWithSelfAndExternalPrefixMix.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- YangContainer yangContainer = (YangContainer) node.getChild().getNextSibling();
-
- YangList yangList = (YangList) yangContainer.getChild();
-
- ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("FirstClass"));
- assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
-
- assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
- is((YangTypeDef) yangList.getChild()));
- assertThat(leafInfo.getDataType().getResolvableStatus(),
- is(INTRA_FILE_RESOLVED));
-
- YangTypeDef typeDef1 = (YangTypeDef) yangList.getChild();
-
- YangTypeDef typeDef2 = (YangTypeDef) yangContainer.getChild().getNextSibling();
-
- assertThat(((YangDerivedInfo<?>) typeDef2.getTypeDefBaseType().getDataTypeExtendedInfo()).getReferredTypeDef(),
- is((YangTypeDef) node.getChild()));
- assertThat(typeDef2.getTypeDefBaseType().getResolvableStatus(),
- is(RESOLVED));
-
- YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- // Check for the effective built-in type.
- assertThat(derivedInfo.getEffectiveBuiltInType(), is(nullValue()));
-
- // Check for the restriction.
- assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
- assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue()));
- }
-
- /**
- * Check self resolution when type referred typedef is not available in
- * file.
- */
- @Test(expected = LinkerException.class)
- public void processSelfResolutionWhenTypeReferredTypedefNotDefined()
- throws IOException, LinkerException {
-
- YangNode node =
- manager.getDataModel("src/test/resources/SelfResolutionWhenTypeReferredTypedefNotDefined.yang");
- }
-
- /**
- * Checks self resolution when typedef and leaf using type are at different
- * level where typedef is is not an ancestor of type.
- */
- @Test(expected = LinkerException.class)
- public void processSelfFileLinkingTypedefNotFound()
- throws IOException, LinkerException {
-
- YangNode node = manager.getDataModel("src/test/resources/SelfFileLinkingTypedefNotFound.yang");
- }
-
- /**
- * Checks hierarchical self resolution with self resolution failure scenario.
- */
- @Test(expected = LinkerException.class)
- public void processSelfFileLinkingWithHierarchicalTypeFailureScenario()
- throws IOException, LinkerException {
-
- YangNode node =
- manager.getDataModel("src/test/resources/SelfFileLinkingWithHierarchicalTypeFailureScenario.yang");
- }
-
- /**
- * Checks self resolution when typedef and leaf using type are siblings for binary type.
- */
- @Test
- public void processSelfResolutionWhenTypeAndTypedefAtRootLevelForBinary()
- throws IOException, ParserException {
-
- YangNode node
- = manager.getDataModel("src/test/resources/SelfResolutionWhenTypeAndTypedefAtRootLevelForBinary.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat(node instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("ospf"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("typedef14"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("type14"));
- assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
-
- assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
- is((YangTypeDef) node.getChild()));
-
- assertThat(leafInfo.getDataType().getResolvableStatus(), is(RESOLVED));
-
- YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- // Check for the effective built-in type.
- assertThat(derivedInfo.getEffectiveBuiltInType(), is(BINARY));
-
- // Check for the restriction.
- assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
- assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue()));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/IntraFileUsesLinkingTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/IntraFileUsesLinkingTest.java
deleted file mode 100644
index 075d2f9..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/IntraFileUsesLinkingTest.java
+++ /dev/null
@@ -1,652 +0,0 @@
-/*
- * 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.plugin.manager;
-
-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.YangContainer;
-import org.onosproject.yangutils.datamodel.YangGrouping;
-import org.onosproject.yangutils.datamodel.YangInput;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangTypeDef;
-import org.onosproject.yangutils.datamodel.YangUses;
-import org.onosproject.yangutils.datamodel.utils.ResolvableStatus;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.linker.exceptions.LinkerException;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-
-/**
- * Test cases for testing uses intra file linking.
- */
-public class IntraFileUsesLinkingTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks self resolution when grouping and uses are siblings.
- * Grouping followed by uses.
- */
- @Test
- public void processSelfResolutionWhenUsesAndGroupingAtRootLevel()
- throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/SelfResolutionWhenUsesAndGroupingAtRootLevel.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- // 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().getDataType(), is(YangDataTypes.STRING));
-
- // Check whether grouping is the sibling of module's child.
- assertThat((yangNode.getChild().getNextSibling() instanceof YangGrouping), is(true));
-
- YangGrouping grouping = (YangGrouping) yangNode.getChild().getNextSibling();
- leafIterator = grouping.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
-
- // 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().getDataType(), is(YangDataTypes.STRING));
-
- // Check whether uses is module's child.
- assertThat((yangNode.getChild() instanceof YangUses), is(true));
- YangUses uses = (YangUses) yangNode.getChild();
-
- // Check whether uses get resolved
- assertThat(uses.getResolvableStatus(),
- is(ResolvableStatus.RESOLVED));
- }
-
- /**
- * Checks self resolution when grouping and uses are siblings.
- * Grouping has a child node.
- */
- @Test
- public void processSelfResolutionWhenUsesAndGroupingAtRootLevelGroupingWithChild()
- throws IOException, ParserException {
-
- YangNode node = manager.getDataModel(
- "src/test/resources/SelfResolutionWhenUsesAndGroupingAtRootLevelGroupingWithChild.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator;
- YangLeaf leafInfo;
-
- ListIterator<YangLeaf> leafIterator1 = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo1 = leafIterator1.next();
-
- // Check whether the information in the leaf is correct under module.
- assertThat(leafInfo1.getName(), is("treat"));
- assertThat(leafInfo1.getDataType().getDataTypeName(), is("string"));
- assertThat(leafInfo1.getDataType().getDataType(), is(YangDataTypes.STRING));
-
- YangContainer container = (YangContainer) yangNode.getChild().getNextSibling().getNextSibling();
-
- // Check whether the container name is set correctly which is under module.
- assertThat(container.getName(), is("test"));
-
- leafIterator = container.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
-
- // 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().getDataType(), is(YangDataTypes.STRING));
-
- // Check whether grouping is the sibling of module's child.
- assertThat((yangNode.getChild().getNextSibling() instanceof YangGrouping), is(true));
-
- YangGrouping grouping = (YangGrouping) yangNode.getChild().getNextSibling();
- leafIterator = grouping.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
-
- // 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().getDataType(), is(YangDataTypes.STRING));
-
- // Check whether container is the child of grouping.
- assertThat((grouping.getChild() instanceof YangContainer), is(true));
- container = (YangContainer) grouping.getChild();
-
- // Check whether the container name is set correctly which is under grouping.
- assertThat(container.getName(), is("test"));
-
- leafIterator = container.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
-
- // 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().getDataType(), is(YangDataTypes.STRING));
-
- // Check whether uses is module's child.
- assertThat((yangNode.getChild() instanceof YangUses), is(true));
- YangUses uses = (YangUses) yangNode.getChild();
-
- // Check whether uses get resolved.
- assertThat(uses.getResolvableStatus(),
- is(ResolvableStatus.RESOLVED));
-
- }
-
- /**
- * Checks self resolution when grouping in rpc and uses in output of the same rpc.
- * Uses is followed by grouping.
- */
- @Test
- public void processSelfResolutionGroupingInRpcAndUsesInOutput()
- throws IOException, ParserException {
-
- YangNode node = manager
- .getDataModel("src/test/resources/SelfResolutionGroupingInRpcAndUsesInOutput.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("rock"));
-
- ListIterator<YangLeaf> leafIterator;
- YangLeaf leafInfo;
-
- // Check whether grouping is the child of rpc.
- assertThat((yangNode.getChild().getChild() instanceof YangGrouping), is(true));
- YangGrouping grouping = (YangGrouping) yangNode.getChild().getChild();
-
- // Check whether the grouping name is set correctly.
- assertThat(grouping.getName(), is("hello"));
-
- // Check whether list is the child of grouping.
- assertThat((grouping.getChild() instanceof YangList), is(true));
- YangList yangListNode = (YangList) grouping.getChild();
-
- // Check whether the list name is set correctly.
- assertThat(yangListNode.getName(), is("valid"));
-
- leafIterator = yangListNode.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
-
- // Check whether the information in the leaf is correct under list which is under grouping.
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
- assertThat(leafInfo.getUnits(), is("\"seconds\""));
- assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
-
- // Check whether uses is input's child.
- assertThat((yangNode.getChild().getChild().getNextSibling().getChild() instanceof YangUses), is(true));
- YangUses uses = (YangUses) yangNode.getChild().getChild().getNextSibling().getChild();
-
- // Check whether uses get resolved.
- assertThat(uses.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
-
- YangInput inputNode = ((YangInput) yangNode.getChild().getChild().getNextSibling());
- assertThat((inputNode.getChild() instanceof YangUses), is(true));
-
- YangList yangList = ((YangList) inputNode.getChild().getNextSibling());
- assertThat(yangList.getName(), is("valid"));
-
- leafIterator = yangList.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
-
- // Check whether the information in the leaf is correct under list which is deep copied.
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
- assertThat(leafInfo.getUnits(), is("\"seconds\""));
- assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
- }
-
- /**
- * Checks the failure scenario when uses is referring to its own grouping directly.
- */
- @Test
- public void processSelfResolutionGroupingReferencingItselfFailureScenerio()
- throws IOException {
-
- thrown.expect(LinkerException.class);
- thrown.expectMessage(
- "YANG file error: Duplicate input identifier detected, same as leaf \"zip-code\"");
- YangNode node = manager
- .getDataModel("src/test/resources/SelfResolutionGroupingReferencingItselfFailureScenerio.yang");
-
- }
-
- /**
- * Checks the when multiple uses are present and are referred to the grouping at different levels.
- */
- @Test
- public void processSelfResolutionGroupingWithMultipleUses()
- throws IOException, ParserException {
-
- YangNode node = manager
- .getDataModel("src/test/resources/SelfResolutionGroupingWithMultipleUses.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator;
- YangLeaf leafInfo;
-
- // Check whether grouping is the child of container.
- assertThat((yangNode.getChild().getChild() instanceof YangGrouping), is(true));
- YangGrouping grouping = (YangGrouping) yangNode.getChild().getChild();
-
- // Check whether the grouping name is set correctly.
- assertThat(grouping.getName(), is("endpoint"));
-
- // Check whether uses is endpoint-grouping's child.
- assertThat((grouping.getChild() instanceof YangUses), is(true));
- YangUses firstUses = (YangUses) grouping.getChild();
-
- // Check whether uses get resolved.
- assertThat(firstUses.getResolvableStatus(), is(ResolvableStatus.RESOLVED));
-
- // Validate first uses child is cloned properly
- assertThat((firstUses.getNextSibling().getNextSibling()
- .getNextSibling().getNextSibling() instanceof YangList), is(true));
- YangList firstUsesChild = ((YangList) firstUses.getNextSibling().getNextSibling().getNextSibling()
- .getNextSibling());
- assertThat(firstUsesChild.getName(), is("valid"));
-
- leafIterator = firstUsesChild.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
-
- // Check whether the information in the leaf is correct under list which has been deep copied from grouping.
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
- assertThat(leafInfo.getUnits(), is("\"seconds\""));
- assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
-
- //validate uses second
- assertThat((firstUses.getNextSibling() instanceof YangContainer), is(true));
- YangContainer container = (YangContainer) firstUses.getNextSibling();
- assertThat(container.getName(), is("design"));
-
- assertThat((container.getChild() instanceof YangUses), is(true));
- assertThat((container.getListOfLeaf().iterator().next().getName()), is("ink"));
-
- //validate uses third
- assertThat((container.getChild().getNextSibling() instanceof YangContainer), is(true));
- YangContainer container2 = ((YangContainer) container.getChild().getNextSibling());
- assertThat(container2.getName(), is("correct"));
- assertThat((container2.getChild() instanceof YangUses), is(true));
- assertThat((container2.getChild().getNextSibling() instanceof YangContainer), is(true));
- YangContainer thirdUsesChild = ((YangContainer) container2.getChild().getNextSibling());
- assertThat(thirdUsesChild.getListOfLeaf().iterator().next().getName(), is("zip-code"));
-
- //validate fourth uses
- assertThat((firstUses.getNextSibling().getNextSibling() instanceof YangUses), is(true));
- YangUses fourthUses = ((YangUses) firstUses.getNextSibling().getNextSibling());
- assertThat((fourthUses.getNextSibling().getNextSibling().getNextSibling() instanceof YangTypeDef),
- is(true));
- assertThat(fourthUses.getNextSibling().getNextSibling().getNextSibling().getName(), is("my-type"));
-
- //validate fifth uses
- assertThat((firstUses.getNextSibling().getNextSibling().getNextSibling() instanceof YangUses),
- is(true));
-
- //validate end point uses
- assertThat(grouping.getNextSibling() instanceof YangUses, is(true));
- assertThat(grouping.getNextSibling().getNextSibling().getNextSibling().getNextSibling()
- .getNextSibling().getNextSibling().getNextSibling().getNextSibling() instanceof YangContainer,
- is(true));
- container = (YangContainer) grouping.getNextSibling().getNextSibling().getNextSibling().getNextSibling()
- .getNextSibling().getNextSibling().getNextSibling().getNextSibling();
- assertThat(container.getName(), is("design"));
- container2 = (YangContainer) container.getChild().getNextSibling();
- assertThat(container2.getName(), is("correct"));
- assertThat(container2.getChild().getNextSibling().getName(), is("value"));
- }
-
- /**
- * Checks the failure scenario when uses is present under the same node many times.
- */
- @Test
- public void processSelfResolutionGroupingHavingSameUsesManyTimes()
- throws IOException, ParserException {
-
- thrown.expect(ParserException.class);
- thrown.expectMessage(
- "YANG file error: Duplicate input identifier detected, same as uses \"failure\"");
- YangNode node = manager
- .getDataModel("src/test/resources/SelfResolutionGroupingHavingSameUsesManyTimes.yang");
- }
-
- /**
- * Checks the rpc having both typedef and grouping.
- * It also checks that the grouping under different nodes will not give any problem in resolving uses.
- */
- @Test
- public void processSelfResolutionRpcWithOneTypedefAndTwoGroupingUnderDifferentNode()
- throws IOException, ParserException {
-
- YangNode node = manager
- .getDataModel(
- "src/test/resources/SelfResolutionRpcWithOneTypedefAndTwoGroupingUnderDifferentNode.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("rock"));
-
- ListIterator<YangLeaf> leafIterator;
- YangLeaf leafInfo;
-
- // Check whether grouping is the child of input.
- assertThat((yangNode.getChild().getChild().getChild() instanceof YangGrouping), is(true));
- YangGrouping groupingUnderInput = (YangGrouping) yangNode.getChild().getChild().getChild();
-
- // Check whether the grouping name is set correctly.
- assertThat(groupingUnderInput.getName(), is("creative"));
-
- leafIterator = groupingUnderInput.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
-
- // Check whether the information in the leaf is correct under grouping.
- assertThat(leafInfo.getName(), is("carry"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("string"));
- assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
-
- // Check whether grouping is the child of output.
- assertThat((yangNode.getChild().getChild().getNextSibling().getChild() instanceof YangGrouping), is(true));
- YangGrouping grouping = (YangGrouping) yangNode.getChild().getChild().getNextSibling().getChild();
- assertThat(grouping.getName(), is("creative"));
-
- // Check whether typedef is the sibling of grouping.
- assertThat((grouping.getNextSibling() instanceof YangTypeDef), is(true));
-
- YangTypeDef typedef = (YangTypeDef) grouping.getNextSibling();
- assertThat(typedef.getName(), is("my-type"));
-
- // Check whether uses is the sibling of typedef.
- assertThat((typedef.getNextSibling() instanceof YangUses), is(true));
-
- // Check whether uses get resolved.
- YangUses uses = (YangUses) typedef.getNextSibling();
- assertThat(uses.getName(), is("creative"));
- assertThat(uses.getResolvableStatus(),
- is(ResolvableStatus.RESOLVED));
- }
-
- /**
- * Checks the failure scenario when uses is cannot resolve its grouping.
- */
- @Test
- public void processSelfResolutionNestedGroupingWithUnresolvedUses()
- throws IOException, LinkerException {
-
- thrown.expect(LinkerException.class);
- thrown.expectMessage(
- "YANG file error: Unable to find base grouping for given uses");
-
- YangNode node = manager
- .getDataModel("src/test/resources/SelfResolutionNestedGroupingWithUnresolvedUses.yang");
- }
-
- /**
- * Checks self resolution when typedef hierarchical references are present
- * with last type is unresolved.
- */
- @Test
- public void processSelfFileLinkingWithGroupingHierarchicalRefUnresolved()
- throws IOException, ParserException {
-
- YangNode node = manager
- .getDataModel("src/test/resources/SelfFileLinkingWithGroupingHierarchicalRefUnresolved.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether container is the sibling of grouping.
- assertThat((yangNode.getChild().getNextSibling() instanceof YangContainer), is(true));
- YangContainer containerWithUses = (YangContainer) yangNode.getChild().getNextSibling();
- assertThat(containerWithUses.getName(), is("test"));
-
- // Check whether uses is the child of container.
- assertThat((containerWithUses.getChild() instanceof YangUses), is(true));
- YangUses uses = (YangUses) containerWithUses.getChild();
- assertThat(uses.getName(), is("create"));
-
- // Check whether uses is getting resolved.
- assertThat(uses.getResolvableStatus(),
- is(ResolvableStatus.INTRA_FILE_RESOLVED));
-
- // Check whether grouping is the child of module.
- assertThat((yangNode.getChild() instanceof YangGrouping), is(true));
- YangGrouping groupingWithUses = (YangGrouping) yangNode.getChild();
- assertThat(groupingWithUses.getName(), is("create"));
-
- // Check whether uses with prefix from from other file, is the child of grouping.
- assertThat((groupingWithUses.getChild() instanceof YangUses), is(true));
- YangUses uses1 = (YangUses) groupingWithUses.getChild();
- assertThat(uses1.getName(), is("valid"));
-
- // Check whether this uses is getting intra-file-resolved.
- assertThat(uses1.getResolvableStatus(),
- is(ResolvableStatus.INTRA_FILE_RESOLVED));
- }
-
- /**
- * Checks self resolution when uses has prefix of self module.
- */
- @Test
- public void processSelfFileLinkingWithGroupingWithSelfModulePrefix()
- throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/SelfFileLinkingWithGroupingWithSelfModulePrefix.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether container is the sibling of grouping.
- YangContainer yangContainer = (YangContainer) node.getChild().getNextSibling();
-
- // Check whether list is the child of container.
- YangList yangList = (YangList) yangContainer.getChild();
-
- // Check whether uses is the child of list.
- assertThat((yangList.getChild() instanceof YangUses), is(true));
- YangUses yangUses1 = (YangUses) yangList.getChild();
- assertThat(yangUses1.getName(), is("FirstClass"));
-
- // Check whether uses is getting resolved.
- assertThat(yangUses1.getResolvableStatus(),
- is(ResolvableStatus.RESOLVED));
-
- // Check whether grouping is the sibling of uses.
- YangGrouping yangGrouping1 = (YangGrouping) yangUses1.getNextSibling();
- assertThat(yangGrouping1.getName(), is("FirstClass"));
-
- // Check whether uses is the child of grouping.
- YangUses yangUses2 = (YangUses) yangGrouping1.getChild();
- assertThat(yangUses2.getName(), is("PassingClass"));
-
- // Check the uses gets resolved.
- assertThat(yangUses2.getResolvableStatus(),
- is(ResolvableStatus.RESOLVED));
-
- // Check whether grouping is the sibling of list.
- YangGrouping yangGrouping2 = (YangGrouping) yangList.getNextSibling();
- assertThat(yangGrouping2.getName(), is("PassingClass"));
-
- // Check uses is the child of that grouping which has prefix of the same module.
- YangUses yangUses3 = (YangUses) yangGrouping2.getChild();
- assertThat(yangUses3.getName(), is("Percentage"));
-
- // Check uses is getting resolved.
- assertThat(yangUses3.getResolvableStatus(),
- is(ResolvableStatus.RESOLVED));
-
- // Check grouping is the child of module.
- YangGrouping yangGrouping3 = (YangGrouping) node.getChild();
-
- ListIterator<YangLeaf> leafIterator;
- YangLeaf leafInfo;
- leafIterator = yangGrouping3.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
-
- // 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().getDataType(), is(YangDataTypes.STRING));
-
- }
-
- /**
- * Checks self resolution when some type uses prefix of self module
- * some uses external prefix.
- */
- @Test
- public void processSelfFileLinkingWithGroupingWithSelfAndExternalPrefixMix()
- throws IOException, ParserException {
-
- YangNode node = manager
- .getDataModel("src/test/resources/SelfFileLinkingWithGroupingWithSelfAndExternalPrefixMix.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat((node instanceof YangModule), is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // Check whether container is the sibling of grouping.
- YangContainer yangContainer = (YangContainer) node.getChild().getNextSibling();
-
- // Check whether list is the child of container.
- YangList yangList = (YangList) yangContainer.getChild();
-
- // Check whether uses is the child of list.
- assertThat((yangList.getChild() instanceof YangUses), is(true));
- YangUses yangUses1 = (YangUses) yangList.getChild();
- assertThat(yangUses1.getName(), is("FirstClass"));
-
- // Check whether uses is getting resolved.
- assertThat(yangUses1.getResolvableStatus(),
- is(ResolvableStatus.INTRA_FILE_RESOLVED));
-
- // Check whether grouping is the sibling of uses.
- YangGrouping yangGrouping1 = (YangGrouping) yangUses1.getNextSibling();
- assertThat(yangGrouping1.getName(), is("FirstClass"));
-
- // Check whether uses is the child of grouping which has prefix from other module.
- YangUses yangUses2 = (YangUses) yangGrouping1.getChild();
- assertThat(yangUses2.getName(), is("PassingClass"));
-
- // Check whether uses gets intra-file-resolved.
- assertThat(yangUses2.getResolvableStatus(),
- is(ResolvableStatus.INTRA_FILE_RESOLVED));
-
- // Check whether grouping is the sibling of list.
- YangGrouping yangGrouping2 = (YangGrouping) yangList.getNextSibling();
- assertThat(yangGrouping2.getName(), is("PassingClass"));
-
- // Check uses is the child of that grouping which has prefix of the same module.
- YangUses yangUses3 = (YangUses) yangGrouping2.getChild();
- assertThat(yangUses3.getName(), is("Percentage"));
-
- // Check uses is getting resolved.
- assertThat(yangUses3.getResolvableStatus(),
- is(ResolvableStatus.RESOLVED));
-
- // Check grouping is the child of module.
- YangGrouping yangGrouping3 = (YangGrouping) node.getChild();
- ListIterator<YangLeaf> leafIterator;
- YangLeaf leafInfo;
- leafIterator = yangGrouping3.getListOfLeaf().listIterator();
- leafInfo = leafIterator.next();
-
- // 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().getDataType(), is(YangDataTypes.STRING));
- }
-
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/NotificationTranslatorTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/NotificationTranslatorTest.java
deleted file mode 100644
index 2c8a7c2..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/NotificationTranslatorTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.plugin.manager;
-
-import java.io.IOException;
-
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-
-import static org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorUtil.generateJavaCode;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
-
-/**
- * Unit tests for union translator.
- */
-public final class NotificationTranslatorTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks union translation should not result in any exception.
- */
- @Test
- public void processNotificationTranslator()
- throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/NotificationTest.yang");
-
- YangPluginConfig yangPluginConfig = new YangPluginConfig();
- yangPluginConfig.setCodeGenDir("target/NotificationTest/");
-
- generateJavaCode(node, yangPluginConfig);
-
- deleteDirectory("target/NotificationTest/");
- }
-
- // TODO enhance the test cases, after having a framework of translator test.
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/RestrictionResolutionTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/RestrictionResolutionTest.java
deleted file mode 100644
index 6b64e5b..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/RestrictionResolutionTest.java
+++ /dev/null
@@ -1,912 +0,0 @@
-/*
- * 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.plugin.manager;
-
-import java.io.IOException;
-import java.math.BigInteger;
-import java.util.ListIterator;
-
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangDerivedInfo;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangPatternRestriction;
-import org.onosproject.yangutils.datamodel.YangRangeInterval;
-import org.onosproject.yangutils.datamodel.YangRangeRestriction;
-import org.onosproject.yangutils.datamodel.YangStringRestriction;
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.datamodel.YangTypeDef;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangInt16;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangInt32;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangUint64;
-import org.onosproject.yangutils.linker.exceptions.LinkerException;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.notNullValue;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.DERIVED;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.INT32;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.STRING;
-import static org.onosproject.yangutils.datamodel.YangNodeType.MODULE_NODE;
-import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.RESOLVED;
-
-/**
- * Test cases for testing restriction resolution.
- */
-public final class RestrictionResolutionTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks length restriction in typedef.
- */
- @Test
- public void processLengthRestrictionInTypedef()
- throws IOException, ParserException, DataModelException {
-
- YangNode node = manager.getDataModel("src/test/resources/LengthRestrictionInTypedef.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat(node instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
- assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
-
- assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
- is((YangTypeDef) node.getChild()));
-
- assertThat(leafInfo.getDataType().getResolvableStatus(), is(RESOLVED));
-
- YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- // Check for the effective built-in type.
- assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
-
- // Check for the restriction.
- assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
- assertThat(derivedInfo.getResolvedExtendedInfo(), is(notNullValue()));
-
- // Check for the restriction value.
- YangStringRestriction stringRestriction = (YangStringRestriction) derivedInfo.getResolvedExtendedInfo();
- YangRangeRestriction lengthRestriction = stringRestriction.getLengthRestriction();
-
- ListIterator<YangRangeInterval> lengthListIterator = lengthRestriction.getAscendingRangeIntervals()
- .listIterator();
-
- YangRangeInterval rangeInterval = lengthListIterator.next();
-
- assertThat(((YangUint64) rangeInterval.getStartValue()).getValue(), is(BigInteger.valueOf(0)));
- assertThat(((YangUint64) rangeInterval.getEndValue()).getValue(), is(BigInteger.valueOf(100)));
- }
-
- /**
- * Checks length restriction in referred type.
- */
- @Test
- public void processLengthRestrictionInRefType()
- throws IOException, ParserException, DataModelException {
-
- YangNode node = manager.getDataModel("src/test/resources/LengthRestrictionInRefType.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat(node instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
- assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
-
- assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
- is((YangTypeDef) node.getChild()));
-
- assertThat(leafInfo.getDataType().getResolvableStatus(), is(RESOLVED));
-
- YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- // Check for the effective built-in type.
- assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
-
- // Check for the restriction.
- assertThat(derivedInfo.getLengthRestrictionString(), is(notNullValue()));
- assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
- assertThat(derivedInfo.getResolvedExtendedInfo(), is(notNullValue()));
-
- // Check for the restriction value.
- YangStringRestriction stringRestriction = (YangStringRestriction) derivedInfo.getResolvedExtendedInfo();
- YangRangeRestriction lengthRestriction = stringRestriction.getLengthRestriction();
-
- ListIterator<YangRangeInterval> lengthListIterator = lengthRestriction.getAscendingRangeIntervals()
- .listIterator();
-
- YangRangeInterval rangeInterval = lengthListIterator.next();
-
- assertThat(((YangUint64) rangeInterval.getStartValue()).getValue(), is(BigInteger.valueOf(0)));
- assertThat(((YangUint64) rangeInterval.getEndValue()).getValue(), is(BigInteger.valueOf(100)));
- }
-
- /**
- * Checks length restriction in typedef and in type with stricter value.
- */
- @Test
- public void processLengthRestrictionInTypedefAndTypeValid()
- throws IOException, ParserException, DataModelException {
-
- YangNode node = manager.getDataModel("src/test/resources/LengthRestrictionInTypedefAndTypeValid.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat(node instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
- assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
-
- assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
- is((YangTypeDef) node.getChild()));
-
- assertThat(leafInfo.getDataType().getResolvableStatus(), is(RESOLVED));
-
- YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- // Check for the effective built-in type.
- assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
-
- // Check for the restriction.
- assertThat(derivedInfo.getLengthRestrictionString(), is(notNullValue()));
- assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
- assertThat(derivedInfo.getResolvedExtendedInfo(), is(notNullValue()));
-
- // Check for the restriction value.
- YangStringRestriction stringRestriction = (YangStringRestriction) derivedInfo.getResolvedExtendedInfo();
- YangRangeRestriction lengthRestriction = stringRestriction.getLengthRestriction();
-
- ListIterator<YangRangeInterval> lengthListIterator = lengthRestriction.getAscendingRangeIntervals()
- .listIterator();
-
- YangRangeInterval rangeInterval1 = lengthListIterator.next();
-
- assertThat(((YangUint64) rangeInterval1.getStartValue()).getValue(), is(BigInteger.valueOf(0)));
- assertThat(((YangUint64) rangeInterval1.getEndValue()).getValue(), is(BigInteger.valueOf(20)));
-
- YangRangeInterval rangeInterval2 = lengthListIterator.next();
-
- assertThat(((YangUint64) rangeInterval2.getStartValue()).getValue(), is(BigInteger.valueOf(201)));
- assertThat(((YangUint64) rangeInterval2.getEndValue()).getValue(), is(BigInteger.valueOf(300)));
- }
-
- /**
- * Checks length restriction in typedef and in type with not stricter value.
- */
- @Test(expected = LinkerException.class)
- public void processLengthRestrictionInTypedefAndTypeInValid()
- throws IOException, DataModelException {
- YangNode node = manager.getDataModel("src/test/resources/LengthRestrictionInTypedefAndTypeInValid.yang");
- }
-
- /**
- * Checks range restriction in typedef.
- */
- @Test
- public void processRangeRestrictionInTypedef()
- throws IOException, ParserException, DataModelException {
-
- YangNode node = manager.getDataModel("src/test/resources/RangeRestrictionInTypedef.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat(node instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
- assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
-
- assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
- is((YangTypeDef) node.getChild()));
-
- assertThat(leafInfo.getDataType().getResolvableStatus(), is(RESOLVED));
-
- YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- // Check for the effective built-in type.
- assertThat(derivedInfo.getEffectiveBuiltInType(), is(INT32));
-
- // Check for the restriction.
- assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
- assertThat(derivedInfo.getResolvedExtendedInfo(), is(notNullValue()));
-
- // Check for the restriction value.
- YangRangeRestriction rangeRestriction = (YangRangeRestriction) derivedInfo.getResolvedExtendedInfo();
-
- ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
- .listIterator();
-
- YangRangeInterval rangeInterval1 = rangeListIterator.next();
-
- assertThat(((YangInt32) rangeInterval1.getStartValue()).getValue(), is(1));
- assertThat(((YangInt32) rangeInterval1.getEndValue()).getValue(), is(4));
-
- YangRangeInterval rangeInterval2 = rangeListIterator.next();
-
- assertThat(((YangInt32) rangeInterval2.getStartValue()).getValue(), is(10));
- assertThat(((YangInt32) rangeInterval2.getEndValue()).getValue(), is(20));
- }
-
- /**
- * Checks range restriction in referred typedef.
- */
- @Test
- public void processRangeRestrictionInRefTypedef()
- throws IOException, ParserException, DataModelException {
-
- YangNode node = manager.getDataModel("src/test/resources/RangeRestrictionInRefTypedef.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat(node instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- // check top typedef
- YangTypeDef topTypedef = (YangTypeDef) yangNode.getChild();
- assertThat(topTypedef.getName(), is("Num3"));
- YangType type = topTypedef.getTypeList().iterator().next();
- assertThat(type.getDataType(), is(YangDataTypes.INT16));
- assertThat(type.getDataTypeName(), is("int16"));
-
- // Check for the restriction value.
- YangRangeRestriction rangeRestriction = (YangRangeRestriction) type.getDataTypeExtendedInfo();
- ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
- .listIterator();
- YangRangeInterval rangeInterval1 = rangeListIterator.next();
- assertThat((int) ((YangInt16) rangeInterval1.getStartValue()).getValue(), is(-32000));
- assertThat((int) ((YangInt16) rangeInterval1.getEndValue()).getValue(), is(4));
-
- YangRangeInterval rangeInterval2 = rangeListIterator.next();
- assertThat((int) ((YangInt16) rangeInterval2.getStartValue()).getValue(), is(32767));
- assertThat((int) ((YangInt16) rangeInterval2.getEndValue()).getValue(), is(32767));
-
- // check referred typedef
- YangTypeDef refTypedef = (YangTypeDef) topTypedef.getNextSibling();
- assertThat(refTypedef.getName(), is("Num6"));
- YangType refType = refTypedef.getTypeList().iterator().next();
- assertThat(refType.getDataType(), is(YangDataTypes.DERIVED));
- assertThat(refType.getDataTypeName(), is("Num3"));
- YangDerivedInfo<YangRangeRestriction> derivedInfo =
- (YangDerivedInfo<YangRangeRestriction>) refType.getDataTypeExtendedInfo();
-
- // Check for the restriction value.
- rangeRestriction = (YangRangeRestriction) derivedInfo.getResolvedExtendedInfo();
- rangeListIterator = rangeRestriction.getAscendingRangeIntervals().listIterator();
- rangeInterval1 = rangeListIterator.next();
- assertThat((int) ((YangInt16) rangeInterval1.getStartValue()).getValue(), is(-3));
- assertThat((int) ((YangInt16) rangeInterval1.getEndValue()).getValue(), is(-3));
-
- rangeInterval2 = rangeListIterator.next();
- assertThat((int) ((YangInt16) rangeInterval2.getStartValue()).getValue(), is(-2));
- assertThat((int) ((YangInt16) rangeInterval2.getEndValue()).getValue(), is(2));
-
- YangRangeInterval rangeInterval3 = rangeListIterator.next();
- assertThat((int) ((YangInt16) rangeInterval3.getStartValue()).getValue(), is(3));
- assertThat((int) ((YangInt16) rangeInterval3.getEndValue()).getValue(), is(3));
- }
-
- /**
- * Checks invalid range restriction in referred typedef.
- */
- @Test(expected = LinkerException.class)
- public void processInvalidRangeRestrictionInRefTypedef()
- throws IOException, ParserException, DataModelException {
-
- manager.getDataModel("src/test/resources/RangeRestrictionInvalidInRefTypedef.yang");
- }
-
- /**
- * Checks range restriction in referred type.
- */
- @Test
- public void processRangeRestrictionInRefType()
- throws IOException, ParserException, DataModelException {
-
- YangNode node = manager.getDataModel("src/test/resources/RangeRestrictionInRefType.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat(node instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
- assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
-
- assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
- is((YangTypeDef) node.getChild()));
-
- assertThat(leafInfo.getDataType().getResolvableStatus(), is(RESOLVED));
-
- YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- // Check for the effective built-in type.
- assertThat(derivedInfo.getEffectiveBuiltInType(), is(INT32));
-
- // Check for the restriction.
- assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getRangeRestrictionString(), is(notNullValue()));
- assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
- assertThat(derivedInfo.getResolvedExtendedInfo(), is(notNullValue()));
-
- // Check for the restriction value.
- YangRangeRestriction rangeRestriction = (YangRangeRestriction) derivedInfo.getResolvedExtendedInfo();
-
- ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
- .listIterator();
-
- YangRangeInterval rangeInterval1 = rangeListIterator.next();
-
- assertThat(((YangInt32) rangeInterval1.getStartValue()).getValue(), is(1));
- assertThat(((YangInt32) rangeInterval1.getEndValue()).getValue(), is(4));
-
- YangRangeInterval rangeInterval2 = rangeListIterator.next();
-
- assertThat(((YangInt32) rangeInterval2.getStartValue()).getValue(), is(10));
- assertThat(((YangInt32) rangeInterval2.getEndValue()).getValue(), is(20));
- }
-
- /**
- * Checks range restriction in typedef and stricter in referred type.
- */
- @Test
- public void processRangeRestrictionInRefTypeAndTypedefValid()
- throws IOException, ParserException, DataModelException {
-
- YangNode node = manager.getDataModel("src/test/resources/RangeRestrictionInRefTypeAndTypedefValid.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat(node instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
- assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
-
- assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
- is((YangTypeDef) node.getChild()));
-
- assertThat(leafInfo.getDataType().getResolvableStatus(), is(RESOLVED));
-
- YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- // Check for the effective built-in type.
- assertThat(derivedInfo.getEffectiveBuiltInType(), is(INT32));
-
- // Check for the restriction.
- assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getRangeRestrictionString(), is(notNullValue()));
- assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
- assertThat(derivedInfo.getResolvedExtendedInfo(), is(notNullValue()));
-
- // Check for the restriction value.
- YangRangeRestriction rangeRestriction = (YangRangeRestriction) derivedInfo.getResolvedExtendedInfo();
-
- ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
- .listIterator();
-
- YangRangeInterval rangeInterval1 = rangeListIterator.next();
-
- assertThat(((YangInt32) rangeInterval1.getStartValue()).getValue(), is(1));
- assertThat(((YangInt32) rangeInterval1.getEndValue()).getValue(), is(4));
-
- YangRangeInterval rangeInterval2 = rangeListIterator.next();
-
- assertThat(((YangInt32) rangeInterval2.getStartValue()).getValue(), is(10));
- assertThat(((YangInt32) rangeInterval2.getEndValue()).getValue(), is(20));
- }
-
- /**
- * Checks range restriction in typedef and not stricter in referred type.
- */
- @Test(expected = LinkerException.class)
- public void processRangeRestrictionInRefTypeAndTypedefInValid()
- throws IOException, ParserException, DataModelException {
- YangNode node = manager.getDataModel("src/test/resources/RangeRestrictionInRefTypeAndTypedefInValid.yang");
- }
-
- /**
- * Checks range restriction for string.
- */
- @Test(expected = ParserException.class)
- public void processRangeRestrictionInString()
- throws IOException, ParserException, DataModelException {
- YangNode node = manager.getDataModel("src/test/resources/RangeRestrictionInString.yang");
- }
-
- /**
- * Checks range restriction for string in referred type.
- */
- @Test(expected = LinkerException.class)
- public void processRangeRestrictionInStringInRefType()
- throws IOException, DataModelException {
- YangNode node = manager.getDataModel("src/test/resources/RangeRestrictionInStringInRefType.yang");
- }
-
- /**
- * Checks pattern restriction in typedef.
- */
- @Test
- public void processPatternRestrictionInTypedef()
- throws IOException, ParserException, DataModelException {
-
- YangNode node = manager.getDataModel("src/test/resources/PatternRestrictionInTypedef.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat(node instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
- assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
-
- assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
- is((YangTypeDef) node.getChild()));
-
- assertThat(leafInfo.getDataType().getResolvableStatus(), is(RESOLVED));
-
- YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- // Check for the effective built-in type.
- assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
-
- // Check for the restriction.
- assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getPatternRestriction(), is(nullValue()));
- assertThat(derivedInfo.getResolvedExtendedInfo(), is(notNullValue()));
-
- // Check for the restriction value.
- YangStringRestriction stringRestriction = (YangStringRestriction) derivedInfo.getResolvedExtendedInfo();
- YangPatternRestriction patternRestriction = stringRestriction.getPatternRestriction();
-
- ListIterator<String> patternListIterator = patternRestriction.getPatternList().listIterator();
- String pattern1 = patternListIterator.next();
-
- assertThat(pattern1, is("[a-zA-Z]"));
- }
-
- /**
- * Checks pattern restriction in referred type.
- */
- @Test
- public void processPatternRestrictionInRefType()
- throws IOException, ParserException, DataModelException {
-
- YangNode node = manager.getDataModel("src/test/resources/PatternRestrictionInRefType.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat(node instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
- assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
-
- assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
- is((YangTypeDef) node.getChild()));
-
- assertThat(leafInfo.getDataType().getResolvableStatus(), is(RESOLVED));
-
- YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- // Check for the effective built-in type.
- assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
-
- // Check for the restriction.
- assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getPatternRestriction(), is(notNullValue()));
- assertThat(derivedInfo.getResolvedExtendedInfo(), is(notNullValue()));
-
- // Check for the restriction value.
- YangStringRestriction stringRestriction = (YangStringRestriction) derivedInfo.getResolvedExtendedInfo();
- YangPatternRestriction patternRestriction = stringRestriction.getPatternRestriction();
-
- ListIterator<String> patternListIterator = patternRestriction.getPatternList().listIterator();
- String pattern1 = patternListIterator.next();
-
- assertThat(pattern1, is("[a-zA-Z]"));
- }
-
- /**
- * Checks pattern restriction in referred type and typedef.
- */
- @Test
- public void processPatternRestrictionInRefTypeAndTypedef()
- throws IOException, ParserException, DataModelException {
-
- YangNode node = manager.getDataModel("src/test/resources/PatternRestrictionInRefTypeAndTypedef.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat(node instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
- assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
-
- assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
- is((YangTypeDef) node.getChild()));
-
- assertThat(leafInfo.getDataType().getResolvableStatus(), is(RESOLVED));
-
- YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- // Check for the effective built-in type.
- assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
-
- // Check for the restriction.
- assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getPatternRestriction(), is(notNullValue()));
- assertThat(derivedInfo.getResolvedExtendedInfo(), is(notNullValue()));
-
- // Check for the restriction value.
- YangStringRestriction stringRestriction = (YangStringRestriction) derivedInfo.getResolvedExtendedInfo();
- YangPatternRestriction patternRestriction = stringRestriction.getPatternRestriction();
-
- ListIterator<String> patternListIterator = patternRestriction.getPatternList().listIterator();
- String pattern1 = patternListIterator.next();
-
- assertThat(pattern1, is("[a-zA-Z]"));
-
- String pattern2 = patternListIterator.next();
-
- assertThat(pattern2, is("[0-9]"));
- }
-
- /**
- * Checks multiple pattern restriction in referred type and typedef.
- */
- @Test
- public void processMultiplePatternRestriction()
- throws IOException, ParserException, DataModelException {
-
- YangNode node = manager.getDataModel("src/test/resources/MultiplePatternRestrictionInRefTypeAndTypedef.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat(node instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
- assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
-
- assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
- is((YangTypeDef) node.getChild()));
-
- assertThat(leafInfo.getDataType().getResolvableStatus(), is(RESOLVED));
-
- YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- // Check for the effective built-in type.
- assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
-
- // Check for the restriction.
- assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getPatternRestriction(), is(notNullValue()));
- assertThat(derivedInfo.getResolvedExtendedInfo(), is(notNullValue()));
-
- // Check for the restriction value.
- YangStringRestriction stringRestriction = (YangStringRestriction) derivedInfo.getResolvedExtendedInfo();
- YangPatternRestriction patternRestriction = stringRestriction.getPatternRestriction();
-
- ListIterator<String> patternListIterator = patternRestriction.getPatternList().listIterator();
- String pattern1 = patternListIterator.next();
-
- assertThat(pattern1, is("[a-z]"));
-
- String pattern2 = patternListIterator.next();
-
- assertThat(pattern2, is("[A-Z]"));
-
- String pattern3 = patternListIterator.next();
-
- assertThat(pattern3, is("[0-9]"));
-
- String pattern4 = patternListIterator.next();
-
- assertThat(pattern4, is("[\\n]"));
- }
-
- /**
- * Checks multiple pattern and length restriction in referred type and
- * typedef.
- */
- @Test
- public void processMultiplePatternAndLengthRestriction()
- throws IOException, ParserException, DataModelException {
-
- YangNode node = manager.getDataModel("src/test/resources/MultiplePatternAndLengthRestriction.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat(node instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
- assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
-
- assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
- is((YangTypeDef) node.getChild()));
-
- assertThat(leafInfo.getDataType().getResolvableStatus(), is(RESOLVED));
-
- YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- // Check for the effective built-in type.
- assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
-
- // Check for the restriction.
- assertThat(derivedInfo.getLengthRestrictionString(), is(notNullValue()));
- assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getPatternRestriction(), is(notNullValue()));
- assertThat(derivedInfo.getResolvedExtendedInfo(), is(notNullValue()));
-
- // Check for the restriction value.
- YangStringRestriction stringRestriction = (YangStringRestriction) derivedInfo.getResolvedExtendedInfo();
-
- // Check for pattern restriction.
- YangPatternRestriction patternRestriction = stringRestriction.getPatternRestriction();
- ListIterator<String> patternListIterator = patternRestriction.getPatternList().listIterator();
- String pattern1 = patternListIterator.next();
-
- assertThat(pattern1, is("[a-z]"));
-
- String pattern2 = patternListIterator.next();
-
- assertThat(pattern2, is("[A-Z]"));
-
- String pattern3 = patternListIterator.next();
-
- assertThat(pattern3, is("[0-9]"));
-
- String pattern4 = patternListIterator.next();
-
- assertThat(pattern4, is("[\\n]"));
-
- // Check for length restriction.
- YangRangeRestriction lengthRestriction = stringRestriction.getLengthRestriction();
- ListIterator<YangRangeInterval> lengthListIterator = lengthRestriction.getAscendingRangeIntervals()
- .listIterator();
-
- YangRangeInterval rangeInterval1 = lengthListIterator.next();
-
- assertThat(((YangUint64) rangeInterval1.getStartValue()).getValue(), is(BigInteger.valueOf(0)));
- assertThat(((YangUint64) rangeInterval1.getEndValue()).getValue(), is(BigInteger.valueOf(20)));
-
- YangRangeInterval rangeInterval2 = lengthListIterator.next();
-
- assertThat(((YangUint64) rangeInterval2.getStartValue()).getValue(), is(BigInteger.valueOf(201)));
- assertThat(((YangUint64) rangeInterval2.getEndValue()).getValue(), is(BigInteger.valueOf(300)));
- }
-
- /**
- * Checks multiple pattern and length restriction in referred type and
- * typedef.
- */
- @Test
- public void processMultiplePatternAndLengthRestrictionValid()
- throws IOException, ParserException, DataModelException {
-
- YangNode node = manager.getDataModel("src/test/resources/MultiplePatternAndLengthRestrictionValid.yang");
-
- // Check whether the data model tree returned is of type module.
- assertThat(node instanceof YangModule, is(true));
-
- // Check whether the node type is set properly to module.
- assertThat(node.getNodeType(), is(MODULE_NODE));
-
- // Check whether the module name is set correctly.
- YangModule yangNode = (YangModule) node;
- assertThat(yangNode.getName(), is("Test"));
-
- ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf leafInfo = leafIterator.next();
-
- assertThat(leafInfo.getName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
- assertThat(leafInfo.getDataType().getDataType(), is(DERIVED));
-
- assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
- is((YangTypeDef) node.getChild()));
-
- assertThat(leafInfo.getDataType().getResolvableStatus(), is(RESOLVED));
-
- YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo();
-
- // Check for the effective built-in type.
- assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING));
-
- // Check for the restriction.
- assertThat(derivedInfo.getLengthRestrictionString(), is(notNullValue()));
- assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue()));
- assertThat(derivedInfo.getPatternRestriction(), is(notNullValue()));
- assertThat(derivedInfo.getResolvedExtendedInfo(), is(notNullValue()));
-
- // Check for the restriction value.
- YangStringRestriction stringRestriction = (YangStringRestriction) derivedInfo.getResolvedExtendedInfo();
-
- // Check for pattern restriction.
- YangPatternRestriction patternRestriction = stringRestriction.getPatternRestriction();
- ListIterator<String> patternListIterator = patternRestriction.getPatternList().listIterator();
- String pattern1 = patternListIterator.next();
-
- assertThat(pattern1, is("[a-z]"));
-
- String pattern2 = patternListIterator.next();
-
- assertThat(pattern2, is("[A-Z]"));
-
- String pattern3 = patternListIterator.next();
-
- assertThat(pattern3, is("[0-9]"));
-
- String pattern4 = patternListIterator.next();
-
- assertThat(pattern4, is("[\\n]"));
-
- // Check for length restriction.
- YangRangeRestriction lengthRestriction = stringRestriction.getLengthRestriction();
- ListIterator<YangRangeInterval> lengthListIterator = lengthRestriction.getAscendingRangeIntervals()
- .listIterator();
-
- YangRangeInterval rangeInterval1 = lengthListIterator.next();
-
- assertThat(((YangUint64) rangeInterval1.getStartValue()).getValue(), is(BigInteger.valueOf(0)));
- assertThat(((YangUint64) rangeInterval1.getEndValue()).getValue(), is(BigInteger.valueOf(20)));
-
- YangRangeInterval rangeInterval2 = lengthListIterator.next();
-
- assertThat(((YangUint64) rangeInterval2.getStartValue()).getValue(), is(BigInteger.valueOf(100)));
- assertThat(((YangUint64) rangeInterval2.getEndValue()).getValue(),
- is(new BigInteger("18446744073709551615")));
- }
-
- /**
- * Checks multiple pattern and length restriction in referred type and
- * typedef invalid scenario.
- */
- @Test(expected = LinkerException.class)
- public void processMultiplePatternAndLengthRestrictionInValid()
- throws IOException, DataModelException {
- YangNode node = manager.getDataModel("src/test/resources/MultiplePatternAndLengthRestrictionInValid.yang");
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/RpcTranslatorTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/RpcTranslatorTest.java
deleted file mode 100644
index d014b84..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/RpcTranslatorTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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.plugin.manager;
-
-import java.io.IOException;
-
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-
-import static org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorUtil.generateJavaCode;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
-
-/**
- * Unit tests for rpc translator.
- */
-public final class RpcTranslatorTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks rpc translation should not result in any exception.
- */
- @Test
- public void processRpcTranslator()
- throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/RpcTranslator.yang");
-
- YangPluginConfig yangPluginConfig = new YangPluginConfig();
- yangPluginConfig.setCodeGenDir("target/RpcTestGenFile/");
-
- generateJavaCode(node, yangPluginConfig);
-
- deleteDirectory("target/RpcTestGenFile/");
- }
- // TODO enhance the test cases, after having a framework of translator test.
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/TypeDefTranslatorTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/TypeDefTranslatorTest.java
deleted file mode 100644
index 3c97292..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/TypeDefTranslatorTest.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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.plugin.manager;
-
-import java.io.IOException;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
-
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
-
-/**
- * Unit test case for typedef translator.
- */
-public class TypeDefTranslatorTest {
-
- private final YangUtilManager utilManager = new YangUtilManager();
-
- /**
- * Checks typedef translation should not result in any exception.
- *
- * @throws MojoExecutionException
- */
- @Test
- public void processTypeDefTranslator() throws IOException, ParserException, MojoExecutionException {
-
- String searchDir = "src/test/resources/typedefTranslator/without";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- utilManager.resolveDependenciesUsingLinker();
-
- YangPluginConfig yangPluginConfig = new YangPluginConfig();
- yangPluginConfig.setCodeGenDir("target/typedefTranslator/");
- utilManager.translateToJava(yangPluginConfig);
-
- deleteDirectory("target/typedefTranslator/");
- }
-
- /**
- * Checks typedef translation should not result in any exception.
- *
- * @throws MojoExecutionException
- */
- @Test
- public void processTypeDefWithRestrictionsTranslator() throws IOException, ParserException, MojoExecutionException {
-
- String searchDir = "src/test/resources/typedefTranslator/with";
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- utilManager.resolveDependenciesUsingLinker();
-
- YangPluginConfig yangPluginConfig = new YangPluginConfig();
- yangPluginConfig.setCodeGenDir("target/typedefTranslator/");
- utilManager.translateToJava(yangPluginConfig);
-
- deleteDirectory("target/typedefTranslator/");
-
- }
-
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/UnionTranslatorTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/UnionTranslatorTest.java
deleted file mode 100644
index 08db37f..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/UnionTranslatorTest.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * 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.plugin.manager;
-
-import java.io.IOException;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-
-import static org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorUtil.generateJavaCode;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
-
-/**
- * Unit tests for union translator.
- */
-public final class UnionTranslatorTest {
-
- private final YangUtilsParserManager manager = new YangUtilsParserManager();
-
- /**
- * Checks union translation should not result in any exception.
- */
- @Test
- public void processUnionTranslator()
- throws IOException, ParserException {
-
- YangNode node = manager.getDataModel("src/test/resources/UnionTranslator.yang");
-
- YangPluginConfig yangPluginConfig = new YangPluginConfig();
- yangPluginConfig.setCodeGenDir("target/UnionTestGenFile/");
-
- generateJavaCode(node, yangPluginConfig);
-
- deleteDirectory("target/UnionTestGenFile/");
- }
-
- /**
- * Unit test case to test conflicting types.
- *
- * @throws IOException when fails to do IO operations
- * @throws MojoExecutionException when fails to do mojo operations
- */
- @Test
- public void processUnionIntUintConflictingTypes() throws IOException, MojoExecutionException {
- String searchDir = "src/test/resources/unionTranslator/intuint";
- YangUtilManager utilManager = new YangUtilManager();
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- utilManager.resolveDependenciesUsingLinker();
-
- YangPluginConfig yangPluginConfig = new YangPluginConfig();
- yangPluginConfig.setCodeGenDir("target/unionTranslator/");
-
- utilManager.translateToJava(yangPluginConfig);
- deleteDirectory("target/unionTranslator/");
- }
-
- /**
- * Unit test case to test conflicting types.
- *
- * @throws IOException when fails to do IO operations
- * @throws MojoExecutionException when fails to do mojo operations
- */
- @Test
- public void processUnionUintIntConflictingTypes() throws IOException, MojoExecutionException {
- String searchDir = "src/test/resources/unionTranslator/uintint";
- YangUtilManager utilManager = new YangUtilManager();
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- utilManager.resolveDependenciesUsingLinker();
-
- YangPluginConfig yangPluginConfig = new YangPluginConfig();
- yangPluginConfig.setCodeGenDir("target/unionTranslator/");
-
- utilManager.translateToJava(yangPluginConfig);
- deleteDirectory("target/unionTranslator/");
- }
-
- /**
- * Unit test case to test conflicting types.
- *
- * @throws IOException when fails to do IO operations
- * @throws MojoExecutionException when fails to do mojo operations
- */
- @Test
- public void processUnionLongUlongConflictingTypes() throws IOException, MojoExecutionException {
- String searchDir = "src/test/resources/unionTranslator/longulong";
- YangUtilManager utilManager = new YangUtilManager();
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- utilManager.resolveDependenciesUsingLinker();
-
- YangPluginConfig yangPluginConfig = new YangPluginConfig();
- yangPluginConfig.setCodeGenDir("target/unionTranslator/");
-
- utilManager.translateToJava(yangPluginConfig);
- deleteDirectory("target/unionTranslator/");
- }
-
- /**
- * Unit test case to test conflicting types.
- *
- * @throws IOException when fails to do IO operations
- * @throws MojoExecutionException when fails to do mojo operations
- */
- @Test
- public void processUnionUlongLongConflictingTypes() throws IOException, MojoExecutionException {
- String searchDir = "src/test/resources/unionTranslator/ulonglong";
- YangUtilManager utilManager = new YangUtilManager();
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- utilManager.resolveDependenciesUsingLinker();
-
- YangPluginConfig yangPluginConfig = new YangPluginConfig();
- yangPluginConfig.setCodeGenDir("target/unionTranslator/");
-
- utilManager.translateToJava(yangPluginConfig);
- deleteDirectory("target/unionTranslator/");
- }
-
- /**
- * Unit test case to test conflicting types.
- *
- * @throws IOException when fails to do IO operations
- * @throws MojoExecutionException when fails to do mojo operations
- */
- @Test
- public void processUnionIntUintUlongLongConflictingTypes() throws IOException, MojoExecutionException {
- String searchDir = "src/test/resources/unionTranslator/intuintulonglong";
- YangUtilManager utilManager = new YangUtilManager();
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- utilManager.resolveDependenciesUsingLinker();
-
- YangPluginConfig yangPluginConfig = new YangPluginConfig();
- yangPluginConfig.setCodeGenDir("target/unionTranslator/");
-
- utilManager.translateToJava(yangPluginConfig);
- deleteDirectory("target/unionTranslator/");
- }
-
- /**
- * Unit test case to test conflicting types.
- *
- * @throws IOException when fails to do IO operations
- * @throws MojoExecutionException when fails to do mojo operations
- */
- @Test
- public void processUnionIntUintUlongLongStringConflictingTypes() throws IOException,
- MojoExecutionException {
- String searchDir = "src/test/resources/unionTranslator/intuintulonglongstring";
- YangUtilManager utilManager = new YangUtilManager();
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- utilManager.resolveDependenciesUsingLinker();
-
- YangPluginConfig yangPluginConfig = new YangPluginConfig();
- yangPluginConfig.setCodeGenDir("target/unionTranslator/");
-
- utilManager.translateToJava(yangPluginConfig);
- deleteDirectory("target/unionTranslator/");
- }
-
- /**
- * Unit test case to test conflicting types.
- *
- * @throws IOException when fails to do IO operations
- * @throws MojoExecutionException when fails to do mojo operations
- */
- @Test
- public void processUnionIntUintStringConflictingTypes() throws IOException,
- MojoExecutionException {
- String searchDir = "src/test/resources/unionTranslator/intuintstring";
- YangUtilManager utilManager = new YangUtilManager();
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- utilManager.resolveDependenciesUsingLinker();
-
- YangPluginConfig yangPluginConfig = new YangPluginConfig();
- yangPluginConfig.setCodeGenDir("target/unionTranslator/");
-
- utilManager.translateToJava(yangPluginConfig);
- deleteDirectory("target/unionTranslator/");
- }
-
- // TODO enhance the test cases, after having a framework of translator test.
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/YangPluginUtilsTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/YangPluginUtilsTest.java
deleted file mode 100644
index 891a280..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/YangPluginUtilsTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.plugin.manager;
-
-import java.io.File;
-import java.io.IOException;
-import org.apache.commons.io.FileUtils;
-import org.apache.maven.project.MavenProject;
-import org.junit.Test;
-import org.sonatype.plexus.build.incremental.BuildContext;
-import org.sonatype.plexus.build.incremental.DefaultBuildContext;
-
-import static org.onosproject.yangutils.plugin.manager.YangPluginUtils.addToCompilationRoot;
-
-/**
- * Unit test case for YANG plugin utils.
- */
-public class YangPluginUtilsTest {
-
- private static final String BASE_DIR = "target/UnitTestCase";
-
- /**
- * This test case checks whether the source is getting added.
- */
- @Test
- public void testForAddSource() throws IOException {
-
- MavenProject project = new MavenProject();
- BuildContext context = new DefaultBuildContext();
- File sourceDir = new File(BASE_DIR + File.separator + "yang");
- sourceDir.mkdirs();
- addToCompilationRoot(sourceDir.toString(), project, context);
- FileUtils.deleteDirectory(sourceDir);
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/YangXpathLinkerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/YangXpathLinkerTest.java
deleted file mode 100644
index a6de459..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/YangXpathLinkerTest.java
+++ /dev/null
@@ -1,686 +0,0 @@
-/*
- * 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.plugin.manager;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.ResolvableType;
-import org.onosproject.yangutils.datamodel.YangAugment;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangReferenceResolver;
-import org.onosproject.yangutils.datamodel.YangResolutionInfo;
-import org.onosproject.yangutils.linker.impl.YangLinkerManager;
-import org.onosproject.yangutils.linker.impl.YangXpathLinker;
-import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-import static org.onosproject.yangutils.linker.impl.YangLinkerUtils.updateFilePriority;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
-
-/**
- * Unit test cases for x-path linker.
- */
-public class YangXpathLinkerTest {
-
- private static final String INTRA_FILE_PATH = "src/test/resources/xPathLinker/IntraFile/";
- private static final String INTER_FILE_PATH = "src/test/resources/xPathLinker/InterFile/";
- private static final String CASE_FILE_PATH = "src/test/resources/xPathLinker/Case/";
- private YangUtilManager utilManager = new YangUtilManager();
- private YangXpathLinker linker = new YangXpathLinker();
- private YangLinkerManager linkerManager = new YangLinkerManager();
-
- /**
- * Unit test case for intra file linking for single level container.
- *
- * @throws IOException when fails to do IO operations
- * @throws MojoExecutionException
- */
- @Test
- public void processIntraFileLinkingSingleLevel() throws IOException, MojoExecutionException {
-
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTRA_FILE_PATH + "IntraSingle/"));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- utilManager.resolveDependenciesUsingLinker();
-
- YangNode targetNode = null;
- String targetNodeName = null;
-
- for (YangNode node : utilManager.getYangNodeSet()) {
- YangReferenceResolver ref = (YangReferenceResolver) node;
- List<YangResolutionInfo> infos = ref.getUnresolvedResolutionList(ResolvableType.YANG_AUGMENT);
- YangResolutionInfo info = infos.get(0);
-
- YangAugment augment = (YangAugment) info.getEntityToResolveInfo().getEntityToResolve();
- targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
- .getName();
- targetNode = augment.getAugmentedNode();
-
- }
-
- assertThat(true, is(targetNode.getName().equals(targetNodeName)));
- }
-
- /**
- * Unit test case for intra file linking for multiple level container.
- *
- * @throws IOException when fails to do IO operations
- */
- @Test
- public void processIntraFileLinkingMultipleLevel() throws IOException {
-
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTRA_FILE_PATH + "IntraMulti/"));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
-
- YangNode targetNode = null;
- String targetNodeName = null;
-
- for (YangNode node : utilManager.getYangNodeSet()) {
- List<YangAugment> augments = linker.getListOfYangAugment(node);
-
- for (YangAugment augment : augments) {
- targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
- .getName();
- targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node);
- }
- }
-
- assertThat(true, is(targetNode.getName().equals(targetNodeName)));
- }
-
- /**
- * Unit test case for intra file linking for single level augment.
- *
- * @throws IOException when fails to do IO operations
- */
- @Test
- public void processIntraFileLinkingInAugmentSingleLevel() throws IOException {
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTRA_FILE_PATH + "IntraSingleAugment/"));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
-
- YangNode targetNode = null;
- String targetNodeName = null;
-
- for (YangNode node : utilManager.getYangNodeSet()) {
- List<YangAugment> augments = linker.getListOfYangAugment(node);
-
- for (YangAugment augment : augments) {
- targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
- .getName();
- targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node);
- }
- }
-
- assertThat(true, is(targetNode.getName().equals(targetNodeName)));
- }
-
- /**
- * Unit test case for intra file linking for multiple level augment.
- *
- * @throws IOException when fails to do IO operations
- */
- @Test
- public void processIntraFileLinkingInAugmentMultiLevel() throws IOException {
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTRA_FILE_PATH + "IntraMultiAugment/"));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
- linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
- linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
- linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- YangNode targetNode = null;
- String targetNodeName = null;
-
- for (YangNode node : utilManager.getYangNodeSet()) {
- List<YangAugment> augments = linker.getListOfYangAugment(node);
-
- for (YangAugment augment : augments) {
- targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
- .getName();
- targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node);
- }
- }
-
- assertThat(true, is(targetNode.getName().equals(targetNodeName)));
-
- }
-
- /**
- * Unit test case for intra file linking for multiple level submodule.
- *
- * @throws IOException when fails to do IO operations
- */
- @Test
- public void processIntraFileLinkingInSubModuleSingleLevel() throws IOException {
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTRA_FILE_PATH + "IntraSingleSubModule/"));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
- linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
- linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
-
- YangNode targetNode = null;
- String targetNodeName = null;
-
- for (YangNode node : utilManager.getYangNodeSet()) {
- List<YangAugment> augments = linker.getListOfYangAugment(node);
-
- for (YangAugment augment : augments) {
- targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
- .getName();
- targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node);
- }
- }
-
- assertThat(true, is(targetNode.getName().equals(targetNodeName)));
- }
-
- /**
- * Unit test case for intra file linking for multiple level submodule.
- *
- * @throws IOException when fails to do IO operations
- */
- @Test
- public void processIntraFileLinkingInSubModuleMultiLevel() throws IOException {
-
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTRA_FILE_PATH + "IntraMultiSubModule/"));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
- linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
- linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
-
- YangNode targetNode = null;
- String targetNodeName = null;
-
- for (YangNode node : utilManager.getYangNodeSet()) {
- List<YangAugment> augments = linker.getListOfYangAugment(node);
-
- for (YangAugment augment : augments) {
- targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
- .getName();
- targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node);
- }
- }
-
- assertThat(true, is(targetNode.getName().equals(targetNodeName)));
- }
-
- /**
- * Unit test case for intra file linking for single level uses.
- *
- * @throws IOException when fails to do IO operations
- */
- @Test
- public void processIntraFileLinkingInUsesSingleLevel() throws IOException {
-
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTRA_FILE_PATH + "IntraSingleUses/"));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
- updateFilePriority(utilManager.getYangNodeSet());
- linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- YangNode targetNode = null;
- String targetNodeName = null;
-
- for (YangNode node : utilManager.getYangNodeSet()) {
- List<YangAugment> augments = linker.getListOfYangAugment(node);
-
- for (YangAugment augment : augments) {
- targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
- .getName();
- targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node);
- }
- }
-
- assertThat(true, is(targetNode.getName().equals(targetNodeName)));
- }
-
- /**
- * Unit test case for intra file linking for multi level uses.
- *
- * @throws IOException when fails to do IO operations
- */
- @Test
- public void processIntraFileLinkingInUsesMultiLevel() throws IOException {
-
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTRA_FILE_PATH + "IntraMultiUses/"));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
- updateFilePriority(utilManager.getYangNodeSet());
- linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- YangNode targetNode = null;
- String targetNodeName = null;
-
- for (YangNode node : utilManager.getYangNodeSet()) {
- List<YangAugment> augments = linker.getListOfYangAugment(node);
-
- for (YangAugment augment : augments) {
- targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
- .getName();
- targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node);
- }
- }
-
- assertThat(true, is(targetNode.getName().equals(targetNodeName)));
- }
-
- /**
- * Unit test case for inter file linking for single level container.
- *
- * @throws IOException when fails to do IO operations
- */
- @Test
- public void processInterFileLinkingSingleLevel() throws IOException {
-
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterSingle/"));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
- linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- YangNode targetNode = null;
- String targetNodeName = null;
-
- for (YangNode node : utilManager.getYangNodeSet()) {
- List<YangAugment> augments = linker.getListOfYangAugment(node);
-
- for (YangAugment augment : augments) {
- targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
- .getName();
- targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node);
- }
- }
-
- assertThat(true, is(targetNode.getName().equals(targetNodeName)));
- }
-
- /**
- * Unit test case for inter file linking for multi level container.
- *
- * @throws IOException when fails to do IO operations
- */
- @Test
- public void processInterFileLinkingMultipleLevel() throws IOException {
-
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterMulti/"));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
- linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- YangNode targetNode = null;
- String targetNodeName = null;
-
- for (YangNode node : utilManager.getYangNodeSet()) {
- List<YangAugment> augments = linker.getListOfYangAugment(node);
-
- for (YangAugment augment : augments) {
- targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
- .getName();
- targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node);
- }
- }
-
- assertThat(true, is(targetNode.getName().equals(targetNodeName)));
- }
-
- /**
- * Unit test case for inter file linking for single level augment.
- *
- * @throws IOException when fails to do IO operations
- */
- @Test
- public void processInterFileLinkingInAugmentSingleLevel() throws IOException {
-
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterSingleAugment/"));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
- linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- YangNode targetNode = null;
- String targetNodeName = null;
-
- for (YangNode node : utilManager.getYangNodeSet()) {
- List<YangAugment> augments = linker.getListOfYangAugment(node);
-
- for (YangAugment augment : augments) {
- targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
- .getName();
- targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node);
- }
- }
-
- assertThat(true, is(targetNode.getName().equals(targetNodeName)));
- }
-
- /**
- * Unit test case for inter file linking for multi level augment.
- *
- * @throws IOException when fails to do IO operations
- */
- @Test
- public void processInterFileLinkingInAugmentMultiLevel() throws IOException {
-
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterMultiAugment/"));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
- linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- YangNode targetNode = null;
- String targetNodeName = null;
-
- for (YangNode node : utilManager.getYangNodeSet()) {
- List<YangAugment> augments = linker.getListOfYangAugment(node);
-
- for (YangAugment augment : augments) {
- targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
- .getName();
- targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node);
- }
- }
-
- assertThat(true, is(targetNode.getName().equals(targetNodeName)));
- }
-
- /**
- * Unit test case for multipler inter file linking for single level augment.
- *
- * @throws IOException when fails to do IO operations
- */
- @Test
- public void processMultiInterFileLinkingInAugmentSingleLevel() throws IOException {
-
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterMultiFileAugment/"));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
- linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
-
- YangNode targetNode = null;
- String targetNodeName = null;
-
- for (YangNode node : utilManager.getYangNodeSet()) {
- List<YangAugment> augments = linker.getListOfYangAugment(node);
-
- for (YangAugment augment : augments) {
- targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
- .getName();
- targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node);
- }
- }
-
- assertThat(true, is(targetNode.getName().equals(targetNodeName)));
- }
-
- /**
- * Unit test case for multiple inter file linking for multi level augment.
- *
- * @throws IOException when fails to do IO operations
- */
- @Test
- public void processMultiInterFileLinkingInAugmentMultiLevel() throws IOException {
-
- utilManager
- .createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterMultiFileAugmentMulti/"));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
- linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
- linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
- linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
- updateFilePriority(utilManager.getYangNodeSet());
- linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- YangNode targetNode = null;
- String targetNodeName = null;
-
- for (YangNode node : utilManager.getYangNodeSet()) {
- List<YangAugment> augments = linker.getListOfYangAugment(node);
-
- for (YangAugment augment : augments) {
- targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
- .getName();
- targetNode = augment.getAugmentedNode();
- }
- }
-
- assertThat(true, is(targetNode.getName().equals(targetNodeName)));
- }
-
- /**
- * Unit test case for inter file linking for single level submodule.
- *
- * @throws IOException when fails to do IO operations
- */
- @Test
- public void processInterFileLinkingInSubModuleSingleLevel() throws IOException {
-
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterSingleSubModule/"));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
- linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
- linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
- linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
- updateFilePriority(utilManager.getYangNodeSet());
- linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
- YangNode targetNode = null;
- String targetNodeName = null;
-
- for (YangNode node : utilManager.getYangNodeSet()) {
- List<YangAugment> augments = linker.getListOfYangAugment(node);
-
- for (YangAugment augment : augments) {
- targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
- .getName();
- targetNode = augment.getAugmentedNode();
- }
- }
-
- assertThat(true, is(targetNode.getName().equals(targetNodeName)));
- }
-
- /**
- * Unit test case for inter file linking for multi level submodule.
- *
- * @throws IOException when fails to do IO operations
- */
- @Test
- public void processInterFileLinkingInSubModuleMultiLevel() throws IOException {
-
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterMultiSubModule/"));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
- linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
- linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
- linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
- updateFilePriority(utilManager.getYangNodeSet());
- linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
- YangNode targetNode = null;
- String targetNodeName = null;
-
- for (YangNode node : utilManager.getYangNodeSet()) {
- List<YangAugment> augments = linker.getListOfYangAugment(node);
-
- for (YangAugment augment : augments) {
- targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
- .getName();
- targetNode = augment.getAugmentedNode();
- }
- }
-
- assertThat(true, is(targetNode.getName().equals(targetNodeName)));
- }
-
- /**
- * Unit test case for inter file linking for multi level uses inside augment.
- *
- * @throws IOException when fails to do IO operations
- */
- @Test
- public void processInterFileLinkingInUsesInAugment() throws IOException {
-
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterSingleUses/"));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
- linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
- linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
- linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
- updateFilePriority(utilManager.getYangNodeSet());
- linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- YangNode targetNode = null;
- String targetNodeName = null;
-
- for (YangNode node : utilManager.getYangNodeSet()) {
- List<YangAugment> augments = linker.getListOfYangAugment(node);
-
- for (YangAugment augment : augments) {
- targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1)
- .getNodeIdentifier().getName();
- targetNode = augment.getAugmentedNode();
- }
- }
-
- assertThat(true, is(targetNode.getName().equals(targetNodeName)));
-
- }
-
- /**
- * Unit test case for inter file linking for multi level uses.
- *
- * @throws IOException when fails to do IO operations
- */
- @Test
- public void processInterFileLinkingInUsesMultiLevel() throws IOException {
-
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterMultiUses/"));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
- linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
- linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
- updateFilePriority(utilManager.getYangNodeSet());
- linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- YangNode targetNode = null;
- String targetNodeName = null;
-
- for (YangNode node : utilManager.getYangNodeSet()) {
- List<YangAugment> augments = linker.getListOfYangAugment(node);
-
- for (YangAugment augment : augments) {
- targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
- .getName();
- targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node);
- }
- }
-
- assertThat(true, is(targetNode.getName().equals(targetNodeName)));
- }
-
- /**
- * Unit test case for inter file linking for multi level uses inside augment.
- *
- * @throws IOException when fails to do IO operations
- */
- @Test
- public void processInterFileLinkingInMultipleSubmodules() throws IOException {
-
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(CASE_FILE_PATH + "submodule/"));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
- linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
- linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
- linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
- updateFilePriority(utilManager.getYangNodeSet());
-
- linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- YangNode targetNode = null;
- String targetNodeName = null;
-
- for (YangNode node : utilManager.getYangNodeSet()) {
- List<YangAugment> augments = linker.getListOfYangAugment(node);
-
- for (YangAugment augment : augments) {
- targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1)
- .getNodeIdentifier().getName();
- targetNode = augment.getAugmentedNode();
- }
- }
-
- assertThat(true, is(targetNode.getName().equals(targetNodeName)));
-
- }
-
- /**
- * Unit test case for inter file linking for multi level uses inside augment.
- *
- * @throws IOException when fails to do IO operations
- */
- @Test
- public void processInterFileLinkingInMultipleUses() throws IOException {
-
- utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(CASE_FILE_PATH + "uses/"));
- utilManager.parseYangFileInfoSet();
- utilManager.createYangNodeSet();
- linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
- linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
- linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
- linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
- updateFilePriority(utilManager.getYangNodeSet());
- linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
-
- YangNode targetNode = null;
- String targetNodeName = null;
-
- for (YangNode node : utilManager.getYangNodeSet()) {
- List<YangAugment> augments = linker.getListOfYangAugment(node);
-
- for (YangAugment augment : augments) {
- targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1)
- .getNodeIdentifier().getName();
- targetNode = augment.getAugmentedNode();
- }
- }
-
- YangPluginConfig yangPluginConfig = new YangPluginConfig();
- yangPluginConfig.setCodeGenDir("target/xpath/");
- utilManager.translateToJava(yangPluginConfig);
- assertThat(true, is(targetNode.getName().equals(targetNodeName)));
-
- deleteDirectory("target/xpath/");
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/javamodel/AttributesJavaDataTypeTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/javamodel/AttributesJavaDataTypeTest.java
deleted file mode 100644
index e54e4f2..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/javamodel/AttributesJavaDataTypeTest.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * 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.translator.tojava.javamodel;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
-import org.onosproject.yangutils.datamodel.YangDerivedInfo;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangToJavaNamingConflictUtil;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNot.not;
-import static org.junit.Assert.assertThat;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.BOOLEAN;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.DERIVED;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.INT32;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.STRING;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.UINT8;
-import static org.onosproject.yangutils.translator.tojava.javamodel.AttributesJavaDataType.getJavaDataType;
-import static org.onosproject.yangutils.translator.tojava.javamodel.AttributesJavaDataType.getJavaImportClass;
-import static org.onosproject.yangutils.translator.tojava.javamodel.AttributesJavaDataType.getJavaImportPackage;
-import static org.onosproject.yangutils.utils.UtilConstants.JAVA_LANG;
-
-/**
- * Unit test case for attribute java data type.
- */
-public class AttributesJavaDataTypeTest {
-
- private static final YangDataTypes TYPE1 = STRING;
- private static final YangDataTypes TYPE2 = INT32;
- private static final YangDataTypes TYPE3 = BOOLEAN;
- private static final YangDataTypes TYPE4 = UINT8;
- private static final YangDataTypes TYPE_DEF = DERIVED;
- private static final String CLASS_INFO1 = "String";
- private static final String CLASS_INFO2 = "int";
- private static final String CLASS_INFO3 = "boolean";
- private static final String CLASS_INFO4 = "short";
- private static final String CLASS_INFO5 = "Integer";
- private static final String TYPE_DEF_PKG = "target.test";
- private static String test = "";
- private static YangToJavaNamingConflictUtil pluginConfig = null;
-
- /**
- * Unit test for private constructor.
- *
- * @throws SecurityException if any security violation is observed
- * @throws NoSuchMethodException if when the method is not found
- * @throws IllegalArgumentException if there is illegal argument found
- * @throws InstantiationException if instantiation is provoked for the private constructor
- * @throws IllegalAccessException if instance is provoked or a method is provoked
- * @throws InvocationTargetException when an exception occurs by the method or constructor
- */
- @Test
- public void callPrivateConstructors()
- throws SecurityException, NoSuchMethodException, IllegalArgumentException,
- InstantiationException, IllegalAccessException, InvocationTargetException {
-
- Class<?>[] classesToConstruct = {AttributesJavaDataType.class };
- for (Class<?> clazz : classesToConstruct) {
- Constructor<?> constructor = clazz.getDeclaredConstructor();
- constructor.setAccessible(true);
- assertThat(null, not(constructor.newInstance()));
- }
- }
-
- /**
- * Unit test for java class info method test.
- */
- @Test
- public void testgetJavaClassInfo() {
- test = getJavaImportClass(getStubYangType(TYPE1), false, pluginConfig);
- assertThat(true, is(test.equals(CLASS_INFO1)));
-
- test = getJavaImportClass(getStubYangType(TYPE2), true, pluginConfig);
- assertThat(true, is(test.equals(CLASS_INFO5)));
-
- test = getJavaImportClass(getStubYangType(TYPE3), false, pluginConfig);
- assertThat(null, is(test));
-
- test = getJavaImportClass(getStubYangType(TYPE4), false, pluginConfig);
- assertThat(null, is(test));
- }
-
- /**
- * Unit test for java data type method.
- */
- @Test
- public void testgetJavaDataType() {
- test = getJavaDataType(getStubYangType(TYPE1));
- assertThat(true, is(test.equals(CLASS_INFO1)));
-
- test = getJavaDataType(getStubYangType(TYPE2));
- assertThat(true, is(test.equals(CLASS_INFO2)));
-
- test = getJavaDataType(getStubYangType(TYPE3));
- assertThat(true, is(test.equals(CLASS_INFO3)));
-
- test = getJavaDataType(getStubYangType(TYPE4));
- assertThat(true, is(test.equals(CLASS_INFO4)));
- }
-
- /**
- * Unit test for java package info method.
- */
- @Test
- public void testgetJavaPkgInfo() {
- test = getJavaImportPackage(getStubYangType(TYPE1), false, pluginConfig);
- assertThat(true, is(test.equals(JAVA_LANG)));
-
- test = getJavaImportPackage(getStubYangType(TYPE2), true, pluginConfig);
- assertThat(true, is(test.equals(JAVA_LANG)));
-
- test = getJavaImportPackage(getStubYangType(TYPE3), false, pluginConfig);
- assertThat(null, is(test));
-
- test = getJavaImportPackage(getStubYangType(TYPE4), false, pluginConfig);
- assertThat(null, is(test));
- }
-
- /**
- * Unit test case for typedef.
- *
- * @throws DataModelException when fails to do data model operations
- */
- @Test
- public void testForTypeDef() throws DataModelException {
- test = getJavaImportPackage(getStubExtendedInfo(getStubYangType(TYPE_DEF)), false, pluginConfig);
- assertThat(true, is(test.equals(TYPE_DEF_PKG)));
- }
-
- /**
- * Returns stub YANG type for test.
- *
- * @param dataTypes YANG data types
- * @return YANG type
- */
- private YangType<?> getStubYangType(YangDataTypes dataTypes) {
- YangType<?> type = new YangType<>();
- type.setDataType(dataTypes);
- return type;
- }
-
- /**
- * Returns YANG type with extended info.
- *
- * @param type YANG type
- * @return YANG type with extended info
- * @throws DataModelException when fails to do data model operations
- */
- @SuppressWarnings("unchecked")
- private YangType<?> getStubExtendedInfo(YangType<?> type) throws DataModelException {
- YangJavaTypeDefTranslator typedef = new YangJavaTypeDefTranslator();
- getStubParent().addChild(typedef);
- YangDerivedInfo<?> derInfo = new YangDerivedInfo<>();
- derInfo.setReferredTypeDef(typedef);
- ((YangType<YangDerivedInfo<?>>) type).setDataTypeExtendedInfo(derInfo);
- return type;
- }
-
- /**
- * Returns java file info.
- *
- * @return java file info
- */
- private JavaFileInfo addStubJavaFileInfo() {
- JavaFileInfo fileInfo = new JavaFileInfo();
- fileInfo.setJavaName("test");
- fileInfo.setPackage("target");
- return fileInfo;
- }
-
- /**
- * Adds stub parent module for typedef.
- *
- * @return stub parent module
- */
- private YangNode getStubParent() {
- YangJavaModuleTranslator parent = new YangJavaModuleTranslator();
- parent.setJavaFileInfo(addStubJavaFileInfo());
- return parent;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/utils/JavaCodeSnippetGenTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/utils/JavaCodeSnippetGenTest.java
deleted file mode 100644
index e5021d3..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/utils/JavaCodeSnippetGenTest.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * 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.translator.tojava.utils;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-
-import org.junit.Test;
-import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNot.not;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaCodeSnippetGen.getImportText;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaCodeSnippetGen.getJavaAttributeDefinition;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaCodeSnippetGen.getJavaClassDefClose;
-import static org.onosproject.yangutils.utils.UtilConstants.CLOSE_CURLY_BRACKET;
-import static org.onosproject.yangutils.utils.UtilConstants.DIAMOND_CLOSE_BRACKET;
-import static org.onosproject.yangutils.utils.UtilConstants.DIAMOND_OPEN_BRACKET;
-import static org.onosproject.yangutils.utils.UtilConstants.IMPORT;
-import static org.onosproject.yangutils.utils.UtilConstants.JAVA_LANG;
-import static org.onosproject.yangutils.utils.UtilConstants.LIST;
-import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE;
-import static org.onosproject.yangutils.utils.UtilConstants.PERIOD;
-import static org.onosproject.yangutils.utils.UtilConstants.PRIVATE;
-import static org.onosproject.yangutils.utils.UtilConstants.SEMI_COLAN;
-import static org.onosproject.yangutils.utils.UtilConstants.SPACE;
-import static org.onosproject.yangutils.utils.UtilConstants.STRING_DATA_TYPE;
-
-/**
- * Unit test cases for java code snippet generator.
- */
-public class JavaCodeSnippetGenTest {
-
- private static final String PKG_INFO = "org.onosproject.unittest";
- private static final String CLASS_INFO = "JavaCodeSnippetGenTest";
- private static final String YANG_NAME = "Test";
-
- /**
- * Unit test for private constructor.
- *
- * @throws SecurityException if any security violation is observed
- * @throws NoSuchMethodException if when the method is not found
- * @throws IllegalArgumentException if there is illegal argument found
- * @throws InstantiationException if instantiation is provoked for the private constructor
- * @throws IllegalAccessException if instance is provoked or a method is provoked
- * @throws InvocationTargetException when an exception occurs by the method or constructor
- */
- @Test
- public void callPrivateConstructors()
- throws SecurityException, NoSuchMethodException, IllegalArgumentException,
- InstantiationException, IllegalAccessException, InvocationTargetException {
-
- Class<?>[] classesToConstruct = {JavaCodeSnippetGen.class};
- for (Class<?> clazz : classesToConstruct) {
- Constructor<?> constructor = clazz.getDeclaredConstructor();
- constructor.setAccessible(true);
- assertThat(null, not(constructor.newInstance()));
- }
- }
-
- /**
- * Unit test case for import text.
- */
- @Test
- public void testForImportText() {
- JavaQualifiedTypeInfoTranslator importInfo = new JavaQualifiedTypeInfoTranslator();
- importInfo.setPkgInfo(PKG_INFO);
- importInfo.setClassInfo(CLASS_INFO);
-
- String imports = getImportText(importInfo);
-
- assertThat(true, is(imports.equals(IMPORT + PKG_INFO + PERIOD + CLASS_INFO + SEMI_COLAN + NEW_LINE)));
- }
-
- /**
- * Unit test case for java class interface definition close.
- */
- @Test
- public void testForJavaClassDefClose() {
- String interfaceDef = getJavaClassDefClose();
- assertThat(true, is(interfaceDef.equals(CLOSE_CURLY_BRACKET)));
- }
-
- /**
- * Unit test case for java attribute info.
- */
- @Test
- public void testForJavaAttributeInfo() {
-
- String attributeWithoutTypePkg = getJavaAttributeDefinition(null, STRING_DATA_TYPE, YANG_NAME,
- false, PRIVATE);
- assertThat(true, is(attributeWithoutTypePkg.equals(
- PRIVATE + SPACE + STRING_DATA_TYPE + SPACE + YANG_NAME + SEMI_COLAN + NEW_LINE)));
-
- String attributeWithTypePkg = getJavaAttributeDefinition(JAVA_LANG, STRING_DATA_TYPE, YANG_NAME,
- false, PRIVATE);
- assertThat(true, is(attributeWithTypePkg.equals(PRIVATE + SPACE + JAVA_LANG + PERIOD
- + STRING_DATA_TYPE + SPACE + YANG_NAME + SEMI_COLAN + NEW_LINE)));
-
- String attributeWithListPkg = getJavaAttributeDefinition(JAVA_LANG, STRING_DATA_TYPE, YANG_NAME,
- true, PRIVATE);
- assertThat(true, is(attributeWithListPkg.contains(
- PRIVATE + SPACE + LIST + DIAMOND_OPEN_BRACKET + JAVA_LANG + PERIOD + STRING_DATA_TYPE
- + DIAMOND_CLOSE_BRACKET + SPACE + YANG_NAME)));
-
- String attributeWithListWithoutPkg = getJavaAttributeDefinition(null, STRING_DATA_TYPE, YANG_NAME,
- true, PRIVATE);
- assertThat(true, is(attributeWithListWithoutPkg.contains(
- PRIVATE + SPACE + LIST + DIAMOND_OPEN_BRACKET + STRING_DATA_TYPE + DIAMOND_CLOSE_BRACKET + SPACE
- + YANG_NAME)));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/utils/JavaIdentifierSyntaxTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/utils/JavaIdentifierSyntaxTest.java
deleted file mode 100644
index 0fee831..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/utils/JavaIdentifierSyntaxTest.java
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
- * 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.translator.tojava.utils;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangToJavaNamingConflictUtil;
-
-import static org.apache.commons.io.FileUtils.deleteDirectory;
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNot.not;
-import static org.junit.Assert.assertThat;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.doesPackageExist;
-import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getRootPackage;
-import static org.onosproject.yangutils.utils.UtilConstants.DEFAULT_BASE_PKG;
-import static org.onosproject.yangutils.utils.UtilConstants.PERIOD;
-import static org.onosproject.yangutils.utils.UtilConstants.SLASH;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCamelCase;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getJavaPackageFromPackagePath;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getPackageDirPathFromJavaJPackage;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getSmallCase;
-
-/**
- * Unit tests for java identifier syntax.
- */
-public final class JavaIdentifierSyntaxTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- private static final String PARENT_PACKAGE = "test5/test6/test7";
- private static final String CHILD_PACKAGE = "test1:test2:test3";
- private static final String DATE1 = "2000-1-5";
- private static final String DATE2 = "1992-01-25";
- private static final String PARENT_WITH_PERIOD = "test5.test6.test7";
- private static final String CHILD_WITH_PERIOD = "test1.test2.test3";
- private static final String DATE_WITH_REV1 = "rev20000105";
- private static final String DATE_WITH_REV2 = "rev19920125";
- private static final String VERSION_NUMBER = "v1";
- private static final String VALID_PREFIX = "123add-prefix";
- private static final String INVALID_PREFIX = "-*()&^&#$%";
- private static final String INVALID_PREFIX1 = "abc~!@#$%^&*()_+}{:<>?`1234567890-=[]''|,./SS";
- private static final String INVALID_NAME_SPACE_FOR_INVALID_PREFIX = "try:#test3:9case3";
- private static final String INVALID_NAME_SPACE1 = "byte:#test2:9test3";
- private static final String INVALID_NAME_SPACE2 = "const:#test2://9test3";
- private static final String INVALID_NAME_SPACE3 = "CONST:TRY://9test3";
- private static final String VALID_NAME_SPACE1 = "123addprefixbyte.test2.123addprefix9test3";
- private static final String VALID_NAME_SPACE2 = "yangautoprefixconst.test2.yangautoprefix9test3";
- private static final String VALID_NAME_SPACE3 = "abc1234567890ssconst.test2.abc1234567890ss9test3";
- private static final String VALID_NAME_SPACE4 = "yangautoprefixconst.yangautoprefixtry.yangautoprefix9test3";
- private static final String WITHOUT_CAMEL_CASE = "test-camel-case-identifier";
- private static final String WITH_CAMEL_CASE = "testCamelCaseIdentifier";
- private static final String WITHOUT_CAMEL_CASE1 = ".-_try-._-.123";
- private static final String WITH_CAMEL_CASE1 = "try123";
- private static final String WITHOUT_CAMEL_CASE2 = "_try";
- private static final String WITH_CAMEL_CASE2 = "yangAutoPrefixTry";
- private static final String WITHOUT_CAMEL_CASE3 = "-1-123g-123ga-a";
- private static final String WITH_CAMEL_CASE3 = "yangAutoPrefix1123G123Gaa";
- private static final String WITHOUT_CAMEL_CASE4 = "a-b-c-d-e-f-g-h";
- private static final String WITH_CAMEL_CASE4 = "aBcDeFgh";
- private static final String WITHOUT_CAMEL_CASE5 = "TestName";
- private static final String WITH_CAMEL_CASE5 = "testName";
- private static final String WITHOUT_CAMEL_CASE6 = "TEST-NAME";
- private static final String WITH_CAMEL_CASE6 = "testName";
- private static final String WITHOUT_CAMEL_CASE7 = "TESTNAME";
- private static final String WITH_CAMEL_CASE7 = "testname";
- private static final String WITHOUT_CAMEL_CASE8 = "TE-ST-NA-ME";
- private static final String WITH_CAMEL_CASE8 = "teStNaMe";
- private static final String WITHOUT_CAMEL_CASE9 = "TEST3NAME";
- private static final String WITH_CAMEL_CASE9 = "test3Name";
- private static final String WITHOUT_CAMEL_CASE10 = "TEST3";
- private static final String WITH_CAMEL_CASE10 = "test3";
- private static final String WITHOUT_CAMEL_CASE11 = "TEST3nAMe";
- private static final String WITH_CAMEL_CASE11 = "test3Name";
- private static final String WITHOUT_CAMEL_CASE12 = "TEST3name";
- private static final String WITH_CAMEL_CASE12 = "test3Name";
- private static final String WITHOUT_CAMEL_CASE13 = "t-RY";
- private static final String WITH_CAMEL_CASE13 = "tRy";
- private static final String WITHOUT_CAMEL_CASE14 = "TRY";
- private static final String WITH_CAMEL_CASE14 = "yangAutoPrefixTry";
- private static final String WITHOUT_CAPITAL = "test_this";
- private static final String WITH_CAPITAL = "Test_this";
- private static final String WITH_SMALL = "test_this";
- private static final String WITH_CAMEL_CASE_WITH_PREFIX = "123addPrefixTry";
- private static final String WITH_CAMEL_CASE_WITH_PREFIX1 = "abc1234567890Ss1123G123Gaa";
- private static final String DATE_FORMAT = "yyyy-MM-dd";
- private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATE_FORMAT);
- private static YangToJavaNamingConflictUtil conflictResolver = new YangToJavaNamingConflictUtil();
- private static final String BASE_DIR_PKG = "target.UnitTestCase.";
- private static final String DIR_PATH = "exist1.exist2.exist3";
- private static final String PKG_INFO = "package-info.java";
-
- /**
- * Unit test for private constructor.
- *
- * @throws SecurityException if any security violation is observed.
- * @throws NoSuchMethodException if when the method is not found.
- * @throws IllegalArgumentException if there is illegal argument found.
- * @throws InstantiationException if instantiation is provoked for the
- * private constructor.
- * @throws IllegalAccessException if instance is provoked or a method is
- * provoked.
- * @throws InvocationTargetException when an exception occurs by the method
- * or constructor.
- */
- @Test
- public void callPrivateConstructors() throws SecurityException, NoSuchMethodException, IllegalArgumentException,
- InstantiationException, IllegalAccessException, InvocationTargetException {
-
- Class<?>[] classesToConstruct = {JavaIdentifierSyntax.class};
- for (Class<?> clazz : classesToConstruct) {
- Constructor<?> constructor = clazz.getDeclaredConstructor();
- constructor.setAccessible(true);
- assertThat(null, not(constructor.newInstance()));
- }
- }
-
- /**
- * Unit test for root package generation with revision complexity.
- */
- @Test
- public void getRootPackageTest() throws ParseException {
- conflictResolver.setPrefixForIdentifier(null);
- Date date = simpleDateFormat.parse(DATE1);
- String rootPackage = getRootPackage((byte) 1, CHILD_PACKAGE, date, conflictResolver);
- assertThat(rootPackage.equals(DEFAULT_BASE_PKG + PERIOD + VERSION_NUMBER
- + PERIOD + CHILD_WITH_PERIOD + PERIOD + DATE_WITH_REV1), is(true));
- }
-
- /**
- * Unit test for root package generation with invalid prefix.
- */
- @Test
- public void getRootPackageWithInvalidPrefix() throws TranslatorException, ParseException {
- thrown.expect(TranslatorException.class);
- thrown.expectMessage("The given prefix in pom.xml is invalid.");
- conflictResolver.setPrefixForIdentifier(INVALID_PREFIX);
- Date date = simpleDateFormat.parse(DATE1);
- String rootPackage1 = getRootPackage((byte) 1, INVALID_NAME_SPACE_FOR_INVALID_PREFIX, date,
- conflictResolver);
- }
-
- /**
- * Unit test for root package generation with special characters presence.
- */
- @Test
- public void getRootPackageWithSpecialCharactersTest() throws ParseException {
- conflictResolver.setPrefixForIdentifier(VALID_PREFIX);
- Date date = simpleDateFormat.parse(DATE1);
- String rootPackage = getRootPackage((byte) 1, INVALID_NAME_SPACE1, date, conflictResolver);
- assertThat(rootPackage.equals(DEFAULT_BASE_PKG + PERIOD + VERSION_NUMBER
- + PERIOD + VALID_NAME_SPACE1 + PERIOD + DATE_WITH_REV1), is(true));
- conflictResolver.setPrefixForIdentifier(null);
- String rootPackage1 = getRootPackage((byte) 1, INVALID_NAME_SPACE2, date, conflictResolver);
- assertThat(rootPackage1.equals(DEFAULT_BASE_PKG + PERIOD + VERSION_NUMBER
- + PERIOD + VALID_NAME_SPACE2 + PERIOD + DATE_WITH_REV1), is(true));
- String rootPackage2 = getRootPackage((byte) 1, INVALID_NAME_SPACE3, date, conflictResolver);
- assertThat(rootPackage2.equals(DEFAULT_BASE_PKG + PERIOD + VERSION_NUMBER
- + PERIOD + VALID_NAME_SPACE4 + PERIOD + DATE_WITH_REV1), is(true));
- conflictResolver.setPrefixForIdentifier(INVALID_PREFIX1);
- String rootPackage3 = getRootPackage((byte) 1, INVALID_NAME_SPACE2, date, conflictResolver);
- assertThat(rootPackage3.equals(DEFAULT_BASE_PKG + PERIOD + VERSION_NUMBER
- + PERIOD + VALID_NAME_SPACE3 + PERIOD + DATE_WITH_REV1), is(true));
-
- }
-
- /**
- * Unit test for root package generation without complexity in revision.
- */
- @Test
- public void getRootPackageWithRevTest() throws ParseException {
- Date date = simpleDateFormat.parse(DATE2);
- String rootPkgWithRev = getRootPackage((byte) 1, CHILD_PACKAGE, date, null);
- assertThat(rootPkgWithRev.equals(
- DEFAULT_BASE_PKG + PERIOD + VERSION_NUMBER + PERIOD + CHILD_WITH_PERIOD + PERIOD + DATE_WITH_REV2),
- is(true));
- }
-
- /**
- * Unit test for capitalizing the incoming string.
- */
- @Test
- public void getCapitalCaseTest() {
- String capitalCase = getCapitalCase(WITHOUT_CAPITAL);
- assertThat(capitalCase.equals(WITH_CAPITAL), is(true));
- }
-
- /**
- * Unit test for getting the camel case for the received string.
- */
- @Test
- public void getCamelCaseTest() {
- conflictResolver.setPrefixForIdentifier(null);
- String camelCase = getCamelCase(WITHOUT_CAMEL_CASE, conflictResolver);
- assertThat(camelCase.equals(WITH_CAMEL_CASE), is(true));
- String camelCase1 = getCamelCase(WITHOUT_CAMEL_CASE1, conflictResolver);
- assertThat(camelCase1.equals(WITH_CAMEL_CASE1), is(true));
- String camelCase2 = getCamelCase(WITHOUT_CAMEL_CASE2, conflictResolver);
- assertThat(camelCase2.equals(WITH_CAMEL_CASE2), is(true));
- String camelCase3 = getCamelCase(WITHOUT_CAMEL_CASE3, conflictResolver);
- assertThat(camelCase3.equals(WITH_CAMEL_CASE3), is(true));
- String camelCase4 = getCamelCase(WITHOUT_CAMEL_CASE4, conflictResolver);
- assertThat(camelCase4.equals(WITH_CAMEL_CASE4), is(true));
- String camelCase5 = getCamelCase(WITHOUT_CAMEL_CASE5, conflictResolver);
- assertThat(camelCase5.equals(WITH_CAMEL_CASE5), is(true));
- String camelCase6 = getCamelCase(WITHOUT_CAMEL_CASE6, conflictResolver);
- assertThat(camelCase6.equals(WITH_CAMEL_CASE6), is(true));
- String camelCase7 = getCamelCase(WITHOUT_CAMEL_CASE7, conflictResolver);
- assertThat(camelCase7.equals(WITH_CAMEL_CASE7), is(true));
- String camelCase8 = getCamelCase(WITHOUT_CAMEL_CASE8, conflictResolver);
- assertThat(camelCase8.equals(WITH_CAMEL_CASE8), is(true));
- String camelCase9 = getCamelCase(WITHOUT_CAMEL_CASE9, conflictResolver);
- assertThat(camelCase9.equals(WITH_CAMEL_CASE9), is(true));
- String camelCase10 = getCamelCase(WITHOUT_CAMEL_CASE10, conflictResolver);
- assertThat(camelCase10.equals(WITH_CAMEL_CASE10), is(true));
- String camelCase11 = getCamelCase(WITHOUT_CAMEL_CASE11, conflictResolver);
- assertThat(camelCase11.equals(WITH_CAMEL_CASE11), is(true));
- String camelCase12 = getCamelCase(WITHOUT_CAMEL_CASE12, conflictResolver);
- assertThat(camelCase12.equals(WITH_CAMEL_CASE12), is(true));
- String camelCase13 = getCamelCase(WITHOUT_CAMEL_CASE13, conflictResolver);
- assertThat(camelCase13.equals(WITH_CAMEL_CASE13), is(true));
- String camelCase14 = getCamelCase(WITHOUT_CAMEL_CASE14, conflictResolver);
- assertThat(camelCase14.equals(WITH_CAMEL_CASE14), is(true));
- }
-
- /**
- * Unit test for getting the camel case along with the prefix provided.
- */
- @Test
- public void getCamelCaseWithPrefixTest() {
-
- conflictResolver.setPrefixForIdentifier(VALID_PREFIX);
- String camelCase = getCamelCase(WITHOUT_CAMEL_CASE2, conflictResolver);
- assertThat(camelCase.equals(WITH_CAMEL_CASE_WITH_PREFIX), is(true));
- conflictResolver.setPrefixForIdentifier(INVALID_PREFIX1);
- String camelCase2 = getCamelCase(WITHOUT_CAMEL_CASE3, conflictResolver);
- assertThat(camelCase2.equals(WITH_CAMEL_CASE_WITH_PREFIX1), is(true));
- }
-
- /**
- * Unit test for getting the camel case along with the invalid prefix provided.
- */
- @Test
- public void getCamelCaseWithInvalidPrefixTest() throws TranslatorException {
-
- thrown.expect(TranslatorException.class);
- thrown.expectMessage("The given prefix in pom.xml is invalid.");
- conflictResolver.setPrefixForIdentifier(INVALID_PREFIX);
- String camelCase = getCamelCase(WITHOUT_CAMEL_CASE3, conflictResolver);
- }
-
- /**
- * Unit test for getting the camel case for the received string.
- */
- @Test
- public void getSmallCaseTest() {
- String smallCase = getSmallCase(WITHOUT_CAPITAL);
- assertThat(smallCase.equals(WITH_SMALL), is(true));
- }
-
- /**
- * Unit test for getting the camel case for the received string.
- */
- @Test
- public void getPackageFromPathTest() {
- String pkg = getJavaPackageFromPackagePath(PARENT_PACKAGE);
- assertThat(pkg.equals(PARENT_WITH_PERIOD), is(true));
- }
-
- /**
- * Unit test for getting the camel case for the received string.
- */
- @Test
- public void getPathFromPackageTest() {
- String path = getPackageDirPathFromJavaJPackage(PARENT_WITH_PERIOD);
- assertThat(path.equals(PARENT_PACKAGE), is(true));
- }
-
-
- /**
- * This test case checks whether the package is existing.
- *
- * @throws IOException when failed to create a test file
- */
- @Test
- public void packageExistTest() throws IOException {
-
- String strPath = BASE_DIR_PKG + DIR_PATH;
- File createDir = new File(strPath.replace(PERIOD, SLASH));
- createDir.mkdirs();
- File createFile = new File(createDir + SLASH + PKG_INFO);
- createFile.createNewFile();
- assertThat(true, is(doesPackageExist(strPath)));
- createDir.delete();
- deleteDirectory(createDir);
- deleteDirectory(new File(BASE_DIR_PKG.replace(PERIOD, SLASH)));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGeneratorTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGeneratorTest.java
deleted file mode 100644
index ceebd35..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGeneratorTest.java
+++ /dev/null
@@ -1,318 +0,0 @@
-/*
- * 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.translator.tojava.utils;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.translator.tojava.JavaAttributeInfo;
-import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNot.not;
-import static org.junit.Assert.assertThat;
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.STRING;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_SERVICE_AND_MANAGER;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getBuild;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getBuildForInterface;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getCheckNotNull;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getConstructor;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getConstructorStart;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getEqualsMethod;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getGetterForClass;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getGetterForInterface;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getOfMethod;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getOverRideString;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getSetterForClass;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getSetterForInterface;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getSetterForTypeDefClass;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getToStringMethod;
-import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getTypeConstructorStringAndJavaDoc;
-import static org.onosproject.yangutils.utils.UtilConstants.ADD_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.BUILD;
-import static org.onosproject.yangutils.utils.UtilConstants.BUILDER;
-import static org.onosproject.yangutils.utils.UtilConstants.CHECK_NOT_NULL_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.CLOSE_CURLY_BRACKET;
-import static org.onosproject.yangutils.utils.UtilConstants.CLOSE_PARENTHESIS;
-import static org.onosproject.yangutils.utils.UtilConstants.COMMA;
-import static org.onosproject.yangutils.utils.UtilConstants.EIGHT_SPACE_INDENTATION;
-import static org.onosproject.yangutils.utils.UtilConstants.EQUAL;
-import static org.onosproject.yangutils.utils.UtilConstants.EQUALS_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.FOUR_SPACE_INDENTATION;
-import static org.onosproject.yangutils.utils.UtilConstants.GET_METHOD_PREFIX;
-import static org.onosproject.yangutils.utils.UtilConstants.JAVA_LANG;
-import static org.onosproject.yangutils.utils.UtilConstants.NEW;
-import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE;
-import static org.onosproject.yangutils.utils.UtilConstants.OBJECT;
-import static org.onosproject.yangutils.utils.UtilConstants.OBJECT_STRING;
-import static org.onosproject.yangutils.utils.UtilConstants.OF;
-import static org.onosproject.yangutils.utils.UtilConstants.OPEN_CURLY_BRACKET;
-import static org.onosproject.yangutils.utils.UtilConstants.OPEN_PARENTHESIS;
-import static org.onosproject.yangutils.utils.UtilConstants.OVERRIDE;
-import static org.onosproject.yangutils.utils.UtilConstants.PERIOD;
-import static org.onosproject.yangutils.utils.UtilConstants.PUBLIC;
-import static org.onosproject.yangutils.utils.UtilConstants.QUOTES;
-import static org.onosproject.yangutils.utils.UtilConstants.RETURN;
-import static org.onosproject.yangutils.utils.UtilConstants.SEMI_COLAN;
-import static org.onosproject.yangutils.utils.UtilConstants.SET_METHOD_PREFIX;
-import static org.onosproject.yangutils.utils.UtilConstants.SIXTEEN_SPACE_INDENTATION;
-import static org.onosproject.yangutils.utils.UtilConstants.SPACE;
-import static org.onosproject.yangutils.utils.UtilConstants.STATIC;
-import static org.onosproject.yangutils.utils.UtilConstants.STRING_DATA_TYPE;
-import static org.onosproject.yangutils.utils.UtilConstants.SUFFIX_S;
-import static org.onosproject.yangutils.utils.UtilConstants.THIS;
-import static org.onosproject.yangutils.utils.UtilConstants.TWELVE_SPACE_INDENTATION;
-import static org.onosproject.yangutils.utils.UtilConstants.VALUE;
-import static org.onosproject.yangutils.utils.UtilConstants.VOID;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase;
-
-/**
- * Unit tests for generated methods from the file type.
- */
-public final class MethodsGeneratorTest {
-
- private static final String CLASS_NAME = "testname";
- private static final String ATTRIBUTE_NAME = "testname";
-
- /**
- * Unit test for private constructor.
- *
- * @throws SecurityException if any security violation is observed
- * @throws NoSuchMethodException if when the method is not found
- * @throws IllegalArgumentException if there is illegal argument found
- * @throws InstantiationException if instantiation is provoked for the private constructor
- * @throws IllegalAccessException if instance is provoked or a method is provoked
- * @throws InvocationTargetException when an exception occurs by the method or constructor
- */
- @Test
- public void callPrivateConstructors()
- throws SecurityException, NoSuchMethodException, IllegalArgumentException,
- InstantiationException, IllegalAccessException, InvocationTargetException {
-
- Class<?>[] classesToConstruct = {MethodsGenerator.class};
- for (Class<?> clazz : classesToConstruct) {
- Constructor<?> constructor = clazz.getDeclaredConstructor();
- constructor.setAccessible(true);
- assertThat(null, not(constructor.newInstance()));
- }
- }
-
- /**
- * Unit test case for checking the parse builder and type constructor.
- */
- @Test
- public void getTypeConstructorTest() {
-
- YangPluginConfig pluginConfig = new YangPluginConfig();
- JavaAttributeInfo testAttr = getTestAttribute();
- String test = getTypeConstructorStringAndJavaDoc(testAttr, CLASS_NAME, pluginConfig);
- assertThat(true, is(test.contains(PUBLIC + SPACE + CLASS_NAME + OPEN_PARENTHESIS)));
- }
-
- /**
- * Test for build method for class.
- */
- @Test
- public void getBuildTest() {
- String method = getBuild(CLASS_NAME, false);
- assertThat(true, is(method.equals(FOUR_SPACE_INDENTATION + PUBLIC + SPACE + CLASS_NAME + SPACE + BUILD
- + OPEN_PARENTHESIS + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE + EIGHT_SPACE_INDENTATION
- + RETURN + SPACE + NEW + SPACE + "Default" + CLASS_NAME + OPEN_PARENTHESIS + THIS + CLOSE_PARENTHESIS
- + SEMI_COLAN + NEW_LINE + FOUR_SPACE_INDENTATION + CLOSE_CURLY_BRACKET)));
-
- }
-
- /**
- * Test for build method of interface.
- */
- @Test
- public void getBuildForInterfaceTest() {
- String method = getBuildForInterface(CLASS_NAME);
- assertThat(true, is(method.equals(FOUR_SPACE_INDENTATION + CLASS_NAME + SPACE + BUILD +
- OPEN_PARENTHESIS + CLOSE_PARENTHESIS + SEMI_COLAN + NEW_LINE)));
- }
-
- /**
- * Test for check not null method.
- */
- @Test
- public void getCheckNotNullTest() {
- String method = getCheckNotNull(CLASS_NAME);
- assertThat(true, is(method.equals(EIGHT_SPACE_INDENTATION + CHECK_NOT_NULL_STRING + OPEN_PARENTHESIS
- + CLASS_NAME + COMMA + SPACE + CLASS_NAME + CLOSE_PARENTHESIS + SEMI_COLAN + NEW_LINE)));
- }
-
- /**
- * Test case for constructor.
- */
- @Test
- public void getConstructorTest() {
- JavaAttributeInfo testAttr = getTestAttribute();
- YangPluginConfig pluginConfig = new YangPluginConfig();
- String method = getConstructor(testAttr, GENERATE_SERVICE_AND_MANAGER, pluginConfig);
- assertThat(true, is(method.contains(THIS + PERIOD + CLASS_NAME + SPACE + EQUAL + SPACE + "builder" + OBJECT
- + PERIOD + GET_METHOD_PREFIX + "Testname" + OPEN_PARENTHESIS + CLOSE_PARENTHESIS + SEMI_COLAN)));
- }
-
- /**
- * Test for constrcutor start method.
- */
- @Test
- public void getConstructorStartTest() {
- YangPluginConfig pluginConfig = new YangPluginConfig();
- String method = getConstructorStart(CLASS_NAME, pluginConfig, false);
- assertThat(true, is(method.contains(PUBLIC + SPACE + "Default" + CLASS_NAME + OPEN_PARENTHESIS + CLASS_NAME
- + BUILDER + SPACE + BUILDER.toLowerCase() + OBJECT + CLOSE_PARENTHESIS + SPACE
- + OPEN_CURLY_BRACKET + NEW_LINE)));
- }
-
- /**
- * Test case for equals method.
- */
- @Test
- public void getEqualsMethodTest() {
- JavaAttributeInfo testAttr = getTestAttribute();
- String method = getEqualsMethod(testAttr);
- assertThat(true, is(method.contains(SIXTEEN_SPACE_INDENTATION + SPACE + OBJECT_STRING + SUFFIX_S + PERIOD
- + EQUALS_STRING + OPEN_PARENTHESIS)));
- }
-
- /**
- * Test for to string method.
- */
- @Test
- public void getToStringMethodTest() {
- JavaAttributeInfo testAttr = getTestAttribute();
- String method = getToStringMethod(testAttr);
- assertThat(true, is(method.equals(
- TWELVE_SPACE_INDENTATION + PERIOD + ADD_STRING + OPEN_PARENTHESIS + QUOTES + testAttr.getAttributeName()
- + QUOTES + COMMA + SPACE + testAttr.getAttributeName() + CLOSE_PARENTHESIS)));
- }
-
- /**
- * Test for getter method of class.
- */
- @Test
- public void getGetterForClassTest() {
- JavaAttributeInfo testAttr = getTestAttribute();
- String method = getGetterForClass(testAttr, GENERATE_SERVICE_AND_MANAGER);
- assertThat(true, is(method.contains(PUBLIC + SPACE + STRING_DATA_TYPE + SPACE + GET_METHOD_PREFIX)));
- }
-
- /**
- * Test for getter of interface.
- */
- @Test
- public void getGetterForInterfaceTest() {
- String method = getGetterForInterface(CLASS_NAME, STRING_DATA_TYPE, false, GENERATE_SERVICE_AND_MANAGER);
- assertThat(true, is(method.contains(STRING_DATA_TYPE + SPACE + GET_METHOD_PREFIX)));
- }
-
- /**
- * Test case for setter method of class.
- */
- @Test
- public void getSetterForClassTest() {
- JavaAttributeInfo testAttr = getTestAttribute();
- String method = getSetterForClass(testAttr, CLASS_NAME, GENERATE_SERVICE_AND_MANAGER);
- assertThat(true, is(
- method.contains(PUBLIC + SPACE + VOID + SPACE +
- SET_METHOD_PREFIX + getCapitalCase(CLASS_NAME) + OPEN_PARENTHESIS +
- STRING_DATA_TYPE + SPACE + ATTRIBUTE_NAME)));
- }
-
- /**
- * Test for setter method of interface.
- */
- @Test
- public void getSetterForInterfaceTest() {
- String method = getSetterForInterface(CLASS_NAME, STRING_DATA_TYPE, CLASS_NAME, false,
- GENERATE_SERVICE_AND_MANAGER);
- assertThat(true, is(method.contains(VOID + SPACE +
- SET_METHOD_PREFIX + "Testname")));
- }
-
- /**
- * Test case for of method.
- */
- @Test
- public void getOfMethodest() {
- JavaAttributeInfo testAttr = getTestAttribute();
- String method = getOfMethod(CLASS_NAME, testAttr);
- assertThat(true, is(method.contains(PUBLIC + SPACE + STATIC + SPACE + CLASS_NAME + SPACE + OF + OPEN_PARENTHESIS
- + STRING_DATA_TYPE + SPACE + VALUE + CLOSE_PARENTHESIS)));
- }
-
- /**
- * Test case for setter in type def class.
- */
- @Test
- public void getSetterForTypeDefClassTest() {
- JavaAttributeInfo testAttr = getTestAttribute();
- String method = getSetterForTypeDefClass(testAttr);
- assertThat(true, is(method.contains(PUBLIC + SPACE + VOID + SPACE + SET_METHOD_PREFIX)));
- }
-
- /**
- * Test case for over ride string.
- */
- @Test
- public void getOverRideStringTest() {
- String method = getOverRideString();
- assertThat(true, is(method.contains(OVERRIDE)));
- }
-
- /**
- * Returns java attribute.
- *
- * @return java attribute
- */
- private JavaAttributeInfo getTestAttribute() {
- JavaAttributeInfo testAttr = new JavaAttributeInfo(getTestYangType(), ATTRIBUTE_NAME, false, false);
- testAttr.setAttributeName(ATTRIBUTE_NAME);
- testAttr.setAttributeType(getTestYangType());
- testAttr.setImportInfo(getTestJavaQualifiedTypeInfo());
- return testAttr;
- }
-
- /**
- * Returns java qualified info.
- *
- * @return java qualified info
- */
- private JavaQualifiedTypeInfoTranslator getTestJavaQualifiedTypeInfo() {
- JavaQualifiedTypeInfoTranslator info = new JavaQualifiedTypeInfoTranslator();
- info.setPkgInfo(JAVA_LANG);
- info.setClassInfo(STRING_DATA_TYPE);
- return info;
- }
-
- /**
- * Returns stub YANG type.
- *
- * @return test YANG type
- */
- private YangType<?> getTestYangType() {
- YangType<?> attrType = new YangType<>();
- attrType.setDataTypeName(STRING_DATA_TYPE);
- attrType.setDataType(STRING);
- return attrType;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/utils/UtilConstantsTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/utils/UtilConstantsTest.java
deleted file mode 100644
index a63d432..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/utils/UtilConstantsTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.utils;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-import static org.hamcrest.core.IsNot.not;
-import static org.junit.Assert.assertThat;
-
-/**
- * Test case for testing the util constants.
- */
-public final class UtilConstantsTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- /**
- * A private constructor is tested.
- *
- * @throws SecurityException if any security violation is observed
- * @throws NoSuchMethodException if when the method is not found
- * @throws IllegalArgumentException if there is illegal argument found
- * @throws InstantiationException if instantiation is provoked for the private constructor
- * @throws IllegalAccessException if instance is provoked or a method is provoked
- * @throws InvocationTargetException when an exception occurs by the method or constructor
- */
- @Test
- public void callPrivateConstructors() throws SecurityException, NoSuchMethodException, IllegalArgumentException,
- InstantiationException, IllegalAccessException, InvocationTargetException {
-
- Class<?>[] classesToConstruct = {UtilConstants.class };
- for (Class<?> clazz : classesToConstruct) {
- Constructor<?> constructor = clazz.getDeclaredConstructor();
- constructor.setAccessible(true);
- assertThat(null, not(constructor.newInstance()));
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/utils/io/impl/CopyrightHeaderTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/utils/io/impl/CopyrightHeaderTest.java
deleted file mode 100644
index 40ac92c..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/utils/io/impl/CopyrightHeaderTest.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * 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.utils.io.impl;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Calendar;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-import static org.apache.commons.io.FileUtils.contentEquals;
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNot.not;
-import static org.junit.Assert.assertThat;
-import static org.onosproject.yangutils.utils.io.impl.CopyrightHeader.getCopyrightHeader;
-
-/**
- * Unit Tests for the CopyrightHeader contents.
- */
-public final class CopyrightHeaderTest {
-
- private static final String COPYRIGHTS_FIRST_LINE = "/*\n * Copyright " + Calendar.getInstance().get(Calendar.YEAR)
- + "-present Open Networking Laboratory\n";
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- /**
- * Unit test for testing private constructor.
- *
- * @throws SecurityException if any security violation is observed
- * @throws NoSuchMethodException if when the method is not found
- * @throws IllegalArgumentException if there is illegal argument found
- * @throws InstantiationException if instantiation is provoked for the private constructor
- * @throws IllegalAccessException if instance is provoked or a method is provoked
- * @throws InvocationTargetException when an exception occurs by the method or constructor
- */
- @Test
- public void callPrivateConstructors() throws SecurityException, NoSuchMethodException, IllegalArgumentException,
- InstantiationException, IllegalAccessException, InvocationTargetException {
-
- Class<?>[] classesToConstruct = {CopyrightHeader.class };
- for (Class<?> clazz : classesToConstruct) {
- Constructor<?> constructor = clazz.getDeclaredConstructor();
- constructor.setAccessible(true);
- assertThat(null, not(constructor.newInstance()));
- }
- }
-
- /**
- * This test case checks the received copyright header contents.
- *
- * @throws IOException when fails to do IO operations
- */
- @Test
- public void testGetCopyrightHeader() throws IOException {
-
- String path = "src/test/resources/CopyrightHeader.txt";
-
- File testRsc = new File(path);
- FileInputStream in = new FileInputStream(testRsc);
-
- File testFile = new File("target/TestHeader.txt");
- FileOutputStream out = new FileOutputStream(testFile);
-
- out.write(COPYRIGHTS_FIRST_LINE.getBytes());
- int c = 0;
- while ((c = in.read()) != -1) {
- out.write(c);
- }
-
- String licenseHeader = getCopyrightHeader();
- File test = new File("target/TestCopyrightHeader.txt");
-
- FileWriter writer = new FileWriter(test);
- writer.write(licenseHeader);
- writer.close();
- out.close();
- out.flush();
- in.close();
-
- assertThat(true, is(contentEquals(test, testFile)));
- test.delete();
- testFile.delete();
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/utils/io/impl/FileSystemUtilTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/utils/io/impl/FileSystemUtilTest.java
deleted file mode 100644
index 271036f..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/utils/io/impl/FileSystemUtilTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * 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.utils.io.impl;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-
-import org.apache.commons.io.FileUtils;
-import org.junit.Test;
-
-import static org.apache.commons.io.FileUtils.deleteDirectory;
-import static org.hamcrest.core.IsNot.not;
-import static org.junit.Assert.assertThat;
-import static org.onosproject.yangutils.utils.UtilConstants.SLASH;
-import static org.onosproject.yangutils.utils.io.impl.FileSystemUtil.appendFileContents;
-import static org.onosproject.yangutils.utils.io.impl.FileSystemUtil.updateFileHandle;
-
-/**
- * Tests the file handle utilities.
- */
-public final class FileSystemUtilTest {
-
- private static final String BASE_PKG = "target/UnitTestCase";
- private static final String TEST_DATA_1 = "This is to append a text to the file first1\n";
- private static final String TEST_DATA_2 = "This is next second line\n";
- private static final String TEST_DATA_3 = "This is next third line in the file";
- private static final String TEST_FILE = "testFile";
- private static final String SOURCE_TEST_FILE = "sourceTestFile";
-
- /**
- * A private constructor is tested.
- *
- * @throws SecurityException if any security violation is observed
- * @throws NoSuchMethodException if when the method is not found
- * @throws IllegalArgumentException if there is illegal argument found
- * @throws InstantiationException if instantiation is provoked for the private constructor
- * @throws IllegalAccessException if instance is provoked or a method is provoked
- * @throws InvocationTargetException when an exception occurs by the method or constructor
- */
- @Test
- public void callPrivateConstructors()
- throws SecurityException, NoSuchMethodException, IllegalArgumentException,
- InstantiationException, IllegalAccessException, InvocationTargetException {
-
- Class<?>[] classesToConstruct = {FileSystemUtil.class};
- for (Class<?> clazz : classesToConstruct) {
- Constructor<?> constructor = clazz.getDeclaredConstructor();
- constructor.setAccessible(true);
- assertThat(null, not(constructor.newInstance()));
- }
- }
-
- /**
- * This test case checks the contents to be written in the file.
- *
- * @throws IOException when fails to create a test file
- */
- @Test
- public void updateFileHandleTest() throws IOException {
-
- File dir = new File(BASE_PKG + SLASH + TEST_FILE);
- dir.mkdirs();
- File createFile = new File(dir + TEST_FILE);
- createFile.createNewFile();
- File createSourceFile = new File(dir + SOURCE_TEST_FILE);
- createSourceFile.createNewFile();
- updateFileHandle(createFile, TEST_DATA_1, false);
- updateFileHandle(createFile, TEST_DATA_2, false);
- updateFileHandle(createFile, TEST_DATA_3, false);
- appendFileContents(createFile, createSourceFile);
- updateFileHandle(createFile, null, true);
- deleteDirectory(dir);
- FileUtils.deleteDirectory(new File(BASE_PKG));
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/utils/io/impl/JavaDocGenTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/utils/io/impl/JavaDocGenTest.java
deleted file mode 100644
index 9fd9d62..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/utils/io/impl/JavaDocGenTest.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * 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.utils.io.impl;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNot.not;
-import static org.junit.Assert.assertThat;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.getJavaDoc;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.BUILDER_CLASS;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.BUILDER_INTERFACE;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.BUILD_METHOD;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.CONSTRUCTOR;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.DEFAULT_CONSTRUCTOR;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.GETTER_METHOD;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.IMPL_CLASS;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.INTERFACE;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.PACKAGE_INFO;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.SETTER_METHOD;
-import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.TYPE_DEF_SETTER_METHOD;
-
-/**
- * Tests the java doc that is generated.
- */
-public final class JavaDocGenTest {
-
- private static final String TEST_NAME = "testName";
- private static final String END_STRING = " */\n";
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- /**
- * This test case checks the content received for the builder class java doc.
- */
- @Test
- public void builderClassGenerationTest() {
- String builderClassJavaDoc = getJavaDoc(BUILDER_CLASS, TEST_NAME, false, getStubPluginConfig());
- assertThat(true, is(builderClassJavaDoc.contains("Represents the builder implementation of")
- && builderClassJavaDoc.contains(END_STRING)));
- }
-
- /**
- * This test case checks the content received for the builder interface ge java doc.
- */
- @Test
- public void builderInterfaceGenerationTest() {
- String builderInterfaceJavaDoc = getJavaDoc(BUILDER_INTERFACE, TEST_NAME, false, getStubPluginConfig());
- assertThat(true,
- is(builderInterfaceJavaDoc.contains("Builder for")
- && builderInterfaceJavaDoc.contains(END_STRING)));
- }
-
- /**
- * This test case checks the content received for the build java doc.
- */
- @Test
- public void buildGenerationTest() {
- String buildDoc = getJavaDoc(BUILD_METHOD, TEST_NAME, false, getStubPluginConfig());
- assertThat(true, is(buildDoc.contains("Builds object of") && buildDoc.contains(END_STRING)));
- }
-
- /**
- * A private constructor is tested.
- *
- * @throws SecurityException if any security violation is observed
- * @throws NoSuchMethodException if when the method is not found
- * @throws IllegalArgumentException if there is illegal argument found
- * @throws InstantiationException if instantiation is provoked for the private constructor
- * @throws IllegalAccessException if instance is provoked or a method is provoked
- * @throws InvocationTargetException when an exception occurs by the method or constructor
- */
- @Test
- public void callPrivateConstructors()
- throws SecurityException, NoSuchMethodException, IllegalArgumentException,
- InstantiationException, IllegalAccessException, InvocationTargetException {
-
- Class<?>[] classesToConstruct = {JavaDocGen.class };
- for (Class<?> clazz : classesToConstruct) {
- Constructor<?> constructor = clazz.getDeclaredConstructor();
- constructor.setAccessible(true);
- assertThat(null, not(constructor.newInstance()));
- }
- }
-
- /**
- * This test case checks the content received for the constructor java doc.
- */
- @Test
- public void constructorGenerationTest() {
- String constructorDoc = getJavaDoc(CONSTRUCTOR, TEST_NAME, false, getStubPluginConfig());
- assertThat(true,
- is(constructorDoc.contains("Creates an instance of ")
- && constructorDoc.contains("builder object of")
- && constructorDoc.contains("@param") && constructorDoc.contains("*/\n")));
- }
-
- /**
- * This test case checks the content received for the default constructor java doc.
- */
- @Test
- public void defaultConstructorGenerationTest() {
- String defaultConstructorDoc = getJavaDoc(DEFAULT_CONSTRUCTOR, TEST_NAME, false, getStubPluginConfig());
- assertThat(true, is(defaultConstructorDoc.contains("Creates an instance of ")
- && defaultConstructorDoc.contains(END_STRING)));
- }
-
- /**
- * This test case checks the content received for the getter java doc.
- */
- @Test
- public void getterGenerationTest() {
- String getterJavaDoc = getJavaDoc(GETTER_METHOD, TEST_NAME, false, getStubPluginConfig());
- assertThat(true,
- is(getterJavaDoc.contains("Returns the attribute") && getterJavaDoc.contains(END_STRING)));
- }
-
- /**
- * This test case checks the content received for the impl class java doc.
- */
- @Test
- public void implClassGenerationTest() {
- String implClassJavaDoc = getJavaDoc(IMPL_CLASS, TEST_NAME, false, getStubPluginConfig());
- assertThat(true,
- is(implClassJavaDoc.contains("Represents the implementation of")
- && implClassJavaDoc.contains(END_STRING)));
- }
-
- /**
- * This test case checks the content received for the interface java doc.
- */
- @Test
- public void interfaceGenerationTest() {
- String interfaceJavaDoc = getJavaDoc(INTERFACE, TEST_NAME, false, getStubPluginConfig());
- assertThat(true,
- is(interfaceJavaDoc.contains("Abstraction of an entity which represents the functionality of")
- && interfaceJavaDoc.contains(END_STRING)));
- }
-
- /**
- * This test case checks the content received for the package info java doc.
- */
- @Test
- public void packageInfoGenerationTest() {
- String packageInfo = getJavaDoc(PACKAGE_INFO, TEST_NAME, false, getStubPluginConfig());
- assertThat(true,
- is(packageInfo.contains("Implementation of YANG node") && packageInfo.contains(END_STRING)));
- }
-
- /**
- * This test case checks the content received for the package info java doc.
- */
- @Test
- public void packageInfoGenerationForChildNodeTest() {
- String packageInfo = getJavaDoc(PACKAGE_INFO, TEST_NAME, true, getStubPluginConfig());
- assertThat(true, is(packageInfo.contains("Implementation of YANG node testName's children nodes")
- && packageInfo.contains(END_STRING)));
- }
-
- /**
- * This test case checks the content received for the setter java doc.
- */
- @Test
- public void setterGenerationTest() {
- String setterJavaDoc = getJavaDoc(SETTER_METHOD, TEST_NAME, false, getStubPluginConfig());
- assertThat(true,
- is(setterJavaDoc.contains("Returns the builder object of") && setterJavaDoc.contains(END_STRING)));
- }
-
- /**
- * This test case checks the content received for the typedef setter java doc.
- */
- @Test
- public void typeDefSetterGenerationTest() {
- String typeDefSetter = getJavaDoc(TYPE_DEF_SETTER_METHOD, TEST_NAME, false, getStubPluginConfig());
- assertThat(true, is(typeDefSetter.contains("Sets the value of") && typeDefSetter.contains(END_STRING)));
- }
-
- /**
- * Returns stub pluginConfig.
- *
- * @return stub pluginConfig
- */
- private YangPluginConfig getStubPluginConfig() {
- YangPluginConfig pluginConfig = new YangPluginConfig();
- pluginConfig.setConflictResolver(null);
- return pluginConfig;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/utils/io/impl/YangFileScannerTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/utils/io/impl/YangFileScannerTest.java
deleted file mode 100644
index 566d24b..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/utils/io/impl/YangFileScannerTest.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * 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.utils.io.impl;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-import static java.io.File.separator;
-
-import static org.apache.commons.io.FileUtils.deleteDirectory;
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNot.not;
-import static org.junit.Assert.assertThat;
-import static org.onosproject.yangutils.utils.io.impl.YangFileScanner.getJavaFiles;
-import static org.onosproject.yangutils.utils.io.impl.YangFileScanner.getYangFiles;
-
-/**
- * Test the file scanner service.
- */
-public final class YangFileScannerTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- String baseDir = "target/UnitTestCase";
-
- /**
- * A private constructor is tested.
- *
- * @throws SecurityException if any security violation is observed
- * @throws NoSuchMethodException if when the method is not found
- * @throws IllegalArgumentException if there is illegal argument found
- * @throws InstantiationException if instantiation is provoked for the private constructor
- * @throws IllegalAccessException if instance is provoked or a method is provoked
- * @throws InvocationTargetException when an exception occurs by the method or constructor
- */
- @Test
- public void callPrivateConstructors() throws SecurityException, NoSuchMethodException, IllegalArgumentException,
- InstantiationException, IllegalAccessException, InvocationTargetException {
-
- Class<?>[] classesToConstruct = {YangFileScanner.class };
- for (Class<?> clazz : classesToConstruct) {
- Constructor<?> constructor = clazz.getDeclaredConstructor();
- constructor.setAccessible(true);
- assertThat(null, not(constructor.newInstance()));
- }
- }
-
- /**
- * This test case checks for a .java file inside the specified dir.
- *
- * @throws IOException when fails to do IO operations
- */
- @Test
- public void checkJavaFileInsideDirTest() throws IOException {
-
- String dir = baseDir + separator + "scanner2";
- File path = createDirectory(dir);
- createFile(path, "testScanner.java");
- List<String> dirContents = getJavaFiles(path.toString());
- List<String> expectedContents = new LinkedList<>();
- expectedContents.add(path.getCanonicalPath() + separator + "testScanner.java");
- assertThat(true, is(dirContents.equals(expectedContents)));
- deleteDirectory(path);
- }
-
- /**
- * Method used for creating multiple directories inside the target file.
- *
- * @param path where directories should be created
- * @return the directory path that is created
- */
- private File createDirectory(String path) {
-
- File myDir = new File(path);
- myDir.mkdirs();
- return myDir;
- }
-
- /**
- * Method used for creating file inside the specified directory.
- *
- * @param myDir the path where file has to be created inside
- * @param fileName the name of the file to be created
- */
- private void createFile(File myDir, String fileName) throws IOException {
-
- File file = null;
- file = new File(myDir + separator + fileName);
- file.createNewFile();
- }
-
- /**
- * This testcase checks for a java file inside an empty directory.
- *
- * @throws IOException when fails to do IO operations
- */
- @Test
- public void emptyDirJavaScannerTest() throws IOException {
-
- String emptyDir = baseDir + separator + "scanner1";
- File path = createDirectory(emptyDir);
- List<String> emptyDirContents = getJavaFiles(path.toString());
- List<String> expectedContents = new LinkedList<>();
- assertThat(true, is(emptyDirContents.equals(expectedContents)));
- deleteDirectory(path);
- }
-
- /**
- * This testcase checks for a yang file inside an empty directory.
- *
- * @throws IOException when fails to do IO operations
- */
- @Test
- public void emptyDirYangScannerTest() throws IOException {
-
- String emptyYangDir = baseDir + separator + "scanner1";
- File path = createDirectory(emptyYangDir);
- List<String> emptyDirContents = getYangFiles(path.toString());
- List<String> expectedContents = new LinkedList<>();
- assertThat(true, is(emptyDirContents.equals(expectedContents)));
- deleteDirectory(path);
- }
-
- /**
- * This test case checks with the sub directories in the given path for java files.
- *
- * @throws IOException when fails to do IO operations
- */
- @Test
- public void emptySubDirScannerTest() throws IOException {
-
- String dir = baseDir + separator + "scanner3";
- File path = createDirectory(dir);
- String subDir = path.toString() + separator + "subDir1";
- createDirectory(subDir);
- createFile(path, "invalidFile.txt");
- List<String> emptySubDirContents = getJavaFiles(path.toString());
- List<String> expectedContents = new LinkedList<>();
- assertThat(true, is(emptySubDirContents.equals(expectedContents)));
- deleteDirectory(path);
- }
-
-}
diff --git a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/utils/io/impl/YangIoUtilsTest.java b/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/utils/io/impl/YangIoUtilsTest.java
deleted file mode 100644
index 393408a..0000000
--- a/utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/utils/io/impl/YangIoUtilsTest.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * 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.utils.io.impl;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import org.apache.commons.io.FileUtils;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
-import org.onosproject.yangutils.utils.UtilConstants;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNot.not;
-import static org.junit.Assert.assertThat;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.addPackageInfo;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.createDirectories;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.trimAtLast;
-
-/**
- * Unit tests for YANG IO utils.
- */
-public final class YangIoUtilsTest {
-
- private static final String BASE_DIR = "target/UnitTestCase";
- private static final String CREATE_PATH = BASE_DIR + File.separator + "dir1/dir2/dir3/dir4/";
- private static final String CHECK_STRING = "one, two, three, four, five, six";
- private static final String TRIM_STRING = "one, two, three, four, five, ";
- private static final String CHECK1 = "check1";
- private static final String PKG_INFO = "package-info.java";
- private static final String PATH = "src/main/yangmodel/";
- private static final String MSG = "Exception occurred while creating package info file.";
-
- /**
- * Expected exceptions.
- */
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- /**
- * This test case checks whether the package-info file is created.
- *
- * @throws IOException when fails to do IO operations for test case
- */
- @Test
- public void addPackageInfoTest() throws IOException {
-
- File dirPath = new File(CREATE_PATH);
- dirPath.mkdirs();
- addPackageInfo(dirPath, CHECK1, CREATE_PATH, false, getStubPluginConfig());
- File filePath = new File(dirPath + File.separator + PKG_INFO);
- assertThat(filePath.isFile(), is(true));
- FileUtils.deleteDirectory(new File(BASE_DIR));
- }
-
- /**
- * This test case checks with an additional info in the path.
- *
- * @throws IOException when fails to do IO operations for test case
- */
- @Test
- public void addPackageInfoWithPathTest() throws IOException {
-
- File dirPath = new File(CREATE_PATH);
- dirPath.mkdirs();
- addPackageInfo(dirPath, CHECK1, PATH + CREATE_PATH, false, getStubPluginConfig());
- File filePath = new File(dirPath + File.separator + PKG_INFO);
- assertThat(filePath.isFile(), is(true));
- FileUtils.deleteDirectory(new File(BASE_DIR));
- }
-
- /**
- * This test case checks with a child node.
- *
- * @throws IOException when fails to do IO operations for test case
- */
- @Test
- public void addPackageInfoWithChildNode() throws IOException {
-
- File dirPath = new File(CREATE_PATH);
- dirPath.mkdirs();
- addPackageInfo(dirPath, CHECK1, PATH + CREATE_PATH, true, getStubPluginConfig());
- File filePath = new File(dirPath + File.separator + PKG_INFO);
- assertThat(filePath.isFile(), is(true));
- FileUtils.deleteDirectory(new File(BASE_DIR));
- }
-
- /**
- * This test case checks whether the package-info file is created when invalid path is given.
- *
- * @throws IOException when fails to do IO operations for test case
- */
- @Test
- public void addPackageInfoWithEmptyPathTest() throws IOException {
-
- File dirPath = new File("invalid/check");
- thrown.expect(IOException.class);
- thrown.expectMessage(MSG);
- addPackageInfo(dirPath, CHECK1, CREATE_PATH, false, getStubPluginConfig());
- File filePath1 = new File(dirPath + File.separator + PKG_INFO);
- assertThat(filePath1.isFile(), is(false));
- FileUtils.deleteDirectory(dirPath);
- FileUtils.deleteDirectory(new File(BASE_DIR));
- }
-
- /**
- * A private constructor is tested.
- *
- * @throws SecurityException if any security violation is observed
- * @throws NoSuchMethodException if when the method is not found
- * @throws IllegalArgumentException if there is illegal argument found
- * @throws InstantiationException if instantiation is provoked for the private constructor
- * @throws IllegalAccessException if instance is provoked or a method is provoked
- * @throws InvocationTargetException when an exception occurs by the method or constructor
- */
- @Test
- public void callPrivateConstructors()
- throws SecurityException, NoSuchMethodException, IllegalArgumentException,
- InstantiationException, IllegalAccessException, InvocationTargetException {
-
- Class<?>[] classesToConstruct = {YangIoUtils.class };
- for (Class<?> clazz : classesToConstruct) {
- Constructor<?> constructor = clazz.getDeclaredConstructor();
- constructor.setAccessible(true);
- assertThat(null, not(constructor.newInstance()));
- }
- }
-
- /**
- * This test case checks if the directory is cleaned.
- *
- * @throws IOException when fails to do IO operations for test case
- */
- @Test
- public void cleanGeneratedDirTest() throws IOException {
-
- File baseDirPath = new File(BASE_DIR);
- File createNewDir = new File(BASE_DIR + File.separator + UtilConstants.YANG_GEN_DIR);
- createNewDir.mkdirs();
- File createFile = new File(createNewDir + File.separator + "check1.java");
- createFile.createNewFile();
- deleteDirectory(baseDirPath.getAbsolutePath());
- FileUtils.deleteDirectory(createNewDir);
- FileUtils.deleteDirectory(baseDirPath);
- }
-
- /**
- * This test case checks the cleaning method when an invalid path is provided.
- *
- * @throws IOException when fails to do IO operations for test case
- */
- @Test
- public void cleanWithInvalidDirTest() throws IOException {
-
- File baseDirPath = new File(BASE_DIR + "invalid");
- deleteDirectory(baseDirPath.getAbsolutePath());
- }
-
- /**
- * This test case tests whether the directories are getting created.
- */
- @Test
- public void createDirectoryTest() throws IOException {
-
- File dirPath = createDirectories(CREATE_PATH);
- assertThat(dirPath.isDirectory(), is(true));
- FileUtils.deleteDirectory(new File(BASE_DIR));
- }
-
- /**
- * Unit test case for trim at last method.
- */
- @Test
- public void testForTrimAtLast() {
-
- String test = trimAtLast(CHECK_STRING, "six");
- assertThat(test.contains(TRIM_STRING), is(true));
- }
-
- /**
- * Returns stub pluginConfig.
- *
- * @return stub pluginConfig
- */
- private YangPluginConfig getStubPluginConfig() {
- YangPluginConfig pluginConfig = new YangPluginConfig();
- pluginConfig.setConflictResolver(null);
- return pluginConfig;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/AnyxmlStatement.yang b/utils/yangutils/plugin/src/test/resources/AnyxmlStatement.yang
deleted file mode 100644
index 4b1e421..0000000
--- a/utils/yangutils/plugin/src/test/resources/AnyxmlStatement.yang
+++ /dev/null
@@ -1,16 +0,0 @@
-module event {
-
- namespace "http://example.com/event";
- prefix "ev";
-
- notification event {
- leaf event-class {
- type string;
- }
- anyxml reporting-entity;
- leaf severity {
- type string;
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/BelongsToDualPrefix.yang b/utils/yangutils/plugin/src/test/resources/BelongsToDualPrefix.yang
deleted file mode 100644
index 37973da..0000000
--- a/utils/yangutils/plugin/src/test/resources/BelongsToDualPrefix.yang
+++ /dev/null
@@ -1,8 +0,0 @@
-submodule Test {
-yang-version 1;
-belongs-to ONOS {
-prefix On1;
-prefix On2;
-}
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/BelongsToWithPrefix.yang b/utils/yangutils/plugin/src/test/resources/BelongsToWithPrefix.yang
deleted file mode 100644
index 75a13ca..0000000
--- a/utils/yangutils/plugin/src/test/resources/BelongsToWithPrefix.yang
+++ /dev/null
@@ -1,6 +0,0 @@
-submodule Test {
-yang-version 1;
-belongs-to ONOS {
-prefix On1;
-}
-}
diff --git a/utils/yangutils/plugin/src/test/resources/BelongsToWithoutPrefix.yang b/utils/yangutils/plugin/src/test/resources/BelongsToWithoutPrefix.yang
deleted file mode 100644
index eaf9885..0000000
--- a/utils/yangutils/plugin/src/test/resources/BelongsToWithoutPrefix.yang
+++ /dev/null
@@ -1,6 +0,0 @@
-submodule Test {
-yang-version 1;
-belongs-to ONOS {
-}
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/BitTypeStatement.yang b/utils/yangutils/plugin/src/test/resources/BitTypeStatement.yang
deleted file mode 100644
index 9d13495..0000000
--- a/utils/yangutils/plugin/src/test/resources/BitTypeStatement.yang
+++ /dev/null
@@ -1,12 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf mybits {
- type bits {
- bit disable-nagle;
- bit auto-sense-speed;
- bit Ten-Mb-only;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/BitTypedefReferredLeafStatement.yang b/utils/yangutils/plugin/src/test/resources/BitTypedefReferredLeafStatement.yang
deleted file mode 100644
index cda6381..0000000
--- a/utils/yangutils/plugin/src/test/resources/BitTypedefReferredLeafStatement.yang
+++ /dev/null
@@ -1,22 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- typedef topBits {
- type bits {
- bit disable-nagle {
- position 0;
- }
- bit auto-sense-speed {
- position 1;
- }
- bit Mb-only {
- position 2;
- }
- }
- }
-
- leaf myBits {
- type topBits;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/BitTypedefStatement.yang b/utils/yangutils/plugin/src/test/resources/BitTypedefStatement.yang
deleted file mode 100644
index d3dc26a..0000000
--- a/utils/yangutils/plugin/src/test/resources/BitTypedefStatement.yang
+++ /dev/null
@@ -1,18 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- typedef type15 {
- type bits {
- bit disable-nagle {
- position 0;
- }
- bit auto-sense-speed {
- position 1;
- }
- bit Mb-only {
- position 2;
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/BitUnionStatement.yang b/utils/yangutils/plugin/src/test/resources/BitUnionStatement.yang
deleted file mode 100644
index dd62eae..0000000
--- a/utils/yangutils/plugin/src/test/resources/BitUnionStatement.yang
+++ /dev/null
@@ -1,20 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf type15 {
- type union {
- type bits {
- bit disable-nagle {
- position 0;
- }
- bit auto-sense-speed {
- position 1;
- }
- bit Mb-only {
- position 2;
- }
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/BitWithDuplicateName.yang b/utils/yangutils/plugin/src/test/resources/BitWithDuplicateName.yang
deleted file mode 100644
index ed5cc32..0000000
--- a/utils/yangutils/plugin/src/test/resources/BitWithDuplicateName.yang
+++ /dev/null
@@ -1,12 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf mybits {
- type bits {
- bit disable-nagle;
- bit disable-nagle;
- bit Ten-Mb-only;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/CaseChoiceHierarchy.yang b/utils/yangutils/plugin/src/test/resources/CaseChoiceHierarchy.yang
deleted file mode 100644
index 28d110e..0000000
--- a/utils/yangutils/plugin/src/test/resources/CaseChoiceHierarchy.yang
+++ /dev/null
@@ -1,23 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container food {
- choice snack {
- case sports-arena {
- leaf pretzel {
- type empty;
- }
- }
- case late-night {
- choice dinner {
- case late-night {
- leaf beer {
- type empty;
- }
- }
- }
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/CaseStatement.yang b/utils/yangutils/plugin/src/test/resources/CaseStatement.yang
deleted file mode 100644
index bb3f6c9..0000000
--- a/utils/yangutils/plugin/src/test/resources/CaseStatement.yang
+++ /dev/null
@@ -1,26 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container food {
- choice snack {
- case sports-arena {
- leaf pretzel {
- type empty;
- }
- leaf beer {
- type empty;
- }
- }
- case late-night {
- leaf chocolate {
- type enumeration {
- enum dark;
- enum milk;
- enum first-available;
- }
- }
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/CaseStatementSameEntryDifferentChoice.yang b/utils/yangutils/plugin/src/test/resources/CaseStatementSameEntryDifferentChoice.yang
deleted file mode 100644
index b42cdf9..0000000
--- a/utils/yangutils/plugin/src/test/resources/CaseStatementSameEntryDifferentChoice.yang
+++ /dev/null
@@ -1,28 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container food {
- choice snack {
- case sports-arena {
- leaf pretzel {
- type empty;
- }
- leaf beer {
- type empty;
- }
- }
- }
- choice lunch {
- case sports-arena {
- leaf chocolate {
- type enumeration {
- enum dark;
- enum milk;
- enum first-available;
- }
- }
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/CaseSubStatementOfAugment.yang b/utils/yangutils/plugin/src/test/resources/CaseSubStatementOfAugment.yang
deleted file mode 100644
index 7123f91..0000000
--- a/utils/yangutils/plugin/src/test/resources/CaseSubStatementOfAugment.yang
+++ /dev/null
@@ -1,58 +0,0 @@
-module event {
-
- namespace "http://example.com/event";
- prefix "ev";
-
- augment /snmp:snmp/snmp:engine/snmp:listen/snmp:transport {
- if-feature tlstm;
- case tls {
- container tls {
- description
- "A list of IPv4 and IPv6 addresses and ports to which the
- engine listens for SNMP messages over TLS.";
- leaf ip {
- type inet:ip-address;
- mandatory true;
- description
- "The IPv4 or IPv6 address on which the engine listens
- for SNMP messages over TLS.";
- }
- leaf port {
- type inet:port-number;
- description
- "The TCP port on which the engine listens for SNMP
- messages over TLS.
- If the port is not configured, an engine that
- acts as a Command Responder uses port 10161, and
- an engine that acts as a Notification Receiver
- uses port 10162.";
- }
- }
- }
- case dtls {
- container dtls1 {
- description
- "A list of IPv4 and IPv6 addresses and ports to which the
- engine listens for SNMP messages over DTLS.";
- leaf ip {
- type inet:ip-address;
- mandatory true;
- description
- "The IPv4 or IPv6 address on which the engine listens
- for SNMP messages over DTLS.";
- }
- leaf port {
- type inet:port-number;
- description
- "The UDP port on which the engine listens for SNMP
- messages over DTLS.
- If the port is not configured, an engine that
- acts as a Command Responder uses port 10161, and
- an engine that acts as a Notification Receiver
- uses port 10162.";
- }
- }
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/ChoiceCaseTranslator.yang b/utils/yangutils/plugin/src/test/resources/ChoiceCaseTranslator.yang
deleted file mode 100644
index e8127ea..0000000
--- a/utils/yangutils/plugin/src/test/resources/ChoiceCaseTranslator.yang
+++ /dev/null
@@ -1,22 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container food {
- choice snack {
- case sports-arena {
- leaf pretzel {
- type string;
- }
- leaf beer {
- type string;
- }
- }
- case late-night {
- leaf chocolate {
- type string;
- }
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ChoiceStatementDuplicateEntry.yang b/utils/yangutils/plugin/src/test/resources/ChoiceStatementDuplicateEntry.yang
deleted file mode 100644
index d2a6371..0000000
--- a/utils/yangutils/plugin/src/test/resources/ChoiceStatementDuplicateEntry.yang
+++ /dev/null
@@ -1,10 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container food {
- choice snack;
- choice lunch;
- choice snack;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ChoiceStatementSameEntryDifferentContainer.yang b/utils/yangutils/plugin/src/test/resources/ChoiceStatementSameEntryDifferentContainer.yang
deleted file mode 100644
index 39ba626..0000000
--- a/utils/yangutils/plugin/src/test/resources/ChoiceStatementSameEntryDifferentContainer.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container food1 {
- choice snack;
- choice lunch;
- }
- container food2 {
- choice snack;
- choice lunch;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ChoiceStatementWithStmtend.yang b/utils/yangutils/plugin/src/test/resources/ChoiceStatementWithStmtend.yang
deleted file mode 100644
index 4b85f59..0000000
--- a/utils/yangutils/plugin/src/test/resources/ChoiceStatementWithStmtend.yang
+++ /dev/null
@@ -1,8 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container food {
- choice snack;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ChoiceStatementWithoutBody.yang b/utils/yangutils/plugin/src/test/resources/ChoiceStatementWithoutBody.yang
deleted file mode 100644
index 2de7787..0000000
--- a/utils/yangutils/plugin/src/test/resources/ChoiceStatementWithoutBody.yang
+++ /dev/null
@@ -1,9 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container food {
- choice snack {
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ChoiceSubStatementDefault.yang b/utils/yangutils/plugin/src/test/resources/ChoiceSubStatementDefault.yang
deleted file mode 100644
index b9fd60d..0000000
--- a/utils/yangutils/plugin/src/test/resources/ChoiceSubStatementDefault.yang
+++ /dev/null
@@ -1,23 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container food {
- choice snack {
- case sports-arena {
- leaf pretzel {
- type string;
- }
- leaf beer {
- type string;
- }
- }
- case late-night {
- leaf chocolate {
- type string;
- }
- }
- default "hello";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ConfigDefaultValue.yang b/utils/yangutils/plugin/src/test/resources/ConfigDefaultValue.yang
deleted file mode 100644
index 7e19946..0000000
--- a/utils/yangutils/plugin/src/test/resources/ConfigDefaultValue.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container valid {
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- mandatory true;
- status current;
- reference "RFC 6020";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ConfigEmptyValue.yang b/utils/yangutils/plugin/src/test/resources/ConfigEmptyValue.yang
deleted file mode 100644
index 0d62956..0000000
--- a/utils/yangutils/plugin/src/test/resources/ConfigEmptyValue.yang
+++ /dev/null
@@ -1,9 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type "uint16";
- config ;
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ConfigFalse.yang b/utils/yangutils/plugin/src/test/resources/ConfigFalse.yang
deleted file mode 100644
index 79dc5ac..0000000
--- a/utils/yangutils/plugin/src/test/resources/ConfigFalse.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- config false;
- mandatory true;
- status current;
- reference "RFC 6020";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ConfigFalseNoKey.yang b/utils/yangutils/plugin/src/test/resources/ConfigFalseNoKey.yang
deleted file mode 100644
index 66f141e..0000000
--- a/utils/yangutils/plugin/src/test/resources/ConfigFalseNoKey.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- config false;
- leaf invalid-interval {
- type "string";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ConfigFalseParentContainerChildLeaf.yang b/utils/yangutils/plugin/src/test/resources/ConfigFalseParentContainerChildLeaf.yang
deleted file mode 100644
index ecc0806..0000000
--- a/utils/yangutils/plugin/src/test/resources/ConfigFalseParentContainerChildLeaf.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container valid {
- config false;
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- config true;
- reference "RFC 6020";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ConfigFalseParentContainerChildLeafList.yang b/utils/yangutils/plugin/src/test/resources/ConfigFalseParentContainerChildLeafList.yang
deleted file mode 100644
index e3c7836..0000000
--- a/utils/yangutils/plugin/src/test/resources/ConfigFalseParentContainerChildLeafList.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container valid {
- config false;
- leaf-list invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- config true;
- reference "RFC 6020";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ConfigFalseParentContainerChildList.yang b/utils/yangutils/plugin/src/test/resources/ConfigFalseParentContainerChildList.yang
deleted file mode 100644
index ffc6f60..0000000
--- a/utils/yangutils/plugin/src/test/resources/ConfigFalseParentContainerChildList.yang
+++ /dev/null
@@ -1,18 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container valid {
- config false;
- list valid {
- key "invalid-interval";
- config true;
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ConfigFalseParentListChildContainer.yang b/utils/yangutils/plugin/src/test/resources/ConfigFalseParentListChildContainer.yang
deleted file mode 100644
index 3158dd4..0000000
--- a/utils/yangutils/plugin/src/test/resources/ConfigFalseParentListChildContainer.yang
+++ /dev/null
@@ -1,24 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- config false;
- key "invalid-interval";
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- container valid {
- config true;
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ConfigFalseParentListChildLeaf.yang b/utils/yangutils/plugin/src/test/resources/ConfigFalseParentListChildLeaf.yang
deleted file mode 100644
index 65171dd..0000000
--- a/utils/yangutils/plugin/src/test/resources/ConfigFalseParentListChildLeaf.yang
+++ /dev/null
@@ -1,16 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "invalid-interval";
- config false;
- leaf invalid-interval {
- type "uint16";
- config true;
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ConfigFalseParentListChildLeafList.yang b/utils/yangutils/plugin/src/test/resources/ConfigFalseParentListChildLeafList.yang
deleted file mode 100644
index 33132cd..0000000
--- a/utils/yangutils/plugin/src/test/resources/ConfigFalseParentListChildLeafList.yang
+++ /dev/null
@@ -1,16 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "invalid-interval";
- config false;
- leaf-list invalid-interval {
- type "uint16";
- config true;
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ConfigFalseValidKeyValidLeaf.yang b/utils/yangutils/plugin/src/test/resources/ConfigFalseValidKeyValidLeaf.yang
deleted file mode 100644
index 368a4b5..0000000
--- a/utils/yangutils/plugin/src/test/resources/ConfigFalseValidKeyValidLeaf.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "invalid-interval";
- config false;
- leaf invalid-interval {
- type "string";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ConfigInvalidValue.yang b/utils/yangutils/plugin/src/test/resources/ConfigInvalidValue.yang
deleted file mode 100644
index b2e7659..0000000
--- a/utils/yangutils/plugin/src/test/resources/ConfigInvalidValue.yang
+++ /dev/null
@@ -1,9 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type "uint16";
- config invalid;
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ConfigTrue.yang b/utils/yangutils/plugin/src/test/resources/ConfigTrue.yang
deleted file mode 100644
index 70349a0..0000000
--- a/utils/yangutils/plugin/src/test/resources/ConfigTrue.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- config true;
- mandatory true;
- status current;
- reference "RFC 6020";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ConfigTrueNoKey.yang b/utils/yangutils/plugin/src/test/resources/ConfigTrueNoKey.yang
deleted file mode 100644
index 7a0a538..0000000
--- a/utils/yangutils/plugin/src/test/resources/ConfigTrueNoKey.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- config true;
- leaf invalid-interval {
- type "string";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ConfigTrueNoleafNoLeafList.yang b/utils/yangutils/plugin/src/test/resources/ConfigTrueNoleafNoLeafList.yang
deleted file mode 100644
index c553e60..0000000
--- a/utils/yangutils/plugin/src/test/resources/ConfigTrueNoleafNoLeafList.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- config true;
- container container1 {
- leaf leaf1 {
- type "string";
- }
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ConfigTrueValidKeyValidLeaf.yang b/utils/yangutils/plugin/src/test/resources/ConfigTrueValidKeyValidLeaf.yang
deleted file mode 100644
index fe8efe3..0000000
--- a/utils/yangutils/plugin/src/test/resources/ConfigTrueValidKeyValidLeaf.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "invalid-interval";
- leaf invalid-interval {
- type "string";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ConfigTrueValidKeyValidLeafList.yang b/utils/yangutils/plugin/src/test/resources/ConfigTrueValidKeyValidLeafList.yang
deleted file mode 100644
index 4196be4..0000000
--- a/utils/yangutils/plugin/src/test/resources/ConfigTrueValidKeyValidLeafList.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "invalid-interval";
- leaf-list invalid-interval {
- type "string";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ConfigWithoutStatementEnd.yang b/utils/yangutils/plugin/src/test/resources/ConfigWithoutStatementEnd.yang
deleted file mode 100644
index 0ae02af..0000000
--- a/utils/yangutils/plugin/src/test/resources/ConfigWithoutStatementEnd.yang
+++ /dev/null
@@ -1,9 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type "uint16";
- config false
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ContactDualEntryTest.yang b/utils/yangutils/plugin/src/test/resources/ContactDualEntryTest.yang
deleted file mode 100644
index 2dca10e..0000000
--- a/utils/yangutils/plugin/src/test/resources/ContactDualEntryTest.yang
+++ /dev/null
@@ -1,9 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-organization "IETF SPRING Working Group";
-contact "WG List";
-contact "Invalid";
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/ContactIncorrectOrder.yang b/utils/yangutils/plugin/src/test/resources/ContactIncorrectOrder.yang
deleted file mode 100644
index 237d003..0000000
--- a/utils/yangutils/plugin/src/test/resources/ContactIncorrectOrder.yang
+++ /dev/null
@@ -1,7 +0,0 @@
-module Test {
-yang-version 1;
-contact "Test";
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-organization "IETF SPRING Working Group";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ContactValidEntry.yang b/utils/yangutils/plugin/src/test/resources/ContactValidEntry.yang
deleted file mode 100644
index f88e147..0000000
--- a/utils/yangutils/plugin/src/test/resources/ContactValidEntry.yang
+++ /dev/null
@@ -1,9 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-organization "IETF SPRING Working Group";
-contact "WG List: <mailto:spring@ietf.org>
-Editor: Stephane Litkowski
- <mailto:stephane.litkowski@orange.com>";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ContactWithEmptyString.yang b/utils/yangutils/plugin/src/test/resources/ContactWithEmptyString.yang
deleted file mode 100644
index 34c6008..0000000
--- a/utils/yangutils/plugin/src/test/resources/ContactWithEmptyString.yang
+++ /dev/null
@@ -1,7 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-organization "IETF SPRING Working Group";
-contact;
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ContactWithoutQuotes.yang b/utils/yangutils/plugin/src/test/resources/ContactWithoutQuotes.yang
deleted file mode 100644
index 20ab72b..0000000
--- a/utils/yangutils/plugin/src/test/resources/ContactWithoutQuotes.yang
+++ /dev/null
@@ -1,8 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-organization "IETF SPRING Working Group";
-contact WG;
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/ContainerDuplicateContainer.yang b/utils/yangutils/plugin/src/test/resources/ContainerDuplicateContainer.yang
deleted file mode 100644
index 4928463..0000000
--- a/utils/yangutils/plugin/src/test/resources/ContainerDuplicateContainer.yang
+++ /dev/null
@@ -1,23 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container ospf {
- container valid {
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
- container valid {
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ContainerInvalidIdentifier.yang b/utils/yangutils/plugin/src/test/resources/ContainerInvalidIdentifier.yang
deleted file mode 100644
index eee1acd..0000000
--- a/utils/yangutils/plugin/src/test/resources/ContainerInvalidIdentifier.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container 1valid {
- reference "RFC 6020";
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ContainerRootNode.yang b/utils/yangutils/plugin/src/test/resources/ContainerRootNode.yang
deleted file mode 100644
index 441d717..0000000
--- a/utils/yangutils/plugin/src/test/resources/ContainerRootNode.yang
+++ /dev/null
@@ -1,9 +0,0 @@
-container valid {
- reference "RFC 6020";
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ContainerSubStatementCardinality.yang b/utils/yangutils/plugin/src/test/resources/ContainerSubStatementCardinality.yang
deleted file mode 100644
index 731e389..0000000
--- a/utils/yangutils/plugin/src/test/resources/ContainerSubStatementCardinality.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container valid {
- reference "RFC 6020";
- reference "RFC 6020";
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ContainerSubStatementConfig.yang b/utils/yangutils/plugin/src/test/resources/ContainerSubStatementConfig.yang
deleted file mode 100644
index 736dcbc..0000000
--- a/utils/yangutils/plugin/src/test/resources/ContainerSubStatementConfig.yang
+++ /dev/null
@@ -1,16 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container valid {
- config true;
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- mandatory true;
- status current;
- reference "RFC 6020";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ContainerSubStatementContainer.yang b/utils/yangutils/plugin/src/test/resources/ContainerSubStatementContainer.yang
deleted file mode 100644
index 1f9f810..0000000
--- a/utils/yangutils/plugin/src/test/resources/ContainerSubStatementContainer.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container ospf {
- container valid {
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ContainerSubStatementDescription.yang b/utils/yangutils/plugin/src/test/resources/ContainerSubStatementDescription.yang
deleted file mode 100644
index dc75d00..0000000
--- a/utils/yangutils/plugin/src/test/resources/ContainerSubStatementDescription.yang
+++ /dev/null
@@ -1,18 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container valid {
- description "container description";
- config true;
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- mandatory true;
- status current;
- reference "RFC 6020";
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/ContainerSubStatementErrorAppTag.yang b/utils/yangutils/plugin/src/test/resources/ContainerSubStatementErrorAppTag.yang
deleted file mode 100644
index 644b890..0000000
--- a/utils/yangutils/plugin/src/test/resources/ContainerSubStatementErrorAppTag.yang
+++ /dev/null
@@ -1,25 +0,0 @@
-module ErrorAppTag {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container interface {
- leaf ifType {
- type enumeration {
- enum ethernet;
- enum atm;
- }
- }
- leaf ifMTU {
- type uint32;
- }
- must "ifType != 'ethernet' or " +
- "(ifType = 'ethernet' and ifMTU = 1500)" {
- description "An ethernet MTU must be 1500";
- error-app-tag "An ethernet MTU must be 1500";
- }
- must "ifType != 'atm' or " +
- "(ifType = 'atm' and ifMTU <= 17966 and ifMTU >= 64)" {
- description "An atm MTU must be 64 .. 17966";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ContainerSubStatementErrorDefaultAppTag.yang b/utils/yangutils/plugin/src/test/resources/ContainerSubStatementErrorDefaultAppTag.yang
deleted file mode 100644
index c265ea2..0000000
--- a/utils/yangutils/plugin/src/test/resources/ContainerSubStatementErrorDefaultAppTag.yang
+++ /dev/null
@@ -1,24 +0,0 @@
-module ErrorAppTag {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container interface {
- leaf ifType {
- type enumeration {
- enum ethernet;
- enum atm;
- }
- }
- leaf ifMTU {
- type uint32;
- }
- must "ifType != 'ethernet' or " +
- "(ifType = 'ethernet' and ifMTU = 1500)" {
- description "An ethernet MTU must be 1500";
- }
- must "ifType != 'atm' or " +
- "(ifType = 'atm' and ifMTU <= 17966 and ifMTU >= 64)" {
- description "An atm MTU must be 64 .. 17966";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ContainerSubStatementErrorMessage.yang b/utils/yangutils/plugin/src/test/resources/ContainerSubStatementErrorMessage.yang
deleted file mode 100644
index 4726d0c..0000000
--- a/utils/yangutils/plugin/src/test/resources/ContainerSubStatementErrorMessage.yang
+++ /dev/null
@@ -1,25 +0,0 @@
-module ErrorMessage {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container interface {
- leaf ifType {
- type enumeration {
- enum ethernet;
- enum atm;
- }
- }
- leaf ifMTU {
- type uint32;
- }
- must "ifType != 'ethernet' or " +
- "(ifType = 'ethernet' and ifMTU = 1500)" {
- description "An ethernet MTU must be 1500";
- error-message "An ethernet MTU must be 1500";
- }
- must "ifType != 'atm' or " +
- "(ifType = 'atm' and ifMTU <= 17966 and ifMTU >= 64)" {
- description "An atm MTU must be 64 .. 17966";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ContainerSubStatementLeaf.yang b/utils/yangutils/plugin/src/test/resources/ContainerSubStatementLeaf.yang
deleted file mode 100644
index c9a64e3..0000000
--- a/utils/yangutils/plugin/src/test/resources/ContainerSubStatementLeaf.yang
+++ /dev/null
@@ -1,17 +0,0 @@
-
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container valid {
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- config true;
- mandatory true;
- status current;
- reference "RFC 6020";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ContainerSubStatementLeafList.yang b/utils/yangutils/plugin/src/test/resources/ContainerSubStatementLeafList.yang
deleted file mode 100644
index a1877b6..0000000
--- a/utils/yangutils/plugin/src/test/resources/ContainerSubStatementLeafList.yang
+++ /dev/null
@@ -1,17 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container valid {
- leaf-list invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- config true;
- min-elements 1;
- max-elements unbounded;
- status current;
- reference "RFC 6020";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ContainerSubStatementList.yang b/utils/yangutils/plugin/src/test/resources/ContainerSubStatementList.yang
deleted file mode 100644
index 19810c7..0000000
--- a/utils/yangutils/plugin/src/test/resources/ContainerSubStatementList.yang
+++ /dev/null
@@ -1,16 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container ospf {
- list valid {
- key "invalid-interval";
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ContainerSubStatementMust.yang b/utils/yangutils/plugin/src/test/resources/ContainerSubStatementMust.yang
deleted file mode 100644
index c089850..0000000
--- a/utils/yangutils/plugin/src/test/resources/ContainerSubStatementMust.yang
+++ /dev/null
@@ -1,24 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container interface {
- leaf ifType {
- type enumeration {
- enum ethernet;
- enum atm;
- }
- }
- leaf ifMTU {
- type uint32;
- }
- must "ifType != 'ethernet' or " +
- "(ifType = 'ethernet' and ifMTU = 1500)" {
- description "An ethernet MTU must be 1500";
- }
- must "ifType != 'atm' or " +
- "(ifType = 'atm' and ifMTU <= 17966 and ifMTU >= 64)" {
- description "An atm MTU must be 64 .. 17966";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ContainerSubStatementPresence.yang b/utils/yangutils/plugin/src/test/resources/ContainerSubStatementPresence.yang
deleted file mode 100644
index d3a30dc..0000000
--- a/utils/yangutils/plugin/src/test/resources/ContainerSubStatementPresence.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container valid {
- presence "invalid";
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ContainerSubStatementReference.yang b/utils/yangutils/plugin/src/test/resources/ContainerSubStatementReference.yang
deleted file mode 100644
index 33f37fd..0000000
--- a/utils/yangutils/plugin/src/test/resources/ContainerSubStatementReference.yang
+++ /dev/null
@@ -1,17 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container valid {
- reference "container reference";
- config true;
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- mandatory true;
- status current;
- reference "RFC 6020";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ContainerSubStatementStatus.yang b/utils/yangutils/plugin/src/test/resources/ContainerSubStatementStatus.yang
deleted file mode 100644
index fdf907d..0000000
--- a/utils/yangutils/plugin/src/test/resources/ContainerSubStatementStatus.yang
+++ /dev/null
@@ -1,17 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container valid {
- config true;
- status obsolete;
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- mandatory true;
- status current;
- reference "RFC 6020";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ContainerSubStatementWhen.yang b/utils/yangutils/plugin/src/test/resources/ContainerSubStatementWhen.yang
deleted file mode 100644
index c25b499..0000000
--- a/utils/yangutils/plugin/src/test/resources/ContainerSubStatementWhen.yang
+++ /dev/null
@@ -1,37 +0,0 @@
-module Test {
- yang-version 1;
- namespace "http://huawei.com";
- prefix Ant;
- list interface-switching-capability {
- when "../switching-capability = 'TDM'" {
- description "Valid only for TDM";
- }
- key "switching-capability";
- description
- "List of Interface Switching Capabilities Descriptors (ISCD)
- for this link.";
- reference
- "RFC3471: Generalized Multi-Protocol Label Switching (GMPLS)
- Signaling Functional Description.
- RFC4203: OSPF Extensions in Support of Generalized
- Multi-Protocol Label Switching (GMPLS).";
- leaf switching-capability {
- type string;
- description
- "Switching Capability for this interface.";
- }
- }
- container time-division-multiplex-capable {
- when "../switching-capability = 'TDM'" {
- description "Valid only for TDM";
- }
- description
- "Interface has time-division multiplex capabilities.";
-
- leaf minimum-lsp-bandwidth {
- type decimal64 {
- fraction-digits 4;
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ContainerSubStatements.yang b/utils/yangutils/plugin/src/test/resources/ContainerSubStatements.yang
deleted file mode 100644
index 2611f97..0000000
--- a/utils/yangutils/plugin/src/test/resources/ContainerSubStatements.yang
+++ /dev/null
@@ -1,18 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container ospf {
- presence "ospf logs";
- config true;
- description "container description";
- status current;
- reference "container reference";
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ContainerWithDuplicateLeaf.yang b/utils/yangutils/plugin/src/test/resources/ContainerWithDuplicateLeaf.yang
deleted file mode 100644
index 3adaccd..0000000
--- a/utils/yangutils/plugin/src/test/resources/ContainerWithDuplicateLeaf.yang
+++ /dev/null
@@ -1,34 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container valid {
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- config true;
- mandatory true;
- status current;
- reference "RFC 6020";
- }
- leaf valid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- config true;
- mandatory true;
- status current;
- reference "RFC 6020";
- }
- leaf valid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- config true;
- mandatory true;
- status current;
- reference "RFC 6020";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/CopyrightHeader.txt b/utils/yangutils/plugin/src/test/resources/CopyrightHeader.txt
deleted file mode 100644
index 2cbed45..0000000
--- a/utils/yangutils/plugin/src/test/resources/CopyrightHeader.txt
+++ /dev/null
@@ -1,14 +0,0 @@
- *
- * 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.
- */
-
diff --git a/utils/yangutils/plugin/src/test/resources/DerivedTypeStatement.yang b/utils/yangutils/plugin/src/test/resources/DerivedTypeStatement.yang
deleted file mode 100644
index afbfd1d..0000000
--- a/utils/yangutils/plugin/src/test/resources/DerivedTypeStatement.yang
+++ /dev/null
@@ -1,11 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- import ietf-yang-types {
- prefix "P";
- }
- leaf invalid-interval {
- type P:hello;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/DescriptionEmptyStatement.yang b/utils/yangutils/plugin/src/test/resources/DescriptionEmptyStatement.yang
deleted file mode 100644
index f6c1c3d..0000000
--- a/utils/yangutils/plugin/src/test/resources/DescriptionEmptyStatement.yang
+++ /dev/null
@@ -1,6 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- description "";
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/DescriptionStringConcat.yang b/utils/yangutils/plugin/src/test/resources/DescriptionStringConcat.yang
deleted file mode 100644
index 8bf0519..0000000
--- a/utils/yangutils/plugin/src/test/resources/DescriptionStringConcat.yang
+++ /dev/null
@@ -1,9 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type "uint16";
- description "Interval before a " + "route is declared invalid";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/DescriptionValidStatement.yang b/utils/yangutils/plugin/src/test/resources/DescriptionValidStatement.yang
deleted file mode 100644
index 70349a0..0000000
--- a/utils/yangutils/plugin/src/test/resources/DescriptionValidStatement.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- config true;
- mandatory true;
- status current;
- reference "RFC 6020";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/DescriptionWithoutStatementEnd.yang b/utils/yangutils/plugin/src/test/resources/DescriptionWithoutStatementEnd.yang
deleted file mode 100644
index ebd8c24..0000000
--- a/utils/yangutils/plugin/src/test/resources/DescriptionWithoutStatementEnd.yang
+++ /dev/null
@@ -1,9 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type "uint16";
- description "Interval before a " + "route is declared invalid"
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/DuplicateCaseInChoice.yang b/utils/yangutils/plugin/src/test/resources/DuplicateCaseInChoice.yang
deleted file mode 100644
index a7b6b50..0000000
--- a/utils/yangutils/plugin/src/test/resources/DuplicateCaseInChoice.yang
+++ /dev/null
@@ -1,26 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container food {
- choice snack {
- case sports-arena {
- leaf pretzel {
- type empty;
- }
- leaf beer {
- type empty;
- }
- }
- case sports-arena {
- leaf chocolate {
- type enumeration {
- enum dark;
- enum milk;
- enum first-available;
- }
- }
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/DuplicateContainerAndList.yang b/utils/yangutils/plugin/src/test/resources/DuplicateContainerAndList.yang
deleted file mode 100644
index 74c7721..0000000
--- a/utils/yangutils/plugin/src/test/resources/DuplicateContainerAndList.yang
+++ /dev/null
@@ -1,29 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container ospf {
- container valid {
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
- list valid {
- key "process-id";
- container interface {
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
- leaf process-id {
- type "string";
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/DuplicateGroupingInContainer.yang b/utils/yangutils/plugin/src/test/resources/DuplicateGroupingInContainer.yang
deleted file mode 100644
index f130797..0000000
--- a/utils/yangutils/plugin/src/test/resources/DuplicateGroupingInContainer.yang
+++ /dev/null
@@ -1,23 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container valid {
- grouping endpoint {
- leaf address {
- type ip-address;
- }
- leaf port {
- type port-number;
- }
- }
- grouping endpoint {
- leaf address {
- type ip-address;
- }
- leaf port {
- type port-number;
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/DuplicateGroupingInList.yang b/utils/yangutils/plugin/src/test/resources/DuplicateGroupingInList.yang
deleted file mode 100644
index a9d1b3b..0000000
--- a/utils/yangutils/plugin/src/test/resources/DuplicateGroupingInList.yang
+++ /dev/null
@@ -1,36 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- import ietf-yang-types {
- prefix "P";
- }
- list valid {
- key address;
- grouping endpoint {
- description "grouping under test";
- status current;
- reference "RFC 6020";
- leaf address {
- type ip-address;
- }
- leaf port {
- type port-number;
- }
- }
- leaf address {
- type ip;
- }
- grouping endpoint {
- description "grouping under test";
- status current;
- reference "RFC 6020";
- leaf address {
- type ip-address;
- }
- leaf port {
- type port-number;
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/DuplicateGroupingInModule.yang b/utils/yangutils/plugin/src/test/resources/DuplicateGroupingInModule.yang
deleted file mode 100644
index ec01781..0000000
--- a/utils/yangutils/plugin/src/test/resources/DuplicateGroupingInModule.yang
+++ /dev/null
@@ -1,24 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- import ietf-yang-types {
- prefix "P";
- }
- grouping endpoint {
- leaf address {
- type P:ip-address;
- }
- leaf port {
- type P:port-number;
- }
- }
- grouping endpoint {
- leaf address {
- type P:pip-address;
- }
- leaf port {
- type P:port-number;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/DuplicateLeafInChoice.yang b/utils/yangutils/plugin/src/test/resources/DuplicateLeafInChoice.yang
deleted file mode 100644
index f951c7f..0000000
--- a/utils/yangutils/plugin/src/test/resources/DuplicateLeafInChoice.yang
+++ /dev/null
@@ -1,21 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container food {
- choice snack {
- case sports-arena {
- leaf pretzel {
- type empty;
- }
- leaf beer {
- type empty;
- }
- }
- case late-night {
- leaf pretzel {
- type empty;
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/DuplicateLeafInHierarchy.yang b/utils/yangutils/plugin/src/test/resources/DuplicateLeafInHierarchy.yang
deleted file mode 100644
index e23f04c..0000000
--- a/utils/yangutils/plugin/src/test/resources/DuplicateLeafInHierarchy.yang
+++ /dev/null
@@ -1,23 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container food {
- choice snack {
- case sports-arena {
- leaf pretzel {
- type empty;
- }
- }
- case late-night {
- choice lunch {
- case late {
- leaf pretzel {
- type empty;
- }
- }
- }
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/EnumBoundaryValue.yang b/utils/yangutils/plugin/src/test/resources/EnumBoundaryValue.yang
deleted file mode 100644
index ac87ef0..0000000
--- a/utils/yangutils/plugin/src/test/resources/EnumBoundaryValue.yang
+++ /dev/null
@@ -1,16 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf ifType {
- type enumeration {
- enum "unbounded";
- enum ZERO;
- enum two;
- enum four;
- enum seven {
- value 21474836472147483647;
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/EnumMaxNextValue.yang b/utils/yangutils/plugin/src/test/resources/EnumMaxNextValue.yang
deleted file mode 100644
index 4e4a373..0000000
--- a/utils/yangutils/plugin/src/test/resources/EnumMaxNextValue.yang
+++ /dev/null
@@ -1,18 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf ifType {
- type enumeration {
- enum "unbounded";
- enum ZERO;
- enum two;
- enum four;
- enum seven {
- value 2147483647;
- }
- enum five;
-
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/EnumSorted.yang b/utils/yangutils/plugin/src/test/resources/EnumSorted.yang
deleted file mode 100644
index 3760e83..0000000
--- a/utils/yangutils/plugin/src/test/resources/EnumSorted.yang
+++ /dev/null
@@ -1,18 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf ifType {
- type enumeration {
- enum four{
- value 7;
- }
- enum seven {
- value 2147483647;
- }
- enum five {
- value 5;
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/EnumTranslator.yang b/utils/yangutils/plugin/src/test/resources/EnumTranslator.yang
deleted file mode 100644
index 1957c1f..0000000
--- a/utils/yangutils/plugin/src/test/resources/EnumTranslator.yang
+++ /dev/null
@@ -1,17 +0,0 @@
-module Sfc {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf test{
- type string;
- }
- leaf myenum {
- type enumeration {
- enum zero;
- enum one;
- enum seven {
- value 7;
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/EnumTypeStatement.yang b/utils/yangutils/plugin/src/test/resources/EnumTypeStatement.yang
deleted file mode 100644
index 1d64805..0000000
--- a/utils/yangutils/plugin/src/test/resources/EnumTypeStatement.yang
+++ /dev/null
@@ -1,12 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf speed {
- type enumeration {
- enum 10m;
- enum 100m;
- enum auto;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/EnumWithDuplicateName.yang b/utils/yangutils/plugin/src/test/resources/EnumWithDuplicateName.yang
deleted file mode 100644
index 47c3a85..0000000
--- a/utils/yangutils/plugin/src/test/resources/EnumWithDuplicateName.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf speed {
- type enumeration {
- enum 10m;
- enum 100m;
- enum 10m {
- value 11;
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/GroupingAttributes.yang b/utils/yangutils/plugin/src/test/resources/GroupingAttributes.yang
deleted file mode 100644
index f04641f..0000000
--- a/utils/yangutils/plugin/src/test/resources/GroupingAttributes.yang
+++ /dev/null
@@ -1,25 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- import ietf-yang-types {
- prefix "P";
- }
- list valid {
- key address;
- leaf address {
- type P:ip;
- }
- grouping endpoint {
- description "grouping under test";
- status current;
- reference "RFC 6020";
- leaf address {
- type P:ip-address;
- }
- leaf port {
- type P:port-number;
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/GroupingInContainer.yang b/utils/yangutils/plugin/src/test/resources/GroupingInContainer.yang
deleted file mode 100644
index dfa8259..0000000
--- a/utils/yangutils/plugin/src/test/resources/GroupingInContainer.yang
+++ /dev/null
@@ -1,18 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- import ietf-yang-types {
- prefix "P";
- }
- container valid {
- grouping endpoint {
- leaf address {
- type P:ip-address;
- }
- leaf port {
- type P:port-number;
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/GroupingInList.yang b/utils/yangutils/plugin/src/test/resources/GroupingInList.yang
deleted file mode 100644
index c5966fc..0000000
--- a/utils/yangutils/plugin/src/test/resources/GroupingInList.yang
+++ /dev/null
@@ -1,22 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- import ietf-yang-types {
- prefix "P";
- }
- list valid {
- key address;
- leaf address {
- type P:ip;
- }
- grouping endpoint {
- leaf address {
- type P:ip-address;
- }
- leaf port {
- type P:port-number;
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/GroupingInModule.yang b/utils/yangutils/plugin/src/test/resources/GroupingInModule.yang
deleted file mode 100644
index 77fef1f..0000000
--- a/utils/yangutils/plugin/src/test/resources/GroupingInModule.yang
+++ /dev/null
@@ -1,16 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- import ietf-yang-types {
- prefix "P";
- }
- grouping endpoint {
- leaf address {
- type P:ip-address;
- }
- leaf port {
- type P:port-number;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/IdentityInModule.yang b/utils/yangutils/plugin/src/test/resources/IdentityInModule.yang
deleted file mode 100644
index 5688615..0000000
--- a/utils/yangutils/plugin/src/test/resources/IdentityInModule.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module IdentityInModule{
- yang-version 1;
- namespace http://huawei.com;
- prefix IdentityInModule;
-
- identity tunnel-type {
- description
- "Base identity from which specific tunnel types are derived.";
- }
-
- identity ref-address-family {
- reference "http://www.iana.org/assignments/address-family-numbers/address-family-numbers.xhtml#address-family-numbers-2";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/IdentityIntraFile.yang b/utils/yangutils/plugin/src/test/resources/IdentityIntraFile.yang
deleted file mode 100644
index c61fcfb..0000000
--- a/utils/yangutils/plugin/src/test/resources/IdentityIntraFile.yang
+++ /dev/null
@@ -1,23 +0,0 @@
-module IdentityIntraFile {
- yang-version 1;
- namespace http://huawei.com;
- prefix IdentityIntraFile;
-
- import "IdentityInModule" {
- prefix "IdentityInModule";
- }
-
- identity ipv4-address-family {
- base IdentityInModule:ref-address-family;
- }
-
- identity ipv6-address-family {
- base IdentityInModule:ref-address-family;
- }
-
- leaf tunnel {
- type identityref {
- base IdentityInModule:ref-address-family;
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/IdentityListener.yang b/utils/yangutils/plugin/src/test/resources/IdentityListener.yang
deleted file mode 100644
index a7ef4d2..0000000
--- a/utils/yangutils/plugin/src/test/resources/IdentityListener.yang
+++ /dev/null
@@ -1,39 +0,0 @@
-module IdentityListener{
- yang-version 1;
- namespace http://huawei.com;
- prefix IdentityListener;
-
- identity tunnel {
- description
- "Base identity from which specific tunnel types are derived.";
- }
-
- identity tunnel-type {
- description
- "Base identity from which specific tunnel types are derived.";
- }
-
- identity ref-address-family {
- reference "http://www.iana.org/assignments/address-family-numbers/address-family-numbers.xhtml#address-family-numbers-2";
- }
-
- identity ipv4-address-family {
- base ref-address-family;
- }
-
- identity ipv6-address-family {
- base ref-address-family;
- }
-
- leaf tunnel {
- type identityref {
- base ref-address-family;
- }
- }
-
- leaf-list network-ref {
- type identityref {
- base ref-address-family;
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/IdentityTypedef.yang b/utils/yangutils/plugin/src/test/resources/IdentityTypedef.yang
deleted file mode 100644
index 6e8f603..0000000
--- a/utils/yangutils/plugin/src/test/resources/IdentityTypedef.yang
+++ /dev/null
@@ -1,20 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
-
- identity tunnel {
- description
- "Base identity from which specific tunnel types are derived.";
- }
-
- leaf tunnel-value {
- type type15;
- }
-
- typedef type15 {
- type identityref {
- base tunnel;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/IdentityTypedefUnresolved.yang b/utils/yangutils/plugin/src/test/resources/IdentityTypedefUnresolved.yang
deleted file mode 100644
index d837fd1..0000000
--- a/utils/yangutils/plugin/src/test/resources/IdentityTypedefUnresolved.yang
+++ /dev/null
@@ -1,16 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
-
- identity tunnel {
- description
- "Base identity from which specific tunnel types are derived.";
- }
-
- typedef type15 {
- type identityref {
- base tunnel;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ImportInvalidOrder.yang b/utils/yangutils/plugin/src/test/resources/ImportInvalidOrder.yang
deleted file mode 100644
index 6bfc685..0000000
--- a/utils/yangutils/plugin/src/test/resources/ImportInvalidOrder.yang
+++ /dev/null
@@ -1,10 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-import ietf {
-revision-date 2015-02-03;
-prefix On1;
-}
-contact "Test";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ImportMultipleInstance.yang b/utils/yangutils/plugin/src/test/resources/ImportMultipleInstance.yang
deleted file mode 100644
index 175f2ff..0000000
--- a/utils/yangutils/plugin/src/test/resources/ImportMultipleInstance.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-import ietf {
-prefix On2;
-revision-date 2015-02-03;
-}
-import itut {
-prefix On3;
-revision-date 2016-02-03;
-}
-contact "Test";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ImportValidEntry.yang b/utils/yangutils/plugin/src/test/resources/ImportValidEntry.yang
deleted file mode 100644
index b725d39..0000000
--- a/utils/yangutils/plugin/src/test/resources/ImportValidEntry.yang
+++ /dev/null
@@ -1,10 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-import ietf {
-prefix On2;
-revision-date 2015-02-03;
-}
-contact "Test";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ImportWithDualPrefix.yang b/utils/yangutils/plugin/src/test/resources/ImportWithDualPrefix.yang
deleted file mode 100644
index 8b40bb0..0000000
--- a/utils/yangutils/plugin/src/test/resources/ImportWithDualPrefix.yang
+++ /dev/null
@@ -1,11 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-import ietf {
-prefix On1;
-prefix On2;
-revision-date 2015-02-03;
-}
-contact "Test";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ImportWithoutPrefix.yang b/utils/yangutils/plugin/src/test/resources/ImportWithoutPrefix.yang
deleted file mode 100644
index ee68e59..0000000
--- a/utils/yangutils/plugin/src/test/resources/ImportWithoutPrefix.yang
+++ /dev/null
@@ -1,9 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-import ietf {
-revision-date 2015-02-03;
-}
-contact "Test";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ImportWithoutRevision.yang b/utils/yangutils/plugin/src/test/resources/ImportWithoutRevision.yang
deleted file mode 100644
index af47b7a..0000000
--- a/utils/yangutils/plugin/src/test/resources/ImportWithoutRevision.yang
+++ /dev/null
@@ -1,9 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-import ietf {
-prefix On2;
-}
-contact "Test";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/InValidIdentifierXML.yang b/utils/yangutils/plugin/src/test/resources/InValidIdentifierXML.yang
deleted file mode 100644
index c6a5a42..0000000
--- a/utils/yangutils/plugin/src/test/resources/InValidIdentifierXML.yang
+++ /dev/null
@@ -1,5 +0,0 @@
-module xMlTest {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-}
diff --git a/utils/yangutils/plugin/src/test/resources/IncludeImportAnyOrder.yang b/utils/yangutils/plugin/src/test/resources/IncludeImportAnyOrder.yang
deleted file mode 100644
index 05339a6..0000000
--- a/utils/yangutils/plugin/src/test/resources/IncludeImportAnyOrder.yang
+++ /dev/null
@@ -1,16 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-include itut {
-revision-date 2016-02-03;
-}
-import ietf {
-prefix On2;
-revision-date 2015-02-03;
-}
-include sdn {
-revision-date 2014-02-03;
-}
-contact "Test";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/IncludeInvalidDateSyntax.yang b/utils/yangutils/plugin/src/test/resources/IncludeInvalidDateSyntax.yang
deleted file mode 100644
index 3716209..0000000
--- a/utils/yangutils/plugin/src/test/resources/IncludeInvalidDateSyntax.yang
+++ /dev/null
@@ -1,16 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-import ietf {
-prefix On2;
-revision-date 2015-02-03;
-}
-include itut {
-revision-date 16-02-03;
-}
-include sdn {
-revision-date 2014-02-03;
-}
-contact "Test";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/IncludeInvalidSyntax.yang b/utils/yangutils/plugin/src/test/resources/IncludeInvalidSyntax.yang
deleted file mode 100644
index 91ae17b..0000000
--- a/utils/yangutils/plugin/src/test/resources/IncludeInvalidSyntax.yang
+++ /dev/null
@@ -1,16 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-import ietf {
-prefix On2;
-revision-date 2015-02-03;
-}
-include itut; {
-revision-date 2016-02-03;
-}
-include sdn {
-revision-date 2014-02-03;
-}
-contact "Test";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/IncludeMultiInstance.yang b/utils/yangutils/plugin/src/test/resources/IncludeMultiInstance.yang
deleted file mode 100644
index 81a527a..0000000
--- a/utils/yangutils/plugin/src/test/resources/IncludeMultiInstance.yang
+++ /dev/null
@@ -1,16 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-import ietf {
-prefix On2;
-revision-date 2015-02-03;
-}
-include itut {
-revision-date 2016-02-03;
-}
-include sdn {
-revision-date 2014-02-03;
-}
-contact "Test";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/IncludeWithDate.yang b/utils/yangutils/plugin/src/test/resources/IncludeWithDate.yang
deleted file mode 100644
index 9701a2d..0000000
--- a/utils/yangutils/plugin/src/test/resources/IncludeWithDate.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-import ietf {
-prefix On2;
-revision-date 2015-02-03;
-}
-include itut {
-revision-date 2016-02-03;
-}
-contact "Test";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/IncludeWithEmptyBody.yang b/utils/yangutils/plugin/src/test/resources/IncludeWithEmptyBody.yang
deleted file mode 100644
index 471fdb3..0000000
--- a/utils/yangutils/plugin/src/test/resources/IncludeWithEmptyBody.yang
+++ /dev/null
@@ -1,12 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-import ietf {
-prefix On2;
-revision-date 2015-02-03;
-}
-include itut {
-}
-contact "Test";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/IncludeWithStmtend.yang b/utils/yangutils/plugin/src/test/resources/IncludeWithStmtend.yang
deleted file mode 100644
index e40813b..0000000
--- a/utils/yangutils/plugin/src/test/resources/IncludeWithStmtend.yang
+++ /dev/null
@@ -1,11 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-import ietf {
-prefix On2;
-revision-date 2015-02-03;
-}
-include itut;
-contact "Test";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/InputStatementWithDataDefinition.yang b/utils/yangutils/plugin/src/test/resources/InputStatementWithDataDefinition.yang
deleted file mode 100644
index 0adf3d3..0000000
--- a/utils/yangutils/plugin/src/test/resources/InputStatementWithDataDefinition.yang
+++ /dev/null
@@ -1,28 +0,0 @@
-module rock {
- namespace "http://example.net/rock";
- prefix "rock";
-
- rpc activate-software-image {
- description "description";
- input {
- leaf image-name {
- type string;
- }
- list ospf {
- key "invalid-interval";
- config true;
- max-elements 10;
- min-elements 3;
- leaf invalid-interval {
- type uint16;
- }
- }
- container isis {
- config true;
- leaf invalid-interval {
- type uint16;
- }
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/InputStatementWithTypedef.yang b/utils/yangutils/plugin/src/test/resources/InputStatementWithTypedef.yang
deleted file mode 100644
index 25ca73d..0000000
--- a/utils/yangutils/plugin/src/test/resources/InputStatementWithTypedef.yang
+++ /dev/null
@@ -1,17 +0,0 @@
-module rock {
- namespace "http://example.net/rock";
- prefix "rock";
-
- rpc activate-software-image {
- description "description";
- input {
- leaf image-name {
- type string;
- }
- typedef my-type {
- status deprecated;
- type int32;
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/InstanceIdentifierListener.yang b/utils/yangutils/plugin/src/test/resources/InstanceIdentifierListener.yang
deleted file mode 100644
index 0bbe2f1..0000000
--- a/utils/yangutils/plugin/src/test/resources/InstanceIdentifierListener.yang
+++ /dev/null
@@ -1,10 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container currentcheck {
- leaf invalid-interval {
- type instance-identifier;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/IntegerTypeStatement.yang b/utils/yangutils/plugin/src/test/resources/IntegerTypeStatement.yang
deleted file mode 100644
index ca2be38..0000000
--- a/utils/yangutils/plugin/src/test/resources/IntegerTypeStatement.yang
+++ /dev/null
@@ -1,8 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type "uint16";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/InvalidLeafIdentifier.yang b/utils/yangutils/plugin/src/test/resources/InvalidLeafIdentifier.yang
deleted file mode 100644
index 6faf092..0000000
--- a/utils/yangutils/plugin/src/test/resources/InvalidLeafIdentifier.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "invalid-interval";
- leaf invalid {
- type "string";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/InvalidPatternSubStatements.yang b/utils/yangutils/plugin/src/test/resources/InvalidPatternSubStatements.yang
deleted file mode 100644
index 76ff75e..0000000
--- a/utils/yangutils/plugin/src/test/resources/InvalidPatternSubStatements.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type string {
- pattern "[a-zA-Z]\" {
- description "pattern description";
- reference "pattern reference";
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/KeyLeafTypeEmpty.yang b/utils/yangutils/plugin/src/test/resources/KeyLeafTypeEmpty.yang
deleted file mode 100644
index 859520c..0000000
--- a/utils/yangutils/plugin/src/test/resources/KeyLeafTypeEmpty.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "invalid-interval";
- leaf invalid-interval {
- type "empty";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/KeyWithUsesInList.yang b/utils/yangutils/plugin/src/test/resources/KeyWithUsesInList.yang
deleted file mode 100644
index d076d0a..0000000
--- a/utils/yangutils/plugin/src/test/resources/KeyWithUsesInList.yang
+++ /dev/null
@@ -1,23 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- grouping network {
- leaf invalid-interval {
- type "string";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
- list valid {
- key "invalid-interval";
- leaf invalid {
- type "string";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- uses "network";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/KeyWithoutStatementEnd.yang b/utils/yangutils/plugin/src/test/resources/KeyWithoutStatementEnd.yang
deleted file mode 100644
index f56101a..0000000
--- a/utils/yangutils/plugin/src/test/resources/KeyWithoutStatementEnd.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "invalid"
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/LeafConfigInvalidCardinality.yang b/utils/yangutils/plugin/src/test/resources/LeafConfigInvalidCardinality.yang
deleted file mode 100644
index d403a56..0000000
--- a/utils/yangutils/plugin/src/test/resources/LeafConfigInvalidCardinality.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- config true;
- config false;
- mandatory true;
- status current;
- reference "RFC 6020";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/LeafInvalidIdentifier.yang b/utils/yangutils/plugin/src/test/resources/LeafInvalidIdentifier.yang
deleted file mode 100644
index dbfff13..0000000
--- a/utils/yangutils/plugin/src/test/resources/LeafInvalidIdentifier.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf 1invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- config true;
- mandatory true;
- status current;
- reference "RFC 6020";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/LeafListConfigInvalidCardinality.yang b/utils/yangutils/plugin/src/test/resources/LeafListConfigInvalidCardinality.yang
deleted file mode 100644
index 361a852..0000000
--- a/utils/yangutils/plugin/src/test/resources/LeafListConfigInvalidCardinality.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- config true;
- config false;
- status current;
- reference "RFC 6020";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/LeafListInvalidIdentifier.yang b/utils/yangutils/plugin/src/test/resources/LeafListInvalidIdentifier.yang
deleted file mode 100644
index 77c24d2..0000000
--- a/utils/yangutils/plugin/src/test/resources/LeafListInvalidIdentifier.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list 1invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- config true;
- status current;
- reference "RFC 6020";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/LeafListInvalidStatement.yang b/utils/yangutils/plugin/src/test/resources/LeafListInvalidStatement.yang
deleted file mode 100644
index 13e4b5f..0000000
--- a/utils/yangutils/plugin/src/test/resources/LeafListInvalidStatement.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaflist invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- config true;
- status current;
- reference "RFC 6020";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/LeafListSubStatementConfig.yang b/utils/yangutils/plugin/src/test/resources/LeafListSubStatementConfig.yang
deleted file mode 100644
index 293e4a5..0000000
--- a/utils/yangutils/plugin/src/test/resources/LeafListSubStatementConfig.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- config true;
- status current;
- reference "RFC 6020";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/LeafListSubStatementDescription.yang b/utils/yangutils/plugin/src/test/resources/LeafListSubStatementDescription.yang
deleted file mode 100644
index 293e4a5..0000000
--- a/utils/yangutils/plugin/src/test/resources/LeafListSubStatementDescription.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- config true;
- status current;
- reference "RFC 6020";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/LeafListSubStatementMaxElements.yang b/utils/yangutils/plugin/src/test/resources/LeafListSubStatementMaxElements.yang
deleted file mode 100644
index 5ab2d0f..0000000
--- a/utils/yangutils/plugin/src/test/resources/LeafListSubStatementMaxElements.yang
+++ /dev/null
@@ -1,9 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type "uint16";
- max-elements 3;
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/LeafListSubStatementMinElements.yang b/utils/yangutils/plugin/src/test/resources/LeafListSubStatementMinElements.yang
deleted file mode 100644
index fd71281..0000000
--- a/utils/yangutils/plugin/src/test/resources/LeafListSubStatementMinElements.yang
+++ /dev/null
@@ -1,9 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type "uint16";
- min-elements 3;
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/LeafListSubStatementReference.yang b/utils/yangutils/plugin/src/test/resources/LeafListSubStatementReference.yang
deleted file mode 100644
index 293e4a5..0000000
--- a/utils/yangutils/plugin/src/test/resources/LeafListSubStatementReference.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- config true;
- status current;
- reference "RFC 6020";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/LeafListSubStatementStatus.yang b/utils/yangutils/plugin/src/test/resources/LeafListSubStatementStatus.yang
deleted file mode 100644
index 293e4a5..0000000
--- a/utils/yangutils/plugin/src/test/resources/LeafListSubStatementStatus.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- config true;
- status current;
- reference "RFC 6020";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/LeafListSubStatementType.yang b/utils/yangutils/plugin/src/test/resources/LeafListSubStatementType.yang
deleted file mode 100644
index 0e5ab56..0000000
--- a/utils/yangutils/plugin/src/test/resources/LeafListSubStatementType.yang
+++ /dev/null
@@ -1,8 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type "uint16";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/LeafListSubStatementUnits.yang b/utils/yangutils/plugin/src/test/resources/LeafListSubStatementUnits.yang
deleted file mode 100644
index 293e4a5..0000000
--- a/utils/yangutils/plugin/src/test/resources/LeafListSubStatementUnits.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- config true;
- status current;
- reference "RFC 6020";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/LeafListSubStatements.yang b/utils/yangutils/plugin/src/test/resources/LeafListSubStatements.yang
deleted file mode 100644
index 29dfdb2..0000000
--- a/utils/yangutils/plugin/src/test/resources/LeafListSubStatements.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type "uint16";
- units "seconds";
- max-elements 3;
- description "Interval before a route is declared invalid";
- config true;
- status current;
- reference "RFC 6020";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/LeafListUnitsInvalidCardinality.yang b/utils/yangutils/plugin/src/test/resources/LeafListUnitsInvalidCardinality.yang
deleted file mode 100644
index 996e49e..0000000
--- a/utils/yangutils/plugin/src/test/resources/LeafListUnitsInvalidCardinality.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type "uint16";
- units "seconds";
- units "minutes";
- description "Interval before a route is declared invalid";
- config true;
- status current;
- reference "RFC 6020";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/LeafListWithoutLeftBrace.yang b/utils/yangutils/plugin/src/test/resources/LeafListWithoutLeftBrace.yang
deleted file mode 100644
index 1196422..0000000
--- a/utils/yangutils/plugin/src/test/resources/LeafListWithoutLeftBrace.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- config true;
- status current;
- reference "RFC 6020";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/LeafMandatoryInvalidCardinality.yang b/utils/yangutils/plugin/src/test/resources/LeafMandatoryInvalidCardinality.yang
deleted file mode 100644
index c275dd7..0000000
--- a/utils/yangutils/plugin/src/test/resources/LeafMandatoryInvalidCardinality.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- config true;
- mandatory true;
- mandatory false;
- status current;
- reference "RFC 6020";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/LeafSubStatementDefault.yang b/utils/yangutils/plugin/src/test/resources/LeafSubStatementDefault.yang
deleted file mode 100644
index a78131d..0000000
--- a/utils/yangutils/plugin/src/test/resources/LeafSubStatementDefault.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- default "1";
- description "Interval before a route is declared invalid";
- config true;
- mandatory true;
- status current;
- reference "RFC 6020";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/LeafSubStatementMust.yang b/utils/yangutils/plugin/src/test/resources/LeafSubStatementMust.yang
deleted file mode 100644
index 6d7e626..0000000
--- a/utils/yangutils/plugin/src/test/resources/LeafSubStatementMust.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf ifType {
- type enumeration {
- enum ethernet;
- enum atm;
- }
- must "ifType != 'ethernet'" {
- description "ifType is not ethernet";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/LeafSubStatementWhen.yang b/utils/yangutils/plugin/src/test/resources/LeafSubStatementWhen.yang
deleted file mode 100644
index 239e0b6..0000000
--- a/utils/yangutils/plugin/src/test/resources/LeafSubStatementWhen.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf ifType {
- when "ifType != 'ethernet'" {
- description "ifType is not ethernet";
- }
- type enumeration {
- enum ethernet;
- enum atm;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/LeafSubStatements.yang b/utils/yangutils/plugin/src/test/resources/LeafSubStatements.yang
deleted file mode 100644
index 70349a0..0000000
--- a/utils/yangutils/plugin/src/test/resources/LeafSubStatements.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- config true;
- mandatory true;
- status current;
- reference "RFC 6020";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/LeafWithoutLeftBrace.yang b/utils/yangutils/plugin/src/test/resources/LeafWithoutLeftBrace.yang
deleted file mode 100644
index c2aa979..0000000
--- a/utils/yangutils/plugin/src/test/resources/LeafWithoutLeftBrace.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- config true;
- mandatory true;
- status current;
- reference "RFC 6020";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/LengthRestrictionInRefType.yang b/utils/yangutils/plugin/src/test/resources/LengthRestrictionInRefType.yang
deleted file mode 100644
index 54684f4..0000000
--- a/utils/yangutils/plugin/src/test/resources/LengthRestrictionInRefType.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type hello {
- length "0..100";
- }
- }
- typedef hello {
- type string;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/LengthRestrictionInTypedef.yang b/utils/yangutils/plugin/src/test/resources/LengthRestrictionInTypedef.yang
deleted file mode 100644
index 17baeec..0000000
--- a/utils/yangutils/plugin/src/test/resources/LengthRestrictionInTypedef.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type hello;
- }
- typedef hello {
- type string {
- length "0..100";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/LengthRestrictionInTypedefAndTypeInValid.yang b/utils/yangutils/plugin/src/test/resources/LengthRestrictionInTypedefAndTypeInValid.yang
deleted file mode 100644
index 65ed7de..0000000
--- a/utils/yangutils/plugin/src/test/resources/LengthRestrictionInTypedefAndTypeInValid.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type hello {
- length "min..20 | 200..max";
- }
- }
- typedef hello {
- type string {
- length "0..100 | 101..200 | 201..300";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/LengthRestrictionInTypedefAndTypeValid.yang b/utils/yangutils/plugin/src/test/resources/LengthRestrictionInTypedefAndTypeValid.yang
deleted file mode 100644
index eca2691..0000000
--- a/utils/yangutils/plugin/src/test/resources/LengthRestrictionInTypedefAndTypeValid.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type hello {
- length "min..20 | 201..max";
- }
- }
- typedef hello {
- type string {
- length "0..100 | 101..200 | 201..300";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/LengthStatementInsideLeafList.yang b/utils/yangutils/plugin/src/test/resources/LengthStatementInsideLeafList.yang
deleted file mode 100644
index 06d08db..0000000
--- a/utils/yangutils/plugin/src/test/resources/LengthStatementInsideLeafList.yang
+++ /dev/null
@@ -1,10 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type string {
- length "1..100";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/LengthStatementInsideTypeDef.yang b/utils/yangutils/plugin/src/test/resources/LengthStatementInsideTypeDef.yang
deleted file mode 100644
index c1195dc..0000000
--- a/utils/yangutils/plugin/src/test/resources/LengthStatementInsideTypeDef.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- typedef invalid-interval {
- type string {
- length "1..100";
- }
- }
- leaf xyz {
- type invalid-interval {
- length "2..100";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/LengthStatementWithSpace.yang b/utils/yangutils/plugin/src/test/resources/LengthStatementWithSpace.yang
deleted file mode 100644
index e8612d1..0000000
--- a/utils/yangutils/plugin/src/test/resources/LengthStatementWithSpace.yang
+++ /dev/null
@@ -1,10 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type string {
- length " 0 .. 100 ";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/LengthSubStatements.yang b/utils/yangutils/plugin/src/test/resources/LengthSubStatements.yang
deleted file mode 100644
index f61f979..0000000
--- a/utils/yangutils/plugin/src/test/resources/LengthSubStatements.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type string {
- length "0..100" {
- description "length description";
- reference "length reference";
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/LengthWithInvalidIntegerPattern.yang b/utils/yangutils/plugin/src/test/resources/LengthWithInvalidIntegerPattern.yang
deleted file mode 100644
index f5c8a69..0000000
--- a/utils/yangutils/plugin/src/test/resources/LengthWithInvalidIntegerPattern.yang
+++ /dev/null
@@ -1,10 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type string {
- length "a..z";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/LengthWithInvalidInterval.yang b/utils/yangutils/plugin/src/test/resources/LengthWithInvalidInterval.yang
deleted file mode 100644
index 7b4ae18..0000000
--- a/utils/yangutils/plugin/src/test/resources/LengthWithInvalidInterval.yang
+++ /dev/null
@@ -1,10 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type string {
- length "0..18446744073709551617";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/LengthWithInvalidType.yang b/utils/yangutils/plugin/src/test/resources/LengthWithInvalidType.yang
deleted file mode 100644
index 74b183c..0000000
--- a/utils/yangutils/plugin/src/test/resources/LengthWithInvalidType.yang
+++ /dev/null
@@ -1,10 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type int8 {
- length "1..100";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/LengthWithMinMax.yang b/utils/yangutils/plugin/src/test/resources/LengthWithMinMax.yang
deleted file mode 100644
index 5884266..0000000
--- a/utils/yangutils/plugin/src/test/resources/LengthWithMinMax.yang
+++ /dev/null
@@ -1,10 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type string {
- length "min..max";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/LengthWithOneInterval.yang b/utils/yangutils/plugin/src/test/resources/LengthWithOneInterval.yang
deleted file mode 100644
index b160f02..0000000
--- a/utils/yangutils/plugin/src/test/resources/LengthWithOneInterval.yang
+++ /dev/null
@@ -1,10 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type string {
- length "1";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ListAsRootNode.yang b/utils/yangutils/plugin/src/test/resources/ListAsRootNode.yang
deleted file mode 100644
index 289525f..0000000
--- a/utils/yangutils/plugin/src/test/resources/ListAsRootNode.yang
+++ /dev/null
@@ -1,9 +0,0 @@
-list valid {
- reference "RFC 6020";
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ListDuplicateContainer.yang b/utils/yangutils/plugin/src/test/resources/ListDuplicateContainer.yang
deleted file mode 100644
index 8c152b2..0000000
--- a/utils/yangutils/plugin/src/test/resources/ListDuplicateContainer.yang
+++ /dev/null
@@ -1,27 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list ospf {
- key "process-id";
- container interface {
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
- leaf process-id {
- type "string";
- }
- container interface {
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ListInvalidIdentifier.yang b/utils/yangutils/plugin/src/test/resources/ListInvalidIdentifier.yang
deleted file mode 100644
index c5f6a3a..0000000
--- a/utils/yangutils/plugin/src/test/resources/ListInvalidIdentifier.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list 1valid {
- key "invalid-interval";
- reference "RFC 6020";
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ListStatementWithoutChild.yang b/utils/yangutils/plugin/src/test/resources/ListStatementWithoutChild.yang
deleted file mode 100644
index 5c006d7..0000000
--- a/utils/yangutils/plugin/src/test/resources/ListStatementWithoutChild.yang
+++ /dev/null
@@ -1,8 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- reference "RFC 6020";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ListSubStatementConfig.yang b/utils/yangutils/plugin/src/test/resources/ListSubStatementConfig.yang
deleted file mode 100644
index 55432fb..0000000
--- a/utils/yangutils/plugin/src/test/resources/ListSubStatementConfig.yang
+++ /dev/null
@@ -1,17 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "invalid-interval";
- config true;
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- mandatory true;
- status current;
- reference "RFC 6020";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ListSubStatementContainer.yang b/utils/yangutils/plugin/src/test/resources/ListSubStatementContainer.yang
deleted file mode 100644
index 4ce6da4..0000000
--- a/utils/yangutils/plugin/src/test/resources/ListSubStatementContainer.yang
+++ /dev/null
@@ -1,19 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list ospf {
- key "process-id";
- container interface {
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
- leaf process-id {
- type "string";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ListSubStatementDescription.yang b/utils/yangutils/plugin/src/test/resources/ListSubStatementDescription.yang
deleted file mode 100644
index a8df3d7..0000000
--- a/utils/yangutils/plugin/src/test/resources/ListSubStatementDescription.yang
+++ /dev/null
@@ -1,18 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "invalid-interval";
- description "list description";
- config true;
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- mandatory true;
- status current;
- reference "RFC 6020";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ListSubStatementKey.yang b/utils/yangutils/plugin/src/test/resources/ListSubStatementKey.yang
deleted file mode 100644
index 791013d..0000000
--- a/utils/yangutils/plugin/src/test/resources/ListSubStatementKey.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "invalid-interval";
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ListSubStatementLeaf.yang b/utils/yangutils/plugin/src/test/resources/ListSubStatementLeaf.yang
deleted file mode 100644
index 59b92cc..0000000
--- a/utils/yangutils/plugin/src/test/resources/ListSubStatementLeaf.yang
+++ /dev/null
@@ -1,17 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "invalid-interval";
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- config true;
- mandatory true;
- status current;
- reference "RFC 6020";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ListSubStatementLeafList.yang b/utils/yangutils/plugin/src/test/resources/ListSubStatementLeafList.yang
deleted file mode 100644
index 672ebdd..0000000
--- a/utils/yangutils/plugin/src/test/resources/ListSubStatementLeafList.yang
+++ /dev/null
@@ -1,20 +0,0 @@
-
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "invalid";
- leaf-list invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- config true;
- status current;
- reference "RFC 6020";
- }
- leaf invalid {
- type "uint16";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ListSubStatementList.yang b/utils/yangutils/plugin/src/test/resources/ListSubStatementList.yang
deleted file mode 100644
index 2021469..0000000
--- a/utils/yangutils/plugin/src/test/resources/ListSubStatementList.yang
+++ /dev/null
@@ -1,20 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list ospf {
- key "process-id";
- list valid {
- key "invalid-interval";
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
- leaf process-id {
- type "string";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ListSubStatementMaxElements.yang b/utils/yangutils/plugin/src/test/resources/ListSubStatementMaxElements.yang
deleted file mode 100644
index e74a5a8..0000000
--- a/utils/yangutils/plugin/src/test/resources/ListSubStatementMaxElements.yang
+++ /dev/null
@@ -1,17 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "invalid";
- max-elements 3;
- leaf-list invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- }
- leaf invalid {
- type "uint16";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ListSubStatementMinElements.yang b/utils/yangutils/plugin/src/test/resources/ListSubStatementMinElements.yang
deleted file mode 100644
index 8454fdd..0000000
--- a/utils/yangutils/plugin/src/test/resources/ListSubStatementMinElements.yang
+++ /dev/null
@@ -1,17 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "invalid";
- min-elements 3;
- leaf-list invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- }
- leaf invalid {
- type "uint16";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ListSubStatementReference.yang b/utils/yangutils/plugin/src/test/resources/ListSubStatementReference.yang
deleted file mode 100644
index 8adfa04..0000000
--- a/utils/yangutils/plugin/src/test/resources/ListSubStatementReference.yang
+++ /dev/null
@@ -1,18 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "invalid-interval";
- reference "list reference";
- config true;
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- mandatory true;
- status current;
- reference "RFC 6020";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ListSubStatementStatus.yang b/utils/yangutils/plugin/src/test/resources/ListSubStatementStatus.yang
deleted file mode 100644
index b88ac74..0000000
--- a/utils/yangutils/plugin/src/test/resources/ListSubStatementStatus.yang
+++ /dev/null
@@ -1,18 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "invalid-interval";
- status current;
- config true;
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- mandatory true;
- status current;
- reference "RFC 6020";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ListSubStatementUnique.yang b/utils/yangutils/plugin/src/test/resources/ListSubStatementUnique.yang
deleted file mode 100644
index b500aa4..0000000
--- a/utils/yangutils/plugin/src/test/resources/ListSubStatementUnique.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- unique "invalid-interval";
- key "invalid-interval";
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ListSubStatements.yang b/utils/yangutils/plugin/src/test/resources/ListSubStatements.yang
deleted file mode 100644
index 109fc17..0000000
--- a/utils/yangutils/plugin/src/test/resources/ListSubStatements.yang
+++ /dev/null
@@ -1,20 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list ospf {
- key "invalid-interval";
- config true;
- max-elements 10;
- min-elements 3;
- description "list description";
- status current;
- reference "list reference";
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ListSubStatementsCardinality.yang b/utils/yangutils/plugin/src/test/resources/ListSubStatementsCardinality.yang
deleted file mode 100644
index 9c4077c..0000000
--- a/utils/yangutils/plugin/src/test/resources/ListSubStatementsCardinality.yang
+++ /dev/null
@@ -1,16 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "invalid-interval";
- reference "RFC 6020";
- reference "RFC 6020";
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ListWithDuplicateLeaf.yang b/utils/yangutils/plugin/src/test/resources/ListWithDuplicateLeaf.yang
deleted file mode 100644
index 55a78f6..0000000
--- a/utils/yangutils/plugin/src/test/resources/ListWithDuplicateLeaf.yang
+++ /dev/null
@@ -1,26 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "invalid-interval";
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- config true;
- mandatory true;
- status current;
- reference "RFC 6020";
- }
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- config true;
- mandatory true;
- status current;
- reference "RFC 6020";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ListWithIdentifierNameEnum.yang b/utils/yangutils/plugin/src/test/resources/ListWithIdentifierNameEnum.yang
deleted file mode 100644
index afa82a4..0000000
--- a/utils/yangutils/plugin/src/test/resources/ListWithIdentifierNameEnum.yang
+++ /dev/null
@@ -1,16 +0,0 @@
-module Test {
- yang-version 1;
- namespace "ydt.enum";
- prefix "t";
-
- list enumList {
- key enum;
- leaf enum {
- type enumeration {
- enum ten { value "10";}
- enum hundred { value "100";}
- enum thousand { value "1000"; }
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/MandatoryDefaultValue.yang b/utils/yangutils/plugin/src/test/resources/MandatoryDefaultValue.yang
deleted file mode 100644
index c71d5ea..0000000
--- a/utils/yangutils/plugin/src/test/resources/MandatoryDefaultValue.yang
+++ /dev/null
@@ -1,8 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type "uint16";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/MandatoryEmptyStatement.yang b/utils/yangutils/plugin/src/test/resources/MandatoryEmptyStatement.yang
deleted file mode 100644
index e2af869..0000000
--- a/utils/yangutils/plugin/src/test/resources/MandatoryEmptyStatement.yang
+++ /dev/null
@@ -1,9 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type "uint16";
- mandatory ;
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/MandatoryFalse.yang b/utils/yangutils/plugin/src/test/resources/MandatoryFalse.yang
deleted file mode 100644
index 3ae4601..0000000
--- a/utils/yangutils/plugin/src/test/resources/MandatoryFalse.yang
+++ /dev/null
@@ -1,9 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type "uint16";
- mandatory false;
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/MandatoryTrue.yang b/utils/yangutils/plugin/src/test/resources/MandatoryTrue.yang
deleted file mode 100644
index 70349a0..0000000
--- a/utils/yangutils/plugin/src/test/resources/MandatoryTrue.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- config true;
- mandatory true;
- status current;
- reference "RFC 6020";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/MandatoryWithoutStatementEnd.yang b/utils/yangutils/plugin/src/test/resources/MandatoryWithoutStatementEnd.yang
deleted file mode 100644
index 055f556..0000000
--- a/utils/yangutils/plugin/src/test/resources/MandatoryWithoutStatementEnd.yang
+++ /dev/null
@@ -1,9 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type "uint16";
- mandatory false
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/MaxElementsCardinality.yang b/utils/yangutils/plugin/src/test/resources/MaxElementsCardinality.yang
deleted file mode 100644
index bff2fd7..0000000
--- a/utils/yangutils/plugin/src/test/resources/MaxElementsCardinality.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type "uint16";
- units "seconds";
- max-elements 4;
- max-elements 6;
- description "Interval before a route is declared invalid";
- config true;
- status current;
- reference "RFC 6020";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/MaxElementsDefaultValue.yang b/utils/yangutils/plugin/src/test/resources/MaxElementsDefaultValue.yang
deleted file mode 100644
index a591146..0000000
--- a/utils/yangutils/plugin/src/test/resources/MaxElementsDefaultValue.yang
+++ /dev/null
@@ -1,8 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type "uint16";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/MaxElementsMaxValue.yang b/utils/yangutils/plugin/src/test/resources/MaxElementsMaxValue.yang
deleted file mode 100644
index 7bdfbb0..0000000
--- a/utils/yangutils/plugin/src/test/resources/MaxElementsMaxValue.yang
+++ /dev/null
@@ -1,9 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type "uint16";
- max-elements 77777777777777777777777;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/MaxElementsUnbounded.yang b/utils/yangutils/plugin/src/test/resources/MaxElementsUnbounded.yang
deleted file mode 100644
index afaca4f..0000000
--- a/utils/yangutils/plugin/src/test/resources/MaxElementsUnbounded.yang
+++ /dev/null
@@ -1,9 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type "uint16";
- max-elements unbounded;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/MaxElementsWithoutStatementEnd.yang b/utils/yangutils/plugin/src/test/resources/MaxElementsWithoutStatementEnd.yang
deleted file mode 100644
index 5973dd0..0000000
--- a/utils/yangutils/plugin/src/test/resources/MaxElementsWithoutStatementEnd.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type "uint16";
- units "seconds";
- max-elements 3
- description "Interval before a route is declared invalid";
- config true;
- status current;
- reference "RFC 6020";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/MinElementsDefaultValue.yang b/utils/yangutils/plugin/src/test/resources/MinElementsDefaultValue.yang
deleted file mode 100644
index a591146..0000000
--- a/utils/yangutils/plugin/src/test/resources/MinElementsDefaultValue.yang
+++ /dev/null
@@ -1,8 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type "uint16";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/MinElementsInvalidCardinality.yang b/utils/yangutils/plugin/src/test/resources/MinElementsInvalidCardinality.yang
deleted file mode 100644
index 18f6019..0000000
--- a/utils/yangutils/plugin/src/test/resources/MinElementsInvalidCardinality.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type "uint16";
- units "seconds";
- min-elements 4;
- min-elements 6;
- description "Interval before a route is declared invalid";
- config true;
- status current;
- reference "RFC 6020";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/MinElementsInvalidValue.yang b/utils/yangutils/plugin/src/test/resources/MinElementsInvalidValue.yang
deleted file mode 100644
index a381184..0000000
--- a/utils/yangutils/plugin/src/test/resources/MinElementsInvalidValue.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type "uint16";
- units "seconds";
- min-elements asd;
- description "Interval before a route is declared invalid";
- config true;
- status current;
- reference "RFC 6020";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/MinElementsMaxValue.yang b/utils/yangutils/plugin/src/test/resources/MinElementsMaxValue.yang
deleted file mode 100644
index 785482b..0000000
--- a/utils/yangutils/plugin/src/test/resources/MinElementsMaxValue.yang
+++ /dev/null
@@ -1,9 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type "uint16";
- min-elements 77777777777777777777777;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/MinElementsWithoutStatementEnd.yang b/utils/yangutils/plugin/src/test/resources/MinElementsWithoutStatementEnd.yang
deleted file mode 100644
index 699a8b8..0000000
--- a/utils/yangutils/plugin/src/test/resources/MinElementsWithoutStatementEnd.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type "uint16";
- units "seconds";
- min-elements 3
- description "Interval before a route is declared invalid";
- config true;
- status current;
- reference "RFC 6020";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ModuleDuplicateContainer.yang b/utils/yangutils/plugin/src/test/resources/ModuleDuplicateContainer.yang
deleted file mode 100644
index bc58896..0000000
--- a/utils/yangutils/plugin/src/test/resources/ModuleDuplicateContainer.yang
+++ /dev/null
@@ -1,29 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container valid {
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
- container invalid {
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
- container valid {
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ModuleInvalidIdentifierLength.yang b/utils/yangutils/plugin/src/test/resources/ModuleInvalidIdentifierLength.yang
deleted file mode 100644
index fac16bc..0000000
--- a/utils/yangutils/plugin/src/test/resources/ModuleInvalidIdentifierLength.yang
+++ /dev/null
@@ -1,5 +0,0 @@
-module Testttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ModuleSubStatementContainer.yang b/utils/yangutils/plugin/src/test/resources/ModuleSubStatementContainer.yang
deleted file mode 100644
index 35a91ad..0000000
--- a/utils/yangutils/plugin/src/test/resources/ModuleSubStatementContainer.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container valid {
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ModuleSubStatementDescription.yang b/utils/yangutils/plugin/src/test/resources/ModuleSubStatementDescription.yang
deleted file mode 100644
index 02643b1..0000000
--- a/utils/yangutils/plugin/src/test/resources/ModuleSubStatementDescription.yang
+++ /dev/null
@@ -1,6 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- description "Interval before a route is declared invalid";
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ModuleSubStatementList.yang b/utils/yangutils/plugin/src/test/resources/ModuleSubStatementList.yang
deleted file mode 100644
index 1bb3bf5..0000000
--- a/utils/yangutils/plugin/src/test/resources/ModuleSubStatementList.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "invalid-interval";
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ModuleSubStatementReference.yang b/utils/yangutils/plugin/src/test/resources/ModuleSubStatementReference.yang
deleted file mode 100644
index 20b2fb6..0000000
--- a/utils/yangutils/plugin/src/test/resources/ModuleSubStatementReference.yang
+++ /dev/null
@@ -1,6 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- reference "RFC 6020";
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ModuleValidEntry.yang b/utils/yangutils/plugin/src/test/resources/ModuleValidEntry.yang
deleted file mode 100644
index 439ded8..0000000
--- a/utils/yangutils/plugin/src/test/resources/ModuleValidEntry.yang
+++ /dev/null
@@ -1,5 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ModuleWithDuplicateLeaf.yang b/utils/yangutils/plugin/src/test/resources/ModuleWithDuplicateLeaf.yang
deleted file mode 100644
index 2c3ecbc..0000000
--- a/utils/yangutils/plugin/src/test/resources/ModuleWithDuplicateLeaf.yang
+++ /dev/null
@@ -1,32 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- config true;
- mandatory true;
- status current;
- reference "RFC 6020";
- }
- leaf valid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- config true;
- mandatory true;
- status current;
- reference "RFC 6020";
- }
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- config true;
- mandatory true;
- status current;
- reference "RFC 6020";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ModuleWithInvalidIdentifier.yang b/utils/yangutils/plugin/src/test/resources/ModuleWithInvalidIdentifier.yang
deleted file mode 100644
index d89340a..0000000
--- a/utils/yangutils/plugin/src/test/resources/ModuleWithInvalidIdentifier.yang
+++ /dev/null
@@ -1,5 +0,0 @@
-module Test:Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-}
diff --git a/utils/yangutils/plugin/src/test/resources/MultipleKeyValues.yang b/utils/yangutils/plugin/src/test/resources/MultipleKeyValues.yang
deleted file mode 100644
index a9d25a2..0000000
--- a/utils/yangutils/plugin/src/test/resources/MultipleKeyValues.yang
+++ /dev/null
@@ -1,20 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "ospf isis";
- leaf ospf {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- leaf isis {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/MultiplePatternAndLengthRestriction.yang b/utils/yangutils/plugin/src/test/resources/MultiplePatternAndLengthRestriction.yang
deleted file mode 100644
index d971643..0000000
--- a/utils/yangutils/plugin/src/test/resources/MultiplePatternAndLengthRestriction.yang
+++ /dev/null
@@ -1,19 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type hello {
- pattern "[a-z]";
- pattern "[A-Z]";
- length "min..20 | 201..max";
- }
- }
- typedef hello {
- type string {
- pattern "[0-9]";
- pattern "[\n]";
- length "0..100 | 101..200 | 201..300";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/MultiplePatternAndLengthRestrictionInValid.yang b/utils/yangutils/plugin/src/test/resources/MultiplePatternAndLengthRestrictionInValid.yang
deleted file mode 100644
index 7ba3ef9..0000000
--- a/utils/yangutils/plugin/src/test/resources/MultiplePatternAndLengthRestrictionInValid.yang
+++ /dev/null
@@ -1,19 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type hello {
- pattern "[a-z]";
- pattern "[A-Z]";
- length "min..20 | 100..max";
- }
- }
- typedef hello {
- type string {
- pattern "[0-9]";
- pattern "[\n]";
- length "0..100 | 101..200 | 201..300";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/MultiplePatternAndLengthRestrictionValid.yang b/utils/yangutils/plugin/src/test/resources/MultiplePatternAndLengthRestrictionValid.yang
deleted file mode 100644
index 161b558..0000000
--- a/utils/yangutils/plugin/src/test/resources/MultiplePatternAndLengthRestrictionValid.yang
+++ /dev/null
@@ -1,18 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type hello {
- pattern "[a-z]";
- pattern "[A-Z]";
- length "min..20 | 100..max";
- }
- }
- typedef hello {
- type string {
- pattern "[0-9]";
- pattern "[\n]";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/MultiplePatternRestrictionInRefTypeAndTypedef.yang b/utils/yangutils/plugin/src/test/resources/MultiplePatternRestrictionInRefTypeAndTypedef.yang
deleted file mode 100644
index eaa28c5..0000000
--- a/utils/yangutils/plugin/src/test/resources/MultiplePatternRestrictionInRefTypeAndTypedef.yang
+++ /dev/null
@@ -1,17 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type hello {
- pattern "[a-z]";
- pattern "[A-Z]";
- }
- }
- typedef hello {
- type string {
- pattern "[0-9]";
- pattern "[\n]";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/MultiplePatternStatement.yang b/utils/yangutils/plugin/src/test/resources/MultiplePatternStatement.yang
deleted file mode 100644
index 7a47bfc..0000000
--- a/utils/yangutils/plugin/src/test/resources/MultiplePatternStatement.yang
+++ /dev/null
@@ -1,11 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type string {
- pattern "[a-zA-Z]";
- pattern "[a-z]";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/MultipleRevision.yang b/utils/yangutils/plugin/src/test/resources/MultipleRevision.yang
deleted file mode 100755
index 4ce440c..0000000
--- a/utils/yangutils/plugin/src/test/resources/MultipleRevision.yang
+++ /dev/null
@@ -1,26 +0,0 @@
-module Test {
- yang-version 1;
- namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
- prefix test;
-
- revision 2013-07-15 {
- description
- "This revision adds the following new data types:
- - yang-identifier
- - hex-string
- - uuid
- - dotted-quad";
- reference
- "RFC 6991: Common YANG Data Types";
- }
- revision 2013-07-14 {
- description
- "This revision adds the following new data types:
- - yang-identifier
- - hex-string
- - uuid
- - dotted-quad";
- reference
- "RFC 6991: Common YANG Data Types";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/MultipleUniqueValues.yang b/utils/yangutils/plugin/src/test/resources/MultipleUniqueValues.yang
deleted file mode 100644
index 28f7978..0000000
--- a/utils/yangutils/plugin/src/test/resources/MultipleUniqueValues.yang
+++ /dev/null
@@ -1,21 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "ospf";
- unique "ospf isis";
- leaf ospf {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- leaf isis {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/NamespaceDualEntry.yang b/utils/yangutils/plugin/src/test/resources/NamespaceDualEntry.yang
deleted file mode 100644
index 09c9b54..0000000
--- a/utils/yangutils/plugin/src/test/resources/NamespaceDualEntry.yang
+++ /dev/null
@@ -1,6 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-namespace urn:ietf:params:xml:ns:yang:ietf-segment-routing;
-prefix On;
-}
diff --git a/utils/yangutils/plugin/src/test/resources/NamespaceInDoubleQuotes.yang b/utils/yangutils/plugin/src/test/resources/NamespaceInDoubleQuotes.yang
deleted file mode 100644
index aec0042..0000000
--- a/utils/yangutils/plugin/src/test/resources/NamespaceInDoubleQuotes.yang
+++ /dev/null
@@ -1,5 +0,0 @@
-module Test {
-yang-version 1;
-namespace "urn:ietf:params:xml:ns:yang:ietf-ospf";
-prefix On;
-}
diff --git a/utils/yangutils/plugin/src/test/resources/NamespaceNoEntryTest.yang b/utils/yangutils/plugin/src/test/resources/NamespaceNoEntryTest.yang
deleted file mode 100644
index ac30ae4..0000000
--- a/utils/yangutils/plugin/src/test/resources/NamespaceNoEntryTest.yang
+++ /dev/null
@@ -1,4 +0,0 @@
-module Test {
-yang-version 1;
-prefix On;
-}
diff --git a/utils/yangutils/plugin/src/test/resources/NamespaceWithConcatenationTest.yang b/utils/yangutils/plugin/src/test/resources/NamespaceWithConcatenationTest.yang
deleted file mode 100644
index c9ac4b0..0000000
--- a/utils/yangutils/plugin/src/test/resources/NamespaceWithConcatenationTest.yang
+++ /dev/null
@@ -1,6 +0,0 @@
-module Test {
-yang-version 1;
-namespace "urn:ietf:params:xml:ns:"
- + "yang:ietf-segment-routing";
-prefix On;
-}
diff --git a/utils/yangutils/plugin/src/test/resources/NamespaceWithInvalidSpaces.yang b/utils/yangutils/plugin/src/test/resources/NamespaceWithInvalidSpaces.yang
deleted file mode 100644
index f8f91c5..0000000
--- a/utils/yangutils/plugin/src/test/resources/NamespaceWithInvalidSpaces.yang
+++ /dev/null
@@ -1,5 +0,0 @@
-module Test {
-yang-version 1;
-namespace "urn:ietf:params:xml :ns:yang:ietf-ospf";
-prefix On;
-}
diff --git a/utils/yangutils/plugin/src/test/resources/NamespaceWithoutQuotes.yang b/utils/yangutils/plugin/src/test/resources/NamespaceWithoutQuotes.yang
deleted file mode 100644
index 439ded8..0000000
--- a/utils/yangutils/plugin/src/test/resources/NamespaceWithoutQuotes.yang
+++ /dev/null
@@ -1,5 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-}
diff --git a/utils/yangutils/plugin/src/test/resources/NoConfigContainerSubStatementContainer.yang b/utils/yangutils/plugin/src/test/resources/NoConfigContainerSubStatementContainer.yang
deleted file mode 100644
index 1aded2d..0000000
--- a/utils/yangutils/plugin/src/test/resources/NoConfigContainerSubStatementContainer.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container hello {
- container valid {
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/NoConfigContainerSubStatementLeaf.yang b/utils/yangutils/plugin/src/test/resources/NoConfigContainerSubStatementLeaf.yang
deleted file mode 100644
index 35a91ad..0000000
--- a/utils/yangutils/plugin/src/test/resources/NoConfigContainerSubStatementLeaf.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container valid {
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/NoConfigContainerSubStatementLeafList.yang b/utils/yangutils/plugin/src/test/resources/NoConfigContainerSubStatementLeafList.yang
deleted file mode 100644
index 79687c2..0000000
--- a/utils/yangutils/plugin/src/test/resources/NoConfigContainerSubStatementLeafList.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container valid {
- leaf-list invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/NoConfigContainerSubStatementList.yang b/utils/yangutils/plugin/src/test/resources/NoConfigContainerSubStatementList.yang
deleted file mode 100644
index f10c686..0000000
--- a/utils/yangutils/plugin/src/test/resources/NoConfigContainerSubStatementList.yang
+++ /dev/null
@@ -1,16 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container hello {
- list valid {
- key "invalid-interval";
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/NoConfigListSubStatementContainer.yang b/utils/yangutils/plugin/src/test/resources/NoConfigListSubStatementContainer.yang
deleted file mode 100644
index 19b4291..0000000
--- a/utils/yangutils/plugin/src/test/resources/NoConfigListSubStatementContainer.yang
+++ /dev/null
@@ -1,22 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list list1 {
- key "invalid-interval";
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- container container1 {
- leaf leaf1 {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/NoConfigListSubStatementLeaf.yang b/utils/yangutils/plugin/src/test/resources/NoConfigListSubStatementLeaf.yang
deleted file mode 100644
index 1bb3bf5..0000000
--- a/utils/yangutils/plugin/src/test/resources/NoConfigListSubStatementLeaf.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "invalid-interval";
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/NoConfigListSubStatementList.yang b/utils/yangutils/plugin/src/test/resources/NoConfigListSubStatementList.yang
deleted file mode 100644
index 4de40cb..0000000
--- a/utils/yangutils/plugin/src/test/resources/NoConfigListSubStatementList.yang
+++ /dev/null
@@ -1,23 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "invalid-interval";
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- list list1 {
- key "leaf1";
- leaf leaf1 {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/NotificationTest.yang b/utils/yangutils/plugin/src/test/resources/NotificationTest.yang
deleted file mode 100644
index f199dbd..0000000
--- a/utils/yangutils/plugin/src/test/resources/NotificationTest.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module NotificationTest {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- notification test {
- leaf type {
- type string;
- }
- leaf severity {
- type string;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/OrderedByStatement.yang b/utils/yangutils/plugin/src/test/resources/OrderedByStatement.yang
deleted file mode 100644
index f6b4336..0000000
--- a/utils/yangutils/plugin/src/test/resources/OrderedByStatement.yang
+++ /dev/null
@@ -1,10 +0,0 @@
-module rock {
- namespace "http://example.net/rock";
- prefix "rock";
- leaf-list cipher {
- type string;
- ordered-by user;
- description "A list of ciphers";
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/OrganizationDualEntry.yang b/utils/yangutils/plugin/src/test/resources/OrganizationDualEntry.yang
deleted file mode 100644
index 64bf23d..0000000
--- a/utils/yangutils/plugin/src/test/resources/OrganizationDualEntry.yang
+++ /dev/null
@@ -1,18 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-import ietf {
-prefix On2;
-revision-date 2015-02-03;
-}
-include itut {
-revision-date 2016-02-03;
-}
-include sdn {
-revision-date 2014-02-03;
-}
-contact "Test";
-organization "IETF SPRING Working Group";
-organization "ITUT SPRING Working Group";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/OrganizationInvalidOrder.yang b/utils/yangutils/plugin/src/test/resources/OrganizationInvalidOrder.yang
deleted file mode 100644
index 333f2e5..0000000
--- a/utils/yangutils/plugin/src/test/resources/OrganizationInvalidOrder.yang
+++ /dev/null
@@ -1,17 +0,0 @@
-module Test {
-yang-version 1;
-organization "ONOS";
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-import ietf {
-prefix On2;
-revision-date 2015-02-03;
-}
-include itut; {
-revision-date 2016-02-03;
-}
-include sdn {
-revision-date 2014-02-03;
-}
-contact "Test";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/OrganizationMissingValue.yang b/utils/yangutils/plugin/src/test/resources/OrganizationMissingValue.yang
deleted file mode 100644
index e9e3f46..0000000
--- a/utils/yangutils/plugin/src/test/resources/OrganizationMissingValue.yang
+++ /dev/null
@@ -1,17 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-import ietf {
-prefix On2;
-revision-date 2015-02-03;
-}
-include itut {
-revision-date 2016-02-03;
-}
-include sdn {
-revision-date 2014-02-03;
-}
-contact "Test";
-organization ;
-}
diff --git a/utils/yangutils/plugin/src/test/resources/OrganizationValidEntry.yang b/utils/yangutils/plugin/src/test/resources/OrganizationValidEntry.yang
deleted file mode 100644
index 25ae1ec..0000000
--- a/utils/yangutils/plugin/src/test/resources/OrganizationValidEntry.yang
+++ /dev/null
@@ -1,17 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-import ietf {
-prefix On2;
-revision-date 2015-02-03;
-}
-include itut {
-revision-date 2016-02-03;
-}
-include sdn {
-revision-date 2014-02-03;
-}
-contact "Test";
-organization "IETF SPRING Working Group";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/OutputStatementWithDataDefinition.yang b/utils/yangutils/plugin/src/test/resources/OutputStatementWithDataDefinition.yang
deleted file mode 100644
index 527b399..0000000
--- a/utils/yangutils/plugin/src/test/resources/OutputStatementWithDataDefinition.yang
+++ /dev/null
@@ -1,28 +0,0 @@
-module rock {
- namespace "http://example.net/rock";
- prefix "rock";
-
- rpc activate-software-image {
- description "description";
- output {
- leaf image-name {
- type string;
- }
- list ospf {
- key "invalid-interval";
- config true;
- max-elements 10;
- min-elements 3;
- leaf invalid-interval {
- type uint16;
- }
- }
- container isis {
- config true;
- leaf invalid-interval {
- type uint16;
- }
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/OutputStatementWithTypedef.yang b/utils/yangutils/plugin/src/test/resources/OutputStatementWithTypedef.yang
deleted file mode 100644
index 6027c2d..0000000
--- a/utils/yangutils/plugin/src/test/resources/OutputStatementWithTypedef.yang
+++ /dev/null
@@ -1,17 +0,0 @@
-module rock {
- namespace "http://example.net/rock";
- prefix "rock";
-
- rpc activate-software-image {
- description "description";
- output {
- leaf image-name {
- type string;
- }
- typedef my-type {
- status deprecated;
- type int32;
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/PatternRestrictionInRefType.yang b/utils/yangutils/plugin/src/test/resources/PatternRestrictionInRefType.yang
deleted file mode 100644
index 189177d..0000000
--- a/utils/yangutils/plugin/src/test/resources/PatternRestrictionInRefType.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type hello {
- pattern "[a-zA-Z]";
- }
- }
- typedef hello {
- type string;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/PatternRestrictionInRefTypeAndTypedef.yang b/utils/yangutils/plugin/src/test/resources/PatternRestrictionInRefTypeAndTypedef.yang
deleted file mode 100644
index e01b224..0000000
--- a/utils/yangutils/plugin/src/test/resources/PatternRestrictionInRefTypeAndTypedef.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type hello {
- pattern "[a-zA-Z]";
- }
- }
- typedef hello {
- type string {
- pattern "[0-9]";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/PatternRestrictionInTypedef.yang b/utils/yangutils/plugin/src/test/resources/PatternRestrictionInTypedef.yang
deleted file mode 100644
index 7875504..0000000
--- a/utils/yangutils/plugin/src/test/resources/PatternRestrictionInTypedef.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type hello;
- }
- typedef hello {
- type string {
- pattern "[a-zA-Z]";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/PatternStatementInsideLeafList.yang b/utils/yangutils/plugin/src/test/resources/PatternStatementInsideLeafList.yang
deleted file mode 100644
index d21c0f6..0000000
--- a/utils/yangutils/plugin/src/test/resources/PatternStatementInsideLeafList.yang
+++ /dev/null
@@ -1,10 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type string {
- pattern "[a-zA-Z]";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/PatternStatementInsideTypeDef.yang b/utils/yangutils/plugin/src/test/resources/PatternStatementInsideTypeDef.yang
deleted file mode 100644
index edb625e..0000000
--- a/utils/yangutils/plugin/src/test/resources/PatternStatementInsideTypeDef.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- typedef invalid-interval {
- type string {
- pattern "[a-zA-Z]";
- }
- }
- leaf xyz {
- type invalid-interval {
- pattern "[a-z]";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/PatternStatementWithPlus.yang b/utils/yangutils/plugin/src/test/resources/PatternStatementWithPlus.yang
deleted file mode 100644
index 417e1d1..0000000
--- a/utils/yangutils/plugin/src/test/resources/PatternStatementWithPlus.yang
+++ /dev/null
@@ -1,10 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type string {
- pattern "-[0-9]+|[0-9]+";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/PatternSubStatements.yang b/utils/yangutils/plugin/src/test/resources/PatternSubStatements.yang
deleted file mode 100644
index 3e792c6..0000000
--- a/utils/yangutils/plugin/src/test/resources/PatternSubStatements.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type string {
- pattern "[a-zA-Z]" {
- description "pattern description";
- reference "pattern reference";
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/PositionDuplication.yang b/utils/yangutils/plugin/src/test/resources/PositionDuplication.yang
deleted file mode 100644
index 81eeb16..0000000
--- a/utils/yangutils/plugin/src/test/resources/PositionDuplication.yang
+++ /dev/null
@@ -1,18 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf mybits {
- type bits {
- bit disable-nagle {
- position 0;
- }
- bit auto-sense-speed {
- position 1;
- }
- bit Ten-Mb-only {
- position 1;
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/PositionImplicitAndExplicit.yang b/utils/yangutils/plugin/src/test/resources/PositionImplicitAndExplicit.yang
deleted file mode 100644
index bef9712..0000000
--- a/utils/yangutils/plugin/src/test/resources/PositionImplicitAndExplicit.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf mybits {
- type bits {
- bit disable-nagle;
- bit auto-sense-speed {
- position 1;
- }
- bit Ten-Mb-only;
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/PositionImplicitAndExplicitDuplication.yang b/utils/yangutils/plugin/src/test/resources/PositionImplicitAndExplicitDuplication.yang
deleted file mode 100644
index 30b81ab..0000000
--- a/utils/yangutils/plugin/src/test/resources/PositionImplicitAndExplicitDuplication.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf mybits {
- type bits {
- bit disable-nagle;
- bit auto-sense-speed {
- position 0;
- }
- bit Ten-Mb-only;
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/PositionNegativeValue.yang b/utils/yangutils/plugin/src/test/resources/PositionNegativeValue.yang
deleted file mode 100644
index 60330e0..0000000
--- a/utils/yangutils/plugin/src/test/resources/PositionNegativeValue.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf mybits {
- type bits {
- bit disable-nagle;
- bit auto-sense-speed {
- position -2;
- }
- bit Ten-Mb-only;
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/PositionStatement.yang b/utils/yangutils/plugin/src/test/resources/PositionStatement.yang
deleted file mode 100644
index afa0a4c..0000000
--- a/utils/yangutils/plugin/src/test/resources/PositionStatement.yang
+++ /dev/null
@@ -1,18 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf mybits {
- type bits {
- bit disable-nagle {
- position 0;
- }
- bit auto-sense-speed {
- position 1;
- }
- bit Ten-Mb-only {
- position 2;
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/PositionWithDoubleQuotes.yang b/utils/yangutils/plugin/src/test/resources/PositionWithDoubleQuotes.yang
deleted file mode 100644
index 0c9d358..0000000
--- a/utils/yangutils/plugin/src/test/resources/PositionWithDoubleQuotes.yang
+++ /dev/null
@@ -1,18 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf mybits {
- type bits {
- bit disable-nagle {
- position "0";
- }
- bit auto-sense-speed {
- position "1";
- }
- bit Ten-Mb-only {
- position "2";
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/PrefixDualEntry.yang b/utils/yangutils/plugin/src/test/resources/PrefixDualEntry.yang
deleted file mode 100644
index e999774..0000000
--- a/utils/yangutils/plugin/src/test/resources/PrefixDualEntry.yang
+++ /dev/null
@@ -1,18 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-import ietf {
-prefix On2;
-prefix On3;
-revision-date 2015-02-03;
-}
-include itut {
-revision-date 2016-02-03;
-}
-include sdn {
-revision-date 2014-02-03;
-}
-contact "Test";
-organization "ONOS";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/PrefixInvalidValue.yang b/utils/yangutils/plugin/src/test/resources/PrefixInvalidValue.yang
deleted file mode 100644
index 40f7617..0000000
--- a/utils/yangutils/plugin/src/test/resources/PrefixInvalidValue.yang
+++ /dev/null
@@ -1,17 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix -On;
-import ietf {
-prefix On2;
-revision-date 2015-02-03;
-}
-include itut {
-revision-date 2016-02-03;
-}
-include sdn {
-revision-date 2014-02-03;
-}
-contact "Test";
-organization "ONOS";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/PrefixMissingValue.yang b/utils/yangutils/plugin/src/test/resources/PrefixMissingValue.yang
deleted file mode 100644
index 4d92ee1..0000000
--- a/utils/yangutils/plugin/src/test/resources/PrefixMissingValue.yang
+++ /dev/null
@@ -1,17 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix ;
-import ietf {
-prefix On2;
-revision-date 2015-02-03;
-}
-include itut {
-revision-date 2016-02-03;
-}
-include sdn {
-revision-date 2014-02-03;
-}
-contact "Test";
-organization "ONOS";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/PrefixOrder.yang b/utils/yangutils/plugin/src/test/resources/PrefixOrder.yang
deleted file mode 100644
index d14e8b1..0000000
--- a/utils/yangutils/plugin/src/test/resources/PrefixOrder.yang
+++ /dev/null
@@ -1,17 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-import ietf {
-prefix On2;
-revision-date 2015-02-03;
-}
-prefix test;
-include itut {
-revision-date 2016-02-03;
-}
-include sdn {
-revision-date 2014-02-03;
-}
-contact "Test";
-organization "ONOS";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/PrefixValidEntry.yang b/utils/yangutils/plugin/src/test/resources/PrefixValidEntry.yang
deleted file mode 100644
index 826dee4..0000000
--- a/utils/yangutils/plugin/src/test/resources/PrefixValidEntry.yang
+++ /dev/null
@@ -1,17 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-import ietf {
-prefix On2;
-revision-date 2015-02-03;
-}
-include itut {
-revision-date 2016-02-03;
-}
-include sdn {
-revision-date 2014-02-03;
-}
-contact "Test";
-organization "ONOS";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/PrefixWithDoubleQuotes.yang b/utils/yangutils/plugin/src/test/resources/PrefixWithDoubleQuotes.yang
deleted file mode 100644
index e9590f1..0000000
--- a/utils/yangutils/plugin/src/test/resources/PrefixWithDoubleQuotes.yang
+++ /dev/null
@@ -1,17 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix "On";
-import ietf {
-prefix On2;
-revision-date 2015-02-03;
-}
-include itut {
-revision-date 2016-02-03;
-}
-include sdn {
-revision-date 2014-02-03;
-}
-contact "Test";
-organization "ONOS";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/PresenceDefaultValue.yang b/utils/yangutils/plugin/src/test/resources/PresenceDefaultValue.yang
deleted file mode 100644
index 6418e20..0000000
--- a/utils/yangutils/plugin/src/test/resources/PresenceDefaultValue.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container valid {
- leaf ospf {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/PresenceWithoutStatementEnd.yang b/utils/yangutils/plugin/src/test/resources/PresenceWithoutStatementEnd.yang
deleted file mode 100644
index 1427c5f..0000000
--- a/utils/yangutils/plugin/src/test/resources/PresenceWithoutStatementEnd.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container valid {
- presence "invalid"
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ProcessFileWithExtraBrace.yang b/utils/yangutils/plugin/src/test/resources/ProcessFileWithExtraBrace.yang
deleted file mode 100644
index ca3f0d0..0000000
--- a/utils/yangutils/plugin/src/test/resources/ProcessFileWithExtraBrace.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container food {
- choice snack {
- list sports-arena {
- }
- }
- }
- }
-}
-}
-}
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ProcessFileWithExtraBraceInBetween.yang b/utils/yangutils/plugin/src/test/resources/ProcessFileWithExtraBraceInBetween.yang
deleted file mode 100644
index 580d270..0000000
--- a/utils/yangutils/plugin/src/test/resources/ProcessFileWithExtraBraceInBetween.yang
+++ /dev/null
@@ -1,35 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- import ietf-yang-types {
- prefix "P";
- }
- grouping Percentage {
- leaf hello{
- type string;
- }
- leaf invalid1{
- type string;
- }
- }
- leaf invalid2{
- type string;
- }
- }
- container ospf {
- list valid {
- key "invalid";
- leaf invalid{
- type string;
- }
- uses Ant:FirstClass;
- grouping FirstClass {
- uses P:PassingClass;
- }
- }
- grouping PassingClass {
- uses Ant:Percentage;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ProcessFileWithExtraLeaf.yang b/utils/yangutils/plugin/src/test/resources/ProcessFileWithExtraLeaf.yang
deleted file mode 100644
index 5624b7a..0000000
--- a/utils/yangutils/plugin/src/test/resources/ProcessFileWithExtraLeaf.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container food {
- choice snack {
- list sports-arena {
- }
- }
- }
-}
-leaf invalid {
-
diff --git a/utils/yangutils/plugin/src/test/resources/RangeRestrictionInRefType.yang b/utils/yangutils/plugin/src/test/resources/RangeRestrictionInRefType.yang
deleted file mode 100644
index da396fa..0000000
--- a/utils/yangutils/plugin/src/test/resources/RangeRestrictionInRefType.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type hello {
- range "1..4 | 10..20";
- }
- }
- typedef hello {
- type int32;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/RangeRestrictionInRefTypeAndTypedefInValid.yang b/utils/yangutils/plugin/src/test/resources/RangeRestrictionInRefTypeAndTypedefInValid.yang
deleted file mode 100644
index f45f1ee..0000000
--- a/utils/yangutils/plugin/src/test/resources/RangeRestrictionInRefTypeAndTypedefInValid.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type hello {
- range "min..4 | min..max";
- }
- }
- typedef hello {
- type int32 {
- range "1..4 | 10..20";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/RangeRestrictionInRefTypeAndTypedefValid.yang b/utils/yangutils/plugin/src/test/resources/RangeRestrictionInRefTypeAndTypedefValid.yang
deleted file mode 100644
index b0af767..0000000
--- a/utils/yangutils/plugin/src/test/resources/RangeRestrictionInRefTypeAndTypedefValid.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type hello {
- range "min..4 | 10..max";
- }
- }
- typedef hello {
- type int32 {
- range "1..4 | 10..20";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/RangeRestrictionInRefTypedef.yang b/utils/yangutils/plugin/src/test/resources/RangeRestrictionInRefTypedef.yang
deleted file mode 100644
index 14382b5..0000000
--- a/utils/yangutils/plugin/src/test/resources/RangeRestrictionInRefTypedef.yang
+++ /dev/null
@@ -1,33 +0,0 @@
-module Test {
- namespace "urn:ietf:params:xml:ns:yang:yt3";
- prefix "yt3";
-
- organization
- "YANG Language Design Team";
-
- contact
- "Andy Bierman";
-
- description
- "YANG test module 3.";
-
- revision 2007-12-04 {
- description "Initial revision.";
- }
-
- typedef Num3 {
- units seconds;
- type int16 {
- range "-32000 .. 4 | max";
- }
- description "test 3";
- }
-
- typedef Num6 {
- description "test 6";
- type Num3 {
- range "-3 | -2 .. +2 | 3";
- }
- default 0;
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/RangeRestrictionInString.yang b/utils/yangutils/plugin/src/test/resources/RangeRestrictionInString.yang
deleted file mode 100644
index f167230..0000000
--- a/utils/yangutils/plugin/src/test/resources/RangeRestrictionInString.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type hello;
- }
- typedef hello {
- type string {
- range "1..4 | 10..20";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/RangeRestrictionInStringInRefType.yang b/utils/yangutils/plugin/src/test/resources/RangeRestrictionInStringInRefType.yang
deleted file mode 100644
index c08635f..0000000
--- a/utils/yangutils/plugin/src/test/resources/RangeRestrictionInStringInRefType.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type hello {
- range "1..4 | 10..20";
- }
- }
- typedef hello {
- type string;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/RangeRestrictionInTypedef.yang b/utils/yangutils/plugin/src/test/resources/RangeRestrictionInTypedef.yang
deleted file mode 100644
index 0f53d1f..0000000
--- a/utils/yangutils/plugin/src/test/resources/RangeRestrictionInTypedef.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type hello;
- }
- typedef hello {
- type int32 {
- range "1..4 | 10..20";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/RangeRestrictionInvalidInRefTypedef.yang b/utils/yangutils/plugin/src/test/resources/RangeRestrictionInvalidInRefTypedef.yang
deleted file mode 100644
index 9e93f1e..0000000
--- a/utils/yangutils/plugin/src/test/resources/RangeRestrictionInvalidInRefTypedef.yang
+++ /dev/null
@@ -1,33 +0,0 @@
-module Test {
- namespace "urn:ietf:params:xml:ns:yang:yt3";
- prefix "yt3";
-
- organization
- "YANG Language Design Team";
-
- contact
- "Andy Bierman";
-
- description
- "YANG test module 3.";
-
- revision 2007-12-04 {
- description "Initial revision.";
- }
-
- typedef Num3 {
- units seconds;
- type int16 {
- range "-3 | -2 .. +2 | 3";
- }
- description "test 3";
- }
-
- typedef Num6 {
- description "test 6";
- type Num3 {
- range "-32000 .. 4 | max" ;
- }
- default 0;
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/RangeStatementInsideLeafList.yang b/utils/yangutils/plugin/src/test/resources/RangeStatementInsideLeafList.yang
deleted file mode 100644
index 9f5808d..0000000
--- a/utils/yangutils/plugin/src/test/resources/RangeStatementInsideLeafList.yang
+++ /dev/null
@@ -1,10 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type int32 {
- range "1..4 | 10..20";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/RangeStatementWithSpace.yang b/utils/yangutils/plugin/src/test/resources/RangeStatementWithSpace.yang
deleted file mode 100644
index a41d68a..0000000
--- a/utils/yangutils/plugin/src/test/resources/RangeStatementWithSpace.yang
+++ /dev/null
@@ -1,11 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type int32 {
- range " 1 .. 4 | 10 .. 20 ";
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/RangeSubStatements.yang b/utils/yangutils/plugin/src/test/resources/RangeSubStatements.yang
deleted file mode 100644
index 4b57bd0..0000000
--- a/utils/yangutils/plugin/src/test/resources/RangeSubStatements.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type int32 {
- range "1..4 | 10..20" {
- description "range description";
- reference "range reference";
- }
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/RangeWithInvalidIntegerPattern.yang b/utils/yangutils/plugin/src/test/resources/RangeWithInvalidIntegerPattern.yang
deleted file mode 100644
index 60c7992..0000000
--- a/utils/yangutils/plugin/src/test/resources/RangeWithInvalidIntegerPattern.yang
+++ /dev/null
@@ -1,10 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type int32 {
- range "a..z";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/RangeWithMinMax.yang b/utils/yangutils/plugin/src/test/resources/RangeWithMinMax.yang
deleted file mode 100644
index 373d45e..0000000
--- a/utils/yangutils/plugin/src/test/resources/RangeWithMinMax.yang
+++ /dev/null
@@ -1,10 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type int32 {
- range "min..max";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/RangeWithOneInterval.yang b/utils/yangutils/plugin/src/test/resources/RangeWithOneInterval.yang
deleted file mode 100644
index 85d0288..0000000
--- a/utils/yangutils/plugin/src/test/resources/RangeWithOneInterval.yang
+++ /dev/null
@@ -1,10 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type int32 {
- range "1";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ReferenceEmptyStatement.yang b/utils/yangutils/plugin/src/test/resources/ReferenceEmptyStatement.yang
deleted file mode 100644
index ff3525a..0000000
--- a/utils/yangutils/plugin/src/test/resources/ReferenceEmptyStatement.yang
+++ /dev/null
@@ -1,6 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- reference "";
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ReferenceStatement.yang b/utils/yangutils/plugin/src/test/resources/ReferenceStatement.yang
deleted file mode 100644
index 70349a0..0000000
--- a/utils/yangutils/plugin/src/test/resources/ReferenceStatement.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- config true;
- mandatory true;
- status current;
- reference "RFC 6020";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ReferenceWithoutStatementEnd.yang b/utils/yangutils/plugin/src/test/resources/ReferenceWithoutStatementEnd.yang
deleted file mode 100644
index f2fcf43..0000000
--- a/utils/yangutils/plugin/src/test/resources/ReferenceWithoutStatementEnd.yang
+++ /dev/null
@@ -1,9 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type "uint16";
- reference "RFC 6020"
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/RequireInstanceDefaultValueForLeafref.yang b/utils/yangutils/plugin/src/test/resources/RequireInstanceDefaultValueForLeafref.yang
deleted file mode 100644
index c4dae28..0000000
--- a/utils/yangutils/plugin/src/test/resources/RequireInstanceDefaultValueForLeafref.yang
+++ /dev/null
@@ -1,31 +0,0 @@
-module PathListener {
- namespace "test";
- prefix test;
- list interface {
- key "name";
- leaf name {
- type string;
- }
- leaf admin-status {
- type string;
- }
- list address {
- key "ip";
- leaf ip {
- type string;
- }
- }
- }
- container default-address {
- leaf ifname {
- type leafref {
- path "../../test:interface/test:name";
- }
- }
- leaf status {
- type leafref {
- path "/test:interface[name = current()/../ifname]/test:admin-status";
- }
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/RequireInstanceDefaultValueInInstanceIdentifier.yang b/utils/yangutils/plugin/src/test/resources/RequireInstanceDefaultValueInInstanceIdentifier.yang
deleted file mode 100644
index e3e15bf..0000000
--- a/utils/yangutils/plugin/src/test/resources/RequireInstanceDefaultValueInInstanceIdentifier.yang
+++ /dev/null
@@ -1,7 +0,0 @@
-module PathListener {
- namespace "test";
- prefix test;
- leaf admin-status {
- type instance-identifier;
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/RequireInstanceFalse.yang b/utils/yangutils/plugin/src/test/resources/RequireInstanceFalse.yang
deleted file mode 100644
index 0a2ba4f..0000000
--- a/utils/yangutils/plugin/src/test/resources/RequireInstanceFalse.yang
+++ /dev/null
@@ -1,9 +0,0 @@
-module PathListener {
- namespace "test";
- prefix test;
- leaf admin-status {
- type instance-identifier {
- require-instance "false";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/RequireInstanceTrue.yang b/utils/yangutils/plugin/src/test/resources/RequireInstanceTrue.yang
deleted file mode 100644
index cace8c5..0000000
--- a/utils/yangutils/plugin/src/test/resources/RequireInstanceTrue.yang
+++ /dev/null
@@ -1,32 +0,0 @@
-module PathListener {
- namespace "test";
- prefix test;
- list interface {
- key "name";
- leaf name {
- type string;
- }
- leaf admin-status {
- type string;
- }
- list address {
- key "ip";
- leaf ip {
- type string;
- }
- }
- }
- container default-address {
- leaf ifname {
- type leafref {
- path "../../test:interface/test:name";
- require-instance true;
- }
- }
- leaf status {
- type leafref {
- path "/test:interface[name = current()/../ifname]/test:admin-status";
- }
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/RevisionAbsence.yang b/utils/yangutils/plugin/src/test/resources/RevisionAbsence.yang
deleted file mode 100644
index eb1d1d9..0000000
--- a/utils/yangutils/plugin/src/test/resources/RevisionAbsence.yang
+++ /dev/null
@@ -1,5 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix test;
-}
diff --git a/utils/yangutils/plugin/src/test/resources/RevisionDateInQuotesAtImport.yang b/utils/yangutils/plugin/src/test/resources/RevisionDateInQuotesAtImport.yang
deleted file mode 100644
index 5f8bcb8..0000000
--- a/utils/yangutils/plugin/src/test/resources/RevisionDateInQuotesAtImport.yang
+++ /dev/null
@@ -1,17 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix test;
-import ietf {
-prefix On2;
-revision-date "2015-02-03";
-}
-include itut {
-revision-date 2016-02-03;
-}
-include sdn {
-revision-date 2014-02-03;
-}
-contact "Test";
-organization "ONOS";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/RevisionDateInQuotesAtInclude.yang b/utils/yangutils/plugin/src/test/resources/RevisionDateInQuotesAtInclude.yang
deleted file mode 100644
index de405a3..0000000
--- a/utils/yangutils/plugin/src/test/resources/RevisionDateInQuotesAtInclude.yang
+++ /dev/null
@@ -1,17 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix test;
-import ietf {
-prefix On2;
-revision-date 2015-02-03;
-}
-include itut {
-revision-date "2016-02-03";
-}
-include sdn {
-revision-date 2014-02-03;
-}
-contact "Test";
-organization "ONOS";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/RevisionDateInvalid.yang b/utils/yangutils/plugin/src/test/resources/RevisionDateInvalid.yang
deleted file mode 100644
index c219d11..0000000
--- a/utils/yangutils/plugin/src/test/resources/RevisionDateInvalid.yang
+++ /dev/null
@@ -1,17 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix test;
-import ietf {
-prefix On2;
-revision-date 2015-02-30;
-}
-include itut {
-revision-date 2016-02-03;
-}
-include sdn {
-revision-date 2014-02-03;
-}
-contact "Test";
-organization "ONOS";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/RevisionDateInvalidFormat.yang b/utils/yangutils/plugin/src/test/resources/RevisionDateInvalidFormat.yang
deleted file mode 100644
index 8a6c717..0000000
--- a/utils/yangutils/plugin/src/test/resources/RevisionDateInvalidFormat.yang
+++ /dev/null
@@ -1,17 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix test;
-import ietf {
-prefix On2;
-revision-date 15-02-03;
-}
-include itut {
-revision-date 2016-02-03;
-}
-include sdn {
-revision-date 2014-02-03;
-}
-contact "Test";
-organization "ONOS";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/RevisionDateInvalidSyntaxAtImport.yang b/utils/yangutils/plugin/src/test/resources/RevisionDateInvalidSyntaxAtImport.yang
deleted file mode 100644
index df726bf..0000000
--- a/utils/yangutils/plugin/src/test/resources/RevisionDateInvalidSyntaxAtImport.yang
+++ /dev/null
@@ -1,17 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix test;
-import ietf {
-prefix On2;
-revision-date 2015/02/03;
-}
-include itut {
-revision-date 2016-02-03;
-}
-include sdn {
-revision-date 2014-02-03;
-}
-contact "Test";
-organization "ONOS";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/RevisionDateInvalidSyntaxAtInclude.yang b/utils/yangutils/plugin/src/test/resources/RevisionDateInvalidSyntaxAtInclude.yang
deleted file mode 100644
index ea5631e..0000000
--- a/utils/yangutils/plugin/src/test/resources/RevisionDateInvalidSyntaxAtInclude.yang
+++ /dev/null
@@ -1,17 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix test;
-import ietf {
-prefix On2;
-revision-date 2015-02-03;
-}
-include itut {
-revision-date 2016/02/03;
-}
-include sdn {
-revision-date 2014-02-03;
-}
-contact "Test";
-organization "ONOS";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/RevisionDateValidEntry.yang b/utils/yangutils/plugin/src/test/resources/RevisionDateValidEntry.yang
deleted file mode 100644
index dbf4d3a..0000000
--- a/utils/yangutils/plugin/src/test/resources/RevisionDateValidEntry.yang
+++ /dev/null
@@ -1,17 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix test;
-import ietf {
-prefix On2;
-revision-date 2015-02-03;
-}
-include itut {
-revision-date 2016-02-03;
-}
-include sdn {
-revision-date 2014-02-03;
-}
-contact "Test";
-organization "ONOS";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/RevisionInValidOrder.yang b/utils/yangutils/plugin/src/test/resources/RevisionInValidOrder.yang
deleted file mode 100644
index c60d434..0000000
--- a/utils/yangutils/plugin/src/test/resources/RevisionInValidOrder.yang
+++ /dev/null
@@ -1,9 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix test;
-revision 2016-02-03;
-include itut {
-revision-date 2016-02-03;
-}
-}
diff --git a/utils/yangutils/plugin/src/test/resources/RevisionInValidSyntax.yang b/utils/yangutils/plugin/src/test/resources/RevisionInValidSyntax.yang
deleted file mode 100644
index 1795b3e..0000000
--- a/utils/yangutils/plugin/src/test/resources/RevisionInValidSyntax.yang
+++ /dev/null
@@ -1,8 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix test;
-contact "Test";
-organization "ONOS";
-revision;
-}
diff --git a/utils/yangutils/plugin/src/test/resources/RevisionNoOptionalParameter.yang b/utils/yangutils/plugin/src/test/resources/RevisionNoOptionalParameter.yang
deleted file mode 100644
index 664204e..0000000
--- a/utils/yangutils/plugin/src/test/resources/RevisionNoOptionalParameter.yang
+++ /dev/null
@@ -1,8 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix test;
-contact "Test";
-organization "ONOS";
-revision 2016-02-03;
-}
diff --git a/utils/yangutils/plugin/src/test/resources/RevisionSubStatementReference.yang b/utils/yangutils/plugin/src/test/resources/RevisionSubStatementReference.yang
deleted file mode 100644
index d1ada14..0000000
--- a/utils/yangutils/plugin/src/test/resources/RevisionSubStatementReference.yang
+++ /dev/null
@@ -1,9 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- description "module description";
- revision 2007-06-09 {
- reference "revision reference";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/RevisionSubStatementRevision.yang b/utils/yangutils/plugin/src/test/resources/RevisionSubStatementRevision.yang
deleted file mode 100644
index 3d1daa2..0000000
--- a/utils/yangutils/plugin/src/test/resources/RevisionSubStatementRevision.yang
+++ /dev/null
@@ -1,10 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- description "module description";
- revision 2007-06-09 {
- description "revision description";
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/RpcTranslator.yang b/utils/yangutils/plugin/src/test/resources/RpcTranslator.yang
deleted file mode 100644
index 2f0616e..0000000
--- a/utils/yangutils/plugin/src/test/resources/RpcTranslator.yang
+++ /dev/null
@@ -1,25 +0,0 @@
-module Sfc {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf test{
- type string;
- }
- container my-container{
- leaf my-val{
- type string;
- }
- }
- rpc SFP {
- input {
- leaf port {
- type string;
- }
- }
- output {
- leaf path {
- type string;
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingTypedefAtMiddleLevelAfterParentHolder.yang b/utils/yangutils/plugin/src/test/resources/SelfFileLinkingTypedefAtMiddleLevelAfterParentHolder.yang
deleted file mode 100644
index 812a528..0000000
--- a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingTypedefAtMiddleLevelAfterParentHolder.yang
+++ /dev/null
@@ -1,16 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container ospf {
- list valid {
- key "invalid-interval";
- leaf invalid-interval {
- type hello;
- }
- }
- typedef hello {
- type string;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingTypedefAtRootIsAfterContainerHavingType.yang b/utils/yangutils/plugin/src/test/resources/SelfFileLinkingTypedefAtRootIsAfterContainerHavingType.yang
deleted file mode 100644
index 10ccab6..0000000
--- a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingTypedefAtRootIsAfterContainerHavingType.yang
+++ /dev/null
@@ -1,16 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container ospf {
- list valid {
- key "invalid-interval";
- leaf invalid-interval {
- type hello;
- }
- }
- }
- typedef hello {
- type string;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingTypedefAtRootTypeTwoLevelInHierarchy.yang b/utils/yangutils/plugin/src/test/resources/SelfFileLinkingTypedefAtRootTypeTwoLevelInHierarchy.yang
deleted file mode 100644
index eddb649..0000000
--- a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingTypedefAtRootTypeTwoLevelInHierarchy.yang
+++ /dev/null
@@ -1,16 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- typedef hello {
- type string;
- }
- container ospf {
- list valid {
- key "invalid-interval";
- leaf invalid-interval {
- type hello;
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingTypedefNotFound.yang b/utils/yangutils/plugin/src/test/resources/SelfFileLinkingTypedefNotFound.yang
deleted file mode 100644
index 523f0b4..0000000
--- a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingTypedefNotFound.yang
+++ /dev/null
@@ -1,18 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container ospf {
- list valid {
- key "invalid-interval";
- leaf invalid-interval {
- type Ant:hello;
- }
- }
- }
- container isis {
- typedef hello {
- type string;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithFeature.yang b/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithFeature.yang
deleted file mode 100644
index 53de63a..0000000
--- a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithFeature.yang
+++ /dev/null
@@ -1,23 +0,0 @@
-module syslog {
- yang-version 1;
- namespace http://huawei.com;
- prefix "sys";
- feature local-storage {
- description
- "This feature means the device supports local
- storage (memory, flash or disk) that can be used to
- store syslog messages.";
- }
-
- container speed {
- leaf local-storage-limit {
- if-feature local-storage;
- type uint64;
- units "kilobyte";
- config false;
- description
- "The amount of local storage that can be
- used to hold syslog messages.";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithFeatureInSubModule.yang b/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithFeatureInSubModule.yang
deleted file mode 100644
index 09b8b37..0000000
--- a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithFeatureInSubModule.yang
+++ /dev/null
@@ -1,24 +0,0 @@
-submodule syslog {
- yang-version 1;
- belongs-to "syslog1" {
- prefix "sys";
- }
- feature local-storage {
- description
- "This feature means the device supports local
- storage (memory, flash or disk) that can be used to
- store syslog messages.";
- }
-
- container speed {
- leaf local-storage-limit {
- if-feature local-storage;
- type uint64;
- units "kilobyte";
- config false;
- description
- "The amount of local storage that can be
- used to hold syslog messages.";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithFeatureUndefined.yang b/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithFeatureUndefined.yang
deleted file mode 100644
index f55c61a..0000000
--- a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithFeatureUndefined.yang
+++ /dev/null
@@ -1,17 +0,0 @@
-module syslog {
- yang-version 1;
- namespace http://huawei.com;
- prefix "sys";
-
- container speed {
- leaf local-storage-limit {
- if-feature local-storage;
- type uint64;
- units "kilobyte";
- config false;
- description
- "The amount of local storage that can be
- used to hold syslog messages.";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithGroupingHierarchicalRefUnresolved.yang b/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithGroupingHierarchicalRefUnresolved.yang
deleted file mode 100644
index cd71621..0000000
--- a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithGroupingHierarchicalRefUnresolved.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- import ietf-yang-types {
- prefix "P";
- }
- grouping create {
- uses P:valid;
- }
- container test{
- uses create;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithGroupingWithSelfAndExternalPrefixMix.yang b/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithGroupingWithSelfAndExternalPrefixMix.yang
deleted file mode 100644
index b6e3b45..0000000
--- a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithGroupingWithSelfAndExternalPrefixMix.yang
+++ /dev/null
@@ -1,28 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- import ietf-yang-types {
- prefix "P";
- }
- grouping Percentage {
- leaf hello{
- type string;
- }
- }
- container ospf {
- list valid {
- key "invalid";
- leaf invalid{
- type string;
- }
- uses Ant:FirstClass;
- grouping FirstClass {
- uses P:PassingClass;
- }
- }
- grouping PassingClass {
- uses Ant:Percentage;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithGroupingWithSelfModulePrefix.yang b/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithGroupingWithSelfModulePrefix.yang
deleted file mode 100644
index 956ba50..0000000
--- a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithGroupingWithSelfModulePrefix.yang
+++ /dev/null
@@ -1,25 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- grouping Percentage {
- leaf hello{
- type string;
- }
- }
- container ospf {
- list valid {
- key "invalid";
- leaf invalid{
- type string;
- }
- uses Ant:FirstClass;
- grouping FirstClass {
- uses PassingClass;
- }
- }
- grouping PassingClass {
- uses Ant:Percentage;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithHierarchicalTypeFailureScenario.yang b/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithHierarchicalTypeFailureScenario.yang
deleted file mode 100644
index d622196..0000000
--- a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithHierarchicalTypeFailureScenario.yang
+++ /dev/null
@@ -1,22 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- typedef Percentage {
- type Ant:INT;
- }
- container ospf {
- list valid {
- key "invalid-interval";
- leaf invalid-interval {
- type Ant:FirstClass;
- }
- typedef FirstClass {
- type Ant:PassingClass;
- }
- }
- typedef PassingClass {
- type Percentage;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithMultipleDependency.yang b/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithMultipleDependency.yang
deleted file mode 100644
index d230f99..0000000
--- a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithMultipleDependency.yang
+++ /dev/null
@@ -1,26 +0,0 @@
-module syslog {
- yang-version 1;
- namespace http://huawei.com;
- prefix "sys";
-
- feature p2mp-te {
- description "Indicates support for P2MP-TE";
- }
-
- feature frr-te {
- description "Indicates support for TE FastReroute (FRR)";
- if-feature p2mp-te;
- }
-
- container speed {
- leaf local-storage-limit {
- if-feature frr-te;
- type uint64;
- units "kilobyte";
- config false;
- description
- "The amount of local storage that can be
- used to hold syslog messages.";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithMultipleDependencyUnresolved.yang b/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithMultipleDependencyUnresolved.yang
deleted file mode 100644
index 02bca89..0000000
--- a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithMultipleDependencyUnresolved.yang
+++ /dev/null
@@ -1,22 +0,0 @@
-module syslog {
- yang-version 1;
- namespace http://huawei.com;
- prefix "sys";
-
- feature frr-te {
- description "Indicates support for TE FastReroute (FRR)";
- if-feature p2mp-te;
- }
-
- container speed {
- leaf local-storage-limit {
- if-feature frr-te;
- type uint64;
- units "kilobyte";
- config false;
- description
- "The amount of local storage that can be
- used to hold syslog messages.";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithMultipleFeature.yang b/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithMultipleFeature.yang
deleted file mode 100644
index 407023c..0000000
--- a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithMultipleFeature.yang
+++ /dev/null
@@ -1,26 +0,0 @@
-module syslog {
- yang-version 1;
- namespace http://huawei.com;
- prefix "sys";
-
- feature p2mp-te {
- description "Indicates support for P2MP-TE";
- }
-
- feature frr-te {
- description "Indicates support for TE FastReroute (FRR)";
- if-feature p2mp-te;
- }
-
- container speed {
- leaf local-storage-limit {
- if-feature local-storage;
- type uint64;
- units "kilobyte";
- config false;
- description
- "The amount of local storage that can be
- used to hold syslog messages.";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithTypdefHierarchicalRefUnresolved.yang b/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithTypdefHierarchicalRefUnresolved.yang
deleted file mode 100644
index a3e4379..0000000
--- a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithTypdefHierarchicalRefUnresolved.yang
+++ /dev/null
@@ -1,25 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- import ietf-yang-types {
- prefix "P";
- }
- typedef Percentage {
- type P:Per;
- }
- container ospf {
- list valid {
- key "invalid-interval";
- leaf invalid-interval {
- type FirstClass;
- }
- typedef FirstClass {
- type PassingClass;
- }
- }
- typedef PassingClass {
- type Percentage;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithTypdefHierarchicalReference.yang b/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithTypdefHierarchicalReference.yang
deleted file mode 100644
index 958dc23..0000000
--- a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithTypdefHierarchicalReference.yang
+++ /dev/null
@@ -1,22 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- typedef Percentage {
- type int32;
- }
- container ospf {
- list valid {
- key "invalid-interval";
- leaf invalid-interval {
- type FirstClass;
- }
- typedef FirstClass {
- type PassingClass;
- }
- }
- typedef PassingClass {
- type Percentage;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithTypeWithSelfAndExternalPrefixMix.yang b/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithTypeWithSelfAndExternalPrefixMix.yang
deleted file mode 100644
index d5f346e..0000000
--- a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithTypeWithSelfAndExternalPrefixMix.yang
+++ /dev/null
@@ -1,25 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- import ietf-yang-types {
- prefix "P";
- }
- typedef Percentage {
- type int32;
- }
- container ospf {
- list valid {
- key "invalid-interval";
- leaf invalid-interval {
- type Ant:FirstClass;
- }
- typedef FirstClass {
- type P:PassingClass;
- }
- }
- typedef PassingClass {
- type Ant:Percentage;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithTypeWithSelfModulePrefix.yang b/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithTypeWithSelfModulePrefix.yang
deleted file mode 100644
index 4f292b8..0000000
--- a/utils/yangutils/plugin/src/test/resources/SelfFileLinkingWithTypeWithSelfModulePrefix.yang
+++ /dev/null
@@ -1,22 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- typedef Percentage {
- type int32;
- }
- container ospf {
- list valid {
- key "invalid-interval";
- leaf invalid-interval {
- type Ant:FirstClass;
- }
- typedef FirstClass {
- type PassingClass;
- }
- }
- typedef PassingClass {
- type Ant:Percentage;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SelfResolutionGroupingHavingSameUsesManyTimes.yang b/utils/yangutils/plugin/src/test/resources/SelfResolutionGroupingHavingSameUsesManyTimes.yang
deleted file mode 100644
index d449adf..0000000
--- a/utils/yangutils/plugin/src/test/resources/SelfResolutionGroupingHavingSameUsesManyTimes.yang
+++ /dev/null
@@ -1,25 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container valid {
- grouping endpoint {
- leaf zip-code {
- type string;
- }
- uses failure;
- container hold {
- leaf newone {
- type string;
- }
-
- }
- uses failure;
- }
- grouping failure {
- leaf test {
- type string;
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SelfResolutionGroupingInRpcAndUsesInOutput.yang b/utils/yangutils/plugin/src/test/resources/SelfResolutionGroupingInRpcAndUsesInOutput.yang
deleted file mode 100644
index 3589a9f..0000000
--- a/utils/yangutils/plugin/src/test/resources/SelfResolutionGroupingInRpcAndUsesInOutput.yang
+++ /dev/null
@@ -1,34 +0,0 @@
-module rock {
- namespace "http://example.net/rock";
- prefix "rock";
-
- rpc rock-the-house {
- description "description";
- status current;
- reference "reference";
- grouping hello {
- list valid {
- key invalid-interval;
- reference "RFC 6020";
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
- }
- input {
- leaf zip-code {
- type string;
- }
- uses hello;
- }
- output {
- leaf status {
- type string;
- }
- uses hello;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SelfResolutionGroupingReferencingItselfFailureScenerio.yang b/utils/yangutils/plugin/src/test/resources/SelfResolutionGroupingReferencingItselfFailureScenerio.yang
deleted file mode 100644
index 3e0ba3d..0000000
--- a/utils/yangutils/plugin/src/test/resources/SelfResolutionGroupingReferencingItselfFailureScenerio.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container valid {
- grouping endpoint {
- leaf zip-code {
- type string;
- }
- uses endpoint;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SelfResolutionGroupingWithMultipleUses.yang b/utils/yangutils/plugin/src/test/resources/SelfResolutionGroupingWithMultipleUses.yang
deleted file mode 100644
index 906890f..0000000
--- a/utils/yangutils/plugin/src/test/resources/SelfResolutionGroupingWithMultipleUses.yang
+++ /dev/null
@@ -1,63 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container valid {
- grouping endpoint {
- leaf zip-code {
- type string;
- }
- uses first;
- container design {
- uses second;
- container correct {
- leaf newone {
- type string;
- }
- uses third;
- }
- }
- uses fourth;
- uses fifth;
- }
- uses endpoint;
- grouping first {
- list valid {
- key invalid-interval;
- reference "RFC 6020";
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
- }
- grouping second {
- leaf ink {
- type int32;
- }
- }
- grouping third {
- container value {
- leaf zip-code {
- type string;
- }
- }
- }
- grouping fourth {
- typedef my-type {
- status deprecated;
- type int32;
- }
- leaf correct {
- type my-type;
- }
- }
- grouping fifth {
- leaf abc {
- type string;
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SelfResolutionNestedGroupingWithUnresolvedUses.yang b/utils/yangutils/plugin/src/test/resources/SelfResolutionNestedGroupingWithUnresolvedUses.yang
deleted file mode 100644
index b2ab735..0000000
--- a/utils/yangutils/plugin/src/test/resources/SelfResolutionNestedGroupingWithUnresolvedUses.yang
+++ /dev/null
@@ -1,17 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container test {
- leaf leaf2 {
- type string;
- }
- grouping treat {
- grouping create {
- grouping mass {
- }
- }
- }
- }
- uses Ant:treat;
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SelfResolutionRpcWithOneTypedefAndTwoGroupingUnderDifferentNode.yang b/utils/yangutils/plugin/src/test/resources/SelfResolutionRpcWithOneTypedefAndTwoGroupingUnderDifferentNode.yang
deleted file mode 100644
index 91dc763..0000000
--- a/utils/yangutils/plugin/src/test/resources/SelfResolutionRpcWithOneTypedefAndTwoGroupingUnderDifferentNode.yang
+++ /dev/null
@@ -1,38 +0,0 @@
-module rock {
- namespace "http://example.net/rock";
- prefix "rock";
-
- rpc rock-the-house {
- description "description";
- status current;
- reference "reference";
- input {
- leaf zip-code {
- type string;
- }
- grouping creative {
- leaf carry {
- type string;
- }
- }
- }
- output {
- leaf status {
- type string;
- }
- grouping creative {
- list valid {
- key invalid-interval;
- leaf invalid-interval {
- type "uint16";
- }
- }
- }
- typedef my-type {
- status deprecated;
- type int32;
- }
- uses creative;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SelfResolutionWhenLeafrefDoesntHavePath.yang b/utils/yangutils/plugin/src/test/resources/SelfResolutionWhenLeafrefDoesntHavePath.yang
deleted file mode 100644
index 90b9efc..0000000
--- a/utils/yangutils/plugin/src/test/resources/SelfResolutionWhenLeafrefDoesntHavePath.yang
+++ /dev/null
@@ -1,17 +0,0 @@
-module ietf-network {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-network";
- prefix nd;
- container networks {
- description
- "Serves as top-level container for a list of networks.";
- leaf network-id {
- type uint8;
- description
- "Identifies a network.";
- }
- }
- leaf-list network-ref {
- type leafref;
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/SelfResolutionWhenTypeAndTypedefAtRootLevel.yang b/utils/yangutils/plugin/src/test/resources/SelfResolutionWhenTypeAndTypedefAtRootLevel.yang
deleted file mode 100644
index da6795b..0000000
--- a/utils/yangutils/plugin/src/test/resources/SelfResolutionWhenTypeAndTypedefAtRootLevel.yang
+++ /dev/null
@@ -1,11 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type hello;
- }
- typedef hello {
- type string;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SelfResolutionWhenTypeAndTypedefAtRootLevelForBinary.yang b/utils/yangutils/plugin/src/test/resources/SelfResolutionWhenTypeAndTypedefAtRootLevelForBinary.yang
deleted file mode 100644
index d6ff30e..0000000
--- a/utils/yangutils/plugin/src/test/resources/SelfResolutionWhenTypeAndTypedefAtRootLevelForBinary.yang
+++ /dev/null
@@ -1,17 +0,0 @@
-module ospf {
- namespace "urn:cisco:params:xml:ns:yang:ospf";
- // replace with IANA namespace when assigned
- prefix ospf;
- revision 2020-10-20 {
- description
- "Initial revision.";
- }
-
- typedef type14 {
- type binary;
- }
-
- leaf typedef14 {
- type type14;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SelfResolutionWhenTypeReferredTypedefNotDefined.yang b/utils/yangutils/plugin/src/test/resources/SelfResolutionWhenTypeReferredTypedefNotDefined.yang
deleted file mode 100644
index 33f90c9..0000000
--- a/utils/yangutils/plugin/src/test/resources/SelfResolutionWhenTypeReferredTypedefNotDefined.yang
+++ /dev/null
@@ -1,11 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type Ant:hello;
- }
- typedef hi {
- type string;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SelfResolutionWhenUsesAndGroupingAtRootLevel.yang b/utils/yangutils/plugin/src/test/resources/SelfResolutionWhenUsesAndGroupingAtRootLevel.yang
deleted file mode 100644
index f6e9197..0000000
--- a/utils/yangutils/plugin/src/test/resources/SelfResolutionWhenUsesAndGroupingAtRootLevel.yang
+++ /dev/null
@@ -1,11 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- uses hello;
- grouping hello {
- leaf hello{
- type string;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SelfResolutionWhenUsesAndGroupingAtRootLevelGroupingWithChild.yang b/utils/yangutils/plugin/src/test/resources/SelfResolutionWhenUsesAndGroupingAtRootLevelGroupingWithChild.yang
deleted file mode 100644
index 13cc4a5..0000000
--- a/utils/yangutils/plugin/src/test/resources/SelfResolutionWhenUsesAndGroupingAtRootLevelGroupingWithChild.yang
+++ /dev/null
@@ -1,16 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- uses treat;
- grouping treat {
- leaf treat{
- type string;
- }
- container test{
- leaf leaf2{
- type string;
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ShortCaseListenerWithContainer.yang b/utils/yangutils/plugin/src/test/resources/ShortCaseListenerWithContainer.yang
deleted file mode 100644
index 3322a66..0000000
--- a/utils/yangutils/plugin/src/test/resources/ShortCaseListenerWithContainer.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container food {
- choice snack {
- container sports-arena {
- leaf pretzel {
- type empty;
- }
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ShortCaseListenerWithList.yang b/utils/yangutils/plugin/src/test/resources/ShortCaseListenerWithList.yang
deleted file mode 100644
index 6eeec79..0000000
--- a/utils/yangutils/plugin/src/test/resources/ShortCaseListenerWithList.yang
+++ /dev/null
@@ -1,16 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container food {
- choice snack {
- list sports-arena {
- key "pretzel";
- leaf pretzel {
- type int32;
- }
- }
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/StatusDefaultValue.yang b/utils/yangutils/plugin/src/test/resources/StatusDefaultValue.yang
deleted file mode 100644
index 0cc9e36..0000000
--- a/utils/yangutils/plugin/src/test/resources/StatusDefaultValue.yang
+++ /dev/null
@@ -1,12 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf-list invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- config true;
- reference "RFC 6020";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/StatusInvalidValue.yang b/utils/yangutils/plugin/src/test/resources/StatusInvalidValue.yang
deleted file mode 100644
index 253b785..0000000
--- a/utils/yangutils/plugin/src/test/resources/StatusInvalidValue.yang
+++ /dev/null
@@ -1,9 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type "uint16";
- status invalid;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/StatusStatementCurrent.yang b/utils/yangutils/plugin/src/test/resources/StatusStatementCurrent.yang
deleted file mode 100644
index dd9a36d..0000000
--- a/utils/yangutils/plugin/src/test/resources/StatusStatementCurrent.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- config true;
- mandatory true;
- status current;
- reference "RFC 6020";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/StatusStatementDeprecated.yang b/utils/yangutils/plugin/src/test/resources/StatusStatementDeprecated.yang
deleted file mode 100644
index 9a257b1..0000000
--- a/utils/yangutils/plugin/src/test/resources/StatusStatementDeprecated.yang
+++ /dev/null
@@ -1,9 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type "uint16";
- status deprecated;
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/StatusStatementObsolete.yang b/utils/yangutils/plugin/src/test/resources/StatusStatementObsolete.yang
deleted file mode 100644
index 19325ed..0000000
--- a/utils/yangutils/plugin/src/test/resources/StatusStatementObsolete.yang
+++ /dev/null
@@ -1,9 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type "uint16";
- status obsolete;
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/StatusWithoutStatementEnd.yang b/utils/yangutils/plugin/src/test/resources/StatusWithoutStatementEnd.yang
deleted file mode 100644
index 27a8cfa..0000000
--- a/utils/yangutils/plugin/src/test/resources/StatusWithoutStatementEnd.yang
+++ /dev/null
@@ -1,9 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type "uint16";
- status current
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SubModuleInvalidName.yang b/utils/yangutils/plugin/src/test/resources/SubModuleInvalidName.yang
deleted file mode 100644
index 7da9397..0000000
--- a/utils/yangutils/plugin/src/test/resources/SubModuleInvalidName.yang
+++ /dev/null
@@ -1,18 +0,0 @@
-submodule Test:Test {
-belongs-to ONOS {
-prefix On1;
-}
-yang-version 1;
-import ietf {
-prefix On2;
-revision-date 2015-02-03;
-}
-include itut {
-revision-date 2016-02-03;
-}
-include sdn {
-revision-date 2014-02-03;
-}
-contact "Test";
-organization "ONOS";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SubModuleOrder.yang b/utils/yangutils/plugin/src/test/resources/SubModuleOrder.yang
deleted file mode 100644
index 9779bbb..0000000
--- a/utils/yangutils/plugin/src/test/resources/SubModuleOrder.yang
+++ /dev/null
@@ -1,18 +0,0 @@
-submodule Test {
-belongs-to ONOS {
-prefix On1;
-}
-yang-version 1;
-import ietf {
-prefix On2;
-revision-date 2015-02-03;
-}
-include itut {
-revision-date 2016-02-03;
-}
-include sdn {
-revision-date 2014-02-03;
-}
-contact "Test";
-organization "ONOS";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SubModuleValidEntry.yang b/utils/yangutils/plugin/src/test/resources/SubModuleValidEntry.yang
deleted file mode 100644
index 00ecdca..0000000
--- a/utils/yangutils/plugin/src/test/resources/SubModuleValidEntry.yang
+++ /dev/null
@@ -1,18 +0,0 @@
-submodule Test {
-yang-version 1;
-belongs-to ONOS {
-prefix On1;
-}
-import ietf {
-prefix On2;
-revision-date 2015-02-03;
-}
-include itut {
-revision-date 2016-02-03;
-}
-include sdn {
-revision-date 2014-02-03;
-}
-contact "Test";
-organization "ONOS";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SubModuleWithNamespace.yang b/utils/yangutils/plugin/src/test/resources/SubModuleWithNamespace.yang
deleted file mode 100644
index d7a38f7..0000000
--- a/utils/yangutils/plugin/src/test/resources/SubModuleWithNamespace.yang
+++ /dev/null
@@ -1,19 +0,0 @@
-submodule Test {
-belongs-to ONOS {
-prefix On1;
-}
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-import ietf {
-prefix On2;
-revision-date 2015-02-03;
-}
-include itut {
-revision-date 2016-02-03;
-}
-include sdn {
-revision-date 2014-02-03;
-}
-contact "Test";
-organization "ONOS";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SubModuleWithoutBelongsTo.yang b/utils/yangutils/plugin/src/test/resources/SubModuleWithoutBelongsTo.yang
deleted file mode 100644
index 4a25209..0000000
--- a/utils/yangutils/plugin/src/test/resources/SubModuleWithoutBelongsTo.yang
+++ /dev/null
@@ -1,3 +0,0 @@
-submodule Test {
-yang-version 1;
-}
diff --git a/utils/yangutils/plugin/src/test/resources/SubModuleWithoutVersion.yang b/utils/yangutils/plugin/src/test/resources/SubModuleWithoutVersion.yang
deleted file mode 100644
index f44df8b..0000000
--- a/utils/yangutils/plugin/src/test/resources/SubModuleWithoutVersion.yang
+++ /dev/null
@@ -1,17 +0,0 @@
-submodule Test {
-belongs-to ONOS {
-prefix On1;
-}
-import ietf {
-prefix On2;
-revision-date 2015-02-03;
-}
-include itut {
-revision-date 2016-02-03;
-}
-include sdn {
-revision-date 2014-02-03;
-}
-contact "Test";
-organization "ONOS";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/UnionTranslator.yang b/utils/yangutils/plugin/src/test/resources/UnionTranslator.yang
deleted file mode 100644
index f1de318..0000000
--- a/utils/yangutils/plugin/src/test/resources/UnionTranslator.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container valid {
- leaf invalid-interval {
- type union {
- type int32;
- type int8;
- }
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/UnionWhenTypeInLeaf.yang b/utils/yangutils/plugin/src/test/resources/UnionWhenTypeInLeaf.yang
deleted file mode 100644
index 65c0369..0000000
--- a/utils/yangutils/plugin/src/test/resources/UnionWhenTypeInLeaf.yang
+++ /dev/null
@@ -1,16 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "invalid-interval";
- leaf invalid-interval {
- type union {
- type int32;
- type enumeration {
- enum "unbounded";
- }
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/UnionWhenTypeInLeafList.yang b/utils/yangutils/plugin/src/test/resources/UnionWhenTypeInLeafList.yang
deleted file mode 100644
index f335960..0000000
--- a/utils/yangutils/plugin/src/test/resources/UnionWhenTypeInLeafList.yang
+++ /dev/null
@@ -1,19 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "invalid";
- leaf-list invalid-interval {
- type union {
- type int32;
- type enumeration {
- enum "unbounded";
- }
- }
- }
- leaf invalid {
- type string;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/UnionWithEmptyType.yang b/utils/yangutils/plugin/src/test/resources/UnionWithEmptyType.yang
deleted file mode 100644
index 81e8795..0000000
--- a/utils/yangutils/plugin/src/test/resources/UnionWithEmptyType.yang
+++ /dev/null
@@ -1,16 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "invalid-interval";
- leaf invalid-interval {
- type union {
- type empty;
- type enumeration {
- enum "unbounded";
- }
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/UnionWithoutChild.yang b/utils/yangutils/plugin/src/test/resources/UnionWithoutChild.yang
deleted file mode 100644
index 14d3329..0000000
--- a/utils/yangutils/plugin/src/test/resources/UnionWithoutChild.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "invalid-interval";
- leaf invalid-interval {
- type union {
- type "union";
- }
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/UnitsDefaultValue.yang b/utils/yangutils/plugin/src/test/resources/UnitsDefaultValue.yang
deleted file mode 100644
index c71d5ea..0000000
--- a/utils/yangutils/plugin/src/test/resources/UnitsDefaultValue.yang
+++ /dev/null
@@ -1,8 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type "uint16";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/UnitsStatement.yang b/utils/yangutils/plugin/src/test/resources/UnitsStatement.yang
deleted file mode 100644
index 70349a0..0000000
--- a/utils/yangutils/plugin/src/test/resources/UnitsStatement.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- description "Interval before a route is declared invalid";
- config true;
- mandatory true;
- status current;
- reference "RFC 6020";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/UnitsStatementCardinality.yang b/utils/yangutils/plugin/src/test/resources/UnitsStatementCardinality.yang
deleted file mode 100644
index 50a2ba0..0000000
--- a/utils/yangutils/plugin/src/test/resources/UnitsStatementCardinality.yang
+++ /dev/null
@@ -1,10 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- units "minutes";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/UnitsStatementOrder.yang b/utils/yangutils/plugin/src/test/resources/UnitsStatementOrder.yang
deleted file mode 100644
index e41e201..0000000
--- a/utils/yangutils/plugin/src/test/resources/UnitsStatementOrder.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- units "seconds";
- type "uint16";
- description "Interval before a route is declared invalid";
- config true;
- mandatory true;
- status current;
- reference "RFC 6020";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/UnitsWithoutStatementEnd.yang b/utils/yangutils/plugin/src/test/resources/UnitsWithoutStatementEnd.yang
deleted file mode 100644
index 889d7b7..0000000
--- a/utils/yangutils/plugin/src/test/resources/UnitsWithoutStatementEnd.yang
+++ /dev/null
@@ -1,9 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type "uint16";
- units "seconds"
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/UsesInContainer.yang b/utils/yangutils/plugin/src/test/resources/UsesInContainer.yang
deleted file mode 100644
index df52fd6..0000000
--- a/utils/yangutils/plugin/src/test/resources/UsesInContainer.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- grouping endpoint {
- }
- container valid {
- uses endpoint {
- description "grouping under test";
- status current;
- reference "RFC 6020";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/UsesInList.yang b/utils/yangutils/plugin/src/test/resources/UsesInList.yang
deleted file mode 100644
index 6ac7795..0000000
--- a/utils/yangutils/plugin/src/test/resources/UsesInList.yang
+++ /dev/null
@@ -1,21 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- import ietf-yang-types {
- prefix "P";
- }
- grouping endpoint {
- }
- list valid {
- key address;
- leaf address {
- type P:ip;
- }
- uses endpoint {
- description "grouping under test";
- status current;
- reference "RFC 6020";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/UsesInModule.yang b/utils/yangutils/plugin/src/test/resources/UsesInModule.yang
deleted file mode 100644
index 02b9f09..0000000
--- a/utils/yangutils/plugin/src/test/resources/UsesInModule.yang
+++ /dev/null
@@ -1,8 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- grouping endpoint {
- }
- uses endpoint;
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ValidAugmentStatement.yang b/utils/yangutils/plugin/src/test/resources/ValidAugmentStatement.yang
deleted file mode 100644
index f6c247e..0000000
--- a/utils/yangutils/plugin/src/test/resources/ValidAugmentStatement.yang
+++ /dev/null
@@ -1,17 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://example.com/schema/ds0;
- prefix On;
-
- import interface-module {
- prefix "if";
- }
- import ietf-yang-types {
- prefix "P";
- }
- augment "/if:interfaces/if:ifEntry" {
- leaf ds0ChannelNumber {
- type P:ChannelNumber;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ValidBinaryLengthStatement.yang b/utils/yangutils/plugin/src/test/resources/ValidBinaryLengthStatement.yang
deleted file mode 100644
index 7182eb3..0000000
--- a/utils/yangutils/plugin/src/test/resources/ValidBinaryLengthStatement.yang
+++ /dev/null
@@ -1,10 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf message {
- type binary {
- length "4";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ValidCompilerAnnotation.yang b/utils/yangutils/plugin/src/test/resources/ValidCompilerAnnotation.yang
deleted file mode 100644
index 7913fab..0000000
--- a/utils/yangutils/plugin/src/test/resources/ValidCompilerAnnotation.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module event {
-
- namespace "http://example.com/event";
- prefix "ev";
-
- ca:compiler-annotation "/candidate-servers/server" {
- abc:app-data-structure "map" {
- ca:key "name";
- }
- xyz:app-extended-name "special-server";
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/ValidExtensionStatement.yang b/utils/yangutils/plugin/src/test/resources/ValidExtensionStatement.yang
deleted file mode 100644
index ca134fa..0000000
--- a/utils/yangutils/plugin/src/test/resources/ValidExtensionStatement.yang
+++ /dev/null
@@ -1,36 +0,0 @@
-module ietf-yang-compiler-annotation {
-
- namespace "urn:ietf:params:xml:ns:yang:ietf-yang-compiler-annotation";
-
- prefix "ca";
-
- organization
- "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
-
- contact
- "WG Web: <http://tools.ietf.org/wg/netmod/>
- WG List: <mailto:netmod@ietf.org>";
-
- description
- "This YANG module defines an extension statement that allows for
- defining compiler annotations.
-
- The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL
- NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'MAY', and
- 'OPTIONAL' in the module text are to be interpreted as described
- in RFC 2119 (http://tools.ietf.org/html/rfc2119).";
-
- revision 2016-07-08 {
- description
- "Initial revision.";
- reference
- "draft-agv-netmod-yang-compiler-metadata:
- Defining and Using compiler annotations with YANG";
- }
-
- extension compiler-annotation {
- argument target;
- description "This extension allows for defining compiler annotations";
- } // compiler-annotation
- } //module agv-yang-compiler-annotation
-
diff --git a/utils/yangutils/plugin/src/test/resources/ValidLengthStatement.yang b/utils/yangutils/plugin/src/test/resources/ValidLengthStatement.yang
deleted file mode 100644
index 57cb809..0000000
--- a/utils/yangutils/plugin/src/test/resources/ValidLengthStatement.yang
+++ /dev/null
@@ -1,10 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type string {
- length "0..100";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ValidLengthStatementInsideBinary.yang b/utils/yangutils/plugin/src/test/resources/ValidLengthStatementInsideBinary.yang
deleted file mode 100644
index 7182eb3..0000000
--- a/utils/yangutils/plugin/src/test/resources/ValidLengthStatementInsideBinary.yang
+++ /dev/null
@@ -1,10 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf message {
- type binary {
- length "4";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ValidNotificationStatement.yang b/utils/yangutils/plugin/src/test/resources/ValidNotificationStatement.yang
deleted file mode 100644
index 1e0f144..0000000
--- a/utils/yangutils/plugin/src/test/resources/ValidNotificationStatement.yang
+++ /dev/null
@@ -1,26 +0,0 @@
-module rock {
- namespace "http://example.net/rock";
- prefix "rock";
-
- import ietf-yang-types {
- prefix "P";
- }
- notification link-failure {
- description "A link failure has been detected";
- status deprecated;
- reference "reference";
- typedef my-type {
- status deprecated;
- type int32;
- }
- leaf if-name {
- type string;
- }
- leaf if-admin-status {
- type P:admin-status;
- }
- leaf if-oper-status {
- type P:oper-status;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ValidPatternStatement.yang b/utils/yangutils/plugin/src/test/resources/ValidPatternStatement.yang
deleted file mode 100644
index 556db31..0000000
--- a/utils/yangutils/plugin/src/test/resources/ValidPatternStatement.yang
+++ /dev/null
@@ -1,10 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type string {
- pattern "[a-zA-Z]";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ValidRangeStatement.yang b/utils/yangutils/plugin/src/test/resources/ValidRangeStatement.yang
deleted file mode 100644
index 4243040..0000000
--- a/utils/yangutils/plugin/src/test/resources/ValidRangeStatement.yang
+++ /dev/null
@@ -1,11 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type int32 {
- range "1..4 | 10..20";
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/ValidRpcStatement.yang b/utils/yangutils/plugin/src/test/resources/ValidRpcStatement.yang
deleted file mode 100644
index f188227..0000000
--- a/utils/yangutils/plugin/src/test/resources/ValidRpcStatement.yang
+++ /dev/null
@@ -1,24 +0,0 @@
-module rock {
- namespace "http://example.net/rock";
- prefix "rock";
-
- rpc rock-the-house {
- description "description";
- status current;
- reference "reference";
- typedef my-type {
- status deprecated;
- type int32;
- }
- input {
- leaf zip-code {
- type string;
- }
- }
- output {
- leaf status {
- type string;
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ValidSameGroupingEntryInModuleAndContainer.yang b/utils/yangutils/plugin/src/test/resources/ValidSameGroupingEntryInModuleAndContainer.yang
deleted file mode 100644
index 2580cdd..0000000
--- a/utils/yangutils/plugin/src/test/resources/ValidSameGroupingEntryInModuleAndContainer.yang
+++ /dev/null
@@ -1,23 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- grouping endpoint {
- leaf address {
- type ip-address;
- }
- leaf port {
- type port-number;
- }
- }
- container valid {
- grouping endpoint {
- leaf address {
- type ip-address;
- }
- leaf port {
- type port-number;
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ValidVersionWithDoubleQuotes.yang b/utils/yangutils/plugin/src/test/resources/ValidVersionWithDoubleQuotes.yang
deleted file mode 100644
index a2c718a..0000000
--- a/utils/yangutils/plugin/src/test/resources/ValidVersionWithDoubleQuotes.yang
+++ /dev/null
@@ -1,5 +0,0 @@
-module Test {
-yang-version "1";
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ValueAndAutoStatement.yang b/utils/yangutils/plugin/src/test/resources/ValueAndAutoStatement.yang
deleted file mode 100644
index 89ba403..0000000
--- a/utils/yangutils/plugin/src/test/resources/ValueAndAutoStatement.yang
+++ /dev/null
@@ -1,16 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf speed {
- type enumeration {
- enum 10m {
- value 10;
- }
- enum 100m;
- enum auto {
- value 1000;
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ValueDuplication.yang b/utils/yangutils/plugin/src/test/resources/ValueDuplication.yang
deleted file mode 100644
index 339a737..0000000
--- a/utils/yangutils/plugin/src/test/resources/ValueDuplication.yang
+++ /dev/null
@@ -1,18 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf speed {
- type enumeration {
- enum 10m {
- value 10;
- }
- enum 100m {
- value 100;
- }
- enum auto {
- value 10;
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ValueExplicitAndAutoDuplication.yang b/utils/yangutils/plugin/src/test/resources/ValueExplicitAndAutoDuplication.yang
deleted file mode 100644
index 3e58155..0000000
--- a/utils/yangutils/plugin/src/test/resources/ValueExplicitAndAutoDuplication.yang
+++ /dev/null
@@ -1,16 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf speed {
- type enumeration {
- enum 10m {
- value 10;
- }
- enum 100m;
- enum auto {
- value 11;
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ValueStatement.yang b/utils/yangutils/plugin/src/test/resources/ValueStatement.yang
deleted file mode 100644
index f461359..0000000
--- a/utils/yangutils/plugin/src/test/resources/ValueStatement.yang
+++ /dev/null
@@ -1,18 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf speed {
- type enumeration {
- enum 10m {
- value 10;
- }
- enum 100m {
- value 100;
- }
- enum auto {
- value 1000;
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ValueStatementWithNegativeValue.yang b/utils/yangutils/plugin/src/test/resources/ValueStatementWithNegativeValue.yang
deleted file mode 100644
index a3f236b..0000000
--- a/utils/yangutils/plugin/src/test/resources/ValueStatementWithNegativeValue.yang
+++ /dev/null
@@ -1,18 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf speed {
- type enumeration {
- enum 10m {
- value -2;
- }
- enum 100m {
- value "-1";
- }
- enum auto {
- value 0;
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/ValueStatementWithQuotes.yang b/utils/yangutils/plugin/src/test/resources/ValueStatementWithQuotes.yang
deleted file mode 100644
index e166ca4..0000000
--- a/utils/yangutils/plugin/src/test/resources/ValueStatementWithQuotes.yang
+++ /dev/null
@@ -1,18 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf speed {
- type enumeration {
- enum 10m {
- value "10";
- }
- enum 100m {
- value "100";
- }
- enum auto {
- value "1000";
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/VersionDualEntry.yang b/utils/yangutils/plugin/src/test/resources/VersionDualEntry.yang
deleted file mode 100644
index f8eaddd..0000000
--- a/utils/yangutils/plugin/src/test/resources/VersionDualEntry.yang
+++ /dev/null
@@ -1,6 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-yang-version 1;
-}
diff --git a/utils/yangutils/plugin/src/test/resources/VersionInvalidSyntax.yang b/utils/yangutils/plugin/src/test/resources/VersionInvalidSyntax.yang
deleted file mode 100644
index 26cb0b2..0000000
--- a/utils/yangutils/plugin/src/test/resources/VersionInvalidSyntax.yang
+++ /dev/null
@@ -1,5 +0,0 @@
-module Test {
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-yang-version ;
-}
diff --git a/utils/yangutils/plugin/src/test/resources/VersionInvalidValue.yang b/utils/yangutils/plugin/src/test/resources/VersionInvalidValue.yang
deleted file mode 100644
index e8e6107..0000000
--- a/utils/yangutils/plugin/src/test/resources/VersionInvalidValue.yang
+++ /dev/null
@@ -1,5 +0,0 @@
-module Test {
-yang-version 2;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-}
diff --git a/utils/yangutils/plugin/src/test/resources/VersionNotPresent.yang b/utils/yangutils/plugin/src/test/resources/VersionNotPresent.yang
deleted file mode 100644
index eed9953..0000000
--- a/utils/yangutils/plugin/src/test/resources/VersionNotPresent.yang
+++ /dev/null
@@ -1,4 +0,0 @@
-module Test {
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-}
diff --git a/utils/yangutils/plugin/src/test/resources/VersionOrder.yang b/utils/yangutils/plugin/src/test/resources/VersionOrder.yang
deleted file mode 100644
index 92463e9..0000000
--- a/utils/yangutils/plugin/src/test/resources/VersionOrder.yang
+++ /dev/null
@@ -1,5 +0,0 @@
-module Test {
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-yang-version 1;
-}
diff --git a/utils/yangutils/plugin/src/test/resources/VersionValidEntry.yang b/utils/yangutils/plugin/src/test/resources/VersionValidEntry.yang
deleted file mode 100644
index 439ded8..0000000
--- a/utils/yangutils/plugin/src/test/resources/VersionValidEntry.yang
+++ /dev/null
@@ -1,5 +0,0 @@
-module Test {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix On;
-}
diff --git a/utils/yangutils/plugin/src/test/resources/YangFileWithSyntaxError.yang b/utils/yangutils/plugin/src/test/resources/YangFileWithSyntaxError.yang
deleted file mode 100644
index 413a181..0000000
--- a/utils/yangutils/plugin/src/test/resources/YangFileWithSyntaxError.yang
+++ /dev/null
@@ -1,6 +0,0 @@
-module Antlrtest {
-yang-version 1
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix Ant;
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/YangFileWithoutSyntaxError.yang b/utils/yangutils/plugin/src/test/resources/YangFileWithoutSyntaxError.yang
deleted file mode 100644
index 4f4839f..0000000
--- a/utils/yangutils/plugin/src/test/resources/YangFileWithoutSyntaxError.yang
+++ /dev/null
@@ -1,6 +0,0 @@
-module Antlrtest {
-yang-version 1;
-namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
-prefix Ant;
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/augmentTranslator/test.yang b/utils/yangutils/plugin/src/test/resources/augmentTranslator/test.yang
deleted file mode 100644
index 3fa36b9..0000000
--- a/utils/yangutils/plugin/src/test/resources/augmentTranslator/test.yang
+++ /dev/null
@@ -1,114 +0,0 @@
-module test {
- namespace "test:test";
- prefix test ;
-
-
- import test1{
- prefix test1;
- }
-
- import test2{
- prefix test2;
- }
-
- include acme-types;
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- container cont1 {
- container cont2 {
- leaf leaf {
- type int32;
- }
- }
- }
-
- choice choice1 {
- case case1 {
- leaf case-leaf {
- type int32;
- }
- container case-container3 {
- leaf leafs {
- type int64;
- }
- }
- }
- }
-
-
- augment /cont3 {
- leaf leaf1 {
- type int32;
- }
- }
-
- augment /cont1/cont2 {
- leaf-list leaf2 {
- type int32;
- }
- }
- augment /choice1 {
- leaf-list leaf2 {
- type int32;
- }
- leaf leaf1 {
- type int32;
- }
- container case-container {
- leaf leafs {
- type int64;
- }
- }
- container case-container2 {
- leaf leafs {
- type int64;
- }
- }
- }
-
- augment /test1:cont1/test1:cont2 {
- leaf a {
- type int32;
- }
- }
-
- augment /test1:cont1/test1:cont2/test1:cont1s/test1:cont1s {
- leaf a {
- type int32;
- }
- }
-
- augment /test1:cont1/test1:cont2/test1:cont1s/test1:cont1s/test2:aa {
- leaf name {
- type string;
- }
- leaf surname {
- type string;
- }
- leaf-list aleaflist {
- type int32;
- }
- container cont1 {
- }
- list alist {
- key "name";
- leaf name {
- type string;
- }
- leaf-list surname {
- type string;
- }
- }
- }
-
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/augmentTranslator/test2.yang b/utils/yangutils/plugin/src/test/resources/augmentTranslator/test2.yang
deleted file mode 100644
index 3b5de76..0000000
--- a/utils/yangutils/plugin/src/test/resources/augmentTranslator/test2.yang
+++ /dev/null
@@ -1,30 +0,0 @@
-module test1 {
- namespace "test1:test1";
- prefix test1 ;
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- container cont1 {
- container cont2 {
- }
- }
-
- augment /cont1/cont2 {
- leaf leaf4 {
- type int32;
- }
- container cont1s {
- container cont1s {
- }
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/augmentTranslator/test3.yang b/utils/yangutils/plugin/src/test/resources/augmentTranslator/test3.yang
deleted file mode 100644
index dca558c..0000000
--- a/utils/yangutils/plugin/src/test/resources/augmentTranslator/test3.yang
+++ /dev/null
@@ -1,26 +0,0 @@
-module test2 {
- namespace "test2:test2";
- prefix test2 ;
-
- import test1{
- prefix test1;
- }
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
-
- augment /test1:cont1/test1:cont2/test1:cont1s/test1:cont1s {
- leaf leaf5 {
- type int32;
- }
- container aa {
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/augmentTranslator/test4.yang b/utils/yangutils/plugin/src/test/resources/augmentTranslator/test4.yang
deleted file mode 100644
index bed22db..0000000
--- a/utils/yangutils/plugin/src/test/resources/augmentTranslator/test4.yang
+++ /dev/null
@@ -1,18 +0,0 @@
-submodule acme-types {
-
- belongs-to "test" {
- prefix "test";
- }
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- container cont3 {
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64MultiTypedefMultiInvalidRangeStatement.yang b/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64MultiTypedefMultiInvalidRangeStatement.yang
deleted file mode 100644
index 966b387..0000000
--- a/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64MultiTypedefMultiInvalidRangeStatement.yang
+++ /dev/null
@@ -1,22 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
-
- typedef topDecimal {
- type decimal64 {
- fraction-digits 4;
- range 4..11;
- }
- }
-
- typedef midDecimal {
- type topDecimal;
- }
-
- leaf lowerDecimal {
- type midDecimal {
- range 1..12;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64MultiTypedefMultiRangeStatement.yang b/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64MultiTypedefMultiRangeStatement.yang
deleted file mode 100644
index 76f215a..0000000
--- a/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64MultiTypedefMultiRangeStatement.yang
+++ /dev/null
@@ -1,22 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
-
- typedef topDecimal {
- type decimal64 {
- fraction-digits 4;
- range 1..12;
- }
- }
-
- typedef midDecimal {
- type topDecimal;
- }
-
- leaf lowerDecimal {
- type midDecimal {
- range 4..11;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64MultiTypedefRangeInLeafStatement.yang b/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64MultiTypedefRangeInLeafStatement.yang
deleted file mode 100644
index eea48f4..0000000
--- a/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64MultiTypedefRangeInLeafStatement.yang
+++ /dev/null
@@ -1,21 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
-
- typedef topDecimal {
- type decimal64 {
- fraction-digits 4;
- }
- }
-
- typedef midDecimal {
- type topDecimal;
- }
-
- leaf lowerDecimal {
- type midDecimal {
- range 1..12;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64MultiTypedefRangeStatement.yang b/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64MultiTypedefRangeStatement.yang
deleted file mode 100644
index b4c0a36..0000000
--- a/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64MultiTypedefRangeStatement.yang
+++ /dev/null
@@ -1,20 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
-
- typedef topDecimal {
- type decimal64 {
- fraction-digits 4;
- range 1..12;
- }
- }
-
- typedef midDecimal {
- type topDecimal;
- }
-
- leaf lowerDecimal {
- type midDecimal;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64MultiTypedefStatement.yang b/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64MultiTypedefStatement.yang
deleted file mode 100644
index 8682aac..0000000
--- a/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64MultiTypedefStatement.yang
+++ /dev/null
@@ -1,19 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
-
- typedef topDecimal {
- type decimal64 {
- fraction-digits 4;
- }
- }
-
- typedef midDecimal {
- type topDecimal;
- }
-
- leaf lowerDecimal {
- type midDecimal;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64MultiTypedefWithMaxRange.yang b/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64MultiTypedefWithMaxRange.yang
deleted file mode 100644
index 405d08c..0000000
--- a/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64MultiTypedefWithMaxRange.yang
+++ /dev/null
@@ -1,22 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
-
- typedef topDecimal {
- type decimal64 {
- fraction-digits 4;
- range 1..12;
- }
- }
-
- typedef midDecimal {
- type topDecimal;
- }
-
- leaf lowerDecimal {
- type midDecimal {
- range 4..max;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64TypeInvalidMaxValueFraction.yang b/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64TypeInvalidMaxValueFraction.yang
deleted file mode 100644
index 68bd8df..0000000
--- a/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64TypeInvalidMaxValueFraction.yang
+++ /dev/null
@@ -1,11 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
-
- leaf invalidDecimal1 {
- type decimal64 {
- fraction-digits 19;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64TypeInvalidMinValueFraction1.yang b/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64TypeInvalidMinValueFraction1.yang
deleted file mode 100644
index 3d7445a..0000000
--- a/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64TypeInvalidMinValueFraction1.yang
+++ /dev/null
@@ -1,11 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
-
- leaf invalidDecimal2 {
- type decimal64 {
- fraction-digits 0;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64TypeInvalidMinValueFraction2.yang b/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64TypeInvalidMinValueFraction2.yang
deleted file mode 100644
index 4e17bbe..0000000
--- a/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64TypeInvalidMinValueFraction2.yang
+++ /dev/null
@@ -1,11 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
-
- leaf invalidDecimal3 {
- type decimal64 {
- fraction-digits -1;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64TypeInvalidRangeStmnt.yang b/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64TypeInvalidRangeStmnt.yang
deleted file mode 100644
index 2ac3d94..0000000
--- a/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64TypeInvalidRangeStmnt.yang
+++ /dev/null
@@ -1,11 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf validDecimal {
- type decimal64 {
- fraction-digits 18;
- range "1 .. 20.14";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64TypeStatement.yang b/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64TypeStatement.yang
deleted file mode 100644
index 9824c12..0000000
--- a/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64TypeStatement.yang
+++ /dev/null
@@ -1,10 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf validDecimal {
- type decimal64 {
- fraction-digits 2;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64TypeValidation.yang b/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64TypeValidation.yang
deleted file mode 100644
index 06bf5b7..0000000
--- a/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64TypeValidation.yang
+++ /dev/null
@@ -1,10 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf validDecimal {
- type decimal64 {
- fraction-digits 18;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64TypeWithMultiValueRangeStmnt.yang b/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64TypeWithMultiValueRangeStmnt.yang
deleted file mode 100644
index f657134..0000000
--- a/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64TypeWithMultiValueRangeStmnt.yang
+++ /dev/null
@@ -1,11 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf validDecimal {
- type decimal64 {
- fraction-digits 18;
- range "-9.22..7.22 | 8 | 9..max";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64TypeWithRangeStatement.yang b/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64TypeWithRangeStatement.yang
deleted file mode 100644
index f184927..0000000
--- a/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64TypeWithRangeStatement.yang
+++ /dev/null
@@ -1,11 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf validDecimal {
- type decimal64 {
- fraction-digits 8;
- range "-92233720368.54775808 .. 92233720368.54775807";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64TypeWithoutFraction.yang b/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64TypeWithoutFraction.yang
deleted file mode 100644
index e7b8beb..0000000
--- a/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64TypeWithoutFraction.yang
+++ /dev/null
@@ -1,8 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf validDecimal {
- type decimal64;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64TypedefStatement.yang b/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64TypedefStatement.yang
deleted file mode 100644
index 66addd2..0000000
--- a/utils/yangutils/plugin/src/test/resources/decimal64/Decimal64TypedefStatement.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
-
- typedef validDecimal {
- type decimal64 {
- fraction-digits 4;
- }
- }
-
- leaf setFourDecimal {
- type validDecimal;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/default/DefaultCaseInChoiceSubStatement.yang b/utils/yangutils/plugin/src/test/resources/default/DefaultCaseInChoiceSubStatement.yang
deleted file mode 100644
index 72b597b..0000000
--- a/utils/yangutils/plugin/src/test/resources/default/DefaultCaseInChoiceSubStatement.yang
+++ /dev/null
@@ -1,23 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container food {
- choice snack {
- case sports-arena {
- leaf pretzel {
- type string;
- }
- leaf beer {
- type string;
- }
- }
- case late-night {
- leaf chocolate {
- type string;
- }
- }
- default "sports-arena";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/default/DefaultInvalidValueBinaryInLeaf.yang b/utils/yangutils/plugin/src/test/resources/default/DefaultInvalidValueBinaryInLeaf.yang
deleted file mode 100644
index aab417b..0000000
--- a/utils/yangutils/plugin/src/test/resources/default/DefaultInvalidValueBinaryInLeaf.yang
+++ /dev/null
@@ -1,12 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
-
- leaf message {
- type binary {
- length "8";
- }
- default "000";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/default/DefaultInvalidValueBitsInLeaf.yang b/utils/yangutils/plugin/src/test/resources/default/DefaultInvalidValueBitsInLeaf.yang
deleted file mode 100644
index 2e84cf3..0000000
--- a/utils/yangutils/plugin/src/test/resources/default/DefaultInvalidValueBitsInLeaf.yang
+++ /dev/null
@@ -1,20 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
-
- leaf mybits {
- type bits {
- bit disable-nagle {
- position 0;
- }
- bit auto-sense-speed {
- position 1;
- }
- bit Mb-only {
- position 2;
- }
- }
- default "xyz";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/default/DefaultInvalidValueBooleanInLeaf.yang b/utils/yangutils/plugin/src/test/resources/default/DefaultInvalidValueBooleanInLeaf.yang
deleted file mode 100644
index 1d98df9..0000000
--- a/utils/yangutils/plugin/src/test/resources/default/DefaultInvalidValueBooleanInLeaf.yang
+++ /dev/null
@@ -1,10 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
-
- leaf myboolean {
- type boolean;
- default "yes";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/default/DefaultInvalidValueDecimal64InLeaf.yang b/utils/yangutils/plugin/src/test/resources/default/DefaultInvalidValueDecimal64InLeaf.yang
deleted file mode 100644
index 305235f..0000000
--- a/utils/yangutils/plugin/src/test/resources/default/DefaultInvalidValueDecimal64InLeaf.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
-
- leaf mydecimal {
- type decimal64 {
- fraction-digits 4;
- range 4..6;
- }
- default "x";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/default/DefaultInvalidValueEnumerationInLeaf.yang b/utils/yangutils/plugin/src/test/resources/default/DefaultInvalidValueEnumerationInLeaf.yang
deleted file mode 100644
index 643dac3..0000000
--- a/utils/yangutils/plugin/src/test/resources/default/DefaultInvalidValueEnumerationInLeaf.yang
+++ /dev/null
@@ -1,16 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
-
- leaf myenum {
- type enumeration {
- enum zero;
- enum one;
- enum seven {
- value 7;
- }
- }
- default "xyz";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/default/DefaultInvalidValueInChoiceSubStmt.yang b/utils/yangutils/plugin/src/test/resources/default/DefaultInvalidValueInChoiceSubStmt.yang
deleted file mode 100644
index b9fd60d..0000000
--- a/utils/yangutils/plugin/src/test/resources/default/DefaultInvalidValueInChoiceSubStmt.yang
+++ /dev/null
@@ -1,23 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container food {
- choice snack {
- case sports-arena {
- leaf pretzel {
- type string;
- }
- leaf beer {
- type string;
- }
- }
- case late-night {
- leaf chocolate {
- type string;
- }
- }
- default "hello";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/default/DefaultInvalidValueInLeafSubStatement.yang b/utils/yangutils/plugin/src/test/resources/default/DefaultInvalidValueInLeafSubStatement.yang
deleted file mode 100644
index 9b20fa2..0000000
--- a/utils/yangutils/plugin/src/test/resources/default/DefaultInvalidValueInLeafSubStatement.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- default "x";
- description "Interval before a route is declared invalid";
- config true;
- mandatory true;
- status current;
- reference "RFC 6020";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/default/DefaultInvalidValueInTypeDef.yang b/utils/yangutils/plugin/src/test/resources/default/DefaultInvalidValueInTypeDef.yang
deleted file mode 100644
index 35f8554..0000000
--- a/utils/yangutils/plugin/src/test/resources/default/DefaultInvalidValueInTypeDef.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
-
- typedef topInt {
- type int64;
- default "x";
- }
-
- leaf myValue {
- type topInt;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/default/DefaultInvalidValueStringInLeaf.yang b/utils/yangutils/plugin/src/test/resources/default/DefaultInvalidValueStringInLeaf.yang
deleted file mode 100644
index 28d3d22..0000000
--- a/utils/yangutils/plugin/src/test/resources/default/DefaultInvalidValueStringInLeaf.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
-
- leaf MyString {
- type string {
- length "0..4";
- pattern "[0-9a-fA-F]*";
- }
- default "2bB2bB";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/default/DefaultInvalidValueUnionInLeaf.yang b/utils/yangutils/plugin/src/test/resources/default/DefaultInvalidValueUnionInLeaf.yang
deleted file mode 100644
index 2bbb698..0000000
--- a/utils/yangutils/plugin/src/test/resources/default/DefaultInvalidValueUnionInLeaf.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
-
- leaf message {
- type union {
- type int32;
- type enumeration {
- enum "unbounded";
- }
- }
- default "xyz";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/default/DefaultInvalidValueWithRangeInTypedef.yang b/utils/yangutils/plugin/src/test/resources/default/DefaultInvalidValueWithRangeInTypedef.yang
deleted file mode 100644
index c4ca002..0000000
--- a/utils/yangutils/plugin/src/test/resources/default/DefaultInvalidValueWithRangeInTypedef.yang
+++ /dev/null
@@ -1,11 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- typedef hello {
- type int32 {
- range "1..4 | 10..20";
- }
- default "0";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/default/DefaultValueBinaryInLeaf.yang b/utils/yangutils/plugin/src/test/resources/default/DefaultValueBinaryInLeaf.yang
deleted file mode 100644
index fa6fb05..0000000
--- a/utils/yangutils/plugin/src/test/resources/default/DefaultValueBinaryInLeaf.yang
+++ /dev/null
@@ -1,12 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
-
- leaf message {
- type binary {
- length "8";
- }
- default "10010010";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/default/DefaultValueBitsInLeaf.yang b/utils/yangutils/plugin/src/test/resources/default/DefaultValueBitsInLeaf.yang
deleted file mode 100644
index 574df85..0000000
--- a/utils/yangutils/plugin/src/test/resources/default/DefaultValueBitsInLeaf.yang
+++ /dev/null
@@ -1,20 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
-
- leaf mybits {
- type bits {
- bit disable-nagle {
- position 0;
- }
- bit auto-sense-speed {
- position 1;
- }
- bit Mb-only {
- position 2;
- }
- }
- default "auto-sense-speed";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/default/DefaultValueBooleanInLeaf.yang b/utils/yangutils/plugin/src/test/resources/default/DefaultValueBooleanInLeaf.yang
deleted file mode 100644
index bb126ff..0000000
--- a/utils/yangutils/plugin/src/test/resources/default/DefaultValueBooleanInLeaf.yang
+++ /dev/null
@@ -1,10 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
-
- leaf myboolean {
- type boolean;
- default "true";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/default/DefaultValueDecimal64InLeaf.yang b/utils/yangutils/plugin/src/test/resources/default/DefaultValueDecimal64InLeaf.yang
deleted file mode 100644
index 18e566d..0000000
--- a/utils/yangutils/plugin/src/test/resources/default/DefaultValueDecimal64InLeaf.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
-
- leaf mydecimal {
- type decimal64 {
- fraction-digits 4;
- range 4..6;
- }
- default "5";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/default/DefaultValueDerivedInTypedef.yang b/utils/yangutils/plugin/src/test/resources/default/DefaultValueDerivedInTypedef.yang
deleted file mode 100644
index b787b18..0000000
--- a/utils/yangutils/plugin/src/test/resources/default/DefaultValueDerivedInTypedef.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
-
- typedef topInt {
- type int64;
- default "10";
- }
-
- leaf myValue {
- type topInt;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/default/DefaultValueEmptyInLeaf.yang b/utils/yangutils/plugin/src/test/resources/default/DefaultValueEmptyInLeaf.yang
deleted file mode 100644
index 8c8bbea..0000000
--- a/utils/yangutils/plugin/src/test/resources/default/DefaultValueEmptyInLeaf.yang
+++ /dev/null
@@ -1,10 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
-
- leaf enable-qos {
- type empty;
- default "something";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/default/DefaultValueEnumerationInLeaf.yang b/utils/yangutils/plugin/src/test/resources/default/DefaultValueEnumerationInLeaf.yang
deleted file mode 100644
index 2545976..0000000
--- a/utils/yangutils/plugin/src/test/resources/default/DefaultValueEnumerationInLeaf.yang
+++ /dev/null
@@ -1,16 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
-
- leaf myenum {
- type enumeration {
- enum zero;
- enum one;
- enum seven {
- value 7;
- }
- }
- default "one";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/default/DefaultValueInLeafSubStatement.yang b/utils/yangutils/plugin/src/test/resources/default/DefaultValueInLeafSubStatement.yang
deleted file mode 100644
index a78131d..0000000
--- a/utils/yangutils/plugin/src/test/resources/default/DefaultValueInLeafSubStatement.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- default "1";
- description "Interval before a route is declared invalid";
- config true;
- mandatory true;
- status current;
- reference "RFC 6020";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/default/DefaultValueInMultiTypeDef.yang b/utils/yangutils/plugin/src/test/resources/default/DefaultValueInMultiTypeDef.yang
deleted file mode 100644
index d25b7c2..0000000
--- a/utils/yangutils/plugin/src/test/resources/default/DefaultValueInMultiTypeDef.yang
+++ /dev/null
@@ -1,18 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
-
- typedef topInt {
- type int64;
- default "10";
- }
-
- typedef midInt {
- type topInt;
- }
-
- leaf lowInt {
- type midInt;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/default/DefaultValueInTypeDef.yang b/utils/yangutils/plugin/src/test/resources/default/DefaultValueInTypeDef.yang
deleted file mode 100644
index b787b18..0000000
--- a/utils/yangutils/plugin/src/test/resources/default/DefaultValueInTypeDef.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
-
- typedef topInt {
- type int64;
- default "10";
- }
-
- leaf myValue {
- type topInt;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/default/DefaultValueStringInLeaf.yang b/utils/yangutils/plugin/src/test/resources/default/DefaultValueStringInLeaf.yang
deleted file mode 100644
index 1bdb1e8..0000000
--- a/utils/yangutils/plugin/src/test/resources/default/DefaultValueStringInLeaf.yang
+++ /dev/null
@@ -1,13 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
-
- leaf MyString {
- type string {
- length "0..4";
- pattern "[0-9a-fA-F]*";
- }
- default "2bB";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/default/DefaultValueUnionInLeaf.yang b/utils/yangutils/plugin/src/test/resources/default/DefaultValueUnionInLeaf.yang
deleted file mode 100644
index e2b39c9..0000000
--- a/utils/yangutils/plugin/src/test/resources/default/DefaultValueUnionInLeaf.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
-
- leaf message {
- type union {
- type int32;
- type enumeration {
- enum "unbounded";
- }
- }
- default "unbounded";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/file1UsesFile2TypeDefFile3Type/ietf-inet-types.yang b/utils/yangutils/plugin/src/test/resources/file1UsesFile2TypeDefFile3Type/ietf-inet-types.yang
deleted file mode 100644
index db6df27..0000000
--- a/utils/yangutils/plugin/src/test/resources/file1UsesFile2TypeDefFile3Type/ietf-inet-types.yang
+++ /dev/null
@@ -1,12 +0,0 @@
- module ietf-inet-types {
-
- yang-version 1;
-
- namespace
- "urn:ietf:params:xml:ns:yang:ietf-inet-types";
-
- prefix inet;
- typedef uri {
- type string;
- }
- }
diff --git a/utils/yangutils/plugin/src/test/resources/file1UsesFile2TypeDefFile3Type/ietf-network-topology.yang b/utils/yangutils/plugin/src/test/resources/file1UsesFile2TypeDefFile3Type/ietf-network-topology.yang
deleted file mode 100644
index 4f426e4..0000000
--- a/utils/yangutils/plugin/src/test/resources/file1UsesFile2TypeDefFile3Type/ietf-network-topology.yang
+++ /dev/null
@@ -1,34 +0,0 @@
- module ietf-network-topology {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-network-topology";
- prefix lnk;
-
- import ietf-inet-types {
- prefix inet;
- }
-
- typedef tp-id {
- type inet:uri;
- description
- "An identifier for termination points on a node.
- The identifier SHOULD be chosen such that the same TP in a
- real network topology will always be identified through the
- same identifier, even if the model is instantiated in
- separate datastores. An implementation MAY choose to capture
- semantics in the identifier, for example to indicate the type
- of TP and/or the type of node and topology that the TP is a
- part of.";
- }
-
- grouping tp-ref {
- description
- "References a termination point in a specific node.";
- leaf tp-ref {
- type tp-id;
- description
- "A type for an absolute reference to a termination point.
- (This type should not be used for relative references.
- In such a case, a relative path should be used instead.)";
- }
- }
- }
diff --git a/utils/yangutils/plugin/src/test/resources/file1UsesFile2TypeDefFile3Type/ietf-te-topology.yang b/utils/yangutils/plugin/src/test/resources/file1UsesFile2TypeDefFile3Type/ietf-te-topology.yang
deleted file mode 100644
index c1d9324..0000000
--- a/utils/yangutils/plugin/src/test/resources/file1UsesFile2TypeDefFile3Type/ietf-te-topology.yang
+++ /dev/null
@@ -1,17 +0,0 @@
- module ietf-te-topology {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-te-topology";
- // replace with IANA namespace when assigned
-
- prefix "tet";
-
- import ietf-network-topology {
- prefix "nt";
- }
-
- container underlay-trail-src {
- uses nt:tp-ref;
- description
- "Source TE link of the underlay trail.";
- }
- }
diff --git a/utils/yangutils/plugin/src/test/resources/groupingNodeSameAsModule/portpair.yang b/utils/yangutils/plugin/src/test/resources/groupingNodeSameAsModule/portpair.yang
deleted file mode 100644
index 3497f04..0000000
--- a/utils/yangutils/plugin/src/test/resources/groupingNodeSameAsModule/portpair.yang
+++ /dev/null
@@ -1,29 +0,0 @@
-module port-pair {
-
- yang-version 1;
-
- namespace "sfc.portpair";
-
- prefix "port-pair";
-
- grouping port-pair {
- container port-pair {
-
- leaf name {
- type string;
- }
-
-
- leaf description {
- type string;
- }
-
- }
- }
-
- rpc get-port-pair {
- output {
- uses port-pair;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/hierarchicalinterfiletype/ietf-inet-types.yang b/utils/yangutils/plugin/src/test/resources/hierarchicalinterfiletype/ietf-inet-types.yang
deleted file mode 100644
index 38f209f..0000000
--- a/utils/yangutils/plugin/src/test/resources/hierarchicalinterfiletype/ietf-inet-types.yang
+++ /dev/null
@@ -1,15 +0,0 @@
- module ietf-inet-types {
-
- yang-version 1;
-
- namespace
- "urn:ietf:params:xml:ns:yang:ietf-inet-types";
-
- prefix inet;
-
-
-
- typedef uri {
- type string;
- }
- }
diff --git a/utils/yangutils/plugin/src/test/resources/hierarchicalinterfiletype/ietf-network-topology.yang b/utils/yangutils/plugin/src/test/resources/hierarchicalinterfiletype/ietf-network-topology.yang
deleted file mode 100644
index 6e9dfb7..0000000
--- a/utils/yangutils/plugin/src/test/resources/hierarchicalinterfiletype/ietf-network-topology.yang
+++ /dev/null
@@ -1,17 +0,0 @@
- module ietf-network-topology {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-network-topology";
- prefix nt;
-
- import ietf-inet-types {
- prefix inet;
- }
- import ietf-network {
- prefix nd;
- }
- leaf source-node {
- type nd:node-id;
- description
- "Source node identifier, must be in same topology.";
- }
- }
diff --git a/utils/yangutils/plugin/src/test/resources/hierarchicalinterfiletype/ietf-network.yang b/utils/yangutils/plugin/src/test/resources/hierarchicalinterfiletype/ietf-network.yang
deleted file mode 100644
index 1f15b40..0000000
--- a/utils/yangutils/plugin/src/test/resources/hierarchicalinterfiletype/ietf-network.yang
+++ /dev/null
@@ -1,16 +0,0 @@
- module ietf-network {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-network";
- prefix nd;
-
- import ietf-inet-types {
- prefix inet;
- }
-
- typedef node-id {
- type inet:uri;
- description
- "Identifier for a node.";
- }
-
- }
diff --git a/utils/yangutils/plugin/src/test/resources/hierarchicalintrawithinterfiletype/ietf-inet-types.yang b/utils/yangutils/plugin/src/test/resources/hierarchicalintrawithinterfiletype/ietf-inet-types.yang
deleted file mode 100644
index 48d13c6..0000000
--- a/utils/yangutils/plugin/src/test/resources/hierarchicalintrawithinterfiletype/ietf-inet-types.yang
+++ /dev/null
@@ -1,13 +0,0 @@
- module ietf-inet-types {
-
- yang-version 1;
-
- namespace
- "urn:ietf:params:xml:ns:yang:ietf-inet-types";
-
- prefix inet;
-
- typedef uri {
- type string;
- }
- }
diff --git a/utils/yangutils/plugin/src/test/resources/hierarchicalintrawithinterfiletype/ietf-network.yang b/utils/yangutils/plugin/src/test/resources/hierarchicalintrawithinterfiletype/ietf-network.yang
deleted file mode 100644
index e35d0f5..0000000
--- a/utils/yangutils/plugin/src/test/resources/hierarchicalintrawithinterfiletype/ietf-network.yang
+++ /dev/null
@@ -1,22 +0,0 @@
- module ietf-network {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-network";
- prefix nd;
-
- import ietf-inet-types {
- prefix inet;
- }
- leaf node-ref {
- type node-id;
- description
- "Used to reference a node.
- Nodes are identified relative to the network they are
- contained in.";
- }
-
- typedef node-id {
- type inet:uri;
- description
- "Identifier for a node.";
- }
- }
diff --git a/utils/yangutils/plugin/src/test/resources/identityRef/identityRef.yang b/utils/yangutils/plugin/src/test/resources/identityRef/identityRef.yang
deleted file mode 100644
index a7389e7..0000000
--- a/utils/yangutils/plugin/src/test/resources/identityRef/identityRef.yang
+++ /dev/null
@@ -1,19 +0,0 @@
-module IdentityTest{
- yang-version 1;
- namespace http://huawei.com;
- prefix IdentityTest;
-
- identity ref-address-family {
- description "ref-address-family";
- }
-
- identity ipv4-address-family {
- base ref-address-family;
- }
-
- leaf tunnel {
- type identityref {
- base ref-address-family;
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/ietfyang/l3vpnservice/ietf-inet-types.yang b/utils/yangutils/plugin/src/test/resources/ietfyang/l3vpnservice/ietf-inet-types.yang
deleted file mode 100644
index 851a4d7..0000000
--- a/utils/yangutils/plugin/src/test/resources/ietfyang/l3vpnservice/ietf-inet-types.yang
+++ /dev/null
@@ -1,454 +0,0 @@
- module ietf-inet-types {
-
- yang-version 1;
-
- namespace
- "urn:ietf:params:xml:ns:yang:ietf-inet-types";
-
- prefix inet;
-
- organization
- "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
-
- contact
- "WG Web: <http://tools.ietf.org/wg/netmod/>
- WG List: <mailto:netmod@ietf.org>
-
- WG Chair: David Kessens
- <mailto:david.kessens@nsn.com>
-
- WG Chair: Juergen Schoenwaelder
- <mailto:j.schoenwaelder@jacobs-university.de>
-
- Editor: Juergen Schoenwaelder
- <mailto:j.schoenwaelder@jacobs-university.de>";
-
- description
- "This module contains a collection of generally useful derived
- YANG data types for Internet addresses and related things.
-
- Copyright (c) 2013 IETF Trust and the persons identified as
- authors of the code. All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, is permitted pursuant to, and subject
- to the license terms contained in, the Simplified BSD License
- set forth in Section 4.c of the IETF Trust's Legal Provisions
- Relating to IETF Documents
- (http://trustee.ietf.org/license-info).
-
- This version of this YANG module is part of RFC 6991; see
- the RFC itself for full legal notices.";
-
- revision "2013-07-15" {
- description
- "This revision adds the following new data types:
- - ip-address-no-zone
- - ipv4-address-no-zone
- - ipv6-address-no-zone";
- reference
- "RFC 6991: Common YANG Data Types";
-
- }
-
- revision "2010-09-24" {
- description "Initial revision.";
- reference
- "RFC 6021: Common YANG Data Types";
-
- }
-
-
- typedef ip-version {
- type enumeration {
- enum "unknown" {
- value 0;
- description
- "An unknown or unspecified version of the Internet
- protocol.";
- }
- enum "ipv4" {
- value 1;
- description
- "The IPv4 protocol as defined in RFC 791.";
- }
- enum "ipv6" {
- value 2;
- description
- "The IPv6 protocol as defined in RFC 2460.";
- }
- }
- description
- "This value represents the version of the IP protocol.
-
- In the value set and its semantics, this type is equivalent
- to the InetVersion textual convention of the SMIv2.";
- reference
- "RFC 791: Internet Protocol
- RFC 2460: Internet Protocol, Version 6 (IPv6) Specification
- RFC 4001: Textual Conventions for Internet Network Addresses";
-
- }
-
- typedef dscp {
- type uint8 {
- range "0..63";
- }
- description
- "The dscp type represents a Differentiated Services Code Point
- that may be used for marking packets in a traffic stream.
- In the value set and its semantics, this type is equivalent
- to the Dscp textual convention of the SMIv2.";
- reference
- "RFC 3289: Management Information Base for the Differentiated
- Services Architecture
- RFC 2474: Definition of the Differentiated Services Field
- (DS Field) in the IPv4 and IPv6 Headers
- RFC 2780: IANA Allocation Guidelines For Values In
- the Internet Protocol and Related Headers";
-
- }
-
- typedef ipv6-flow-label {
- type uint32 {
- range "0..1048575";
- }
- description
- "The ipv6-flow-label type represents the flow identifier or Flow
- Label in an IPv6 packet header that may be used to
- discriminate traffic flows.
-
- In the value set and its semantics, this type is equivalent
- to the IPv6FlowLabel textual convention of the SMIv2.";
- reference
- "RFC 3595: Textual Conventions for IPv6 Flow Label
- RFC 2460: Internet Protocol, Version 6 (IPv6) Specification";
-
- }
-
- typedef port-number {
- type uint16 {
- range "0..65535";
- }
- description
- "The port-number type represents a 16-bit port number of an
- Internet transport-layer protocol such as UDP, TCP, DCCP, or
- SCTP. Port numbers are assigned by IANA. A current list of
- all assignments is available from <http://www.iana.org/>.
-
- Note that the port number value zero is reserved by IANA. In
- situations where the value zero does not make sense, it can
- be excluded by subtyping the port-number type.
- In the value set and its semantics, this type is equivalent
- to the InetPortNumber textual convention of the SMIv2.";
- reference
- "RFC 768: User Datagram Protocol
- RFC 793: Transmission Control Protocol
- RFC 4960: Stream Control Transmission Protocol
- RFC 4340: Datagram Congestion Control Protocol (DCCP)
- RFC 4001: Textual Conventions for Internet Network Addresses";
-
- }
-
- typedef as-number {
- type uint32;
- description
- "The as-number type represents autonomous system numbers
- which identify an Autonomous System (AS). An AS is a set
- of routers under a single technical administration, using
- an interior gateway protocol and common metrics to route
- packets within the AS, and using an exterior gateway
- protocol to route packets to other ASes. IANA maintains
- the AS number space and has delegated large parts to the
- regional registries.
-
- Autonomous system numbers were originally limited to 16
- bits. BGP extensions have enlarged the autonomous system
- number space to 32 bits. This type therefore uses an uint32
- base type without a range restriction in order to support
- a larger autonomous system number space.
-
- In the value set and its semantics, this type is equivalent
- to the InetAutonomousSystemNumber textual convention of
- the SMIv2.";
- reference
- "RFC 1930: Guidelines for creation, selection, and registration
- of an Autonomous System (AS)
- RFC 4271: A Border Gateway Protocol 4 (BGP-4)
- RFC 4001: Textual Conventions for Internet Network Addresses
- RFC 6793: BGP Support for Four-Octet Autonomous System (AS)
- Number Space";
-
- }
-
- typedef ip-address {
- type union {
- type ipv4-address;
- type ipv6-address;
- }
- description
- "The ip-address type represents an IP address and is IP
- version neutral. The format of the textual representation
- implies the IP version. This type supports scoped addresses
- by allowing zone identifiers in the address format.";
- reference
- "RFC 4007: IPv6 Scoped Address Architecture";
-
- }
-
- typedef ipv4-address {
- type string {
- pattern
- '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(%[\p{N}\p{L}]+)?';
- }
- description
- "The ipv4-address type represents an IPv4 address in
- dotted-quad notation. The IPv4 address may include a zone
- index, separated by a % sign.
-
- The zone index is used to disambiguate identical address
- values. For link-local addresses, the zone index will
- typically be the interface index number or the name of an
- interface. If the zone index is not present, the default
- zone of the device will be used.
-
- The canonical format for the zone index is the numerical
- format";
- }
-
- typedef ipv6-address {
- type string {
- pattern
- '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(%[\p{N}\p{L}]+)?';
- pattern
- '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)(%.+)?';
- }
- description
- "The ipv6-address type represents an IPv6 address in full,
- mixed, shortened, and shortened-mixed notation. The IPv6
- address may include a zone index, separated by a % sign.
-
- The zone index is used to disambiguate identical address
- values. For link-local addresses, the zone index will
- typically be the interface index number or the name of an
- interface. If the zone index is not present, the default
- zone of the device will be used.
-
-
-
- The canonical format of IPv6 addresses uses the textual
- representation defined in Section 4 of RFC 5952. The
- canonical format for the zone index is the numerical
- format as described in Section 11.2 of RFC 4007.";
- reference
- "RFC 4291: IP Version 6 Addressing Architecture
- RFC 4007: IPv6 Scoped Address Architecture
- RFC 5952: A Recommendation for IPv6 Address Text
- Representation";
-
- }
-
- typedef ip-address-no-zone {
- type union {
- type ipv4-address-no-zone;
- type ipv6-address-no-zone;
- }
- description
- "The ip-address-no-zone type represents an IP address and is
- IP version neutral. The format of the textual representation
- implies the IP version. This type does not support scoped
- addresses since it does not allow zone identifiers in the
- address format.";
- reference
- "RFC 4007: IPv6 Scoped Address Architecture";
-
- }
-
- typedef ipv4-address-no-zone {
- type ipv4-address {
- pattern '[0-9\.]*';
- }
- description
- "An IPv4 address without a zone index. This type, derived from
- ipv4-address, may be used in situations where the zone is
- known from the context and hence no zone index is needed.";
- }
-
- typedef ipv6-address-no-zone {
- type ipv6-address {
- pattern '[0-9a-fA-F:\.]*';
- }
- description
- "An IPv6 address without a zone index. This type, derived from
- ipv6-address, may be used in situations where the zone is
- known from the context and hence no zone index is needed.";
- reference
- "RFC 4291: IP Version 6 Addressing Architecture
- RFC 4007: IPv6 Scoped Address Architecture
- RFC 5952: A Recommendation for IPv6 Address Text
- Representation";
-
- }
-
- typedef ip-prefix {
- type union {
- type ipv4-prefix;
- type ipv6-prefix;
- }
- description
- "The ip-prefix type represents an IP prefix and is IP
- version neutral. The format of the textual representations
- implies the IP version.";
- }
-
- typedef ipv4-prefix {
- type string {
- pattern
- '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))';
- }
- description
- "The ipv4-prefix type represents an IPv4 address prefix.
- The prefix length is given by the number following the
- slash character and must be less than or equal to 32.
-
- A prefix length value of n corresponds to an IP address
- mask that has n contiguous 1-bits from the most
- significant bit (MSB) and all other bits set to 0.
-
- The canonical format of an IPv4 prefix has all bits of
- the IPv4 address set to zero that are not part of the
- IPv4 prefix.";
- }
-
- typedef ipv6-prefix {
- type string {
- pattern
- '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))';
- pattern
- '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)(/.+)';
- }
- description
- "The ipv6-prefix type represents an IPv6 address prefix.
- The prefix length is given by the number following the
- slash character and must be less than or equal to 128.
-
- A prefix length value of n corresponds to an IP address
- mask that has n contiguous 1-bits from the most
- significant bit (MSB) and all other bits set to 0.
-
- The IPv6 address should have all bits that do not belong
- to the prefix set to zero.
-
- The canonical format of an IPv6 prefix has all bits of
- the IPv6 address set to zero that are not part of the
- IPv6 prefix. Furthermore, the IPv6 address is represented
- as defined in Section 4 of RFC 5952.";
- reference
- "RFC 5952: A Recommendation for IPv6 Address Text
- Representation";
-
- }
-
- typedef domain-name {
- type string {
- length "1..253";
- pattern
- '((([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.)*([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.?)|\.';
- }
- description
- "The domain-name type represents a DNS domain name. The
- name SHOULD be fully qualified whenever possible.
-
- Internet domain names are only loosely specified. Section
- 3.5 of RFC 1034 recommends a syntax (modified in Section
- 2.1 of RFC 1123). The pattern above is intended to allow
- for current practice in domain name use, and some possible
- future expansion. It is designed to hold various types of
- domain names, including names used for A or AAAA records
- (host names) and other records, such as SRV records. Note
- that Internet host names have a stricter syntax (described
- in RFC 952) than the DNS recommendations in RFCs 1034 and
- 1123, and that systems that want to store host names in
- schema nodes using the domain-name type are recommended to
- adhere to this stricter standard to ensure interoperability.
-
- The encoding of DNS names in the DNS protocol is limited
- to 255 characters. Since the encoding consists of labels
- prefixed by a length bytes and there is a trailing NULL
- byte, only 253 characters can appear in the textual dotted
- notation.
-
- The description clause of schema nodes using the domain-name
- type MUST describe when and how these names are resolved to
- IP addresses. Note that the resolution of a domain-name value
- may require to query multiple DNS records (e.g., A for IPv4
- and AAAA for IPv6). The order of the resolution process and
- which DNS record takes precedence can either be defined
- explicitly or may depend on the configuration of the
- resolver.
-
- Domain-name values use the US-ASCII encoding. Their canonical
- format uses lowercase US-ASCII characters. Internationalized
- domain names MUST be A-labels as per RFC 5890.";
- reference
- "RFC 952: DoD Internet Host Table Specification
- RFC 1034: Domain Names - Concepts and Facilities
- RFC 1123: Requirements for Internet Hosts -- Application
- and Support
- RFC 2782: A DNS RR for specifying the location of services
- (DNS SRV)
- RFC 5890: Internationalized Domain Names in Applications
- (IDNA): Definitions and Document Framework";
-
- }
-
- typedef host {
- type union {
- type ip-address;
- type domain-name;
- }
- description
- "The host type represents either an IP address or a DNS
- domain name.";
- }
-
- typedef uri {
- type string;
- description
- "The uri type represents a Uniform Resource Identifier
- (URI) as defined by STD 66.
-
- Objects using the uri type MUST be in US-ASCII encoding,
- and MUST be normalized as described by RFC 3986 Sections
- 6.2.1, 6.2.2.1, and 6.2.2.2. All unnecessary
- percent-encoding is removed, and all case-insensitive
- characters are set to lowercase except for hexadecimal
- digits, which are normalized to uppercase as described in
- Section 6.2.2.1.
-
- The purpose of this normalization is to help provide
- unique URIs. Note that this normalization is not
- sufficient to provide uniqueness. Two URIs that are
- textually distinct after this normalization may still be
- equivalent.
-
- Objects using the uri type may restrict the schemes that
- they permit. For example, 'data:' and 'urn:' schemes
- might not be appropriate.
-
- A zero-length URI is not a valid URI. This can be used to
- express 'URI absent' where required.
-
- In the value set and its semantics, this type is equivalent
- to the Uri SMIv2 textual convention defined in RFC 5017.";
- reference
- "RFC 3986: Uniform Resource Identifier (URI): Generic Syntax
- RFC 3305: Report from the Joint W3C/IETF URI Planning Interest
- Group: Uniform Resource Identifiers (URIs), URLs,
- and Uniform Resource Names (URNs): Clarifications
- and Recommendations
- RFC 5017: MIB Textual Conventions for Uniform Resource
- Identifiers (URIs)";
-
- }
- } // module ietf-inet-types
diff --git a/utils/yangutils/plugin/src/test/resources/ietfyang/l3vpnservice/ietf-sd-onos-common-types.yang b/utils/yangutils/plugin/src/test/resources/ietfyang/l3vpnservice/ietf-sd-onos-common-types.yang
deleted file mode 100644
index 7cde2ec..0000000
--- a/utils/yangutils/plugin/src/test/resources/ietfyang/l3vpnservice/ietf-sd-onos-common-types.yang
+++ /dev/null
@@ -1,141 +0,0 @@
- module ietf-sd-onos-common-types {
- namespace "urn:ietf:params:xml:ns:yang:ietf-sd-onos-common-types";
- prefix types ;
- /*
- import ietf-inet-types{
- prefix inet;
- }
- import ietf-yang-types {
- prefix yang-types;
- }
- */
- organization "";
- contact "";
-
- description
- "Defines common basic types of L3VPN.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- typedef admin-status {
- type enumeration {
- enum admin-up {
- value 0 ;
- description "admin up, the operate-status is depend on the real
- running status ." ;
- }
- enum admin-down {
- value 1 ;
- description "admin down,the operate-status is forced to down no
- matter what the real status is" ;
- }
- enum config-up {
- value 2 ;
- description "the operate-status is forced to up no matter what
- the real status is." ;
- }
- }
- default admin-up;
- description
- "The administration status of the service.";
- }
-
- typedef notification-status {
- type enumeration {
- enum up {
- value 0 ;
- description "up." ;
- }
- enum down {
- value 1 ;
- description "down." ;
- }
- }
- default up;
- description
- "The notification status of the service.";
- }
-
- typedef notification-type {
- type enumeration {
- enum ne{
- value 0 ;
- description "ncd change." ;
- }
- enum link{
- value 1 ;
- description "link change." ;
- }
- enum ltp{
- value 2 ;
- description "ltp change." ;
- }
- }
- default ltp;
- description
- "The notification-type of the service.";
- }
-
- typedef operate-status {
- type enumeration {
- enum operate-up {
- value 0 ;
- description "operate up." ;
- }
- enum operate-down {
- value 1 ;
- description "operate down." ;
- }
- }
- default operate-up;
- description
- "The operation status of the service.";
- }
-
- grouping command-result {
- description
- "Reusable container of the result of the command.";
- container command-result {
- description
- "The result of the command.";
- leaf result {
- type int8;
- description
- "1 : success, 2 : failed, 3 : partly failed" ;
- }
- container success-resources {
- description
- "The resources those are available." ;
- list success-resource-list {
- description
- "The resource list shows those are available." ;
- leaf resource-id {
- type string;
- description
- "The available resource id." ;
- }
- }
- }
- container failed-resources {
- description
- "The resources those are failed." ;
- list failed-resource-list {
- description
- "The resources list shows those are failed." ;
- leaf resource-id {
- type string;
- description
- "The failed resources ids." ;
- }
- leaf error-code {
- type string;
- description
- "The error code." ;
- }
- }
- }
- }
- }
- }
diff --git a/utils/yangutils/plugin/src/test/resources/ietfyang/l3vpnservice/ietf-sd-onos-service-l3vpn.yang b/utils/yangutils/plugin/src/test/resources/ietfyang/l3vpnservice/ietf-sd-onos-service-l3vpn.yang
deleted file mode 100644
index 7b55f71..0000000
--- a/utils/yangutils/plugin/src/test/resources/ietfyang/l3vpnservice/ietf-sd-onos-service-l3vpn.yang
+++ /dev/null
@@ -1,316 +0,0 @@
- module ietf-sd-onos-service-l3vpn {
- namespace "urn:ietf:params:xml:ns:yang:ietf-sd-onos-service-l3vpn";
- prefix l3vpn ;
- /*
- import ietf-inet-types{
- prefix inet;
- }
- import ietf-yang-types {
- prefix yang-types;
- }
- */
- import ietf-sd-onos-service-types {
- prefix service-types;
- }
- import ietf-sd-onos-common-types {
- prefix types;
- }
- organization "";
- contact "";
-
- description
- "L3vpn configuration model in ONOS.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- grouping l3vpn {
- description
- "The configuration module of l3 vpn.";
- leaf name {
- type string ;
- mandatory true;
- description "name of snc eline." ;
- }
- leaf id {
- type uint32 ;
- mandatory true;
- description "ID of snc eline." ;
- }
- leaf user-label {
- type string ;
- description "user label of snc eline." ;
- }
- leaf parent-ncd-id {
- type string ;
- description "parent ncd id." ;
- }
-
- leaf admin-status {
- type types:admin-status;
- description "administration status." ;
- }
- leaf operate-status {
- type types:operate-status;
- description "operation status." ;
- }
-
- uses service-type-grouping;
- container acess-information {
- description "access information of the l3 vpn." ;
-
- uses service-types:l3-ac; }
-
- container protect-policy{
- description "L3VPN Service protect policy." ;
- uses service-types:protect-policy;
- }
- container tunnel-service {
- description "tunnel service." ;
- uses service-types:tunnel-service;
- }
-
- }
-
- grouping service-type-grouping {
- description "Basic service type" ;
- leaf service-topology {
- type enumeration {
- enum full-mesh {
- value 1 ;
- description "full-mesh." ;
- }
- enum hub-spoke {
- value 2 ;
- description "hub-spoke." ;
- }
- }
- default full-mesh;
- description "service topology type." ;
- }
- }
-
- container service {
- description
- "Root level of L3vpn service module.";
- container l3vpn-cfg {
- description
- "L3vpn configuration model in ONOS.";
- list vpn-cfg {
- key name;
- description
- "vpn configuration parameter list.";
- uses l3vpn;
- }
- }
- container service-paths {
- description
- "The service path of the l3 vpn.";
- }
- }
-
-
-
- rpc create-l3vpn-instance {
- description "Create l3vpn instance." ;
- input {
- container l3vpn-instance {
- description "Create l3vpn instance." ;
- uses l3vpn;
- }
- }
- }
-
- rpc delete-l3vpn-instance {
- description "Delete l3vpn instance." ;
- input {
- leaf l3vpn-id {
- type string;
- description "vpn id." ;
- }
- }
- }
-
- rpc close-l3vpn {
- description "Close l3vpn." ;
- input {
- leaf l3vpn-id {
- type string;
- description "vpn id." ;
- }
- container ac-status {
- description "Access status of the vpn." ;
- list acs{
- key "id";
- description "Access information." ;
- leaf id {
- type string;
- description "Access id." ;
- }
- leaf admin-status {
- type types:admin-status;
- description "Administration status." ;
- }
- }
- }
- }
- }
-
- rpc modify-l3vpn-instance-basic {
- description "Modify l3vpn instance basic information." ;
- input {
- leaf l3vpn-id {
- type string;
- description "vpn id." ;
- }
- leaf user-label {
- type string ;
- description "user label." ;
- }
- }
- }
-
- rpc modify-l3vpn-instance-ac-qos {
- description "Modify l3vpn instance ac qos information." ;
- input {
- leaf l3vpn-id {
- type string;
- description "L3vpn ID." ;
- }
- container ac-qos {
- description "ac qos information." ;
- list acs{
- key "id";
- description "acs list." ;
- leaf id {
- type string;
- description "acs ID." ;
- }
- container qos-policy {
- description "qos policy." ;
- container qos-if-cars {
- description "cars qos policy." ;
- uses service-types:qos-if-car;
-
- }
- }
- }
- }
- }
- }
- rpc modify-l3vpn-instance-connection {
- description "Modify a l3vpn connection." ;
- input {
- leaf l3vpn-id {
- type string;
- description "L3vpn ID." ;
- }
- container ac-connection {
- description "ac connection." ;
- list acs{
- key "id";
- description "acs ID." ;
- leaf id {
- type string ;
- description "acs ID." ;
- }
- container connection {
- description "CE to PE connection." ;
- uses service-types:connection;
- }
- }
- }
- }
- }
- rpc inquire-l3vpn-instance-work-path {
- description "Inquire a L3VPN instance work path." ;
- input {
- leaf service-id {
- type string;
- description "service ID." ;
- }
- leaf ingress-ne-id {
- type string ;
- description "ingress network element ID." ;
- }
- leaf destination-ne-id {
- type string ;
- description "destination network element ID." ;
- }
- leaf ingress-ac-id {
- type string ;
- description "ingress ac ID." ;
- }
- leaf destination-ac-id {
- type string ;
- description "destination ac ID." ;
- }
- leaf path-layer {
- type string ;
- description "path layer." ;
- }
- leaf path-role {
- type string ;
- description "path role." ;
- }
- }
- output {
- container service-path {
- description "service path." ;
- leaf service-id {
- type string;
- description "service ID." ;
- }
- leaf ingress-ne-id {
- type string ;
- description "ingress network element ID." ;
- }
- leaf destination-ne-id {
- type string ;
- description "destination network element ID." ;
- }
- leaf ingress-ac-id {
- type string ;
- description "ingress access circuit ID." ;
- }
- leaf destination-ac-id {
- type string ;
- description "destination access circuit ID." ;
- }
- leaf path-layer {
- type string ;
- description "path layer." ;
- }
- leaf path-role {
- type string ;
- description "path role." ;
- }
- list path-list {
- key "ne-id";
- description "path list." ;
- leaf ne-id {
- type string;
- description "network element ID." ;
- }
- leaf ingress-ltp-id {
- type string;
- description "LTP ID." ;
- }
- leaf backward-peer-id {
- type string;
- description "backward peer ID." ;
- }
- leaf egress-ltp-id {
- type string;
- description "egress ltp ID." ;
- }
- leaf forward-peer-id {
- type string;
- description "forward peer ID." ;
- }
- }
- }
- }
- }
- }
diff --git a/utils/yangutils/plugin/src/test/resources/ietfyang/l3vpnservice/ietf-sd-onos-service-types.yang b/utils/yangutils/plugin/src/test/resources/ietfyang/l3vpnservice/ietf-sd-onos-service-types.yang
deleted file mode 100644
index 7fd7700..0000000
--- a/utils/yangutils/plugin/src/test/resources/ietfyang/l3vpnservice/ietf-sd-onos-service-types.yang
+++ /dev/null
@@ -1,816 +0,0 @@
- module ietf-sd-onos-service-types {
- namespace "urn:ietf:params:xml:ns:yang:ietf-sd-onos-service-types";
- prefix service-types ;
-
- import ietf-inet-types {prefix inet; }
- import ietf-sd-onos-common-types {prefix types;}
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- typedef exp {
- type enumeration {
- enum BE {
- value 0 ;
- description "BE." ;
- }
- enum AF1 {
- value 1 ;
- description "AF1." ;
- }
- enum AF2 {
- value 2 ;
- description "AF2." ;
- }
- enum AF3 {
- value 3 ;
- description "AF3." ;
- }
- enum AF4 {
- value 4 ;
- description "AF4." ;
- }
- enum EF {
- value 5 ;
- description "EF." ;
- }
- enum CS6 {
- value 6 ;
- description "CS6." ;
- }
- enum CS7 {
- value 7 ;
- description "CS7." ;
- }
- }
- default CS7;
- description
- "exp parameter.";
- }
-
- typedef pw-role{
- type enumeration {
- enum normal{
- value 0 ;
- description "normal." ;
- }
- enum master {
- value 1 ;
- description "master." ;
- }
- enum slave {
- value 2 ;
- description "slave." ;
- }
- enum DNI-PW {
- value 3 ;
- description "DNI PW." ;
- }
- }
- default normal;
- description
- "The role of the PW.";
- }
-
- grouping qos-if-car {
- description "qos parameter." ;
- list qos-if-car {
- key "direction";
- description "cars qos policy." ;
- leaf direction {
- type enumeration {
- enum inbound{
- value 0 ;
- description "inbound." ;
- }
- enum outbound {
- value 1 ;
- description "outbound." ;
- }
- }
- description "qos for interface car" ;
- }
-
- leaf cir {
- type int32;
- description "forward CIR. unit:Kbps" ;
- }
- leaf pir {
- type int32;
- description "forward PIR. unit:Kbps" ;
- }
- leaf cbs {
- type int32;
- description "forward CBS. unit:Kbps" ;
- }
- leaf pbs {
- type int32;
- description "forward PBS. unit:Kbps" ;
- }
- }
- }
-
- grouping protect-policy {
- description "The protect policy of the VPN" ;
- leaf protect-type {
- type enumeration {
- enum unprotected {
- value 0 ;
- description "unprotected." ;
- }
- enum protected {
- value 1 ;
- description "protection." ;
- }
- }
- default unprotected ;
- description "protection type" ;
- }
-
- leaf revertive-type {
- type enumeration {
- enum no-revertive {
- value 0 ;
- description "unprotected." ;
- }
- enum revertive {
- value 1 ;
- description "protection." ;
- }
- }
- description "revertive mode" ;
- }
- leaf wtr {
- type uint32;
- default 300;
- description "WTR.unit:s" ;
- }
- }
- grouping oam-policy {
- description "The oam policy of the vpn service." ;
- leaf detect-type {
- type enumeration {
- enum undetect {
- value 0 ;
- description "unprotected." ;
- }
- enum APS {
- value 1 ;
- description "protection." ;
- }
- enum BFD {
- value 2 ;
- description "unprotected." ;
- }
- }
- description "detect type" ;
- }
- container bfd-detect-para {
- description "bfd detect parameters." ;
- leaf ingress-discriminator {
- type int32;
- description "ingress-discriminator" ;
- }
- leaf egress-discriminator {
- type int32;
- description "egress-discriminator" ;
- }
- leaf tx-interval {
- type int32;
- description "tx-interval" ;
- }
- leaf rx-interval {
- type int32;
- description "rx-interval" ;
- }
- leaf detect-interval {
- type int32;
- description "detect-interval" ;
- }
- }
- }
- grouping ac {
- description "Access information." ;
- leaf id{
- type string;
- mandatory true;
- description "ac id." ;
- }
- leaf name{
- type string;
- config false;
- description "ac name." ;
- }
-
- leaf ne-id {
- type string ;
- mandatory true;
- description "ne id." ;
- }
-
- leaf ltp-id {
- type string ;
- mandatory true;
- description "ltp id." ;
- }
- leaf admin-status {
- type types:admin-status;
- description "Administration status." ;
- }
- leaf operate-status {
- type types:operate-status;
- description "Operation status." ;
- }
- container l2-access {
- description "link layer access information of ac." ;
- uses l2-access;
- }
-
- leaf role {
- type enumeration {
- enum master {
- value 0 ;
- description "master." ;
- }
- enum slave {
- value 1 ;
- description "slave." ;
- }
- enum hub {
- value 2 ;
- description "slave." ;
- }
- enum spoke {
- value 3 ;
- description "slave." ;
- }
- }
- default master;
- description "role of snc lsp." ;
- }
- container qos-policy {
- description "The qos policy of the vpn service." ;
- container qos-if-cars {
- description "qos policy if car." ;
- list qos-if-car {
- //key "direction";
- uses qos-if-car;
- description "List of qos parameters." ;
- }
- }
- }
- }
- grouping l3-ac {
- description "Access information of l3vpn." ;
- list access-circuit {
- key "id";
- description "list of access circuit." ;
- uses ac;
- container connection {
- description "connection information of ac." ;
- uses connection;
- }
- }
- }
- grouping l2-access {
- description "Access information of l2vpn." ;
- leaf access-type{
- type enumeration {
- enum Port {
- value 0 ;
- description "master." ;
- }
- enum Dot1Q {
- value 1 ;
- description "slave." ;
- }
- enum QinQ {
- value 2 ;
- description "master." ;
- }
- }
- mandatory true;
- description "The access type of the vpn service." ;
- }
- leaf dot1q-vlan-bitmap {
- type string;
- mandatory true;
- description "Dot1Q Vlan Bitmap." ;
- }
-
- leaf qinq-svlan-bitmap {
- type string;
- mandatory true;
- description "QinQ svlan Bitmap." ;
- }
-
- leaf qinq-cvlan-bitmap {
- type string;
- mandatory true;
- description "QinQ cvlan Bitmap." ;
- }
- leaf access-action {
- type enumeration {
- enum Keep {
- value 0 ;
- description "keep." ;
- }
- enum Push {
- value 1 ;
- description "push." ;
- }
- enum Pop {
- value 2 ;
- description "pop." ;
- }
- enum Swap {
- value 3 ;
- description "swap." ;
- }
- }
- mandatory true;
- description "access type." ;
- }
-
- leaf action-vlan-id {
- type int32 {
- range "1..4094";
- }
- description "action vlan id." ;
- }
- }
- grouping connection {
- description "Describe the connection of the vpn service." ;
- leaf ip-address {
- type inet:ip-address ;
- description "ip address of access circuit's connection." ;
- }
- leaf mask-length {
- type int32 {
- range "1..32";
- }
- description "mask length of ip address." ;
- }
- leaf protocols {
- type enumeration {
- enum static {
- value 0 ;
- description "static." ;
- }
- enum ospf {
- value 1 ;
- description "ospf." ;
- }
- enum isis {
- value 2 ;
- description "bgp" ;
- }
- enum bgp {
- value 3 ;
- description "bgp" ;
- }
- }
- description "protocols between PE and CE." ;
- }
- container static-routes {
- description "Defines the static routes." ;
- list static-route {
- key "ip-prefix mask-length";
- description "List of static route." ;
- leaf ip-prefix {
- type inet:ipv4-address;
- description "ip prefix" ;
- }
- leaf mask-length {
- type uint32 {
- range "1..32";
- }
- description "mast length" ;
- }
- leaf next-hop {
- type inet:ipv4-address ;
- description "next hop" ;
- }
- leaf preference {
- type uint32 {
- range "1..65535";
- }
- description "preference of the route." ;
- }
- }
- }
- }
-
- grouping pw{
- description "PW definition ";
- leaf id {
- type string ;
- description "ID of pw." ;
- }
- uses encaplate-type-grouping;
-
- leaf ingress-ne-id {
- type string ;
- description "ingress ne id." ;
- }
-
- leaf egress-ne-id {
- type string ;
- description "egress ne id." ;
- }
-
- leaf ctrl-word-support {
- type enumeration {
- enum not-support {
- value 0 ;
- description "pw doesn't support control word" ;
- }
- enum support {
- value 1 ;
- description "pw supports control word" ;
- }
- }
- default support;
- description "ctrl word support. 0 : not support, 1 : support" ;
- }
-
- leaf sn-support {
- type enumeration {
- enum not-support {
- value 0 ;
- description "pw doesn't support control word" ;
- }
- enum support {
- value 1 ;
- description "pw supports control word" ;
- }
- }
- default not-support;
- description "serial number support. 0 : not support, 1 : support" ;
- }
-
- leaf vccv-type {
- type enumeration {
- enum not-support {
- value 0 ;
- description "pw doesn't support vccv" ;
- }
- enum CWD {
- value 1 ;
- description "pw supports vccv" ;
- }
- enum Label-alert {
- value 2 ;
- description "pw supports vccv" ;
- }
- enum TTL {
- value 3 ;
- description "pw supports vccv" ;
- }
- enum CWD&Label-alert {
- value 4 ;
- description "pw supports vccv" ;
- }
- enum CWD&TTL {
- value 5 ;
- description "pw supports vccv" ;
- }
- enum Label-alert&TTL {
- value 6 ;
- description "pw supports vccv" ;
- }
- enum CWD&Label-alert&TTL {
- value 7 ;
- description "pw supports vccv" ;
- }
- }
- default not-support;
- description "vccv type" ;
- }
-
- leaf conn-ack-type {
- type enumeration {
- enum not-support {
- value 0 ;
- description "pw doesn't support connection ack" ;
- }
- enum support {
- value 1 ;
- description "pw supports connection ack" ;
- }
- }
- default not-support;
- description "Connectivity test type" ;
- }
- container tunnels {
- description "Define tunnels." ;
- list tunnel{
- key "tunnel-id";
- description "The list of tunnel id." ;
- uses tunnel;
- }
- }
- }
- grouping tunnel {
- description "Reusable entity of tunnel." ;
- leaf tunnel-id {
- type string ;
- description "ID of tunnel." ;
- }
- }
- grouping encaplate-type-grouping {
- description "encaplate type" ;
- leaf encaplate-type {
- type enumeration {
- enum NONE {
- value 0 ;
- description "none." ;
- }
- enum fr-dlci-martini {
- value 1 ;
- description "fr-dlci-martini." ;
- }
- enum atm-aal5-sdu {
- value 2 ;
- description "atm-aal5-sdu." ;
- }
- enum atm-transparent {
- value 3 ;
- description "atm-transparent." ;
- }
- enum ethernet-vlan {
- value 4 ;
- description "ethernet-vlan." ;
- }
- enum ethernet {
- value 5 ;
- description "ethernet ." ;
- }
- enum hdlc {
- value 6 ;
- description " hdlc." ;
- }
- enum ppp {
- value 7 ;
- description "ppp." ;
- }
- enum cep-mpls {
- value 8 ;
- description " cep-mpls." ;
- }
- enum atm-ntol {
- value 9 ;
- description "atm-ntol." ;
- }
- enum atm-nto1-vpc {
- value 10 ;
- description "atm-nto1-vpc." ;
- }
- enum ip-layer2 {
- value 11 ;
- description " ip-layer2." ;
- }
- enum atm-1to1-vcc {
- value 12 ;
- description "atm-1to1-vcc." ;
- }
- enum atm-1to1-vpc {
- value 13 ;
- description "atm-1to1-vpc." ;
- }
- enum atm-aal5-pdu {
- value 14 ;
- description "atm-aal5-pdu." ;
- }
- enum fr-port {
- value 15 ;
- description "fr-port." ;
- }
- enum cep-packet {
- value 16 ;
- description "cep-packet." ;
- }
- enum e1 {
- value 17 ;
- description "e1." ;
- }
- enum t1 {
- value 18 ;
- description "t1." ;
- }
- enum e3 {
- value 19 ;
- description "e3." ;
- }
- enum t3 {
- value 20 ;
- description " t3." ;
- }
- enum cesopsn-basic {
- value 21 ;
- description "cesopsn-basic." ;
- }
- enum tdmoip-aal1 {
- value 22 ;
- description "tdmoip-aal1." ;
- }
- enum cesopsn-tdm {
- value 23 ;
- description "cesopsn-tdm." ;
- }
- enum tdmoip-aal2 {
- value 24 ;
- description "tdmoip-aal2." ;
- }
- enum fr-dlci {
- value 25 ;
- description "fr-dlci." ;
- }
- }
- description "encaplate type." ;
- }
- }
-
- grouping pw-trail{
- description "pw trail information." ;
- leaf id {
- type string ;
- description "ID of pw-trail." ;
- }
-
- leaf role {
- type pw-role;
- description "role of pw-trail." ;
- }
- container pw-lists {
- description "List of pw information." ;
- list pw-list {
- key id;
- description "List of pw information." ;
- uses pw ;
- }
- }
- }
- grouping tunnel-service {
- description "Reusable entity of tunnel service." ;
- leaf signaling-type {
- type enumeration {
- enum RSVP-TE {
- value 0 ;
- description "RSVP-TE" ;
- }
- enum LDP {
- value 1 ;
- description "LDP" ;
- }
- enum GRE {
- value 2 ;
- description "GRE" ;
- }
- enum SR-BE {
- value 3 ;
- description "SR-BE" ;
- }
- enum SR-TE {
- value 4 ;
- description "SR-TE" ;
- }
- }
- default RSVP-TE;
- description "signaling type." ;
- }
- leaf tunnel-mode {
- type enumeration {
- enum Nto1 {
- value 0 ;
- description "multi service one tunnel" ;
- }
- enum 1to1 {
- value 1 ;
- description "oner service one tunnel" ;
- }
- }
- default Nto1;
- description "service to tunnel mode." ;
- }
- container protect-policy {
- description "Protect policy." ;
- uses protect-policy;
- }
- container oam-policy {
- description "oam policy." ;
- uses oam-policy;
- }
- leaf latency {
- type int32;
- description "tunnel latency requirement." ;
- }
- }
- grouping service-path {
- description "Service path of l3vpn." ;
- list service-path{
- key "service-id source-ne-id source-ac-id destination-ne-id destination-ac-id";
- description
- "The list of service path.";
- leaf service-id {
- type string ;
- description "l2vpn or l3vpn service id." ;
- }
- leaf source-ne-id {
- type string ;
- description "source ne id." ;
- }
-
- leaf source-ac-id {
- type string ;
- description "source ltp id." ;
- }
- leaf destination-ne-id {
- type string ;
- description "destination ne id." ;
- }
-
- leaf destination-ac-id {
- type string ;
- description "destination ltp id." ;
- }
- container path-lists{
- description "The path list of service path." ;
- list path-list {
- key "path-layer path-role";
- description "The path list of service path." ;
- leaf path-layer {
- type enumeration {
- enum PW {
- value 0 ;
- description "pw path." ;
- }
- enum BGP-LSP {
- value 1 ;
- description "BGP-LSP Path." ;
- }
- enum LSP {
- value 2 ;
- description "LSP Path." ;
- }
- }
- description "path type. 0 : PW, 1 : BGP-LSP, 2 : PW" ;
- }
- leaf path-role {
- type enumeration {
- enum Primary {
- value 0 ;
- description "master path." ;
- }
- enum Backup {
- value 1 ;
- description "backup path." ;
- }
- enum Active {
- value 2 ;
- description "active path." ;
- }
- }
- description "path role.. 0 : master, 1 : backup, 2 :
- Bypass." ;
- }
- container paths {
- description "path definition." ;
- list path {
- key "ne-id";
- description "Network element id list." ;
- leaf ne-id {
- type string;
- description "Network element id." ;
- }
- leaf ingress-ltp-id {
- type string;
- description "ingress ltd id." ;
- }
- leaf backward-peer-id {
- type string;
- description "backward peer id." ;
- }
- leaf egress-ltp-id {
- type string;
- description "egress ltd id." ;
- }
- leaf forward-peer-id {
- type string;
- description "forward peer id." ;
- }
- }
- }
- }
- }
-
- }
- }
- }
diff --git a/utils/yangutils/plugin/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-network-topology.yang b/utils/yangutils/plugin/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-network-topology.yang
deleted file mode 100644
index 499c0f1..0000000
--- a/utils/yangutils/plugin/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-network-topology.yang
+++ /dev/null
@@ -1,37 +0,0 @@
-module ietf-network-topology {
- yang-version 1;
- namespace "ietf-vidya-topology";
- prefix lnk;
-
- import ietf-network {
- prefix nd;
- }
-
- revision 2015-12-08 {
- description
- "Initial revision.
- NOTE TO RFC EDITOR: Please replace the following reference
- to draft-ietf-i2rs-yang-network-topo-02 with
- RFC number when published (i.e. RFC xxxx).";
- reference
- "draft-ietf-i2rs-yang-network-topo-02.";
- }
-
- augment "/nd:networks/nd:network" {
- list link {
- key "link-id";
- container source {
- leaf source-node {
- type string;
- mandatory true;
- }
- leaf source-tp {
- type string;
- }
- }
- leaf link-id {
- type string;
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-network.yang b/utils/yangutils/plugin/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-network.yang
deleted file mode 100644
index a78b231..0000000
--- a/utils/yangutils/plugin/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-network.yang
+++ /dev/null
@@ -1,30 +0,0 @@
-module ietf-network {
- yang-version 1;
- namespace "ietf-network";
- prefix nd;
-
- revision 2015-12-08 {
- description
- "Initial revision.
- NOTE TO RFC EDITOR: Please replace the following reference
- to draft-ietf-i2rs-yang-network-topo-02 with
- RFC number when published (i.e. RFC xxxx).";
- reference
- "draft-ietf-i2rs-yang-network-topo-02";
- }
-
- container networks {
- list network {
- key "network-id";
- leaf network-id {
- type string;
- }
- list node {
- key "node-id";
- leaf node-id {
- type string;
- }
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-te-topology.yang b/utils/yangutils/plugin/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-te-topology.yang
deleted file mode 100644
index f92fccc..0000000
--- a/utils/yangutils/plugin/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-te-topology.yang
+++ /dev/null
@@ -1,65 +0,0 @@
-module ietf-te-topology {
- yang-version 1;
- namespace "ietf-te-topology";
- prefix "tet";
-
- import ietf-te-types {
- prefix "te-types";
- }
-
- import ietf-network {
- prefix "nw";
- }
-
- import ietf-network-topology {
- prefix "nt";
- }
-
- revision "2016-03-17" {
- description "Initial revision";
- reference "TBD";
- }
-
- grouping te-link-augment {
- container te {
- container config {
- uses te-link-config;
- } // config
- } // te
- } // te-link-augment
-
- grouping te-link-config {
- uses te-link-config-attributes;
- } // te-link-config
-
- grouping te-link-config-attributes {
- container te-link-attributes {
- container underlay {
- uses te-link-underlay-attributes;
- } // underlay
- } // te-link-attributes
- } // te-link-config-attributes
-
- grouping te-link-underlay-attributes {
- container underlay-primary-path {
- list path-element {
- key "path-element-id";
- description
- "A list of path elements describing the service path.";
- leaf path-element-id {
- type uint32;
- description "To identify the element in a path.";
- }
- uses te-path-element;
- }
- } // underlay-primary-path
- } // te-link-underlay-attributes
-
- grouping te-path-element {
- uses te-types:explicit-route-subobject;
- } // te-path-element
-
- augment "/nw:networks/nw:network/nt:link" {
- uses te-link-augment;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-te-types.yang b/utils/yangutils/plugin/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-te-types.yang
deleted file mode 100644
index 96ce986..0000000
--- a/utils/yangutils/plugin/src/test/resources/interFileUsesInsideChildOfGrouping/ietf-te-types.yang
+++ /dev/null
@@ -1,19 +0,0 @@
-module ietf-te-types {
-
- namespace "ietf-te-types";
- prefix "te-types";
-
- revision 2016-03-20 {
- description "Latest revision of TE generic types";
- reference "RFC3209";
- }
- grouping explicit-route-subobject {
- choice type {
- case ipv4-address {
- leaf v4-address {
- type string;
- }
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interJarFileLinking/yangFiles/flowclassifier.yang b/utils/yangutils/plugin/src/test/resources/interJarFileLinking/yangFiles/flowclassifier.yang
deleted file mode 100644
index 0fa3ba1..0000000
--- a/utils/yangutils/plugin/src/test/resources/interJarFileLinking/yangFiles/flowclassifier.yang
+++ /dev/null
@@ -1,175 +0,0 @@
-module flow-classifier {
-
- yang-version 1;
-
- namespace "sfc.flowclassifier";
-
- prefix "flow-classifier";
-
- import "port-pair" {
- prefix "port-pair";
- }
-
- organization "ON-LAB";
-
- description "This submodule defines for flow classifier.";
-
- revision "2016-05-24" {
- description "Initial revision.";
- }
-
- typedef flow-classifier-id {
- type port-pair:uuid;
- }
-
- typedef IpPrefix {
- type string;
- }
-
- typedef VirtualPortId {
- type string;
- }
-
- grouping flow-classifier {
- container flow-classifier {
- leaf id {
- type flow-classifier-id;
- }
-
- leaf tenant-id {
- type port-pair:tenant-id;
- }
-
- leaf name {
- type string;
- }
-
- leaf description {
- type string;
- }
-
- leaf etherType {
- type string;
- }
-
- leaf protocol {
- type string;
- }
-
- leaf priority {
- type int32;
- }
-
- leaf minSrcPortRange {
- type int32;
- }
-
- leaf maxSrcPortRange {
- type int32;
- }
-
- leaf minDstPortRange {
- type int32;
- }
-
- leaf maxDstPortRange {
- type int32;
- }
-
- leaf srcIpPrefix {
- type IpPrefix;
- }
-
- leaf dstIpPrefix {
- type IpPrefix;
- }
-
- leaf srcPort {
- type VirtualPortId;
- }
-
- leaf dstPort {
- type VirtualPortId;
- }
- }
- }
- rpc exists {
- input {
- leaf id {
- type flow-classifier-id;
- }
- }
- output {
- leaf is-present {
- type boolean;
- }
- }
- }
-
- rpc get-flow-classifier-count {
-
- output {
- leaf count {
- type int32;
- }
- }
- }
-
- rpc get-flow-classifier {
- input {
- leaf id {
- type flow-classifier-id;
- }
- }
- output {
- uses flow-classifier;
- }
- }
-
- rpc create-flow-classifier {
- input {
- uses flow-classifier;
- }
- output {
- leaf is-created {
- type boolean;
- }
- }
- }
-
- rpc update-flow-classifier {
- input {
- uses flow-classifier;
- }
- output {
- leaf is-updated {
- type boolean;
- }
- }
- }
-
- rpc remove-flow-classifier {
- input {
- leaf id {
- type flow-classifier-id;
- }
- }
- output {
- leaf is-removed {
- type boolean;
- }
- }
- }
-
- notification Flow-Classifier-Put {
- uses flow-classifier;
- }
-
- notification Flow-Classifier-Delete {
- uses flow-classifier;
- }
-
- notification Flow-Classifier-Update {
- uses flow-classifier;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interJarFileLinking/yangFiles/portpair.yang b/utils/yangutils/plugin/src/test/resources/interJarFileLinking/yangFiles/portpair.yang
deleted file mode 100644
index ee67c62..0000000
--- a/utils/yangutils/plugin/src/test/resources/interJarFileLinking/yangFiles/portpair.yang
+++ /dev/null
@@ -1,137 +0,0 @@
-module port-pair {
-
- yang-version 1;
-
- namespace "sfc.portpair";
-
- prefix "port-pair";
-
- organization "Huawei india pvt. ltd..";
-
- description "This submodule defines for port pair.";
-
- revision "2016-05-24" {
- description "Initial revision.";
- }
-
- typedef uuid {
- type string;
- }
-
- typedef port-pair-id {
- type uuid;
- }
-
- typedef tenant-id {
- type uuid;
- }
-
- grouping port-pair {
- container port-pair {
-
- leaf name {
- type string;
- }
-
- leaf id {
- type port-pair-id;
- }
-
- leaf tenantIdentifier {
- type tenant-id;
- }
-
- leaf description {
- type string;
- }
-
- leaf ingress {
- type uuid;
- }
-
- leaf egress {
- type uuid;
- }
- }
- }
- rpc exists {
- input {
- leaf id {
- type port-pair-id;
- }
- }
- output {
- leaf is-present {
- type boolean;
- }
- }
- }
-
- rpc get-port-pair-count {
-
- output {
- leaf count {
- type int32;
- }
- }
- }
-
- rpc get-port-pair {
- input {
- leaf id {
- type port-pair-id;
- }
- }
- output {
- uses port-pair;
- }
- }
-
- rpc create-port-pair {
- input {
- uses port-pair;
- }
- output {
- leaf is-created {
- type boolean;
- }
- }
- }
-
- rpc update-port-pair {
- input {
- uses port-pair;
- }
- output {
- leaf is-updated {
- type boolean;
- }
- }
- }
-
- rpc remove-port-pair {
- input {
- leaf id {
- type port-pair-id;
- }
- }
- output {
- leaf is-removed {
- type boolean;
- }
- }
- }
-
-
- notification port-pair-put {
- uses port-pair;
- }
-
- notification port-pair-Delete {
- uses port-pair;
- }
-
- notification port-pair-Update {
- uses port-pair;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interJarFileLinking/yangFiles/test.yang b/utils/yangutils/plugin/src/test/resources/interJarFileLinking/yangFiles/test.yang
deleted file mode 100644
index 4e7275c..0000000
--- a/utils/yangutils/plugin/src/test/resources/interJarFileLinking/yangFiles/test.yang
+++ /dev/null
@@ -1,29 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- container valid {
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
- container invalid {
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
- container valid2 {
- leaf invalid-interval {
- type "uint16";
- units "seconds";
- status current;
- reference "RFC 6020";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfilefeatureimport/featureFile1.yang b/utils/yangutils/plugin/src/test/resources/interfilefeatureimport/featureFile1.yang
deleted file mode 100644
index e78e583..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfilefeatureimport/featureFile1.yang
+++ /dev/null
@@ -1,26 +0,0 @@
-module syslog1 {
- yang-version 1;
- namespace "http://huawei1.com";
- prefix "sys1";
-
- import "syslog2" {
- prefix "sys2";
- }
-
- feature frr-te {
- description "Indicates support for TE FastReroute (FRR)";
- if-feature "sys2:p2mp-te";
- }
-
- container speed {
- leaf local-storage-limit {
- if-feature frr-te;
- type uint64;
- units "kilobyte";
- config false;
- description
- "The amount of local storage that can be
- used to hold syslog messages.";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfilefeatureimport/featureFile2.yang b/utils/yangutils/plugin/src/test/resources/interfilefeatureimport/featureFile2.yang
deleted file mode 100644
index 782571c..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfilefeatureimport/featureFile2.yang
+++ /dev/null
@@ -1,9 +0,0 @@
-module syslog2 {
- yang-version 1;
- namespace "http://huawei2.com";
- prefix "sys2";
-
- feature p2mp-te {
- description "Indicates support for P2MP-TE";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfilefeatureimportdependency/featurefile1.yang b/utils/yangutils/plugin/src/test/resources/interfilefeatureimportdependency/featurefile1.yang
deleted file mode 100644
index e78e583..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfilefeatureimportdependency/featurefile1.yang
+++ /dev/null
@@ -1,26 +0,0 @@
-module syslog1 {
- yang-version 1;
- namespace "http://huawei1.com";
- prefix "sys1";
-
- import "syslog2" {
- prefix "sys2";
- }
-
- feature frr-te {
- description "Indicates support for TE FastReroute (FRR)";
- if-feature "sys2:p2mp-te";
- }
-
- container speed {
- leaf local-storage-limit {
- if-feature frr-te;
- type uint64;
- units "kilobyte";
- config false;
- description
- "The amount of local storage that can be
- used to hold syslog messages.";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfilefeatureimportdependency/featurefile2.yang b/utils/yangutils/plugin/src/test/resources/interfilefeatureimportdependency/featurefile2.yang
deleted file mode 100644
index fcaf8e0..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfilefeatureimportdependency/featurefile2.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module syslog2 {
- yang-version 1;
- namespace "http://huawei2.com";
- prefix "sys2";
-
- import "syslog3" {
- prefix "sys3";
- }
-
- feature p2mp-te {
- description "Indicates support for P2MP-TE";
- if-feature "sys3:extended-admin-groups";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfilefeatureimportdependency/featurefile3.yang b/utils/yangutils/plugin/src/test/resources/interfilefeatureimportdependency/featurefile3.yang
deleted file mode 100644
index 13d6787..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfilefeatureimportdependency/featurefile3.yang
+++ /dev/null
@@ -1,11 +0,0 @@
-module syslog3 {
- yang-version 1;
- namespace "http://huawei3.com";
- prefix "sys3";
-
- feature extended-admin-groups {
- description
- "Indicates support for TE link extended admin
- groups.";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfilefeatureimportdependencyUndefined/featurefile1.yang b/utils/yangutils/plugin/src/test/resources/interfilefeatureimportdependencyUndefined/featurefile1.yang
deleted file mode 100644
index e78e583..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfilefeatureimportdependencyUndefined/featurefile1.yang
+++ /dev/null
@@ -1,26 +0,0 @@
-module syslog1 {
- yang-version 1;
- namespace "http://huawei1.com";
- prefix "sys1";
-
- import "syslog2" {
- prefix "sys2";
- }
-
- feature frr-te {
- description "Indicates support for TE FastReroute (FRR)";
- if-feature "sys2:p2mp-te";
- }
-
- container speed {
- leaf local-storage-limit {
- if-feature frr-te;
- type uint64;
- units "kilobyte";
- config false;
- description
- "The amount of local storage that can be
- used to hold syslog messages.";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfilefeatureimportdependencyUndefined/featurefile2.yang b/utils/yangutils/plugin/src/test/resources/interfilefeatureimportdependencyUndefined/featurefile2.yang
deleted file mode 100644
index 199a6a6..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfilefeatureimportdependencyUndefined/featurefile2.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-module syslog2 {
- yang-version 1;
- namespace "http://huawei2.com";
- prefix "sys2";
-
- import "syslog3" {
- prefix "sys3";
- }
-
- feature p2mp-te {
- description "Indicates support for P2MP-TE";
- if-feature "sys3:extended-admin-groups";
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/interfilefeatureimportdependencyUndefined/featurefile3.yang b/utils/yangutils/plugin/src/test/resources/interfilefeatureimportdependencyUndefined/featurefile3.yang
deleted file mode 100644
index f638139..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfilefeatureimportdependencyUndefined/featurefile3.yang
+++ /dev/null
@@ -1,5 +0,0 @@
-module syslog3 {
- yang-version 1;
- namespace "http://huawei3.com";
- prefix "sys3";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfilefeatureinclude/featureFile3.yang b/utils/yangutils/plugin/src/test/resources/interfilefeatureinclude/featureFile3.yang
deleted file mode 100644
index b387853..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfilefeatureinclude/featureFile3.yang
+++ /dev/null
@@ -1,24 +0,0 @@
-module syslog3 {
- yang-version 1;
- namespace "http://huawei3.com";
- prefix "sys3";
-
- include "syslog4";
-
- feature frr-te {
- description "Indicates support for TE FastReroute (FRR)";
- if-feature "p2mp-te";
- }
-
- container speed {
- leaf local-storage-limit {
- if-feature frr-te;
- type uint64;
- units "kilobyte";
- config false;
- description
- "The amount of local storage that can be
- used to hold syslog messages.";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfilefeatureinclude/featureFile4.yang b/utils/yangutils/plugin/src/test/resources/interfilefeatureinclude/featureFile4.yang
deleted file mode 100644
index 30e1ce5..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfilefeatureinclude/featureFile4.yang
+++ /dev/null
@@ -1,10 +0,0 @@
-submodule syslog4 {
- yang-version 1;
- belongs-to "syslog3" {
- prefix "sys3";
- }
-
- feature p2mp-te {
- description "Indicates support for P2MP-TE";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfilefeatureincludedependency/featurefile1.yang b/utils/yangutils/plugin/src/test/resources/interfilefeatureincludedependency/featurefile1.yang
deleted file mode 100644
index a30c85a..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfilefeatureincludedependency/featurefile1.yang
+++ /dev/null
@@ -1,24 +0,0 @@
-module syslog1 {
- yang-version 1;
- namespace "http://huawei3.com";
- prefix "sys1";
-
- include "syslog2";
-
- feature frr-te {
- description "Indicates support for TE FastReroute (FRR)";
- if-feature "p2mp-te";
- }
-
- container speed {
- leaf local-storage-limit {
- if-feature frr-te;
- type uint64;
- units "kilobyte";
- config false;
- description
- "The amount of local storage that can be
- used to hold syslog messages.";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfilefeatureincludedependency/featurefile2.yang b/utils/yangutils/plugin/src/test/resources/interfilefeatureincludedependency/featurefile2.yang
deleted file mode 100644
index 370490a..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfilefeatureincludedependency/featurefile2.yang
+++ /dev/null
@@ -1,16 +0,0 @@
-submodule syslog2 {
- yang-version 1;
- belongs-to "syslog1" {
- prefix "sys1";
- }
-
- import "syslog3" {
- prefix "sys3";
- }
-
- feature p2mp-te {
- description "Indicates support for P2MP-TE";
- if-feature "sys3:extended-admin-groups";
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/interfilefeatureincludedependency/featurefile3.yang b/utils/yangutils/plugin/src/test/resources/interfilefeatureincludedependency/featurefile3.yang
deleted file mode 100644
index 13d6787..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfilefeatureincludedependency/featurefile3.yang
+++ /dev/null
@@ -1,11 +0,0 @@
-module syslog3 {
- yang-version 1;
- namespace "http://huawei3.com";
- prefix "sys3";
-
- feature extended-admin-groups {
- description
- "Indicates support for TE link extended admin
- groups.";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfilefeatureincludedependencyUndefined/featurefile1.yang b/utils/yangutils/plugin/src/test/resources/interfilefeatureincludedependencyUndefined/featurefile1.yang
deleted file mode 100644
index a30c85a..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfilefeatureincludedependencyUndefined/featurefile1.yang
+++ /dev/null
@@ -1,24 +0,0 @@
-module syslog1 {
- yang-version 1;
- namespace "http://huawei3.com";
- prefix "sys1";
-
- include "syslog2";
-
- feature frr-te {
- description "Indicates support for TE FastReroute (FRR)";
- if-feature "p2mp-te";
- }
-
- container speed {
- leaf local-storage-limit {
- if-feature frr-te;
- type uint64;
- units "kilobyte";
- config false;
- description
- "The amount of local storage that can be
- used to hold syslog messages.";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfilefeatureincludedependencyUndefined/featurefile2.yang b/utils/yangutils/plugin/src/test/resources/interfilefeatureincludedependencyUndefined/featurefile2.yang
deleted file mode 100644
index 370490a..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfilefeatureincludedependencyUndefined/featurefile2.yang
+++ /dev/null
@@ -1,16 +0,0 @@
-submodule syslog2 {
- yang-version 1;
- belongs-to "syslog1" {
- prefix "sys1";
- }
-
- import "syslog3" {
- prefix "sys3";
- }
-
- feature p2mp-te {
- description "Indicates support for P2MP-TE";
- if-feature "sys3:extended-admin-groups";
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/interfilefeatureincludedependencyUndefined/featurefile3.yang b/utils/yangutils/plugin/src/test/resources/interfilefeatureincludedependencyUndefined/featurefile3.yang
deleted file mode 100644
index f638139..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfilefeatureincludedependencyUndefined/featurefile3.yang
+++ /dev/null
@@ -1,5 +0,0 @@
-module syslog3 {
- yang-version 1;
- namespace "http://huawei3.com";
- prefix "sys3";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfileidentityimport/IdentityInModule.yang b/utils/yangutils/plugin/src/test/resources/interfileidentityimport/IdentityInModule.yang
deleted file mode 100644
index efaadd6..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfileidentityimport/IdentityInModule.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-
-module IdentityInModule{
- yang-version 1;
- namespace http://huawei.com;
- prefix IdentityInModule;
-
- identity tunnel-type {
- description
- "Base identity from which specific tunnel types are derived.";
- }
-
- identity ref-address-family {
- reference "http://www.iana.org/assignments/address-family-numbers/address-family-numbers.xhtml#address-family-numbers-2";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/interfileidentityimport/IdentityIntraFile.yang b/utils/yangutils/plugin/src/test/resources/interfileidentityimport/IdentityIntraFile.yang
deleted file mode 100644
index 4036e97..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfileidentityimport/IdentityIntraFile.yang
+++ /dev/null
@@ -1,29 +0,0 @@
-module IdentityIntraFile {
- yang-version 1;
- namespace http://huawei.com;
- prefix IdentityIntraFile;
-
- import "IdentityInModule" {
- prefix "IdentityInModule";
- }
-
- identity ipv4-address-family {
- base IdentityInModule:ref-address-family;
- }
-
- identity ipv6-address-family {
- base IdentityInModule:ref-address-family;
- }
-
- leaf tunnel {
- type identityref {
- base IdentityInModule:ref-address-family;
- }
- }
-
- leaf-list network-ref {
- type identityref {
- base IdentityInModule:ref-address-family;
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/interfileidentityimportdependency/featurefile1.yang b/utils/yangutils/plugin/src/test/resources/interfileidentityimportdependency/featurefile1.yang
deleted file mode 100644
index b808b11..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfileidentityimportdependency/featurefile1.yang
+++ /dev/null
@@ -1,30 +0,0 @@
-module syslog1 {
- yang-version 1;
- namespace "http://huawei1.com";
- prefix "sys1";
-
- import "syslog2" {
- prefix "sys2";
- }
-
- identity ipv4-address-family {
- base sys2:ref-address-family;
- }
-
- identity ipv6-address-family {
- base sys2:ref-address-family;
- }
-
- leaf tunnel {
- type identityref {
- base sys2:ref-address-family;
- }
- }
-
- leaf-list network-ref {
- type identityref {
- base sys2:ref-address-family;
- }
- }
-
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfileidentityimportdependency/featurefile2.yang b/utils/yangutils/plugin/src/test/resources/interfileidentityimportdependency/featurefile2.yang
deleted file mode 100644
index 2469e24..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfileidentityimportdependency/featurefile2.yang
+++ /dev/null
@@ -1,17 +0,0 @@
-module syslog2 {
- yang-version 1;
- namespace "http://huawei2.com";
- prefix "sys2";
-
- import "syslog3" {
- prefix "sys3";
- }
-
- identity tunnel-type {
- base sys3:final-address-family;
- }
-
- identity ref-address-family {
- base sys3:final-address-family;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfileidentityimportdependency/featurefile3.yang b/utils/yangutils/plugin/src/test/resources/interfileidentityimportdependency/featurefile3.yang
deleted file mode 100644
index f460bd1..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfileidentityimportdependency/featurefile3.yang
+++ /dev/null
@@ -1,10 +0,0 @@
-module syslog3 {
- yang-version 1;
- namespace "http://huawei3.com";
- prefix "sys3";
-
- identity final-address-family {
- description
- "Base identity from which specific tunnel types are derived.";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfileidentityimportdependencyUndefined/featurefile1.yang b/utils/yangutils/plugin/src/test/resources/interfileidentityimportdependencyUndefined/featurefile1.yang
deleted file mode 100644
index ec2e48c..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfileidentityimportdependencyUndefined/featurefile1.yang
+++ /dev/null
@@ -1,29 +0,0 @@
-module syslog1 {
- yang-version 1;
- namespace "http://huawei1.com";
- prefix "sys1";
-
- import "syslog2" {
- prefix "sys2";
- }
-
- identity ipv4-address-family {
- base sys2:ref-address-family;
- }
-
- identity ipv6-address-family {
- base sys2:ref-address-family;
- }
-
- leaf tunnel {
- type identityref {
- base sys2:ref-address-family;
- }
- }
-
- leaf-list network-ref {
- type identityref {
- base sys2:ref-address-family;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfileidentityimportdependencyUndefined/featurefile2.yang b/utils/yangutils/plugin/src/test/resources/interfileidentityimportdependencyUndefined/featurefile2.yang
deleted file mode 100644
index 25e66af..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfileidentityimportdependencyUndefined/featurefile2.yang
+++ /dev/null
@@ -1,18 +0,0 @@
-module syslog2 {
- yang-version 1;
- namespace "http://huawei2.com";
- prefix "sys2";
-
- import "syslog3" {
- prefix "sys3";
- }
-
- identity tunnel-type {
- base sys3:final-address-family;
- }
-
- identity ref-address-family {
- base sys3:final-address-family;
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/interfileidentityimportdependencyUndefined/featurefile3.yang b/utils/yangutils/plugin/src/test/resources/interfileidentityimportdependencyUndefined/featurefile3.yang
deleted file mode 100644
index f638139..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfileidentityimportdependencyUndefined/featurefile3.yang
+++ /dev/null
@@ -1,5 +0,0 @@
-module syslog3 {
- yang-version 1;
- namespace "http://huawei3.com";
- prefix "sys3";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfileidentityincludedependency/featurefile1.yang b/utils/yangutils/plugin/src/test/resources/interfileidentityincludedependency/featurefile1.yang
deleted file mode 100644
index fe987ea..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfileidentityincludedependency/featurefile1.yang
+++ /dev/null
@@ -1,27 +0,0 @@
-module syslog1 {
- yang-version 1;
- namespace "http://huawei3.com";
- prefix "sys1";
-
- include "syslog2";
-
- identity ipv4-address-family {
- base ref-address-family;
- }
-
- identity ipv6-address-family {
- base ref-address-family;
- }
-
- leaf tunnel {
- type identityref {
- base ref-address-family;
- }
- }
-
- leaf-list network-ref {
- type identityref {
- base ref-address-family;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfileidentityincludedependency/featurefile2.yang b/utils/yangutils/plugin/src/test/resources/interfileidentityincludedependency/featurefile2.yang
deleted file mode 100644
index 14fd83c..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfileidentityincludedependency/featurefile2.yang
+++ /dev/null
@@ -1,19 +0,0 @@
-submodule syslog2 {
- yang-version 1;
- belongs-to "syslog1" {
- prefix "sys1";
- }
-
- import "syslog3" {
- prefix "sys3";
- }
-
- identity tunnel-type {
- base sys3:final-address-family;
- }
-
- identity ref-address-family {
- base sys3:final-address-family;
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/interfileidentityincludedependency/featurefile3.yang b/utils/yangutils/plugin/src/test/resources/interfileidentityincludedependency/featurefile3.yang
deleted file mode 100644
index aa056f0..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfileidentityincludedependency/featurefile3.yang
+++ /dev/null
@@ -1,10 +0,0 @@
-module syslog3 {
- yang-version 1;
- namespace "http://huawei3.com";
- prefix "sys3";
-
- identity final-address-family {
- description
- "Base identity from which specific tunnel types are derived.";
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfileidentityincludedependencyUndefined/featurefile1.yang b/utils/yangutils/plugin/src/test/resources/interfileidentityincludedependencyUndefined/featurefile1.yang
deleted file mode 100644
index bc4878f..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfileidentityincludedependencyUndefined/featurefile1.yang
+++ /dev/null
@@ -1,27 +0,0 @@
-module syslog1 {
- yang-version 1;
- namespace "http://huawei3.com";
- prefix "sys1";
-
- include "syslog2";
-
- identity ipv4-address-family {
- base sys2:ref-address-family;
- }
-
- identity ipv6-address-family {
- base sys2:ref-address-family;
- }
-
- leaf tunnel {
- type identityref {
- base sys2:ref-address-family;
- }
- }
-
- leaf-list network-ref {
- type identityref {
- base sys2:ref-address-family;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfileidentityincludedependencyUndefined/featurefile2.yang b/utils/yangutils/plugin/src/test/resources/interfileidentityincludedependencyUndefined/featurefile2.yang
deleted file mode 100644
index 14fd83c..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfileidentityincludedependencyUndefined/featurefile2.yang
+++ /dev/null
@@ -1,19 +0,0 @@
-submodule syslog2 {
- yang-version 1;
- belongs-to "syslog1" {
- prefix "sys1";
- }
-
- import "syslog3" {
- prefix "sys3";
- }
-
- identity tunnel-type {
- base sys3:final-address-family;
- }
-
- identity ref-address-family {
- base sys3:final-address-family;
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/interfileidentityincludedependencyUndefined/featurefile3.yang b/utils/yangutils/plugin/src/test/resources/interfileidentityincludedependencyUndefined/featurefile3.yang
deleted file mode 100644
index f638139..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfileidentityincludedependencyUndefined/featurefile3.yang
+++ /dev/null
@@ -1,5 +0,0 @@
-module syslog3 {
- yang-version 1;
- namespace "http://huawei3.com";
- prefix "sys3";
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfileidentityinlude/IdentityInModule.yang b/utils/yangutils/plugin/src/test/resources/interfileidentityinlude/IdentityInModule.yang
deleted file mode 100644
index e42ad86..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfileidentityinlude/IdentityInModule.yang
+++ /dev/null
@@ -1,27 +0,0 @@
-module syslog3 {
- yang-version 1;
- namespace "http://huawei3.com";
- prefix "sys3";
-
- include "syslog4";
-
- identity ipv4-address-family {
- base ref-address-family;
- }
-
- identity ipv6-address-family {
- base ref-address-family;
- }
-
- leaf tunnel {
- type identityref {
- base ref-address-family;
- }
- }
-
- leaf-list network-ref {
- type identityref {
- base ref-address-family;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfileidentityinlude/IdentityIntraFile.yang b/utils/yangutils/plugin/src/test/resources/interfileidentityinlude/IdentityIntraFile.yang
deleted file mode 100644
index ffa1a7d..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfileidentityinlude/IdentityIntraFile.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-submodule syslog4 {
- yang-version 1;
- belongs-to "syslog3" {
- prefix "sys3";
- }
-
- identity tunnel-type {
- description
- "Base identity from which specific tunnel types are derived.";
- }
-
- identity ref-address-family {
- reference "http://www.iana.org/assignments/address-family-numbers/address-family-numbers.xhtml#address-family-numbers-2";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/interfileidentitytypedef/IdentityInModule.yang b/utils/yangutils/plugin/src/test/resources/interfileidentitytypedef/IdentityInModule.yang
deleted file mode 100644
index 5688615..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfileidentitytypedef/IdentityInModule.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module IdentityInModule{
- yang-version 1;
- namespace http://huawei.com;
- prefix IdentityInModule;
-
- identity tunnel-type {
- description
- "Base identity from which specific tunnel types are derived.";
- }
-
- identity ref-address-family {
- reference "http://www.iana.org/assignments/address-family-numbers/address-family-numbers.xhtml#address-family-numbers-2";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/interfileidentitytypedef/IdentityIntraFile.yang b/utils/yangutils/plugin/src/test/resources/interfileidentitytypedef/IdentityIntraFile.yang
deleted file mode 100644
index fcb2984..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfileidentitytypedef/IdentityIntraFile.yang
+++ /dev/null
@@ -1,35 +0,0 @@
-module IdentityIntraFile {
- yang-version 1;
- namespace http://huawei.com;
- prefix IdentityIntraFile;
-
- import "IdentityInModule" {
- prefix "IdentityInModule";
- }
-
- identity ipv4-address-family {
- base IdentityInModule:ref-address-family;
- }
-
- identity ipv6-address-family {
- base IdentityInModule:ref-address-family;
- }
-
- leaf tunnel {
- type identityref {
- base IdentityInModule:ref-address-family;
- }
- }
-
- leaf-list network-ref {
- type identityref {
- base IdentityInModule:ref-address-family;
- }
- }
-
- typedef type15 {
- type identityref {
- base IdentityInModule:ref-address-family;
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/interfileidentitytypedef/IdentityTypedef.yang b/utils/yangutils/plugin/src/test/resources/interfileidentitytypedef/IdentityTypedef.yang
deleted file mode 100644
index 6a58976..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfileidentitytypedef/IdentityTypedef.yang
+++ /dev/null
@@ -1,31 +0,0 @@
-module IdentityTypedef {
- yang-version 1;
- namespace http://huawei.com;
- prefix IdentityTypedef;
-
- import "IdentityInModule" {
- prefix "IdentityInModule";
- }
-
- identity ipv4-address-family {
- base IdentityInModule:ref-address-family;
- }
-
- identity ipv6-address-family {
- base IdentityInModule:ref-address-family;
- }
-
- leaf tunnel {
- type type15;
- }
-
- leaf-list network-ref {
- type type15;
- }
-
- typedef type15 {
- type identityref {
- base IdentityInModule:ref-address-family;
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/interfileietf/ietf-inet-types.yang b/utils/yangutils/plugin/src/test/resources/interfileietf/ietf-inet-types.yang
deleted file mode 100644
index 2b7ed38..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfileietf/ietf-inet-types.yang
+++ /dev/null
@@ -1,454 +0,0 @@
- module ietf-inet-types {
-
- yang-version 1;
-
- namespace
- "urn:ietf:params:xml:ns:yang:ietf-inet-types";
-
- prefix inet;
-
- organization
- "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
-
- contact
- "WG Web: <http://tools.ietf.org/wg/netmod/>
- WG List: <mailto:netmod@ietf.org>
-
- WG Chair: David Kessens
- <mailto:david.kessens@nsn.com>
-
- WG Chair: Juergen Schoenwaelder
- <mailto:j.schoenwaelder@jacobs-university.de>
-
- Editor: Juergen Schoenwaelder
- <mailto:j.schoenwaelder@jacobs-university.de>";
-
- description
- "This module contains a collection of generally useful derived
- YANG data types for Internet addresses and related things.
-
- Copyright (c) 2013 IETF Trust and the persons identified as
- authors of the code. All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, is permitted pursuant to, and subject
- to the license terms contained in, the Simplified BSD License
- set forth in Section 4.c of the IETF Trust's Legal Provisions
- Relating to IETF Documents
- (http://trustee.ietf.org/license-info).
-
- This version of this YANG module is part of RFC 6991; see
- the RFC itself for full legal notices.";
-
- revision "2013-07-15" {
- description
- "This revision adds the following new data types:
- - ip-address-no-zone
- - ipv4-address-no-zone
- - ipv6-address-no-zone";
- reference
- "RFC 6991: Common YANG Data Types";
-
- }
-
- revision "2010-09-24" {
- description "Initial revision.";
- reference
- "RFC 6021: Common YANG Data Types";
-
- }
-
-
- typedef ip-version {
- type enumeration {
- enum "unknown" {
- value 0;
- description
- "An unknown or unspecified version of the Internet
- protocol.";
- }
- enum "ipv4" {
- value 1;
- description
- "The IPv4 protocol as defined in RFC 791.";
- }
- enum "ipv6" {
- value 2;
- description
- "The IPv6 protocol as defined in RFC 2460.";
- }
- }
- description
- "This value represents the version of the IP protocol.
-
- In the value set and its semantics, this type is equivalent
- to the InetVersion textual convention of the SMIv2.";
- reference
- "RFC 791: Internet Protocol
- RFC 2460: Internet Protocol, Version 6 (IPv6) Specification
- RFC 4001: Textual Conventions for Internet Network Addresses";
-
- }
-
- typedef dscp {
- type uint8 {
- range "0..63";
- }
- description
- "The dscp type represents a Differentiated Services Code Point
- that may be used for marking packets in a traffic stream.
- In the value set and its semantics, this type is equivalent
- to the Dscp textual convention of the SMIv2.";
- reference
- "RFC 3289: Management Information Base for the Differentiated
- Services Architecture
- RFC 2474: Definition of the Differentiated Services Field
- (DS Field) in the IPv4 and IPv6 Headers
- RFC 2780: IANA Allocation Guidelines For Values In
- the Internet Protocol and Related Headers";
-
- }
-
- typedef ipv6-flow-label {
- type uint32 {
- range "0..1048575";
- }
- description
- "The ipv6-flow-label type represents the flow identifier or Flow
- Label in an IPv6 packet header that may be used to
- discriminate traffic flows.
-
- In the value set and its semantics, this type is equivalent
- to the IPv6FlowLabel textual convention of the SMIv2.";
- reference
- "RFC 3595: Textual Conventions for IPv6 Flow Label
- RFC 2460: Internet Protocol, Version 6 (IPv6) Specification";
-
- }
-
- typedef port-number {
- type uint16 {
- range "0..65535";
- }
- description
- "The port-number type represents a 16-bit port number of an
- Internet transport-layer protocol such as UDP, TCP, DCCP, or
- SCTP. Port numbers are assigned by IANA. A current list of
- all assignments is available from <http://www.iana.org/>.
-
- Note that the port number value zero is reserved by IANA. In
- situations where the value zero does not make sense, it can
- be excluded by subtyping the port-number type.
- In the value set and its semantics, this type is equivalent
- to the InetPortNumber textual convention of the SMIv2.";
- reference
- "RFC 768: User Datagram Protocol
- RFC 793: Transmission Control Protocol
- RFC 4960: Stream Control Transmission Protocol
- RFC 4340: Datagram Congestion Control Protocol (DCCP)
- RFC 4001: Textual Conventions for Internet Network Addresses";
-
- }
-
- typedef as-number {
- type uint32;
- description
- "The as-number type represents autonomous system numbers
- which identify an Autonomous System (AS). An AS is a set
- of routers under a single technical administration, using
- an interior gateway protocol and common metrics to route
- packets within the AS, and using an exterior gateway
- protocol to route packets to other ASes. IANA maintains
- the AS number space and has delegated large parts to the
- regional registries.
-
- Autonomous system numbers were originally limited to 16
- bits. BGP extensions have enlarged the autonomous system
- number space to 32 bits. This type therefore uses an uint32
- base type without a range restriction in order to support
- a larger autonomous system number space.
-
- In the value set and its semantics, this type is equivalent
- to the InetAutonomousSystemNumber textual convention of
- the SMIv2.";
- reference
- "RFC 1930: Guidelines for creation, selection, and registration
- of an Autonomous System (AS)
- RFC 4271: A Border Gateway Protocol 4 (BGP-4)
- RFC 4001: Textual Conventions for Internet Network Addresses
- RFC 6793: BGP Support for Four-Octet Autonomous System (AS)
- Number Space";
-
- }
-
- typedef ip-address {
- type union {
- type ipv4-address;
- type ipv6-address;
- }
- description
- "The ip-address type represents an IP address and is IP
- version neutral. The format of the textual representation
- implies the IP version. This type supports scoped addresses
- by allowing zone identifiers in the address format.";
- reference
- "RFC 4007: IPv6 Scoped Address Architecture";
-
- }
-
- typedef ipv4-address {
- type string {
- pattern
- '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(%[\p{N}\p{L}]+)?';
- }
- description
- "The ipv4-address type represents an IPv4 address in
- dotted-quad notation. The IPv4 address may include a zone
- index, separated by a % sign.
-
- The zone index is used to disambiguate identical address
- values. For link-local addresses, the zone index will
- typically be the interface index number or the name of an
- interface. If the zone index is not present, the default
- zone of the device will be used.
-
- The canonical format for the zone index is the numerical
- format";
- }
-
- typedef ipv6-address {
- type string {
- pattern
- '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(%[\p{N}\p{L}]+)?';
- pattern
- '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)(%.+)?';
- }
- description
- "The ipv6-address type represents an IPv6 address in full,
- mixed, shortened, and shortened-mixed notation. The IPv6
- address may include a zone index, separated by a % sign.
-
- The zone index is used to disambiguate identical address
- values. For link-local addresses, the zone index will
- typically be the interface index number or the name of an
- interface. If the zone index is not present, the default
- zone of the device will be used.
-
-
-
- The canonical format of IPv6 addresses uses the textual
- representation defined in Section 4 of RFC 5952. The
- canonical format for the zone index is the numerical
- format as described in Section 11.2 of RFC 4007.";
- reference
- "RFC 4291: IP Version 6 Addressing Architecture
- RFC 4007: IPv6 Scoped Address Architecture
- RFC 5952: A Recommendation for IPv6 Address Text
- Representation";
-
- }
-
- typedef ip-address-no-zone {
- type union {
- type ipv4-address-no-zone;
- type ipv6-address-no-zone;
- }
- description
- "The ip-address-no-zone type represents an IP address and is
- IP version neutral. The format of the textual representation
- implies the IP version. This type does not support scoped
- addresses since it does not allow zone identifiers in the
- address format.";
- reference
- "RFC 4007: IPv6 Scoped Address Architecture";
-
- }
-
- typedef ipv4-address-no-zone {
- type ipv4-address {
- pattern '[0-9\.]*';
- }
- description
- "An IPv4 address without a zone index. This type, derived from
- ipv4-address, may be used in situations where the zone is
- known from the context and hence no zone index is needed.";
- }
-
- typedef ipv6-address-no-zone {
- type ipv6-address {
- pattern '[0-9a-fA-F:\.]*';
- }
- description
- "An IPv6 address without a zone index. This type, derived from
- ipv6-address, may be used in situations where the zone is
- known from the context and hence no zone index is needed.";
- reference
- "RFC 4291: IP Version 6 Addressing Architecture
- RFC 4007: IPv6 Scoped Address Architecture
- RFC 5952: A Recommendation for IPv6 Address Text
- Representation";
-
- }
-
- typedef ip-prefix {
- type union {
- type ipv4-prefix;
- type ipv6-prefix;
- }
- description
- "The ip-prefix type represents an IP prefix and is IP
- version neutral. The format of the textual representations
- implies the IP version.";
- }
-
- typedef ipv4-prefix {
- type string {
- pattern
- '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))';
- }
- description
- "The ipv4-prefix type represents an IPv4 address prefix.
- The prefix length is given by the number following the
- slash character and must be less than or equal to 32.
-
- A prefix length value of n corresponds to an IP address
- mask that has n contiguous 1-bits from the most
- significant bit (MSB) and all other bits set to 0.
-
- The canonical format of an IPv4 prefix has all bits of
- the IPv4 address set to zero that are not part of the
- IPv4 prefix.";
- }
-
- typedef ipv6-prefix {
- type string {
- pattern
- '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))';
- pattern
- '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)(/.+)';
- }
- description
- "The ipv6-prefix type represents an IPv6 address prefix.
- The prefix length is given by the number following the
- slash character and must be less than or equal to 128.
-
- A prefix length value of n corresponds to an IP address
- mask that has n contiguous 1-bits from the most
- significant bit (MSB) and all other bits set to 0.
-
- The IPv6 address should have all bits that do not belong
- to the prefix set to zero.
-
- The canonical format of an IPv6 prefix has all bits of
- the IPv6 address set to zero that are not part of the
- IPv6 prefix. Furthermore, the IPv6 address is represented
- as defined in Section 4 of RFC 5952.";
- reference
- "RFC 5952: A Recommendation for IPv6 Address Text
- Representation";
-
- }
-
- typedef domain-name {
- type string {
- length "1..253";
- pattern
- '((([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.)*([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.?)|\.';
- }
- description
- "The domain-name type represents a DNS domain name. The
- name SHOULD be fully qualified whenever possible.
-
- Internet domain names are only loosely specified. Section
- 3.5 of RFC 1034 recommends a syntax (modified in Section
- 2.1 of RFC 1123). The pattern above is intended to allow
- for current practice in domain name use, and some possible
- future expansion. It is designed to hold various types of
- domain names, including names used for A or AAAA records
- (host names) and other records, such as SRV records. Note
- that Internet host names have a stricter syntax (described
- in RFC 952) than the DNS recommendations in RFCs 1034 and
- 1123, and that systems that want to store host names in
- schema nodes using the domain-name type are recommended to
- adhere to this stricter standard to ensure interoperability.
-
- The encoding of DNS names in the DNS protocol is limited
- to 255 characters. Since the encoding consists of labels
- prefixed by a length bytes and there is a trailing NULL
- byte, only 253 characters can appear in the textual dotted
- notation.
-
- The description clause of schema nodes using the domain-name
- type MUST describe when and how these names are resolved to
- IP addresses. Note that the resolution of a domain-name value
- may require to query multiple DNS records (e.g., A for IPv4
- and AAAA for IPv6). The order of the resolution process and
- which DNS record takes precedence can either be defined
- explicitly or may depend on the configuration of the
- resolver.
-
- Domain-name values use the US-ASCII encoding. Their canonical
- format uses lowercase US-ASCII characters. Internationalized
- domain names MUST be A-labels as per RFC 5890.";
- reference
- "RFC 952: DoD Internet Host Table Specification
- RFC 1034: Domain Names - Concepts and Facilities
- RFC 1123: Requirements for Internet Hosts -- Application
- and Support
- RFC 2782: A DNS RR for specifying the location of services
- (DNS SRV)
- RFC 5890: Internationalized Domain Names in Applications
- (IDNA): Definitions and Document Framework";
-
- }
-
- typedef host {
- type union {
- type ip-address;
- type domain-name;
- }
- description
- "The host type represents either an IP address or a DNS
- domain name.";
- }
-
- typedef uri {
- type string;
- description
- "The uri type represents a Uniform Resource Identifier
- (URI) as defined by STD 66.
-
- Objects using the uri type MUST be in US-ASCII encoding,
- and MUST be normalized as described by RFC 3986 Sections
- 6.2.1, 6.2.2.1, and 6.2.2.2. All unnecessary
- percent-encoding is removed, and all case-insensitive
- characters are set to lowercase except for hexadecimal
- digits, which are normalized to uppercase as described in
- Section 6.2.2.1.
-
- The purpose of this normalization is to help provide
- unique URIs. Note that this normalization is not
- sufficient to provide uniqueness. Two URIs that are
- textually distinct after this normalization may still be
- equivalent.
-
- Objects using the uri type may restrict the schemes that
- they permit. For example, 'data:' and 'urn:' schemes
- might not be appropriate.
-
- A zero-length URI is not a valid URI. This can be used to
- express 'URI absent' where required.
-
- In the value set and its semantics, this type is equivalent
- to the Uri SMIv2 textual convention defined in RFC 5017.";
- reference
- "RFC 3986: Uniform Resource Identifier (URI): Generic Syntax
- RFC 3305: Report from the Joint W3C/IETF URI Planning Interest
- Group: Uniform Resource Identifiers (URIs), URLs,
- and Uniform Resource Names (URNs): Clarifications
- and Recommendations
- RFC 5017: MIB Textual Conventions for Uniform Resource
- Identifiers (URIs)";
-
- }
- } // module ietf-inet-types
diff --git a/utils/yangutils/plugin/src/test/resources/interfileietf/ietf-network-topology.yang b/utils/yangutils/plugin/src/test/resources/interfileietf/ietf-network-topology.yang
deleted file mode 100644
index 4c57482..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfileietf/ietf-network-topology.yang
+++ /dev/null
@@ -1,297 +0,0 @@
- module ietf-network-topology {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-network-topology";
- prefix lnk;
-
- import ietf-inet-types {
- prefix inet;
- }
- import ietf-network {
- prefix nd;
- }
-
- organization
- "IETF I2RS (Interface to the Routing System) Working Group";
-
- contact
- "WG Web: <http://tools.ietf.org/wg/i2rs/>
- WG List: <mailto:i2rs@ietf.org>
-
- WG Chair: Susan Hares
- <mailto:shares@ndzh.com>
-
- WG Chair: Jeffrey Haas
- <mailto:jhaas@pfrc.org>
-
- Editor: Alexander Clemm
- <mailto:alex@cisco.com>
-
- Editor: Jan Medved
- <mailto:jmedved@cisco.com>
-
- Editor: Robert Varga
- <mailto:rovarga@cisco.com>
-
- Editor: Tony Tkacik
- <mailto:ttkacik@cisco.com>
-
- Editor: Nitin Bahadur
- <mailto:nitin_bahadur@yahoo.com>
-
- Editor: Hariharan Ananthakrishnan
- <mailto:hari@packetdesign.com>";
-
- description
- "This module defines a common base model for network topology,
- augmenting the base network model with links to connect nodes,
- as well as termination points to terminate links on nodes.
-
- Copyright (c) 2015 IETF Trust and the persons identified as
- authors of the code. All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, is permitted pursuant to, and subject
- to the license terms contained in, the Simplified BSD License
- set forth in Section 4.c of the IETF Trust's Legal Provisions
- Relating to IETF Documents
- (http://trustee.ietf.org/license-info).
-
- This version of this YANG module is part of
- draft-ietf-i2rs-yang-network-topo-02;
- see the RFC itself for full legal notices.
-
- NOTE TO RFC EDITOR: Please replace above reference to
- draft-ietf-i2rs-yang-network-topo-02 with RFC
- number when published (i.e. RFC xxxx).";
-
- revision 2015-12-08 {
- description
- "Initial revision.
- NOTE TO RFC EDITOR: Please replace the following reference
- to draft-ietf-i2rs-yang-network-topo-02 with
- RFC number when published (i.e. RFC xxxx).";
- reference
- "draft-ietf-i2rs-yang-network-topo-02.";
- }
-
- typedef link-id {
- type inet:uri;
- description
- "An identifier for a link in a topology.
- The identifier SHOULD be chosen such that the same link in a
- real network topology will always be identified through the
- same identifier, even if the model is instantiated in
- separate datastores. An implementation MAY choose to capture
- semantics in the identifier, for example to indicate the type
- of link and/or the type of topology that the link is a part
- of.";
- }
-
- typedef tp-id {
- type inet:uri;
- description
- "An identifier for termination points on a node.
- The identifier SHOULD be chosen such that the same TP in a
- real network topology will always be identified through the
- same identifier, even if the model is instantiated in
- separate datastores. An implementation MAY choose to capture
- semantics in the identifier, for example to indicate the type
- of TP and/or the type of node and topology that the TP is a
- part of.";
- }
- grouping link-ref {
- description
- "References a link in a specific network.";
- leaf link-ref {
- type leafref {
- path "/nd:networks/nd:network[nd:network-id=current()/../"+
- "network-ref]/lnk:link/lnk:link-id";
- require-instance false;
- }
- description
- "A type for an absolute reference a link instance.
- (This type should not be used for relative references.
- In such a case, a relative path should be used instead.)";
- }
- uses nd:network-ref;
- }
-
- grouping tp-ref {
- description
- "References a termination point in a specific node.";
- leaf tp-ref {
- type leafref {
- path "/nd:networks/nd:network[nd:network-id=current()/../"+
- "network-ref]/nd:node[nd:node-id=current()/../"+
- "node-ref]/lnk:termination-point/lnk:tp-id";
- require-instance false;
- }
- description
- "A type for an absolute reference to a termination point.
- (This type should not be used for relative references.
- In such a case, a relative path should be used instead.)";
- }
- uses nd:node-ref;
- }
-
- augment "/nd:networks/nd:network" {
- description
- "Add links to the network model.";
- list link {
- key "link-id";
- description
- "A Network Link connects a by Local (Source) node and
- a Remote (Destination) Network Nodes via a set of the
- nodes' termination points.
- As it is possible to have several links between the same
- source and destination nodes, and as a link could
- potentially be re-homed between termination points, to
- ensure that we would always know to distinguish between
- links, every link is identified by a dedicated link
- identifier.
- Note that a link models a point-to-point link, not a
- multipoint link.
- Layering dependencies on links in underlay topologies are
- not represented as the layering information of nodes and of
- termination points is sufficient.";
- container source {
- description
- "This container holds the logical source of a particular
- link.";
- leaf source-node {
- type leafref {
- path "../../../nd:node/nd:node-id";
- }
- mandatory true;
- description
- "Source node identifier, must be in same topology.";
- }
- leaf source-tp {
- type leafref {
- path "../../../nd:node[nd:node-id=current()/../"+
- "source-node]/termination-point/tp-id";
- }
- description
- "Termination point within source node that terminates
- the link.";
- }
- }
- container destination {
- description
- "This container holds the logical destination of a
- particular link.";
- leaf dest-node {
- type leafref {
- path "../../../nd:node/nd:node-id";
- }
- mandatory true;
- description
- "Destination node identifier, must be in the same
- network.";
- }
- leaf dest-tp {
- type leafref {
- path "../../../nd:node[nd:node-id=current()/../"+
- "dest-node]/termination-point/tp-id";
- }
- description
- "Termination point within destination node that
- terminates the link.";
- }
- }
- leaf link-id {
- type link-id;
- description
- "The identifier of a link in the topology.
- A link is specific to a topology to which it belongs.";
- }
- list supporting-link {
- key "network-ref link-ref";
- description
- "Identifies the link, or links, that this link
- is dependent on.";
- leaf network-ref {
- type leafref {
- path "../../../nd:supporting-network/nd:network-ref";
- require-instance false;
- }
- description
- "This leaf identifies in which underlay topology
- supporting link is present.";
- }
- leaf link-ref {
- type leafref {
- path "/nd:networks/nd:network[nd:network-id=current()/"+
- "../network-ref]/link/link-id";
- require-instance false;
- }
- description
- "This leaf identifies a link which is a part
- of this link's underlay. Reference loops, in which
- a link identifies itself as its underlay, either
- directly or transitively, are not allowed.";
- }
- }
- }
- }
- augment "/nd:networks/nd:network/nd:node" {
- description
- "Augment termination points which terminate links.
- Termination points can ultimately be mapped to interfaces.";
- list termination-point {
- key "tp-id";
- description
- "A termination point can terminate a link.
- Depending on the type of topology, a termination point
- could, for example, refer to a port or an interface.";
- leaf tp-id {
- type tp-id;
- description
- "Termination point identifier.";
- }
- list supporting-termination-point {
- key "network-ref node-ref tp-ref";
- description
- "The leaf list identifies any termination points that
- the termination point is dependent on, or maps onto.
- Those termination points will themselves be contained
- in a supporting node.
- This dependency information can be inferred from
- the dependencies between links. For this reason,
- this item is not separately configurable. Hence no
- corresponding constraint needs to be articulated.
- The corresponding information is simply provided by the
- implementing system.";
- leaf network-ref {
- type leafref {
- path "../../../nd:supporting-node/nd:network-ref";
- require-instance false;
- }
- description
- "This leaf identifies in which topology the
- supporting termination point is present.";
- }
- leaf node-ref {
- type leafref {
- path "../../../nd:supporting-node/nd:node-ref";
- require-instance false;
- }
- description
- "This leaf identifies in which node the supporting
- termination point is present.";
- }
- leaf tp-ref {
- type leafref {
- path "/nd:networks/nd:network[nd:network-id=current()/"+
- "../network-ref]/nd:node[nd:node-id=current()/../"+
- "node-ref]/termination-point/tp-id";
- require-instance false;
- }
- description
- "Reference to the underlay node, must be in a
- different topology";
- }
- }
- }
- }
- }
diff --git a/utils/yangutils/plugin/src/test/resources/interfileietf/ietf-network.yang b/utils/yangutils/plugin/src/test/resources/interfileietf/ietf-network.yang
deleted file mode 100644
index 60c47ce..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfileietf/ietf-network.yang
+++ /dev/null
@@ -1,216 +0,0 @@
- module ietf-network {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-network";
- prefix nd;
-
- import ietf-inet-types {
- prefix inet;
- }
-
- organization
- "IETF I2RS (Interface to the Routing System) Working Group";
-
- contact
- "WG Web: <http://tools.ietf.org/wg/i2rs/>
- WG List: <mailto:i2rs@ietf.org>
-
- WG Chair: Susan Hares
- <mailto:shares@ndzh.com>
-
- WG Chair: Jeffrey Haas
- <mailto:jhaas@pfrc.org>
-
- Editor: Alexander Clemm
- <mailto:alex@cisco.com>
-
- Editor: Jan Medved
- <mailto:jmedved@cisco.com>
-
- Editor: Robert Varga
- <mailto:rovarga@cisco.com>
-
- Editor: Tony Tkacik
- <mailto:ttkacik@cisco.com>
-
- Editor: Nitin Bahadur
- <mailto:nitin_bahadur@yahoo.com>
-
- Editor: Hariharan Ananthakrishnan
- <mailto:hari@packetdesign.com>";
-
- description
- "This module defines a common base model for a collection
- of nodes in a network. Node definitions are further used
- in network topologies and inventories.
-
- Copyright (c) 2015 IETF Trust and the persons identified as
- authors of the code. All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, is permitted pursuant to, and subject
- to the license terms contained in, the Simplified BSD License
- set forth in Section 4.c of the IETF Trust's Legal Provisions
- Relating to IETF Documents
- (http://trustee.ietf.org/license-info).
-
- This version of this YANG module is part of
- draft-ietf-i2rs-yang-network-topo-02;
- see the RFC itself for full legal notices.
-
- NOTE TO RFC EDITOR: Please replace above reference to
- draft-ietf-i2rs-yang-network-topo-02 with RFC
- number when published (i.e. RFC xxxx).";
-
- revision 2015-12-08 {
- description
- "Initial revision.
- NOTE TO RFC EDITOR: Please replace the following reference
- to draft-ietf-i2rs-yang-network-topo-02 with
- RFC number when published (i.e. RFC xxxx).";
- reference
- "draft-ietf-i2rs-yang-network-topo-02";
- }
-
- typedef node-id {
- type inet:uri;
- description
- "Identifier for a node.";
- }
-
- typedef network-id {
- type inet:uri;
- description
- "Identifier for a network.";
- }
- grouping network-ref {
- description
- "Contains the information necessary to reference a network,
- for example an underlay network.";
- leaf network-ref {
- type leafref {
- path "/nd:networks/nd:network/nd:network-id";
- require-instance false;
- }
- description
- "Used to reference a network, for example an underlay
- network.";
- }
- }
-
- grouping node-ref {
- description
- "Contains the information necessary to reference a node.";
- leaf node-ref {
- type leafref {
- path "/nd:networks/nd:network[nd:network-id=current()/../"+
- "network-ref]/nd:node/nd:node-id";
- require-instance false;
- }
- description
- "Used to reference a node.
- Nodes are identified relative to the network they are
- contained in.";
- }
- uses network-ref;
- }
-
- container networks {
- description
- "Serves as top-level container for a list of networks.";
- list network {
- key "network-id";
- description
- "Describes a network.
- A network typically contains an inventory of nodes,
- topological information (augmented through
- network-topology model), as well as layering
- information.";
- container network-types {
- description
- "Serves as an augmentation target.
- The network type is indicated through corresponding
- presence containers augmented into this container.";
- }
- leaf network-id {
- type network-id;
- description
- "Identifies a network.";
- }
- list supporting-network {
- key "network-ref";
- description
- "An underlay network, used to represent layered network
- topologies.";
- leaf network-ref {
- type leafref {
- path "/networks/network/network-id";
- require-instance false;
- }
- description
- "References the underlay network.";
- }
- }
- list node {
- key "node-id";
- description
- "The inventory of nodes of this network.";
- leaf node-id {
- type node-id;
- description
- "Identifies a node uniquely within the containing
- network.";
- }
- list supporting-node {
- key "network-ref node-ref";
- description
- "Represents another node, in an underlay network, that
- this node is supported by. Used to represent layering
- structure.";
- leaf network-ref {
- type leafref {
- path "../../../supporting-network/network-ref";
- require-instance false;
- }
- description
- "References the underlay network that the
- underlay node is part of.";
- }
- leaf node-ref {
- type leafref {
- path "/networks/network/node/node-id";
- require-instance false;
- }
- description
- "References the underlay node itself.";
- }
- }
- }
- }
- }
- container networks-state {
- config false;
- description
- "Serves as top-level container for a list of state information
- for networks";
- list network {
- key "network-ref";
- description
- "Data nodes representing operational data and state of
- networks.
- An instance is automatically created for every network
- in the corresponding list under the networks container.";
- uses network-ref;
- leaf server-provided {
- type boolean;
- description
- "Indicates whether the information concerning this
- particular network is populated by the server
- (server-provided true, the general case for network
- information discovered from the server),
- or whether it is configured by a client
- (server-provided true, possible e.g. for
- service overlays managed through a controller).";
- }
- }
- }
- }
diff --git a/utils/yangutils/plugin/src/test/resources/interfileietf/ietf-schedule.yang b/utils/yangutils/plugin/src/test/resources/interfileietf/ietf-schedule.yang
deleted file mode 100644
index b9f7297..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfileietf/ietf-schedule.yang
+++ /dev/null
@@ -1,64 +0,0 @@
- module ietf-schedule {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-schedule";
- // replace with IANA namespace when assigned
-
- prefix "sch";
-
- import ietf-yang-types {
- prefix "yang";
- }
-
- organization "TBD";
- contact "TBD";
- description
- "The model allows time scheduling parameters to be specified.";
-
- revision "2016-03-01" {
- description "Initial revision";
- reference "TBD";
- }
-
- /*
- * Groupings
- */
-
- grouping schedules {
- description
- "A list of schedules defining when a particular
- configuration takes effect.";
- container schedules {
- description
- "Container of a schedule list defining when a particular
- configuration takes effect.";
- list schedule {
- key "schedule-id";
- description "A list of schedule elements.";
-
- leaf schedule-id {
- type uint32;
- description "Identifies the schedule element.";
- }
- leaf start {
- type yang:date-and-time;
- description "Start time.";
- }
- leaf schedule-duration {
- type string {
- pattern
- 'P(\d+Y)?(\d+M)?(\d+W)?(\d+D)?T(\d+H)?(\d+M)?(\d+S)?';
- }
- description "Schedule duration in ISO 8601 format.";
- }
- leaf repeat-interval {
- type string {
- pattern
- 'R\d*/P(\d+Y)?(\d+M)?(\d+W)?(\d+D)?T(\d+H)?(\d+M)?'
- + '(\d+S)?';
- }
- description "Repeat interval in ISO 8601 format.";
- }
- }
- }
- } // schedules
- }
diff --git a/utils/yangutils/plugin/src/test/resources/interfileietf/ietf-te-topology.yang b/utils/yangutils/plugin/src/test/resources/interfileietf/ietf-te-topology.yang
deleted file mode 100644
index 582ba9e..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfileietf/ietf-te-topology.yang
+++ /dev/null
@@ -1,1779 +0,0 @@
- module ietf-te-topology {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-te-topology";
- // replace with IANA namespace when assigned
-
- prefix "tet";
-
- import ietf-inet-types {
- prefix "inet";
- }
-
- import ietf-schedule {
- prefix "sch";
- }
-
- import ietf-te-types {
- prefix "te-types";
- }
-
- import ietf-network {
- prefix "nw";
- }
-
- import ietf-network-topology {
- prefix "nt";
- }
-
- organization
- "Traffic Engineering Architecture and Signaling (TEAS)
- Working Group";
-
- contact
- "WG Web: <http://tools.ietf.org/wg/teas/>
- WG List: <mailto:teas@ietf.org>
-
- WG Chair: Lou Berger
- <mailto:lberger@labn.net>
-
- WG Chair: Vishnu Pavan Beeram
- <mailto:vbeeram@juniper.net>
-
- Editor: Xufeng Liu
- <mailto:xliu@kuatrotech.com>
-
- Editor: Igor Bryskin
- <mailto:Igor.Bryskin@huawei.com>
-
- Editor: Vishnu Pavan Beeram
- <mailto:vbeeram@juniper.net>
-
- Editor: Tarek Saad
- <mailto:tsaad@cisco.com>
-
- Editor: Himanshu Shah
- <mailto:hshah@ciena.com>
-
- Editor: Oscar Gonzalez De Dios
- <mailto:oscar.gonzalezdedios@telefonica.com>";
-
- description "TE topology model";
-
- revision "2016-03-17" {
- description "Initial revision";
- reference "TBD";
- }
-
- /*
- * Features
- */
-
- feature configuration-schedule {
- description
- "This feature indicates that the system supports
- configuration scheduling.";
- }
-
- feature te-topology-hierarchy {
- description
- "This feature indicates that the system allows underlay
- and/or overlay TE topology hierarchy.";
- }
-
- feature te-performance-metric {
- description
- "This feature indicates that the system supports
- TE performance metric defined in
- RFC7471: OSPF Traffic Engineering (TE) Metric Extensions.";
- }
-
- feature template {
- description
- "This feature indicates that the system supports
- template configuration.";
- }
-
- /*
- * Typedefs
- */
- typedef performance-metric-normality {
- type enumeration {
- enum "unknown" {
- value 0;
- description
- "Unknown.";
- }
- enum "normal" {
- value 1;
- description
- "Normal.";
- }
- enum "abnormal" {
- value 2;
- description
- "Abnormal. The anomalous bit is set.";
- }
- }
- description
- "Indicates whether a performance metric is normal, abnormal, or
- unknown.";
- reference
- "RFC7471: OSPF Traffic Engineering (TE) Metric Extensions.";
- }
-
- typedef te-admin-status {
- type enumeration {
- enum up {
- description
- "Enabled.";
- }
- enum down {
- description
- "Disabled.";
- }
- enum testing {
- description
- "In some test mode.";
- }
- enum preparing-maintenance {
- description
- "Resource is disabled in the control plane to prepare for
- graceful shutdown for maintenance purposes.";
- reference
- "RFC5817: Graceful Shutdown in MPLS and Generalized MPLS
- Traffic Engineering Networks";
- }
- enum maintenance {
- description
- "Resource is disabled in the data plane for maintenance
- purposes.";
- }
- }
- description
- "Defines a type representing the administrative status of
- a TE resource.";
- }
- typedef te-global-id {
- type uint32;
- description
- "An identifier to uniquely identify an operator, which can be
- either a provider or a client.
- The definition of this type is taken from RFC6370 and RFC5003.
- This attribute type is used solely to provide a globally
- unique context for TE topologies.";
- }
-
- typedef te-link-access-type {
- type enumeration {
- enum point-to-point {
- description
- "The link is point-to-point.";
- }
- enum multi-access {
- description
- "The link is multi-access, including broacast and NBMA.";
- }
- }
- description
- "Defines a type representing the access type of a TE link.";
- reference
- "RFC3630: Traffic Engineering (TE) Extensions to OSPF
- Version 2.";
- }
-
- typedef te-node-id {
- type inet:ip-address;
- description
- "An identifier for a node in a topology.
- The identifier is represented as an IPv4 or IPv6 address.
- This attribute is mapped to Router ID in
- RFC3630, RFC5329, RFC5305, and RFC 6119.";
- }
-
- typedef te-oper-status {
- type enumeration {
- enum up {
- description
- "Operational up.";
- }
- enum down {
- description
- "Operational down.";
- }
- enum testing {
- description
- "In some test mode.";
- }
- enum unknown {
- description
- "Status cannot be determined for some reason.";
- }
- enum preparing-maintenance {
- description
- "Resource is disabled in the control plane to prepare for
- graceful shutdown for maintenance purposes.";
- reference
- "RFC5817: Graceful Shutdown in MPLS and Generalized MPLS
- Traffic Engineering Networks";
- }
- enum maintenance {
- description
- "Resource is disabled in the data plane for maintenance
- purposes.";
- }
- }
- description
- "Defines a type representing the operational status of
- a TE resource.";
- }
-
- typedef te-recovery-status {
- type enumeration {
- enum normal {
- description
- "Both the recovery and working spans are fully
- allocated and active, data traffic is being
- transported over (or selected from) the working
- span, and no trigger events are reported.";
- }
- enum recovery-started {
- description
- "The recovery action has been started, but not completed.";
- }
- enum recovery-succeeded {
- description
- "The recovery action has succeeded. The working span has
- reported a failure/degrade condition and the user traffic
- is being transported (or selected) on the recovery span.";
- }
- enum recovery-failed {
- description
- "The recovery action has failed.";
- }
- enum reversion-started {
- description
- "The reversion has started.";
- }
- enum reversion-failed {
- description
- "The reversion has failed.";
- }
- enum recovery-unavailable {
- description
- "The recovery is unavailable -- either as a result of an
- operator Lockout command or a failure condition detected
- on the recovery span.";
- }
- enum recovery-admin {
- description
- "The operator has issued a command switching the user
- traffic to the recovery span.";
- }
- enum wait-to-restore {
- description
- "The recovery domain is recovering from a failuer/degrade
- condition on the working span that is being controlled by
- the Wait-to-Restore (WTR) timer.";
- }
- }
- description
- "Defines the status of a recovery action.";
- reference
- "RFC4427: Recovery (Protection and Restoration) Terminology
- for Generalized Multi-Protocol Label Switching (GMPLS).
- RFC6378: MPLS Transport Profile (MPLS-TP) Linear Protection";
- }
-
- typedef te-template-name {
- type string {
- pattern '/?([a-zA-Z0-9\-_.]+)(/[a-zA-Z0-9\-_.]+)*';
- }
- description
- "A type for the name of a TE node template or TE link
- template.";
- }
-
- typedef te-topology-event-type {
- type enumeration {
- enum "add" {
- value 0;
- description
- "A TE node or te-link has been added.";
- }
- enum "remove" {
- value 1;
- description
- "A TE node or te-link has been removed.";
- }
- enum "update" {
- value 2;
- description
- "A TE node or te-link has been updated.";
- }
- }
- description "TE Event type for notifications";
- } // te-topology-event-type
- typedef te-topology-id {
- type string {
- pattern '/?([a-zA-Z0-9\-_.]+)(/[a-zA-Z0-9\-_.]+)*';
- }
- description
- "An identifier for a topology.";
- }
-
- typedef te-tp-id {
- type union {
- type uint32; // Unnumbered
- type inet:ip-address; // IPv4 or IPv6 address
- }
- description
- "An identifier for a TE link endpoint on a node.
- This attribute is mapped to local or remote link identifier in
- RFC3630 and RFC5305.";
- }
-
- /*
- * Identities
- */
-
- /*
- * Groupings
- */
- grouping information-source-attributes {
- description
- "The attributes identifying source that has provided the
- related information, and the source credibility.";
- leaf information-source {
- type enumeration {
- enum "unknown" {
- description "The source is unknown.";
- }
- enum "locally-configured" {
- description "Configured entity.";
- }
- enum "ospfv2" {
- description "OSPFv2.";
- }
- enum "ospfv3" {
- description "OSPFv3.";
- }
- enum "isis" {
- description "ISIS.";
- }
- enum "system-processed" {
- description "System processed entity.";
- }
- enum "other" {
- description "Other source.";
- }
- }
- description
- "Indicates the source of the information.";
- }
- container information-source-state {
- description
- "The container contains state attributes related to
- the information source.";
- leaf credibility-preference {
- type uint16;
- description
- "The preference value to calculate the traffic
- engineering database credibility value used for
- tie-break selection between different
- information-source values.
- Higher value is more preferable.";
- }
- container topology {
- description
- "When the information is processed by the system,
- the attributes in this container indicate which topology
- is used to process to generate the result information.";
- uses te-topology-ref;
- } // topology
- leaf routing-instance {
- type string;
- description
- "When applicable, this is the name of a routing instance
- from which the information is learned.";
- } // routing-information
- }
- } // information-source-attributes
-
- grouping performance-metric-attributes {
- description
- "Link performance information in real time.";
- reference
- "RFC7471: OSPF Traffic Engineering (TE) Metric Extensions.";
- leaf unidirectional-delay {
- type uint32 {
- range 0..16777215;
- }
- description "Delay or latency in micro seconds.";
- }
- leaf unidirectional-min-delay {
- type uint32 {
- range 0..16777215;
- }
- description "Minimum delay or latency in micro seconds.";
- }
- leaf unidirectional-max-delay {
- type uint32 {
- range 0..16777215;
- }
- description "Maximum delay or latency in micro seconds.";
- }
- leaf unidirectional-delay-variation {
- type uint32 {
- range 0..16777215;
- }
- description "Delay variation in micro seconds.";
- }
- leaf unidirectional-packet-loss {
- type decimal64 {
- fraction-digits 6;
- range "0 .. 50.331642";
- }
- description
- "Packet loss as a percentage of the total traffic sent
- over a configurable interval. The finest precision is
- 0.000003%.";
- }
- leaf unidirectional-residual-bandwidth {
- type decimal64 {
- fraction-digits 2;
- }
- description
- "Residual bandwidth that subtracts tunnel
- reservations from Maximum Bandwidth (or link capacity)
- [RFC3630] and provides an aggregated remainder across QoS
- classes.";
- }
- leaf unidirectional-available-bandwidth {
- type decimal64 {
- fraction-digits 2;
- }
- description
- "Available bandwidth that is defined to be residual
- bandwidth minus the measured bandwidth used for the
- actual forwarding of non-RSVP-TE LSP packets. For a
- bundled link, available bandwidth is defined to be the
- sum of the component link available bandwidths.";
- }
- leaf unidirectional-utilized-bandwidth {
- type decimal64 {
- fraction-digits 2;
- }
- description
- "Bandwidth utilization that represents the actual
- utilization of the link (i.e. as measured in the router).
- For a bundled link, bandwidth utilization is defined to
- be the sum of the component link bandwidth
- utilizations.";
- }
- } // performance-metric-attributes
- grouping performance-metric-normality-attributes {
- description
- "Link performance metric normality attributes.";
- reference
- "RFC7471: OSPF Traffic Engineering (TE) Metric Extensions.";
- leaf unidirectional-delay {
- type performance-metric-normality;
- description "Delay normality.";
- }
- leaf unidirectional-min-delay {
- type performance-metric-normality;
- description "Minimum delay or latency normality.";
- }
- leaf unidirectional-max-delay {
- type performance-metric-normality;
- description "Maximum delay or latency normality.";
- }
- leaf unidirectional-delay-variation {
- type performance-metric-normality;
- description "Delay variation normality.";
- }
- leaf unidirectional-packet-loss {
- type performance-metric-normality;
- description "Packet loss normality.";
- }
- leaf unidirectional-residual-bandwidth {
- type performance-metric-normality;
- description "Residual bandwidth normality.";
- }
- leaf unidirectional-available-bandwidth {
- type performance-metric-normality;
- description "Available bandwidth normality.";
- }
- leaf unidirectional-utilized-bandwidth {
- type performance-metric-normality;
- description "Bandwidth utilization normality.";
- }
- } // performance-metric-normality-attributes
-
- grouping performance-metric-throttle-container {
- description
- "A container controlling performance metric throttle.";
- container performance-metric-throttle {
- if-feature te-performance-metric;
- must "suppression-interval >= measure-interval" {
- error-message
- "suppression-interval cannot be less then
- measure-interval.";
- description
- "Constraint on suppression-interval and
- measure-interval.";
- }
- description
- "Link performance information in real time.";
- reference
- "RFC7471: OSPF Traffic Engineering (TE) Metric Extensions.";
- leaf unidirectional-delay-offset {
- type uint32 {
- range 0..16777215;
- }
- description
- "Offset value to be added to the measured delay value.";
- }
- leaf measure-interval {
- type uint32;
- default 30;
- description
- "Interval in seconds to measure the extended metric
- values.";
- }
- leaf advertisement-interval {
- type uint32;
- description
- "Interval in seconds to advertise the extended metric
- values.";
- }
- leaf suppression-interval {
- type uint32 {
- range "1 .. max";
- }
- default 120;
- description
- "Interval in seconds to suppress advertising the extended
- metric values.";
- }
- container threshold-out {
- uses performance-metric-attributes;
- description
- "If the measured parameter falls outside an upper bound
- for all but the min delay metric (or lower bound for
- min-delay metric only) and the advertised value is not
- already outside that bound, anomalous announcement will be
- triggered.";
- }
- container threshold-in {
- uses performance-metric-attributes;
- description
- "If the measured parameter falls inside an upper bound
- for all but the min delay metric (or lower bound for
- min-delay metric only) and the advertised value is not
- already inside that bound, normal (anomalous-flag cleared)
- announcement will be triggered.";
- }
- container threshold-accelerated-advertisement {
- description
- "When the difference between the last advertised value and
- current measured value exceed this threshold, anomalous
- announcement will be triggered.";
- uses performance-metric-attributes;
- }
- }
- } // performance-metric-throttle-container
-
- grouping te-link-augment {
- description
- "Augmentation for TE link.";
-
- container te {
- presence "TE support.";
- description
- "Indicates TE support.";
-
- container config {
- description
- "Configuration data.";
- uses te-link-config;
- } // config
- container state {
- config false;
- description
- "Operational state data.";
- uses te-link-config;
- uses te-link-state-derived;
- } // state
- } // te
- } // te-link-augment
-
- grouping te-link-config {
- description
- "TE link configuration grouping.";
- choice bundle-stack-level {
- description
- "The TE link can be partitioned into bundled
- links, or component links.";
- case bundle {
- container bundled-links {
- description
- "A set of bundled links.";
- reference
- "RFC4201: Link Bundling in MPLS Traffic Engineering
- (TE).";
- list bundled-link {
- key "sequence";
- description
- "Specify a bundled interface that is
- further partitioned.";
- leaf sequence {
- type uint32;
- description
- "Identify the sequence in the bundle.";
- }
- leaf src-tp-ref {
- type leafref {
- path "../../../../../../nw:node[nw:node-id = "
- + "current()/../../../../../nt:source/"
- + "nt:source-node]/"
- + "nt:termination-point/nt:tp-id";
- require-instance true;
- }
- description
- "Reference to another TE termination point on the
- same souruce node.";
- }
- leaf des-tp-ref {
- type leafref {
- path "../../../../../../nw:node[nw:node-id = "
- + "current()/../../../../../nt:destination/"
- + "nt:dest-node]/"
- + "nt:termination-point/nt:tp-id";
- require-instance true;
- }
- description
- "Reference to another TE termination point on the
- same destination node.";
- }
- } // list bundled-link
- }
- }
- case component {
- container component-links {
- description
- "A set of component links";
- list component-link {
- key "sequence";
- description
- "Specify a component interface that is
- sufficient to unambiguously identify the
- appropriate resources";
-
- leaf sequence {
- type uint32;
- description
- "Identify the sequence in the bundle.";
- }
- leaf src-interface-ref {
- type string;
- description
- "Reference to component link interface on the
- source node.";
- }
- leaf des-interface-ref {
- type string;
- description
- "Reference to component link interface on the
- destinatioin node.";
- }
- }
- }
- }
- } // bundle-stack-level
-
- leaf-list te-link-template {
- if-feature template;
- type leafref {
- path "../../../../../te/templates/link-template/name";
- }
- description
- "The reference to a TE link template.";
- }
- uses te-link-config-attributes;
- } // te-link-config
-
- grouping te-link-config-attributes {
- description
- "Link configuration attributes in a TE topology.";
- container te-link-attributes {
- description "Link attributes in a TE topology.";
- uses sch:schedules;
- leaf access-type {
- type te-link-access-type;
- description
- "Link access type, which can be point-to-point or
- multi-access.";
- }
- leaf is-abstract {
- type empty;
- description "Present if the link is abstract.";
- }
- leaf name {
- type string;
- description "Link Name.";
- }
- container underlay {
- if-feature te-topology-hierarchy;
- presence
- "Indicates the underlay exists for this link.";
- description "Attributes of the te-link underlay.";
- reference
- "RFC4206: Label Switched Paths (LSP) Hierarchy with
- Generalized Multi-Protocol Label Switching (GMPLS)
- Traffic Engineering (TE)";
-
- uses te-link-underlay-attributes;
- } // underlay
- leaf admin-status {
- type te-admin-status;
- description
- "The administrative state of the link.";
- }
-
- uses performance-metric-throttle-container;
- uses te-link-info-attributes;
- } // te-link-attributes
- } // te-link-config-attributes
-
- grouping te-link-info-attributes {
- description
- "Advertised TE information attributes.";
- leaf link-index {
- type uint64;
- description
- "The link identifier. If OSPF is used, this represents an
- ospfLsdbID. If IS-IS is used, this represents an isisLSPID.
- If a locally configured link is used, this object represents
- a unique value, which is locally defined in a router.";
- }
- leaf administrative-group {
- type te-types:admin-groups;
- description
- "Administrative group or color of the link.
- This attribute covers both administrative group (defined in
- RFC3630, RFC5329, and RFC5305), and extended administrative
- group (defined in RFC7308).";
- }
- leaf max-link-bandwidth {
- type decimal64 {
- fraction-digits 2;
- }
- description
- "Maximum bandwidth that can be seen on this link in this
- direction. Units in bytes per second.";
- reference
- "RFC3630: Traffic Engineering (TE) Extensions to OSPF
- Version 2.
- RFC5305: IS-IS Extensions for Traffic Engineering.";
- }
- leaf max-resv-link-bandwidth {
- type decimal64 {
- fraction-digits 2;
- }
- description
- "Maximum amount of bandwidth that can be reserved in this
- direction in this link. Units in bytes per second.";
- reference
- "RFC3630: Traffic Engineering (TE) Extensions to OSPF
- Version 2.
- RFC5305: IS-IS Extensions for Traffic Engineering.";
- }
- list unreserved-bandwidth {
- key "priority";
- max-elements "8";
- description
- "Unreserved bandwidth for 0-7 priority levels. Units in
- bytes per second.";
- reference
- "RFC3630: Traffic Engineering (TE) Extensions to OSPF
- Version 2.
- RFC5305: IS-IS Extensions for Traffic Engineering.";
- leaf priority {
- type uint8 {
- range "0..7";
- }
- description "Priority.";
- }
- leaf bandwidth {
- type decimal64 {
- fraction-digits 2;
- }
- description
- "Unreserved bandwidth for this level.";
- }
- }
- leaf te-default-metric {
- type uint32;
- description
- "Traffic Engineering Metric.";
- }
- container performance-metric {
- if-feature te-performance-metric;
- description
- "Link performance information in real time.";
- reference
- "RFC7471: OSPF Traffic Engineering (TE) Metric Extensions.";
- container measurement {
- description
- "Measured performance metric values. Static configuration
- and manual overrides of these measurements are also
- allowed.";
- uses performance-metric-attributes;
- }
- container normality
- {
- description
- "Performance metric normality values.";
- uses performance-metric-normality-attributes;
- }
- }
- leaf link-protection-type {
- type enumeration {
- enum "unprotected" {
- description "Unprotected.";
- }
- enum "extra-traffic" {
- description "Extra traffic.";
- }
- enum "shared" {
- description "Shared.";
- }
- enum "1-for-1" {
- description "One for one protection.";
- }
- enum "1-plus-1" {
- description "One plus one protection.";
- }
- enum "enhanced" {
- description "Enhanced protection.";
- }
- }
- description
- "Link Protection Type desired for this link.";
- reference
- "RFC4202: Routing Extensions in Support of
- Generalized Multi-Protocol Label Switching (GMPLS).";
- }
- list interface-switching-capability {
- key "switching-capability";
- description
- "List of Interface Switching Capabilities Descriptors (ISCD)
- for this link.";
- reference
- "RFC3471: Generalized Multi-Protocol Label Switching (GMPLS)
- Signaling Functional Description.
- RFC4203: OSPF Extensions in Support of Generalized
- Multi-Protocol Label Switching (GMPLS).";
- leaf switching-capability {
- type identityref {
- base te-types:switching-capabilities;
- }
- description
- "Switching Capability for this interface.";
- }
- leaf encoding {
- type identityref {
- base te-types:lsp-encoding-types;
- }
- description
- "Encoding supported by this interface.";
- }
- list max-lsp-bandwidth {
- key "priority";
- max-elements "8";
- description
- "Maximum LSP Bandwidth at priorities 0-7.";
- leaf priority {
- type uint8 {
- range "0..7";
- }
- description "Priority.";
- }
- leaf bandwidth {
- type decimal64 {
- fraction-digits 2;
- }
- description
- "Max LSP Bandwidth for this level";
- }
- }
- container time-division-multiplex-capable {
- when "../switching-capability = 'TDM'" {
- description "Valid only for TDM";
- }
- description
- "Interface has time-division multiplex capabilities.";
-
- leaf minimum-lsp-bandwidth {
- type decimal64 {
- fraction-digits 2;
- }
- description
- "Minimum LSP Bandwidth. Units in bytes per second.";
- }
- leaf indication {
- type enumeration {
- enum "standard" {
- description
- "Indicates support of standard SONET/SDH.";
- }
- enum "arbitrary" {
- description
- "Indicates support of arbitrary SONET/SDH.";
- }
- }
- description
- "Indication whether the interface supports Standard or
- Arbitrary SONET/SDH";
- }
- }
- list interface-adjustment-capability {
- key "upper-sc";
- description
- "List of Interface Adjustment Capability Descriptors (IACD)
- for this link.";
- reference
- "RFC6001: Generalized MPLS (GMPLS) Protocol Extensions
- for Multi-Layer and Multi-Region Networks (MLN/MRN).";
- leaf upper-sc {
- type identityref {
- base te-types:switching-capabilities;
- }
- description
- "Switching Capability for this interface.";
- }
- leaf upper-encoding {
- type identityref {
- base te-types:lsp-encoding-types;
- }
- description
- "Encoding supported by this interface.";
- }
- list max-lsp-bandwidth {
- key "priority";
- max-elements "8";
- description
- "Maximum LSP Bandwidth at priorities 0-7.";
- leaf priority {
- type uint8 {
- range "0..7";
- }
- description "Priority.";
- }
- leaf bandwidth {
- type decimal64 {
- fraction-digits 2;
- }
- description
- "Max LSP Bandwidth for this level.";
- }
- }
- } // interface-adjustment-capability
- } // interface-switching-capability
- container te-srlgs {
- description
- "A list of SLRGs.";
- leaf-list values {
- type te-types:srlg;
- description "SRLG value.";
- reference
- "RFC4202: Routing Extensions in Support of
- Generalized Multi-Protocol Label Switching (GMPLS).";
- }
- }
- } // te-link-info-attributes
-
- grouping te-link-state-derived {
- description
- "Link state attributes in a TE topology.";
- leaf oper-status {
- type te-oper-status;
- description
- "The current operational state of the link.";
- }
- uses information-source-attributes;
- list alt-information-sources {
- key "information-source";
- description
- "A list of information sources learned but not used.";
- uses information-source-attributes;
- uses te-link-info-attributes;
- }
- container recovery {
- description
- "Status of the recovery process.";
- leaf restoration-status {
- type te-recovery-status;
- description
- "Restoration status.";
- }
- leaf protection-status {
- type te-recovery-status;
- description
- "Protection status.";
- }
- }
- container underlay {
- if-feature te-topology-hierarchy;
- description "State attributes for te-link underlay.";
- uses te-link-state-underlay-attributes;
- }
- } // te-link-state-derived
- grouping te-link-state-underlay-attributes {
- description "State attributes for te-link underlay.";
- leaf dynamic {
- type boolean;
- description
- "true if the underlay is dynamically created.";
- }
- leaf committed {
- type boolean;
- description
- "true if the underlay is committed.";
- }
- } // te-link-state-underlay-attributes
-
- grouping te-link-underlay-attributes {
- description "Attributes for te-link underlay.";
- reference
- "RFC4206: Label Switched Paths (LSP) Hierarchy with
- Generalized Multi-Protocol Label Switching (GMPLS)
- Traffic Engineering (TE)";
- container underlay-primary-path {
- description
- "The service path on the underlay topology that
- supports this link.";
- uses te-topology-ref;
- list path-element {
- key "path-element-id";
- description
- "A list of path elements describing the service path.";
- leaf path-element-id {
- type uint32;
- description "To identify the element in a path.";
- }
- uses te-path-element;
- }
- } // underlay-primary-path
- list underlay-backup-path {
- key "index";
- description
- "A list of backup service paths on the underlay topology that
- protect the underlay primary path. If the primary path is
- not protected, the list contains zero elements. If the
- primary path is protected, the list contains one or more
- elements.";
- leaf index {
- type uint32;
- description
- "A sequence number to identify a backup path.";
- }
- uses te-topology-ref;
- list path-element {
- key "path-element-id";
- description
- "A list of path elements describing the backup service
- path";
- leaf path-element-id {
- type uint32;
- description "To identify the element in a path.";
- }
- uses te-path-element;
- }
- } // underlay-backup-path
- leaf underlay-protection-type {
- type uint16;
- description
- "Underlay protection type desired for this link";
- }
- container underlay-trail-src {
- uses nt:tp-ref;
- description
- "Source TE link of the underlay trail.";
- }
- container underlay-trail-des {
- uses nt:tp-ref;
- description
- "Destination TE link of the underlay trail.";
- }
- } // te-link-underlay-attributes
-
- grouping te-node-augment {
- description
- "Augmentation for TE node.";
-
- container te {
- presence "TE support.";
- description
- "Indicates TE support.";
-
- leaf te-node-id {
- type te-node-id;
- mandatory true;
- description
- "The identifier of a node in the TE topology.
- A node is specific to a topology to which it belongs.";
- }
-
- container config {
- description
- "Configuration data.";
- uses te-node-config;
- } // config
- container state {
- config false;
- description
- "Operational state data.";
-
- uses te-node-config;
- uses te-node-state-derived;
- } // state
-
- list tunnel-termination-point {
- key "tunnel-tp-id";
- description
- "A termination point can terminate a tunnel.";
- leaf tunnel-tp-id {
- type binary;
- description
- "Tunnel termination point identifier.";
- }
- container config {
- description
- "Configuration data.";
- uses te-node-tunnel-termination-capability;
- }
-
- container state {
- config false;
- description
- "Operational state data.";
-
- uses te-node-tunnel-termination-capability;
- leaf switching-capability {
- type identityref {
- base te-types:switching-capabilities;
- }
- mandatory true;
- description
- "Switching Capability.";
- }
- leaf encoding {
- type identityref {
- base te-types:lsp-encoding-types;
- }
- mandatory true;
- description
- "Encoding type.";
- }
- } // state
-
- } // tunnel-termination-point
- } // te
- } // te-node-augment
-
- grouping te-node-config {
- description "TE node configuration grouping.";
-
- leaf-list te-node-template {
- if-feature template;
- type leafref {
- path "../../../../../te/templates/node-template/name";
- }
- description
- "The reference to a TE node template.";
- }
- uses te-node-config-attributes;
- } // te-node-config
-
- grouping te-node-config-attributes {
- description "Configuration node attributes in a TE topology.";
- container te-node-attributes {
- description "Containing node attributes in a TE topology.";
- uses sch:schedules;
- leaf admin-status {
- type te-admin-status;
- description
- "The administrative state of the link.";
- }
- uses te-node-connectivity-matrix;
- uses te-node-info-attributes;
- } // te-node-attributes
- } // te-node-config-attributes
-
- grouping te-node-config-attributes-notification {
- description
- "Configuration node attributes for template in a TE topology.";
- container te-node-attributes {
- description "Containing node attributes in a TE topology.";
- uses sch:schedules;
- leaf admin-status {
- type te-admin-status;
- description
- "The administrative state of the link.";
- }
- uses te-node-connectivity-matrix-abs;
- uses te-node-info-attributes;
- } // te-node-attributes
- } // te-node-config-attributes-notification
-
- grouping te-node-config-attributes-template {
- description
- "Configuration node attributes for template in a TE topology.";
- container te-node-attributes {
- description "Containing node attributes in a TE topology.";
- uses sch:schedules;
- leaf admin-status {
- type te-admin-status;
- description
- "The administrative state of the link.";
- }
- uses te-node-info-attributes;
- } // te-node-attributes
- } // te-node-config-attributes-template
-
- grouping te-node-connectivity-matrix {
- description "Connectivity matrix on a TE node.";
- list connectivity-matrix {
- key "id";
- description
- "Represents node's switching limitations, i.e. limitations
- in interconnecting network TE links across the node.";
- reference
- "RFC7579: General Network Element Constraint Encoding
- for GMPLS-Controlled Networks.";
- leaf id {
- type uint32;
- description "Identifies the connectivity-matrix entry.";
- }
- container from {
- leaf tp-ref {
- type leafref {
- path "../../../../../../nt:termination-point/nt:tp-id";
- }
- description
- "Relative reference to source termination point.";
- }
- description
- "Reference to source NTP.";
- }
- container to {
- leaf tp-ref {
- type leafref {
- path "../../../../../../nt:termination-point/nt:tp-id";
- }
- description
- "Relative reference to destination termination point.";
- }
- description
- "Reference to destination NTP.";
- }
- leaf is-allowed {
- type boolean;
- description
- "true - switching is allowed,
- false - switching is disallowed.";
- }
- }
- } // te-node-connectivity-matrix
-
- grouping te-node-connectivity-matrix-abs {
- description
- "Connectivity matrix on a TE node, using absolute
- paths to reference termination points.";
- list connectivity-matrix {
- key "id";
- description
- "Represents node's switching limitations, i.e. limitations
- in interconnecting network TE links across the node.";
- reference
- "RFC7579: General Network Element Constraint Encoding
- for GMPLS-Controlled Networks.";
- leaf id {
- type uint32;
- description "Identifies the connectivity-matrix entry.";
- }
- container from {
- uses nt:tp-ref;
- description
- "Reference to source NTP.";
- }
- container to {
- uses nt:tp-ref;
- description
- "Reference to destination NTP.";
- }
- leaf is-allowed {
- type boolean;
- description
- "true - switching is allowed,
- false - switching is disallowed.";
- }
- }
- } // te-node-connectivity-matrix-abs
-
- grouping te-node-info-attributes {
- description
- "Advertised TE information attributes.";
- leaf domain-id {
- type uint32;
- description
- "Identifies the domain that this node belongs.
- This attribute is used to support inter-domain links.";
- reference
- "RFC5152: A Per-Domain Path Computation Method for
- Establishing Inter-Domain Traffic Engineering (TE)
- Label Switched Paths (LSPs).
- RFC5392: OSPF Extensions in Support of Inter-Autonomous
- System (AS) MPLS and GMPLS Traffic Engineering.
- RFC5316: ISIS Extensions in Support of Inter-Autonomous
- System (AS) MPLS and GMPLS Traffic Engineering.";
- }
- leaf is-abstract {
- type empty;
- description
- "Present if the node is abstract, not present if the node
- is actual.";
- }
- leaf name {
- type inet:domain-name;
- description "Node name.";
- }
- leaf-list signaling-address {
- type inet:ip-address;
- description "Node signaling address.";
- }
- container underlay-topology {
- if-feature te-topology-hierarchy;
- description
- "When an abstract node encapsulates a topology,
- the attributes in this container point to said topology.";
- uses te-topology-ref;
- }
- } // te-node-info-attributes
-
- grouping te-node-state-derived {
- description "Node state attributes in a TE topology.";
- leaf oper-status {
- type te-oper-status;
- description
- "The current operational state of the node.";
- }
- leaf is-multi-access-dr {
- type empty;
- description
- "The presence of this attribute indicates that this TE node
- is a pseudonode elected as a designated router.";
- reference
- "RFC3630: Traffic Engineering (TE) Extensions to OSPF
- Version 2.
- RFC1195: Use of OSI IS-IS for Routing in TCP/IP and Dual
- Environments.";
- }
- uses information-source-attributes;
- list alt-information-sources {
- key "information-source";
- description
- "A list of information sources learned but not used.";
- uses information-source-attributes;
- uses te-node-connectivity-matrix;
- uses te-node-info-attributes;
- }
- } // te-node-state-derived
-
- grouping te-node-state-derived-notification {
- description "Node state attributes in a TE topology.";
- leaf oper-status {
- type te-oper-status;
- description
- "The current operational state of the node.";
- }
- leaf is-multi-access-dr {
- type empty;
- description
- "The presence of this attribute indicates that this TE node
- is a pseudonode elected as a designated router.";
- reference
- "RFC3630: Traffic Engineering (TE) Extensions to OSPF
- Version 2.
- RFC1195: Use of OSI IS-IS for Routing in TCP/IP and Dual
- Environments.";
- }
- uses information-source-attributes;
- list alt-information-sources {
- key "information-source";
- description
- "A list of information sources learned but not used.";
- uses information-source-attributes;
- uses te-node-connectivity-matrix-abs;
- uses te-node-info-attributes;
- }
- } // te-node-state-derived-notification
-
- grouping te-node-tunnel-termination-capability {
- description
- "Termination capability of a tunnel termination point on a
- TE node.";
-
- list termination-capability {
- key "link-tp";
- description
- "The termination capabilities between
- tunnel-termination-point and link termination-point.
- The capability information can be used to compute
- the tunnel path.";
- leaf link-tp {
- type leafref {
- path "../../../../../nt:termination-point/nt:tp-id";
- }
- description
- "Link termination point.";
- }
- } // termination-capability
- } // te-node-tunnel-termination-capability
-
- grouping te-path-element {
- description
- "A group of attributes defining an element in a TE path
- such as TE node, TE link, TE atomic resource or label.";
- uses te-types:explicit-route-subobject;
- } // te-path-element
-
- grouping te-termination-point-augment {
- description
- "Augmentation for TE termination point.";
-
- container te {
- presence "TE support.";
- description
- "Indicates TE support.";
-
- leaf te-tp-id {
- type te-tp-id;
- mandatory true;
- description
- "An identifier to uniquely identify a TE termination
- point.";
- }
-
- container config {
- description
- "Configuration data.";
- uses te-termination-point-config;
- } // config
- container state {
- config false;
- description
- "Operational state data.";
- uses te-termination-point-config;
- } // state
- } // te
- } // te-termination-point-augment
-
- grouping te-termination-point-config {
- description
- "TE termination point configuration grouping.";
- uses sch:schedules;
- } // te-termination-point-config
-
- grouping te-topologies-augment {
- description
- "Augmentation for TE topologies.";
-
- container te {
- presence "TE support.";
- description
- "Indicates TE support.";
-
- container templates {
- description
- "Configuration parameters for templates used for TE
- topology.";
-
- list node-template {
- if-feature template;
- key "name";
- leaf name {
- type te-template-name;
- description
- "The name to identify a TE node template.";
- }
- description
- "The list of TE node templates used to define sharable
- and reusable TE node attributes.";
- uses template-attributes;
- uses te-node-config-attributes-template;
- } // node-template
-
- list link-template {
- if-feature template;
- key "name";
- leaf name {
- type te-template-name;
- description
- "The name to identify a TE link template.";
- }
- description
- "The list of TE link templates used to define sharable
- and reusable TE link attributes.";
- uses template-attributes;
- uses te-link-config-attributes;
- } // link-template
- } // templates
- } // te
- } // te-topologies-augment
-
- grouping te-topology-augment {
- description
- "Augmentation for TE topology.";
-
- container te {
- presence "TE support.";
- description
- "Indicates TE support.";
-
- leaf provider-id {
- type te-global-id;
- mandatory true;
- description
- "An identifier to uniquely identify a provider.";
- }
- leaf client-id {
- type te-global-id;
- mandatory true;
- description
- "An identifier to uniquely identify a client.";
- }
- leaf te-topology-id {
- type te-topology-id;
- mandatory true;
- description
- "It is presumed that a datastore will contain many
- topologies. To distinguish between topologies it is
- vital to have UNIQUE topology identifiers.";
- }
-
- container config {
- description
- "Configuration data.";
- uses te-topology-config;
- } // config
- container state {
- config false;
- description
- "Operational state data.";
- uses te-topology-config;
- } // state
- } // te
- } // te-topology-augment
-
- grouping te-topology-config {
- description
- "TE topology configuration grouping.";
- uses sch:schedules;
- leaf preference {
- type uint8 {
- range "1..255";
- }
- description
- "Specifies a preference for this topology. A lower number
- indicates a higher preference.";
- }
- } // te-topology-config
-
- grouping te-topology-ref {
- description
- "References a TE topology.";
- leaf provider-id-ref {
- type leafref {
- path "/nw:networks/nw:network[nw:network-id = "
- + "current()/../network-id-ref]/tet:te/tet:provider-id";
- require-instance false;
- }
- description
- "A reference to a provider-id.";
- }
- leaf client-id-ref {
- type leafref {
- path "/nw:networks/nw:network[nw:network-id = "
- + "current()/../network-id-ref]/tet:te/tet:client-id";
- require-instance false;
- }
- description
- "A reference to a client-id.";
- }
- leaf te-topology-id-ref {
- type leafref {
- path "/nw:networks/nw:network[nw:network-id = "
- + "current()/../network-id-ref]/tet:te/tet:te-topology-id";
- require-instance false;
- }
- description
- "A reference to a te-topology-id.";
- }
- leaf network-id-ref {
- type leafref {
- path "/nw:networks/nw:network/nw:network-id";
- require-instance false;
- }
- description
- "A reference to a network-id in base ietf-network module.";
- }
- } // te-topology-ref
-
- grouping te-topology-type {
- description
- "Identifies the TE topology type.";
- container te-topology {
- presence "Indicates TE topology.";
- description
- "Its presence identifies the TE topology type.";
- }
- } // te-topology-type
-
- grouping template-attributes {
- description
- "Common attributes for all templates.";
-
- leaf priority {
- type uint16;
- description
- "The preference value to resolve conflicts between different
- templates. When two or more templates specify values for
- one configuration attribute, the value from the template
- with the highest priority is used.";
- }
- leaf reference-change-policy {
- type enumeration {
- enum no-action {
- description
- "When an attribute changes in this template, the
- configuration node referring to this template does
- not take any action.";
- }
- enum not-allowed {
- description
- "When any configuration object has a reference to this
- template, changing this template is not allowed.";
- }
- enum cascade {
- description
- "When an attribute changes in this template, the
- configuration object referring to this template applies
- the new attribute value to the corresponding
- configuration.";
- }
- }
- description
- "This attribute specifies the action taken to a configuration
- node that has a reference to this template.";
- }
- } // template-attributes
-
- /*
- * Configuration data nodes
- */
- augment "/nw:networks/nw:network/nw:network-types" {
- description
- "Introduce new network type for TE topology.";
- uses te-topology-type;
- }
-
- augment "/nw:networks" {
- description
- "Augmentation parameters for TE topologies.";
- uses te-topologies-augment;
- }
-
- augment "/nw:networks/nw:network" {
- when "nw:network-types/te-topology" {
- description
- "Augmentation parameters apply only for networks with
- TE topology type.";
- }
- description
- "Configuration parameters for TE topology.";
- uses te-topology-augment;
- }
-
- augment "/nw:networks/nw:network/nw:node" {
- when "../nw:network-types/te-topology" {
- description
- "Augmentation parameters apply only for networks with
- TE topology type.";
- }
- description
- "Configuration parameters for TE at node level.";
- uses te-node-augment;
- }
-
- augment "/nw:networks/nw:network/nt:link" {
- when "../nw:network-types/te-topology" {
- description
- "Augmentation parameters apply only for networks with
- TE topology type.";
- }
- description
- "Configuration parameters for TE at link level";
- uses te-link-augment;
- }
-
- augment "/nw:networks/nw:network/nw:node/"
- + "nt:termination-point" {
- when "../../nw:network-types/te-topology" {
- description
- "Augmentation parameters apply only for networks with
- TE topology type.";
- }
- description
- "Configuration parameters for TE at termination point level";
- uses te-termination-point-augment;
- }
-
- /*
- * Operational state data nodes
- */
-
- /*
- * Notifications
- */
- notification te-node-event {
- description "Notification event for TE node.";
- leaf event-type {
- type te-topology-event-type;
- description "Event type.";
- }
- uses nw:node-ref;
- uses te-topology-type;
- uses tet:te-node-config-attributes-notification;
- uses tet:te-node-state-derived-notification;
- }
-
- notification te-link-event {
- description "Notification event for TE link.";
- leaf event-type {
- type te-topology-event-type;
- description "Event type";
- }
- uses nt:link-ref;
- uses te-topology-type;
- uses tet:te-link-config-attributes;
- uses tet:te-link-state-derived;
- }
-
- augment "/te-link-event/te-link-attributes/underlay" {
- description "Add state attributes to te-link underlay.";
- uses te-link-state-underlay-attributes;
- }
- }
diff --git a/utils/yangutils/plugin/src/test/resources/interfileietf/ietf-te-types.yang b/utils/yangutils/plugin/src/test/resources/interfileietf/ietf-te-types.yang
deleted file mode 100644
index 9347f26..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfileietf/ietf-te-types.yang
+++ /dev/null
@@ -1,870 +0,0 @@
- module ietf-te-types {
-
- namespace "urn:ietf:params:xml:ns:yang:ietf-te-types";
-
- /* Replace with IANA when assigned */
- prefix "te-types";
-
- import ietf-inet-types {
- prefix inet;
- }
-
- organization
- "IETF Traffic Engineering Architecture and Signaling (TEAS)
- Working Group";
-
- contact
- "WG Web: <http://tools.ietf.org/wg/teas/>
- WG List: <mailto:teas@ietf.org>
-
- WG Chair: Lou Berger
- <mailto:lberger@labn.net>
-
- WG Chair: Vishnu Pavan Beeram
- <mailto:vbeeram@juniper.net>
-
- Editor: Tarek Saad
- <mailto:tsaad@cisco.com>
-
- Editor: Rakesh Gandhi
- <mailto:rgandhi@cisco.com>
-
- Editor: Vishnu Pavan Beeram
- <mailto:vbeeram@juniper.net>
-
- Editor: Himanshu Shah
- <mailto:hshah@ciena.com>
-
- Editor: Xufeng Liu
- <mailto:xufeng.liu@ericsson.com>
-
- Editor: Xia Chen
- <mailto:jescia.chenxia@huawei.com>
-
- Editor: Raqib Jones
- <mailto:raqib@Brocade.com>
-
- Editor: Bin Wen
- <mailto:Bin_Wen@cable.comcast.com>";
-
- description
- "This module contains a collection of generally
- useful TE specific YANG data type defintions.";
-
- revision 2016-03-20 {
- description "Latest revision of TE generic types";
- reference "RFC3209";
- }
-
- identity tunnel-type {
- description
- "Base identity from which specific tunnel types are
- derived.";
- }
-
- identity tunnel-p2p {
- base tunnel-type;
- description
- "TE point-to-point tunnel type.";
- }
-
- identity tunnel-p2mp {
- base tunnel-type;
- description
- "TE point-to-multipoint tunnel type.";
- }
-
- identity state-type {
- description
- "Base identity for TE states";
- }
-
- identity state-up {
- base state-type;
- description
- "State up";
- }
-
- identity state-down {
- base state-type;
- description
- "State down";
- }
-
- identity lsp-prot-type {
- description
- "Base identity from which LSP protection types are
- derived.";
- }
-
- identity lsp-prot-unprotected {
- description
- "LSP protection 'Unprotected'";
- reference "RFC4872";
- }
-
- identity lsp-prot-reroute-extra {
- description
- "LSP protection '(Full) Rerouting'";
- reference "RFC4872";
- }
-
- identity lsp-prot-reroute {
- description
- "LSP protection 'Rerouting without Extra-Traffic'";
- reference "RFC4872";
- }
-
- identity lsp-prot-1-for-n {
- description
- "LSP protection '1:N Protection with Extra-Traffic'";
- reference "RFC4872";
- }
-
- identity lsp-prot-unidir-1-to-1 {
- description
- "LSP protection '1+1 Unidirectional Protection'";
- reference "RFC4872";
- }
-
- identity lsp-prot-bidir-1-to-1 {
- description
- "LSP protection '1+1 Bidirectional Protection'";
- reference "RFC4872";
- }
-
- identity switching-capabilities {
- description
- "Base identity for interface switching capabilities";
- }
-
- identity switching-psc1 {
- base switching-capabilities;
- description
- "Packet-Switch Capable-1 (PSC-1)";
- }
-
- identity switching-evpl {
- base switching-capabilities;
- description
- "Ethernet Virtual Private Line (EVPL)";
- }
-
- identity switching-l2sc {
- base switching-capabilities;
- description
- "Layer-2 Switch Capable (L2SC)";
- }
-
- identity switching-tdm {
- base switching-capabilities;
- description
- "Time-Division-Multiplex Capable (TDM)";
- }
-
- identity switching-otn {
- base switching-capabilities;
- description
- "OTN-TDM capable";
- }
-
- identity switching-dcsc {
- base switching-capabilities;
- description
- "Data Channel Switching Capable (DCSC)";
- }
- identity switching-lsc {
- base switching-capabilities;
- description
- "Lambda-Switch Capable (LSC)";
- }
-
- identity switching-fsc {
- base switching-capabilities;
- description
- "Fiber-Switch Capable (FSC)";
- }
-
- identity lsp-encoding-types {
- description
- "Base identity for encoding types";
- }
-
- identity lsp-encoding-packet {
- base lsp-encoding-types;
- description
- "Packet LSP encoding";
- }
-
- identity lsp-encoding-ethernet {
- base lsp-encoding-types;
- description
- "Ethernet LSP encoding";
- }
-
- identity lsp-encoding-pdh {
- base lsp-encoding-types;
- description
- "ANSI/ETSI LSP encoding";
- }
-
- identity lsp-encoding-sdh {
- base lsp-encoding-types;
- description
- "SDH ITU-T G.707 / SONET ANSI T1.105 LSP encoding";
- }
-
- identity lsp-encoding-digital-wrapper {
- base lsp-encoding-types;
- description
- "Digital Wrapper LSP encoding";
- }
-
- identity lsp-encoding-lambda {
- base lsp-encoding-types;
- description
- "Lambda (photonic) LSP encoding";
- }
-
- identity lsp-encoding-fiber {
- base lsp-encoding-types;
- description
- "Fiber LSP encoding";
- }
-
- identity lsp-encoding-fiber-channel {
- base lsp-encoding-types;
- description
- "FiberChannel LSP encoding";
- }
-
- identity lsp-encoding-oduk {
- base lsp-encoding-types;
- description
- "G.709 ODUk (Digital Path)LSP encoding";
- }
-
- identity lsp-encoding-optical-channel {
- base lsp-encoding-types;
- description
- "Line (e.g., 8B/10B) LSP encoding";
- }
-
- identity lsp-encoding-line {
- base lsp-encoding-types;
- description
- "Line (e.g., 8B/10B) LSP encoding";
- }
-
- /* TE basic features */
- feature p2mp-te {
- description
- "Indicates support for P2MP-TE";
- }
-
- feature frr-te {
- description
- "Indicates support for TE FastReroute (FRR)";
- }
-
- feature extended-admin-groups {
- description
- "Indicates support for TE link extended admin
- groups.";
- }
-
- feature named-path-affinities {
- description
- "Indicates support for named path affinities";
- }
-
- feature named-extended-admin-groups {
- description
- "Indicates support for named extended admin groups";
- }
-
- feature named-srlg-groups {
- description
- "Indicates support for named SRLG groups";
- }
-
- feature named-path-constraints {
- description
- "Indicates support for named path constraints";
- }
-
- grouping explicit-route-subobject {
- description
- "The explicit route subobject grouping";
- choice type {
- description
- "The explicit route subobject type";
- case ipv4-address {
- description
- "IPv4 address explicit route subobject";
- leaf v4-address {
- type inet:ipv4-address;
- description
- "An IPv4 address. This address is
- treated as a prefix based on the
- prefix length value below. Bits beyond
- the prefix are ignored on receipt and
- SHOULD be set to zero on transmission.";
- }
- leaf v4-prefix-length {
- type uint8;
- description
- "Length in bits of the IPv4 prefix";
- }
- leaf v4-loose {
- type boolean;
- description
- "Describes whether the object is loose
- if set, or otherwise strict";
- }
- }
- case ipv6-address {
- description
- "IPv6 address Explicit Route Object";
- leaf v6-address {
- type inet:ipv6-address;
- description
- "An IPv6 address. This address is
- treated as a prefix based on the
- prefix length value below. Bits
- beyond the prefix are ignored on
- receipt and SHOULD be set to zero
- on transmission.";
- }
- leaf v6-prefix-length {
- type uint8;
- description
- "Length in bits of the IPv4 prefix";
- }
- leaf v6-loose {
- type boolean;
- description
- "Describes whether the object is loose
- if set, or otherwise strict";
- }
- }
- case as-number {
- leaf as-number {
- type uint16;
- description "AS number";
- }
- description
- "Autonomous System explicit route subobject";
- }
- case unnumbered-link {
- leaf router-id {
- type inet:ip-address;
- description
- "A router-id address";
- }
- leaf interface-id {
- type uint32;
- description "The interface identifier";
- }
- description
- "Unnumbered link explicit route subobject";
- reference
- "RFC3477: Signalling Unnumbered Links in
- RSVP-TE";
- }
- case label {
- leaf value {
- type uint32;
- description "the label value";
- }
- description
- "The Label ERO subobject";
- }
- /* AS domain sequence..? */
- }
- }
-
- grouping record-route-subobject {
- description
- "The record route subobject grouping";
- choice type {
- description
- "The record route subobject type";
- case ipv4-address {
- leaf v4-address {
- type inet:ipv4-address;
- description
- "An IPv4 address. This address is
- treated as a prefix based on the prefix
- length value below. Bits beyond the
- prefix are ignored on receipt and
- SHOULD be set to zero on transmission.";
- }
- leaf v4-prefix-length {
- type uint8;
- description
- "Length in bits of the IPv4 prefix";
- }
- leaf v4-flags {
- type uint8;
- description
- "IPv4 address sub-object flags";
- reference "RFC3209";
- }
- }
- case ipv6-address {
- leaf v6-address {
- type inet:ipv6-address;
- description
- "An IPv6 address. This address is
- treated as a prefix based on the
- prefix length value below. Bits
- beyond the prefix are ignored on
- receipt and SHOULD be set to zero
- on transmission.";
- }
- leaf v6-prefix-length {
- type uint8;
- description
- "Length in bits of the IPv4 prefix";
- }
- leaf v6-flags {
- type uint8;
- description
- "IPv6 address sub-object flags";
- reference "RFC3209";
- }
- }
- case label {
- leaf value {
- type uint32;
- description "the label value";
- }
- leaf flags {
- type uint8;
- description
- "Label sub-object flags";
- reference "RFC3209";
- }
- description
- "The Label ERO subobject";
- }
- }
- }
-
- identity route-usage-type {
- description
- "Base identity for route usage";
- }
-
- identity route-include-ero {
- base route-usage-type;
- description
- "Include ERO from route";
- }
-
- identity route-exclude-ero {
- base route-usage-type;
- description
- "Exclude ERO from route";
- }
-
- identity route-exclude-srlg {
- base route-usage-type;
- description
- "Exclude SRLG from route";
- }
-
- identity path-metric-type {
- description
- "Base identity for path metric type";
- }
-
- identity path-metric-te {
- base path-metric-type;
- description
- "TE path metric";
- }
-
- identity path-metric-igp {
- base path-metric-type;
- description
- "IGP path metric";
- }
-
- identity path-tiebreaker-type {
- description
- "Base identity for path tie-breaker type";
- }
-
- identity path-tiebreaker-minfill {
- base path-tiebreaker-type;
- description
- "Min-Fill LSP path placement";
- }
-
- identity path-tiebreaker-maxfill {
- base path-tiebreaker-type;
- description
- "Max-Fill LSP path placement";
- }
-
- identity path-tiebreaker-randoom {
- base path-tiebreaker-type;
- description
- "Random LSP path placement";
- }
-
- identity bidir-provisioning-mode {
- description
- "Base identity for bidirectional provisioning
- mode.";
- }
-
- identity bidir-provisioning-single-sided {
- base bidir-provisioning-mode;
- description
- "Single-sided bidirectional provioning mode";
- }
-
- identity bidir-provisioning-double-sided {
- base bidir-provisioning-mode;
- description
- "Double-sided bidirectional provioning mode";
- }
-
- identity bidir-association-type {
- description
- "Base identity for bidirectional association type";
- }
-
- identity bidir-assoc-corouted {
- base bidir-association-type;
- description
- "Co-routed bidirectional association type";
- }
-
- identity bidir-assoc-non-corouted {
- base bidir-association-type;
- description
- "Non co-routed bidirectional association type";
- }
-
- identity resource-affinities-type {
- description
- "Base identity for resource affinities";
- }
-
- identity resource-aff-include-all {
- base resource-affinities-type;
- description
- "The set of attribute filters associated with a
- tunnel all of which must be present for a link
- to be acceptable";
- }
-
- identity resource-aff-include-any {
- base resource-affinities-type;
- description
- "The set of attribute filters associated with a
- tunnel any of which must be present for a link
- to be acceptable";
- }
-
- identity resource-aff-exclude-any {
- base resource-affinities-type;
- description
- "The set of attribute filters associated with a
- tunnel any of which renders a link unacceptable";
- }
-
- typedef admin-group {
- type binary {
- length 32;
- }
- description
- "Administrative group/Resource class/Color.";
- }
-
- typedef extended-admin-group {
- type binary;
- description
- "Extended administrative group/Resource class/Color.";
- }
-
- typedef admin-groups {
- type union {
- type admin-group;
- type extended-admin-group;
- }
- description "TE administrative group derived type";
- }
-
- typedef srlg {
- type uint32;
- description "SRLG type";
- }
-
- identity path-computation-srlg-type {
- description
- "Base identity for SRLG path computation";
- }
-
- identity srlg-ignore {
- base path-computation-srlg-type;
- description
- "Ignores SRLGs in path computation";
- }
-
- identity srlg-strict {
- base path-computation-srlg-type;
- description
- "Include strict SRLG check in path computation";
- }
-
- identity srlg-preferred {
- base path-computation-srlg-type;
- description
- "Include preferred SRLG check in path computation";
- }
-
- identity srlg-weighted {
- base path-computation-srlg-type;
- description
- "Include weighted SRLG check in path computation";
- }
-
- typedef te-metric {
- type uint32;
- description
- "TE link metric";
- }
-
- typedef topology-id {
- type string {
- pattern '/?([a-zA-Z0-9\-_.]+)(/[a-zA-Z0-9\-_.]+)*';
- }
- description
- "An identifier for a topology.";
- }
-
- /**
- * TE tunnel generic groupings
- **/
-
- /* Tunnel path selection parameters */
- grouping tunnel-path-selection {
- description
- "Tunnel path selection properties grouping";
- container path-selection {
- description
- "Tunnel path selection properties container";
- leaf topology {
- type te-types:topology-id;
- description
- "The tunnel path is computed using the specific
- topology identified by this identifier";
- }
- leaf cost-limit {
- type uint32 {
- range "1..4294967295";
- }
- description
- "The tunnel path cost limit.";
- }
- leaf hop-limit {
- type uint8 {
- range "1..255";
- }
- description
- "The tunnel path hop limit.";
- }
- leaf metric-type {
- type identityref {
- base path-metric-type;
- }
- default path-metric-te;
- description
- "The tunnel path metric type.";
- }
- leaf tiebreaker-type {
- type identityref {
- base path-tiebreaker-type;
- }
- default path-tiebreaker-maxfill;
- description
- "The tunnel path computation tie breakers.";
- }
- leaf ignore-overload {
- type boolean;
- description
- "The tunnel path can traverse overloaded node.";
- }
- uses tunnel-path-affinities;
- uses tunnel-path-srlgs;
- }
- }
-
- grouping tunnel-path-affinities {
- description
- "Path affinities grouping";
- container tunnel-path-affinities {
- if-feature named-path-affinities;
- description
- "Path affinities container";
- choice style {
- description
- "Path affinities representation style";
- case values {
- leaf value {
- type uint32 {
- range "0..4294967295";
- }
- description
- "Affinity value";
- }
- leaf mask {
- type uint32 {
- range "0..4294967295";
- }
- description
- "Affinity mask";
- }
- }
- case named {
- list constraints {
- key "usage";
- leaf usage {
- type identityref {
- base resource-affinities-type;
- }
- description "Affinities usage";
- }
- container constraint {
- description
- "Container for named affinities";
- list affinity-names {
- key "name";
- leaf name {
- type string;
- description
- "Affinity name";
- }
- description
- "List of named affinities";
- }
- }
- description
- "List of named affinity constraints";
- }
- }
- }
- }
- }
-
- grouping tunnel-path-srlgs {
- description
- "Path SRLG properties grouping";
- container tunnel-path-srlgs {
- description
- "Path SRLG properties container";
- choice style {
- description
- "Type of SRLG representation";
- case values {
- leaf usage {
- type identityref {
- base route-exclude-srlg;
- }
- description "SRLG usage";
- }
- leaf-list values {
- type te-types:srlg;
- description "SRLG value";
- }
- }
- case named {
- list constraints {
- key "usage";
- leaf usage {
- type identityref {
- base route-exclude-srlg;
- }
- description "SRLG usage";
- }
- container constraint {
- description
- "Container for named SRLG list";
- list srlg-names {
- key "name";
- leaf name {
- type string;
- description
- "The SRLG name";
- }
- description
- "List named SRLGs";
- }
- }
- description
- "List of named SRLG constraints";
- }
- }
- }
- }
- }
-
- grouping tunnel-bidir-assoc-properties {
- description
- "TE tunnel associated bidirectional properties
- grouping";
- container bidirectional {
- description
- "TE tunnel associated bidirectional attributes.";
- container association {
- description
- "Tunnel bidirectional association properties";
- leaf id {
- type uint16;
- description
- "The TE tunnel association identifier.";
- }
- leaf source {
- type inet:ip-address;
- description
- "The TE tunnel association source.";
- }
- leaf global-source {
- type inet:ip-address;
- description
- "The TE tunnel association global
- source.";
- }
- leaf type {
- type identityref {
- base bidir-association-type;
- }
- default bidir-assoc-non-corouted;
- description
- "The TE tunnel association type.";
- }
- leaf provisioing {
- type identityref {
- base bidir-provisioning-mode;
- }
- description
- "Describes the provisioning model of the
- associated bidirectional LSP";
- reference
- "draft-ietf-teas-mpls-tp-rsvpte-ext-
- associated-lsp, section-3.2";
- }
- }
- }
- }
- /*** End of TE tunnel groupings ***/
-
- /**
- * TE interface generic groupings
- **/
- }
diff --git a/utils/yangutils/plugin/src/test/resources/interfileietf/ietf-yang-types.yang b/utils/yangutils/plugin/src/test/resources/interfileietf/ietf-yang-types.yang
deleted file mode 100644
index 9a543fa..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfileietf/ietf-yang-types.yang
+++ /dev/null
@@ -1,490 +0,0 @@
- module ietf-yang-types {
-
- yang-version 1;
-
- namespace
- "urn:ietf:params:xml:ns:yang:ietf-yang-types";
-
- prefix yang;
-
- organization
- "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
-
- contact
- "WG Web: <http://tools.ietf.org/wg/netmod/>
- WG List: <mailto:netmod@ietf.org>
-
- WG Chair: David Kessens
- <mailto:david.kessens@nsn.com>
-
- WG Chair: Juergen Schoenwaelder
- <mailto:j.schoenwaelder@jacobs-university.de>
-
- Editor: Juergen Schoenwaelder
- <mailto:j.schoenwaelder@jacobs-university.de>";
-
- description
- "This module contains a collection of generally useful derived
- YANG data types.
-
- Copyright (c) 2013 IETF Trust and the persons identified as
- authors of the code. All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, is permitted pursuant to, and subject
- to the license terms contained in, the Simplified BSD License
- set forth in Section 4.c of the IETF Trust's Legal Provisions
- Relating to IETF Documents
- (http://trustee.ietf.org/license-info).
-
- This version of this YANG module is part of RFC 6991; see
- the RFC itself for full legal notices.";
-
- revision "2013-07-15" {
- description
- "This revision adds the following new data types:
- - yang-identifier
- - hex-string
- - uuid
- - dotted-quad";
- reference
- "RFC 6991: Common YANG Data Types";
-
- }
-
- revision "2010-09-24" {
- description "Initial revision.";
- reference
- "RFC 6021: Common YANG Data Types";
-
- }
-
-
- typedef counter32 {
- type uint32;
- description
- "The counter32 type represents a non-negative integer
- that monotonically increases until it reaches a
- maximum value of 2^32-1 (4294967295 decimal), when it
- wraps around and starts increasing again from zero.
-
- Counters have no defined 'initial' value, and thus, a
- single value of a counter has (in general) no information
- content. Discontinuities in the monotonically increasing
- value normally occur at re-initialization of the
- management system, and at other times as specified in the
- description of a schema node using this type. If such
- other times can occur, for example, the creation of
- a schema node of type counter32 at times other than
- re-initialization, then a corresponding schema node
- should be defined, with an appropriate type, to indicate
- the last discontinuity.
-
- The counter32 type should not be used for configuration
- schema nodes. A default statement SHOULD NOT be used in
- combination with the type counter32.
-
- In the value set and its semantics, this type is equivalent
- to the Counter32 type of the SMIv2.";
- reference
- "RFC 2578: Structure of Management Information Version 2
- (SMIv2)";
-
- }
-
- typedef zero-based-counter32 {
- type counter32;
- default "0";
- description
- "The zero-based-counter32 type represents a counter32
- that has the defined 'initial' value zero.
-
- A schema node of this type will be set to zero (0) on creation
- and will thereafter increase monotonically until it reaches
- a maximum value of 2^32-1 (4294967295 decimal), when it
- wraps around and starts increasing again from zero.
-
- Provided that an application discovers a new schema node
- of this type within the minimum time to wrap, it can use the
- 'initial' value as a delta. It is important for a management
- station to be aware of this minimum time and the actual time
- between polls, and to discard data if the actual time is too
- long or there is no defined minimum time.
-
- In the value set and its semantics, this type is equivalent
- to the ZeroBasedCounter32 textual convention of the SMIv2.";
- reference
- "RFC 4502: Remote Network Monitoring Management Information
- Base Version 2";
-
- }
-
- typedef counter64 {
- type uint64;
- description
- "The counter64 type represents a non-negative integer
- that monotonically increases until it reaches a
- maximum value of 2^64-1 (18446744073709551615 decimal),
- when it wraps around and starts increasing again from zero.
-
- Counters have no defined 'initial' value, and thus, a
- single value of a counter has (in general) no information
- content. Discontinuities in the monotonically increasing
- value normally occur at re-initialization of the
- management system, and at other times as specified in the
- description of a schema node using this type. If such
- other times can occur, for example, the creation of
- a schema node of type counter64 at times other than
- re-initialization, then a corresponding schema node
- should be defined, with an appropriate type, to indicate
- the last discontinuity.
-
- The counter64 type should not be used for configuration
- schema nodes. A default statement SHOULD NOT be used in
- combination with the type counter64.
-
- In the value set and its semantics, this type is equivalent
- to the Counter64 type of the SMIv2.";
- reference
- "RFC 2578: Structure of Management Information Version 2
- (SMIv2)";
-
- }
-
- typedef zero-based-counter64 {
- type counter64;
- default "0";
- description
- "The zero-based-counter64 type represents a counter64 that
- has the defined 'initial' value zero.
-
-
-
-
- A schema node of this type will be set to zero (0) on creation
- and will thereafter increase monotonically until it reaches
- a maximum value of 2^64-1 (18446744073709551615 decimal),
- when it wraps around and starts increasing again from zero.
-
- Provided that an application discovers a new schema node
- of this type within the minimum time to wrap, it can use the
- 'initial' value as a delta. It is important for a management
- station to be aware of this minimum time and the actual time
- between polls, and to discard data if the actual time is too
- long or there is no defined minimum time.
-
- In the value set and its semantics, this type is equivalent
- to the ZeroBasedCounter64 textual convention of the SMIv2.";
- reference
- "RFC 2856: Textual Conventions for Additional High Capacity
- Data Types";
-
- }
-
- typedef gauge32 {
- type uint32;
- description
- "The gauge32 type represents a non-negative integer, which
- may increase or decrease, but shall never exceed a maximum
- value, nor fall below a minimum value. The maximum value
- cannot be greater than 2^32-1 (4294967295 decimal), and
- the minimum value cannot be smaller than 0. The value of
- a gauge32 has its maximum value whenever the information
- being modeled is greater than or equal to its maximum
- value, and has its minimum value whenever the information
- being modeled is smaller than or equal to its minimum value.
- If the information being modeled subsequently decreases
- below (increases above) the maximum (minimum) value, the
- gauge32 also decreases (increases).
-
- In the value set and its semantics, this type is equivalent
- to the Gauge32 type of the SMIv2.";
- reference
- "RFC 2578: Structure of Management Information Version 2
- (SMIv2)";
-
- }
-
- typedef gauge64 {
- type uint64;
- description
- "The gauge64 type represents a non-negative integer, which
- may increase or decrease, but shall never exceed a maximum
- value, nor fall below a minimum value. The maximum value
- cannot be greater than 2^64-1 (18446744073709551615), and
- the minimum value cannot be smaller than 0. The value of
- a gauge64 has its maximum value whenever the information
- being modeled is greater than or equal to its maximum
- value, and has its minimum value whenever the information
- being modeled is smaller than or equal to its minimum value.
- If the information being modeled subsequently decreases
- below (increases above) the maximum (minimum) value, the
- gauge64 also decreases (increases).
-
- In the value set and its semantics, this type is equivalent
- to the CounterBasedGauge64 SMIv2 textual convention defined
- in RFC 2856";
- reference
- "RFC 2856: Textual Conventions for Additional High Capacity
- Data Types";
-
- }
-
- typedef object-identifier {
- type string {
- pattern
- '(([0-1](\.[1-3]?[0-9]))|(2\.(0|([1-9]\d*))))(\.(0|([1-9]\d*)))*';
- }
- description
- "The object-identifier type represents administratively
- assigned names in a registration-hierarchical-name tree.
-
- Values of this type are denoted as a sequence of numerical
- non-negative sub-identifier values. Each sub-identifier
- value MUST NOT exceed 2^32-1 (4294967295). Sub-identifiers
- are separated by single dots and without any intermediate
- whitespace.
-
- The ASN.1 standard restricts the value space of the first
- sub-identifier to 0, 1, or 2. Furthermore, the value space
- of the second sub-identifier is restricted to the range
- 0 to 39 if the first sub-identifier is 0 or 1. Finally,
- the ASN.1 standard requires that an object identifier
- has always at least two sub-identifiers. The pattern
- captures these restrictions.
-
- Although the number of sub-identifiers is not limited,
- module designers should realize that there may be
- implementations that stick with the SMIv2 limit of 128
- sub-identifiers.
-
- This type is a superset of the SMIv2 OBJECT IDENTIFIER type
- since it is not restricted to 128 sub-identifiers. Hence,
- this type SHOULD NOT be used to represent the SMIv2 OBJECT
- IDENTIFIER type; the object-identifier-128 type SHOULD be
- used instead.";
- reference
- "ISO9834-1: Information technology -- Open Systems
- Interconnection -- Procedures for the operation of OSI
- Registration Authorities: General procedures and top
- arcs of the ASN.1 Object Identifier tree";
-
- }
-
- typedef object-identifier-128 {
- type object-identifier {
- pattern '\d*(\.\d*){1,127}';
- }
- description
- "This type represents object-identifiers restricted to 128
- sub-identifiers.
-
- In the value set and its semantics, this type is equivalent
- to the OBJECT IDENTIFIER type of the SMIv2.";
- reference
- "RFC 2578: Structure of Management Information Version 2
- (SMIv2)";
-
- }
-
- typedef yang-identifier {
- type string {
- length "1..max";
- pattern '[a-zA-Z_][a-zA-Z0-9\-_.]*';
- pattern
- '.|..|[^xX].*|.[^mM].*|..[^lL].*';
- }
- description
- "A YANG identifier string as defined by the 'identifier'
- rule in Section 12 of RFC 6020. An identifier must
- start with an alphabetic character or an underscore
- followed by an arbitrary sequence of alphabetic or
- numeric characters, underscores, hyphens, or dots.
-
- A YANG identifier MUST NOT start with any possible
- combination of the lowercase or uppercase character
- sequence 'xml'.";
- reference
- "RFC 6020: YANG - A Data Modeling Language for the Network
- Configuration Protocol (NETCONF)";
-
- }
-
- typedef date-and-time {
- type string {
- pattern
- '\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[\+\-]\d{2}:\d{2})';
- }
- description
- "The date-and-time type is a profile of the ISO 8601
- standard for representation of dates and times using the
- Gregorian calendar. The profile is defined by the
- date-time production in Section 5.6 of RFC 3339.
-
- The date-and-time type is compatible with the dateTime XML
- schema type with the following notable exceptions:
-
- (a) The date-and-time type does not allow negative years.
-
- (b) The date-and-time time-offset -00:00 indicates an unknown
- time zone (see RFC 3339) while -00:00 and +00:00 and Z
- all represent the same time zone in dateTime.
-
- (c) The canonical format (see below) of data-and-time values
- differs from the canonical format used by the dateTime XML
- schema type, which requires all times to be in UTC using
- the time-offset 'Z'.
-
- This type is not equivalent to the DateAndTime textual
- convention of the SMIv2 since RFC 3339 uses a different
- separator between full-date and full-time and provides
- higher resolution of time-secfrac.
-
- The canonical format for date-and-time values with a known time
- zone uses a numeric time zone offset that is calculated using
- the device's configured known offset to UTC time. A change of
- the device's offset to UTC time will cause date-and-time values
- to change accordingly. Such changes might happen periodically
- in case a server follows automatically daylight saving time
- (DST) time zone offset changes. The canonical format for
- date-and-time values with an unknown time zone (usually
- referring to the notion of local time) uses the time-offset
- -00:00.";
- reference
- "RFC 3339: Date and Time on the Internet: Timestamps
- RFC 2579: Textual Conventions for SMIv2
- XSD-TYPES: XML Schema Part 2: Datatypes Second Edition";
-
- }
-
- typedef timeticks {
- type uint32;
- description
- "The timeticks type represents a non-negative integer that
- represents the time, modulo 2^32 (4294967296 decimal), in
- hundredths of a second between two epochs. When a schema
- node is defined that uses this type, the description of
- the schema node identifies both of the reference epochs.
-
- In the value set and its semantics, this type is equivalent
- to the TimeTicks type of the SMIv2.";
- reference
- "RFC 2578: Structure of Management Information Version 2
- (SMIv2)";
-
- }
-
- typedef timestamp {
- type timeticks;
- description
- "The timestamp type represents the value of an associated
- timeticks schema node at which a specific occurrence
- happened. The specific occurrence must be defined in the
- description of any schema node defined using this type. When
- the specific occurrence occurred prior to the last time the
- associated timeticks attribute was zero, then the timestamp
- value is zero. Note that this requires all timestamp values
- to be reset to zero when the value of the associated timeticks
- attribute reaches 497+ days and wraps around to zero.
-
- The associated timeticks schema node must be specified
- in the description of any schema node using this type.
-
- In the value set and its semantics, this type is equivalent
- to the TimeStamp textual convention of the SMIv2.";
- reference
- "RFC 2579: Textual Conventions for SMIv2";
-
- }
-
- typedef phys-address {
- type string {
- pattern
- '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?';
- }
- description
- "Represents media- or physical-level addresses represented
- as a sequence octets, each octet represented by two hexadecimal
- numbers. Octets are separated by colons. The canonical
- representation uses lowercase characters.
-
- In the value set and its semantics, this type is equivalent
- to the PhysAddress textual convention of the SMIv2.";
- reference
- "RFC 2579: Textual Conventions for SMIv2";
-
- }
-
- typedef mac-address {
- type string {
- pattern
- '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}';
- }
- description
- "The mac-address type represents an IEEE 802 MAC address.
- The canonical representation uses lowercase characters.
-
- In the value set and its semantics, this type is equivalent
- to the MacAddress textual convention of the SMIv2.";
- reference
- "IEEE 802: IEEE Standard for Local and Metropolitan Area
- Networks: Overview and Architecture
- RFC 2579: Textual Conventions for SMIv2";
-
- }
-
- typedef xpath1.0 {
- type string;
- description
- "This type represents an XPATH 1.0 expression.
-
- When a schema node is defined that uses this type, the
- description of the schema node MUST specify the XPath
- context in which the XPath expression is evaluated.";
- reference
- "XPATH: XML Path Language (XPath) Version 1.0";
-
- }
-
- typedef hex-string {
- type string {
- pattern
- '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?';
- }
- description
- "A hexadecimal string with octets represented as hex digits
- separated by colons. The canonical representation uses
- lowercase characters.";
- }
-
- typedef uuid {
- type string {
- pattern
- '[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}';
- }
- description
- "A Universally Unique IDentifier in the string representation
- defined in RFC 4122. The canonical representation uses
- lowercase characters.
-
- The following is an example of a UUID in string representation:
- f81d4fae-7dec-11d0-a765-00a0c91e6bf6
- ";
- reference
- "RFC 4122: A Universally Unique IDentifier (UUID) URN
- Namespace";
-
- }
-
- typedef dotted-quad {
- type string {
- pattern
- '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])';
- }
- description
- "An unsigned 32-bit number expressed in the dotted-quad
- notation, i.e., four octets written as decimal numbers
- and separated with the '.' (full stop) character.";
- }
- } // module ietf-yang-types
-
diff --git a/utils/yangutils/plugin/src/test/resources/interfilepriority/module1.yang b/utils/yangutils/plugin/src/test/resources/interfilepriority/module1.yang
deleted file mode 100644
index 9a21b03..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfilepriority/module1.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module module1 {
- yang-version 1;
- namespace "http://huawei.com";
- prefix Ant;
- import module2 {
- prefix p;
- }
- leaf invalid-interval {
- type p:hello;
- }
- typedef hello {
- type string;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfilepriority/module2.yang b/utils/yangutils/plugin/src/test/resources/interfilepriority/module2.yang
deleted file mode 100644
index 0a3bdad..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfilepriority/module2.yang
+++ /dev/null
@@ -1,8 +0,0 @@
-module module2 {
- yang-version 1;
- namespace "http://huawei.com";
- prefix Ant2;
- typedef hello {
- type string;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfilepriority/module3.yang b/utils/yangutils/plugin/src/test/resources/interfilepriority/module3.yang
deleted file mode 100644
index 948c797..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfilepriority/module3.yang
+++ /dev/null
@@ -1,8 +0,0 @@
-module module3 {
- yang-version 1;
- namespace "http://huawei.com";
- prefix Ant;
- import module1 {
- prefix p;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfilepriority/module4.yang b/utils/yangutils/plugin/src/test/resources/interfilepriority/module4.yang
deleted file mode 100644
index df6f8b2..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfilepriority/module4.yang
+++ /dev/null
@@ -1,8 +0,0 @@
-module module4 {
- yang-version 1;
- namespace "http://huawei.com";
- prefix Ant;
- import module3 {
- prefix p;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfiletype/module1.yang b/utils/yangutils/plugin/src/test/resources/interfiletype/module1.yang
deleted file mode 100644
index 3c60bd6..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfiletype/module1.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module module1 {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- import module2 {
- prefix p;
- }
- leaf invalid-interval {
- type p:hello;
- }
- typedef hello {
- type string;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfiletype/module2.yang b/utils/yangutils/plugin/src/test/resources/interfiletype/module2.yang
deleted file mode 100644
index 6784c45..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfiletype/module2.yang
+++ /dev/null
@@ -1,8 +0,0 @@
-module module2 {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant2;
- typedef hello {
- type string;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfiletypewithinclude/module1.yang b/utils/yangutils/plugin/src/test/resources/interfiletypewithinclude/module1.yang
deleted file mode 100644
index d1d4db3..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfiletypewithinclude/module1.yang
+++ /dev/null
@@ -1,9 +0,0 @@
-module module1 {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- include module2;
- leaf invalid-interval {
- type hello;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfiletypewithinclude/module2.yang b/utils/yangutils/plugin/src/test/resources/interfiletypewithinclude/module2.yang
deleted file mode 100644
index 8e47100..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfiletypewithinclude/module2.yang
+++ /dev/null
@@ -1,9 +0,0 @@
-submodule module2 {
- yang-version 1;
- belongs-to module1 {
- prefix "module1";
- }
- typedef hello {
- type string;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfiletypewithrevision/module1.yang b/utils/yangutils/plugin/src/test/resources/interfiletypewithrevision/module1.yang
deleted file mode 100644
index 180511d..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfiletypewithrevision/module1.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-module module1 {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- import module2 {
- prefix p;
- revision-date 2007-06-09;
- }
- leaf invalid-interval {
- type p:hello;
- }
- typedef hello {
- type string;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfiletypewithrevision/module2.yang b/utils/yangutils/plugin/src/test/resources/interfiletypewithrevision/module2.yang
deleted file mode 100644
index fd99872..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfiletypewithrevision/module2.yang
+++ /dev/null
@@ -1,11 +0,0 @@
-module module2 {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant2;
- revision 2007-06-09 {
- description "Initial revision.";
- }
- typedef hello {
- type string;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfiletypewithrevisioninname/module1.yang b/utils/yangutils/plugin/src/test/resources/interfiletypewithrevisioninname/module1.yang
deleted file mode 100644
index 180511d..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfiletypewithrevisioninname/module1.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-module module1 {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- import module2 {
- prefix p;
- revision-date 2007-06-09;
- }
- leaf invalid-interval {
- type p:hello;
- }
- typedef hello {
- type string;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfiletypewithrevisioninname/module2@2007-06-09.yang b/utils/yangutils/plugin/src/test/resources/interfiletypewithrevisioninname/module2@2007-06-09.yang
deleted file mode 100644
index fd99872..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfiletypewithrevisioninname/module2@2007-06-09.yang
+++ /dev/null
@@ -1,11 +0,0 @@
-module module2 {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant2;
- revision 2007-06-09 {
- description "Initial revision.";
- }
- typedef hello {
- type string;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfileuses/module1.yang b/utils/yangutils/plugin/src/test/resources/interfileuses/module1.yang
deleted file mode 100644
index 69df326..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfileuses/module1.yang
+++ /dev/null
@@ -1,9 +0,0 @@
-module module1 {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- import module2 {
- prefix p;
- }
- uses p:hello;
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfileuses/module2.yang b/utils/yangutils/plugin/src/test/resources/interfileuses/module2.yang
deleted file mode 100644
index 5bb3616..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfileuses/module2.yang
+++ /dev/null
@@ -1,10 +0,0 @@
-module module2 {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- grouping hello {
- leaf hello {
- type string;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfileuseswithinclude/module1.yang b/utils/yangutils/plugin/src/test/resources/interfileuseswithinclude/module1.yang
deleted file mode 100644
index 41899d9..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfileuseswithinclude/module1.yang
+++ /dev/null
@@ -1,7 +0,0 @@
-module module1 {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- include module2;
- uses hello;
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfileuseswithinclude/module2.yang b/utils/yangutils/plugin/src/test/resources/interfileuseswithinclude/module2.yang
deleted file mode 100644
index 1b423d9..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfileuseswithinclude/module2.yang
+++ /dev/null
@@ -1,11 +0,0 @@
-submodule module2 {
- yang-version 1;
- belongs-to module1 {
- prefix "module1";
- }
- grouping hello {
- leaf hello {
- type string;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfilewithusesreferringtype/ietf-network.yang b/utils/yangutils/plugin/src/test/resources/interfilewithusesreferringtype/ietf-network.yang
deleted file mode 100644
index 3d96560..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfilewithusesreferringtype/ietf-network.yang
+++ /dev/null
@@ -1,14 +0,0 @@
- module ietf-network {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-network";
- prefix nd;
-
- container networks {
- container network-types {
- description
- "Serves as an augmentation target.
- The network type is indicated through corresponding
- presence containers augmented into this container.";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/interfilewithusesreferringtype/ietf-te-topology.yang b/utils/yangutils/plugin/src/test/resources/interfilewithusesreferringtype/ietf-te-topology.yang
deleted file mode 100644
index 2434403..0000000
--- a/utils/yangutils/plugin/src/test/resources/interfilewithusesreferringtype/ietf-te-topology.yang
+++ /dev/null
@@ -1,51 +0,0 @@
- module ietf-te-topology {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-te-topology";
- // replace with IANA namespace when assigned
-
- prefix "tet";
-
- import ietf-network {
- prefix "nw";
- }
-
- grouping te-topologies-augment {
- description
- "Augmentation for TE topologies.";
- leaf reference-change-policy {
- type enumeration {
- enum no-action {
- description
- "When an attribute changes in this template, the
- configuration node referring to this template does
- not take any action.";
- }
- enum not-allowed {
- description
- "When any configuration object has a reference to this
- template, changing this template is not allowed.";
- }
- enum cascade {
- description
- "When an attribute changes in this template, the
- configuration object referring to this template applies
- the new attribute value to the corresponding
- configuration.";
- }
- }
- description
- "This attribute specifies the action taken to a configuration
- node that has a reference to this template.";
- }
- } // te-topologies-augment
-
-
-
- augment "/nw:networks" {
- description
- "Augmentation parameters for TE topologies.";
- uses te-topologies-augment;
- }
-
-
-}
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/iffeatuinleafref/featurebymultileafref/SelfFileLinkingWithFeatureReferredByMultiLeafref.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/iffeatuinleafref/featurebymultileafref/SelfFileLinkingWithFeatureReferredByMultiLeafref.yang
deleted file mode 100644
index f57fa6b..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/iffeatuinleafref/featurebymultileafref/SelfFileLinkingWithFeatureReferredByMultiLeafref.yang
+++ /dev/null
@@ -1,40 +0,0 @@
-module syslog {
- yang-version 1;
- namespace http://huawei.com;
- prefix "sys";
- feature local-storage {
- description
- "This feature means the device supports local
- storage (memory, flash or disk) that can be used to
- store syslog messages.";
- }
- feature main-storage {
- description
- "This feature means the device supports main
- storage that can be used to
- store syslog messages.";
- }
-
- container speed {
- leaf local-storage-limit {
- if-feature local-storage;
- type leafref {
- path "/value";
- }
- units "kilobyte";
- config false;
- description
- "The amount of local storage that can be
- used to hold syslog messages.";
- }
- }
- leaf storage-value {
- type leafref {
- path "/speed/local-storage-limit";
- }
- }
- leaf value {
- if-feature main-storage;
- type uint64;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/iffeatuinleafref/simpleleafrefwithiffeature/SelfFileLinkingWithFeatureReferredByLeafref.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/iffeatuinleafref/simpleleafrefwithiffeature/SelfFileLinkingWithFeatureReferredByLeafref.yang
deleted file mode 100644
index 941b56b..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/iffeatuinleafref/simpleleafrefwithiffeature/SelfFileLinkingWithFeatureReferredByLeafref.yang
+++ /dev/null
@@ -1,28 +0,0 @@
-module syslog {
- yang-version 1;
- namespace http://huawei.com;
- prefix "sys";
- feature local-storage {
- description
- "This feature means the device supports local
- storage (memory, flash or disk) that can be used to
- store syslog messages.";
- }
-
- container speed {
- leaf local-storage-limit {
- if-feature local-storage;
- type uint64;
- units "kilobyte";
- config false;
- description
- "The amount of local storage that can be
- used to hold syslog messages.";
- }
- }
- leaf storage-value {
- type leafref {
- path "/speed/local-storage-limit";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/interfile/interfileleafreffromgroupingreferstootherfile/module1.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/interfile/interfileleafreffromgroupingreferstootherfile/module1.yang
deleted file mode 100644
index b8a5d98..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/interfile/interfileleafreffromgroupingreferstootherfile/module1.yang
+++ /dev/null
@@ -1,28 +0,0 @@
-module module1 {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-te-topology";
- prefix "tet";
- import module2 {
- prefix "nt";
- }
- container te-node-tunnel-termination-capability {
- description
- "Termination capability of a tunnel termination point on a
- TE node.";
- list termination-capability {
- key "link-tp";
- description
- "The termination capabilities between
- tunnel-termination-point and link termination-point.
- The capability information can be used to compute
- the tunnel path.";
- leaf link-tp {
- type leafref {
- path "/nt:termination-point/nt:tp-id";
- }
- description
- "Link termination point.";
- }
- } // termination-capability
- } // te-node-tunnel-termination-capability
-}
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/interfile/interfileleafreffromgroupingreferstootherfile/module2.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/interfile/interfileleafreffromgroupingreferstootherfile/module2.yang
deleted file mode 100644
index 822d90b..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/interfile/interfileleafreffromgroupingreferstootherfile/module2.yang
+++ /dev/null
@@ -1,11 +0,0 @@
-module module2 {
- yang-version 1;
- namespace
- "urn:ietf:params:xml:ns:yang:ietf-inet-types";
- prefix inet;
- container termination-point {
- leaf tp-id {
- type string;
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/interfile/interfileleafrefreferstomultipleleafrefinmultiplefiles/ieft-inet-types.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/interfile/interfileleafrefreferstomultipleleafrefinmultiplefiles/ieft-inet-types.yang
deleted file mode 100644
index c393dbf..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/interfile/interfileleafrefreferstomultipleleafrefinmultiplefiles/ieft-inet-types.yang
+++ /dev/null
@@ -1,11 +0,0 @@
-module ietf-inet-types {
- yang-version 1;
- namespace
- "urn:ietf:params:xml:ns:yang:ietf-inet-types";
- prefix inet;
- typedef tp-ref {
- type leafref {
- path "/nwtp:value";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/interfile/interfileleafrefreferstomultipleleafrefinmultiplefiles/ietf-network-topology.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/interfile/interfileleafrefreferstomultipleleafrefinmultiplefiles/ietf-network-topology.yang
deleted file mode 100644
index b488f46..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/interfile/interfileleafrefreferstomultipleleafrefinmultiplefiles/ietf-network-topology.yang
+++ /dev/null
@@ -1,28 +0,0 @@
-module ietf-network-topology {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-te-topology";
- prefix "tet";
- import ietf-network {
- prefix "nt";
- }
- container te-node-tunnel-termination-capability {
- description
- "Termination capability of a tunnel termination point on a
- TE node.";
- list termination-capability {
- key "link-tp";
- description
- "The termination capabilities between
- tunnel-termination-point and link termination-point.
- The capability information can be used to compute
- the tunnel path.";
- leaf link-tp {
- type leafref {
- path "/nt:termination-point/nt:tp-id";
- }
- description
- "Link termination point.";
- }
- } // termination-capability
- } // te-node-tunnel-termination-capability
-}
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/interfile/interfileleafrefreferstomultipleleafrefinmultiplefiles/ietf-network.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/interfile/interfileleafrefreferstomultipleleafrefinmultiplefiles/ietf-network.yang
deleted file mode 100644
index 49a6a04..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/interfile/interfileleafrefreferstomultipleleafrefinmultiplefiles/ietf-network.yang
+++ /dev/null
@@ -1,14 +0,0 @@
-module ietf-network {
- yang-version 1;
- namespace
- "urn:ietf:params:xml:ns:yang:ietf-inet-types";
- prefix nw;
- import ietf-inet-types {
- prefix inet;
- }
- container termination-point {
- leaf tp-id {
- type string;
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/interfile/interfileleafrefwithimport/module1.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/interfile/interfileleafrefwithimport/module1.yang
deleted file mode 100644
index d33cf1e..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/interfile/interfileleafrefwithimport/module1.yang
+++ /dev/null
@@ -1,16 +0,0 @@
-module module1 {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- import module2 {
- prefix p;
- }
- leaf invalid-interval {
- type leafref {
- path "/p:hello";
- }
- }
- leaf hello {
- type string;
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/interfile/interfileleafrefwithimport/module2.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/interfile/interfileleafrefwithimport/module2.yang
deleted file mode 100644
index 28a869b..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/interfile/interfileleafrefwithimport/module2.yang
+++ /dev/null
@@ -1,8 +0,0 @@
-module module2 {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant2;
- leaf hello {
- type string;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/interfile/leafrefInGroupingWithPrefix/GroupingCopiedInModule2.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/interfile/leafrefInGroupingWithPrefix/GroupingCopiedInModule2.yang
deleted file mode 100644
index dae2db2..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/interfile/leafrefInGroupingWithPrefix/GroupingCopiedInModule2.yang
+++ /dev/null
@@ -1,12 +0,0 @@
-module GroupingCopiedInModule2 {
- yang-version 1;
- namespace "onos-yang-19:level1:newlevel";
- prefix test;
- import LeafrefInGroupingOfModule1 {
- prefix module1;
- }
- description "leaf scenario";
- container value {
- uses "module1:network-ref";
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/interfile/leafrefInGroupingWithPrefix/LeafrefInGroupingOfModule1.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/interfile/leafrefInGroupingWithPrefix/LeafrefInGroupingOfModule1.yang
deleted file mode 100644
index 0753619..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/interfile/leafrefInGroupingWithPrefix/LeafrefInGroupingOfModule1.yang
+++ /dev/null
@@ -1,40 +0,0 @@
-module LeafrefInGroupingOfModule1 {
- yang-version 1;
- namespace "onos-yang-19:level1:newlevel";
- prefix test2;
- description "leaf scenario";
- container networks {
- list network {
- key "network-id";
- description
- "Describes a network.
- A network typically contains an inventory of nodes,
- topological information (augmented through
- network-topology model), as well as layering
- information.";
- container network-types {
- description
- "Serves as an augmentation target.
- The network type is indicated through corresponding
- presence containers augmented into this container.";
- }
- leaf network-id {
- type string;
- description
- "Identifies a network.";
- }
- }
- leaf network-ip {
- type uint8;
- description
- "Identifies a network.";
- }
- }
- grouping network-ref {
- leaf network-ref {
- type leafref {
- path "/test2:networks/test2:network/test2:network-id";
- }
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/interfile/leafrefInGroupingWithPrefixAndManyReference/GroupingCopiedInModule2.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/interfile/leafrefInGroupingWithPrefixAndManyReference/GroupingCopiedInModule2.yang
deleted file mode 100644
index d988a3a..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/interfile/leafrefInGroupingWithPrefixAndManyReference/GroupingCopiedInModule2.yang
+++ /dev/null
@@ -1,37 +0,0 @@
-module ietf-te-topology {
- yang-version 1;
- namespace "onos-yang-19:level1:newlevel";
- prefix test;
- import ietf-network {
- prefix "nw";
- }
- description "leaf scenario";
- typedef te-topology-event-type {
- type enumeration {
- enum "add" {
- value 0;
- description
- "A TE node or te-link has been added.";
- }
- enum "remove" {
- value 1;
- description
- "A TE node or te-link has been removed.";
- }
- enum "update" {
- value 2;
- description
- "A TE node or te-link has been updated.";
- }
- }
- description "TE Event type for notifications";
- } // te-topology-event-type
- container te-node-event {
- leaf event-type {
- type te-topology-event-type;
- description "Event type.";
- }
- description "Notification event for TE node.";
- uses nw:node-ref;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/interfile/leafrefInGroupingWithPrefixAndManyReference/LeafrefInGroupingOfModule1.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/interfile/leafrefInGroupingWithPrefixAndManyReference/LeafrefInGroupingOfModule1.yang
deleted file mode 100644
index f2b7591..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/interfile/leafrefInGroupingWithPrefixAndManyReference/LeafrefInGroupingOfModule1.yang
+++ /dev/null
@@ -1,212 +0,0 @@
- module ietf-network {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-network";
- prefix nd;
-
- organization
- "IETF I2RS (Interface to the Routing System) Working Group";
-
- contact
- "WG Web: <http://tools.ietf.org/wg/i2rs/>
- WG List: <mailto:i2rs@ietf.org>
-
- WG Chair: Susan Hares
- <mailto:shares@ndzh.com>
-
- WG Chair: Jeffrey Haas
- <mailto:jhaas@pfrc.org>
-
- Editor: Alexander Clemm
- <mailto:alex@cisco.com>
-
- Editor: Jan Medved
- <mailto:jmedved@cisco.com>
-
- Editor: Robert Varga
- <mailto:rovarga@cisco.com>
-
- Editor: Tony Tkacik
- <mailto:ttkacik@cisco.com>
-
- Editor: Nitin Bahadur
- <mailto:nitin_bahadur@yahoo.com>
-
- Editor: Hariharan Ananthakrishnan
- <mailto:hari@packetdesign.com>";
-
- description
- "This module defines a common base model for a collection
- of nodes in a network. Node definitions are further used
- in network topologies and inventories.
-
- Copyright (c) 2015 IETF Trust and the persons identified as
- authors of the code. All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, is permitted pursuant to, and subject
- to the license terms contained in, the Simplified BSD License
- set forth in Section 4.c of the IETF Trust's Legal Provisions
- Relating to IETF Documents
- (http://trustee.ietf.org/license-info).
-
- This version of this YANG module is part of
- draft-ietf-i2rs-yang-network-topo-02;
- see the RFC itself for full legal notices.
-
- NOTE TO RFC EDITOR: Please replace above reference to
- draft-ietf-i2rs-yang-network-topo-02 with RFC
- number when published (i.e. RFC xxxx).";
-
- revision 2015-12-08 {
- description
- "Initial revision.
- NOTE TO RFC EDITOR: Please replace the following reference
- to draft-ietf-i2rs-yang-network-topo-02 with
- RFC number when published (i.e. RFC xxxx).";
- reference
- "draft-ietf-i2rs-yang-network-topo-02";
- }
-
- typedef node-id {
- type string;
- description
- "Identifier for a node.";
- }
-
- typedef network-id {
- type string;
- description
- "Identifier for a network.";
- }
- grouping network-ref {
- description
- "Contains the information necessary to reference a network,
- for example an underlay network.";
- leaf network-ref {
- type leafref {
- path "/nd:networks/nd:network/nd:network-id";
- require-instance false;
- }
- description
- "Used to reference a network, for example an underlay
- network.";
- }
- }
-
- grouping node-ref {
- description
- "Contains the information necessary to reference a node.";
- leaf node-ref {
- type leafref {
- path "/nd:networks/nd:network[nd:network-id=current()/../"+
- "network-ref]/nd:node/nd:node-id";
- require-instance false;
- }
- description
- "Used to reference a node.
- Nodes are identified relative to the network they are
- contained in.";
- }
- uses network-ref;
- }
-
- container networks {
- description
- "Serves as top-level container for a list of networks.";
- list network {
- key "network-id";
- description
- "Describes a network.
- A network typically contains an inventory of nodes,
- topological information (augmented through
- network-topology model), as well as layering
- information.";
- container network-types {
- description
- "Serves as an augmentation target.
- The network type is indicated through corresponding
- presence containers augmented into this container.";
- }
- leaf network-id {
- type network-id;
- description
- "Identifies a network.";
- }
- list supporting-network {
- key "network-ref";
- description
- "An underlay network, used to represent layered network
- topologies.";
- leaf network-ref {
- type leafref {
- path "/networks/network/network-id";
- require-instance false;
- }
- description
- "References the underlay network.";
- }
- }
- list node {
- key "node-id";
- description
- "The inventory of nodes of this network.";
- leaf node-id {
- type node-id;
- description
- "Identifies a node uniquely within the containing
- network.";
- }
- list supporting-node {
- key "network-ref node-ref";
- description
- "Represents another node, in an underlay network, that
- this node is supported by. Used to represent layering
- structure.";
- leaf network-ref {
- type leafref {
- path "../../../supporting-network/network-ref";
- require-instance false;
- }
- description
- "References the underlay network that the
- underlay node is part of.";
- }
- leaf node-ref {
- type leafref {
- path "/networks/network/node/node-id";
- require-instance false;
- }
- description
- "References the underlay node itself.";
- }
- }
- }
- }
- }
- container networks-state {
- config false;
- description
- "Serves as top-level container for a list of state information
- for networks";
- list network {
- key "network-ref";
- description
- "Data nodes representing operational data and state of
- networks.
- An instance is automatically created for every network
- in the corresponding list under the networks container.";
- uses network-ref;
- leaf server-provided {
- type boolean;
- description
- "Indicates whether the information concerning this
- particular network is populated by the server
- (server-provided true, the general case for network
- information discovered from the server),
- or whether it is configured by a client
- (server-provided true, possible e.g. for
- service overlays managed through a controller).";
- }
- }
- }
- }
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/invalidscenerioforgrouping/SelfResolutionWhenLeafrefInModuleReferToGroupingInModule.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/invalidscenerioforgrouping/SelfResolutionWhenLeafrefInModuleReferToGroupingInModule.yang
deleted file mode 100644
index a0bd03b..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/invalidscenerioforgrouping/SelfResolutionWhenLeafrefInModuleReferToGroupingInModule.yang
+++ /dev/null
@@ -1,19 +0,0 @@
-module SelfResolutionWhenLeafrefInModuleReferToGroupingInModule {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-network";
- prefix nd;
- grouping networks {
- leaf network-id {
- type uint8;
- description
- "Identifies a network.";
- }
- }
- container current {
- leaf network-ref {
- type leafref {
- path "/networks/network-id";
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/invalidsceneriowithinvalidnode/SelfResolutionWhenLeafrefInModuleReferToInvalidNode.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/invalidsceneriowithinvalidnode/SelfResolutionWhenLeafrefInModuleReferToInvalidNode.yang
deleted file mode 100644
index c10ba2b..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/invalidsceneriowithinvalidnode/SelfResolutionWhenLeafrefInModuleReferToInvalidNode.yang
+++ /dev/null
@@ -1,19 +0,0 @@
-module SelfResolutionWhenLeafrefInModuleReferToInvalidNode {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-network";
- prefix nd;
- container networks {
- description
- "Serves as top-level container for a list of networks.";
- leaf network-id {
- type uint8;
- description
- "Identifies a network.";
- }
- }
- leaf network-ref {
- type leafref {
- path "/define/network-id";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/invalidsceneriowithnorefleaf/SelfResolutionWhenLeafrefDoesNotReferToLeafOrLeafList.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/invalidsceneriowithnorefleaf/SelfResolutionWhenLeafrefDoesNotReferToLeafOrLeafList.yang
deleted file mode 100644
index e5de10b..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/invalidsceneriowithnorefleaf/SelfResolutionWhenLeafrefDoesNotReferToLeafOrLeafList.yang
+++ /dev/null
@@ -1,22 +0,0 @@
-module ietf-network {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-network";
- prefix nd;
- container networks {
- description
- "Serves as top-level container for a list of networks.";
- leaf network-id {
- type status;
- description
- "Identifies a network.";
- }
- }
- typedef status {
- type uint8;
- }
- leaf network-ref {
- type leafref {
- path "/networks";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafrefInAugment/SelfResolutionIfLeafrefInGroupingIsCopiedToAugment.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafrefInAugment/SelfResolutionIfLeafrefInGroupingIsCopiedToAugment.yang
deleted file mode 100644
index a208903..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafrefInAugment/SelfResolutionIfLeafrefInGroupingIsCopiedToAugment.yang
+++ /dev/null
@@ -1,64 +0,0 @@
-module topology {
- yang-version 1;
- namespace "onos-yang-19:level1:newlevel";
- prefix test;
- organization "huawei";
- contact "adarsh.m@huawei.com";
- description "leaf scenario";
- container networks {
- list network {
- key "network-id";
- description
- "Describes a network.
- A network typically contains an inventory of nodes,
- topological information (augmented through
- network-topology model), as well as layering
- information.";
- container network-types {
- description
- "Serves as an augmentation target.
- The network type is indicated through corresponding
- presence containers augmented into this container.";
- }
- leaf network-id {
- type string;
- description
- "Identifies a network.";
- }
- }
- leaf network-ip {
- type uint8;
- description
- "Identifies a network.";
- }
- }
- augment "/networks/network" {
- container config {
- description
- "Configuration data.";
- choice bundle-stack-level {
- description
- "The TE link can be partitioned into bundled
- links, or component links.";
- case bundle {
- container bundled-links {
- description
- "A set of bundled links.";
- reference
- "RFC4201: Link Bundling in MPLS Traffic Engineering
- (TE).";
- list bundled-link {
- key "src-tp-ref";
- leaf src-tp-ref {
- type leafref {
- path "../../../../../network-ip";
- require-instance true;
- }
- }
- }
- }
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafrefingroupingonly/SelfResolutionWithLeafrefInGrouping.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafrefingroupingonly/SelfResolutionWithLeafrefInGrouping.yang
deleted file mode 100644
index 80b6ab0..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafrefingroupingonly/SelfResolutionWithLeafrefInGrouping.yang
+++ /dev/null
@@ -1,37 +0,0 @@
-module ietf-network {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-network";
- prefix nd;
-
- import ietf-inet-types {
- prefix inet;
- }
- typedef node-id {
- type inet:uri;
- description
- "Identifier for a node.";
- }
-
- leaf xyz {
- type string;
- }
- typedef network-id {
- type inet:uri;
- description
- "Identifier for a network.";
- }
- grouping network-ref {
- description
- "Contains the information necessary to reference a network,
- for example an underlay network.";
- leaf network-ref {
- type leafref {
- path "/nd:xyz";
- require-instance false;
- }
- description
- "Used to reference a network, for example an underlay
- network.";
- }
- }
- }
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafrefintypedef/SelfResolutionWhenLeafrefInTypedefReferToContainer.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafrefintypedef/SelfResolutionWhenLeafrefInTypedefReferToContainer.yang
deleted file mode 100644
index ae42100..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafrefintypedef/SelfResolutionWhenLeafrefInTypedefReferToContainer.yang
+++ /dev/null
@@ -1,22 +0,0 @@
-module ietf-network {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-network";
- prefix nd;
- container networks {
- description
- "Serves as top-level container for a list of networks.";
- leaf network-id {
- type network-ref;
- description
- "Identifies a network.";
- }
- leaf id {
- type uint8;
- }
- }
- typedef network-ref {
- type leafref {
- path "/networks/id";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafrefintypedefwithsamereferpath/SelfResolutionWhenLeafrefInTypedefIsUsedInSameReferredNode.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafrefintypedefwithsamereferpath/SelfResolutionWhenLeafrefInTypedefIsUsedInSameReferredNode.yang
deleted file mode 100644
index 7506be9..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafrefintypedefwithsamereferpath/SelfResolutionWhenLeafrefInTypedefIsUsedInSameReferredNode.yang
+++ /dev/null
@@ -1,34 +0,0 @@
-module typedef {
- yang-version "1";
- namespace "http://rob.sh/yang/test/list";
- prefix "foo";
- organization "BugReports Inc";
- contact "Bug reporter";
-
- description
- "A test module";
- revision 2014-01-01 {
- description "april-fools";
- reference "fooled-you";
- }
-
- typedef referenced-leaf {
- type leafref {
- path "/container/target";
- require-instance false;
- }
- }
-
- container container {
- description
- "A container";
- leaf-list target {
- type uint8;
- description
- "A target leaf for leafref checks";
- }
- leaf reference {
- type referenced-leaf;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafrefinusesundergrouping/ietf-network.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafrefinusesundergrouping/ietf-network.yang
deleted file mode 100644
index 4eaa2bf..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafrefinusesundergrouping/ietf-network.yang
+++ /dev/null
@@ -1,33 +0,0 @@
-module ietf-network {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-network";
- prefix nd;
- import network {
- prefix "nw";
- }
- grouping xyz {
- leaf network-id-ref {
- type leafref {
- path "/nw:networks/nw:network/nw:network-id";
- require-instance false;
- }
- description
- "A reference to a network-id in base ietf-network module.";
- }
- }
- grouping yzx {
- container hi {
- uses xyz;
- }
- }
- container fine {
- uses yzx;
- }
- container networks {
- leaf network {
- type string;
- }
- }
-}
-
-
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafrefinusesundergrouping/network.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafrefinusesundergrouping/network.yang
deleted file mode 100644
index 30e8b80..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafrefinusesundergrouping/network.yang
+++ /dev/null
@@ -1,212 +0,0 @@
- module network {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-network";
- prefix nd;
-
- organization
- "IETF I2RS (Interface to the Routing System) Working Group";
-
- contact
- "WG Web: <http://tools.ietf.org/wg/i2rs/>
- WG List: <mailto:i2rs@ietf.org>
-
- WG Chair: Susan Hares
- <mailto:shares@ndzh.com>
-
- WG Chair: Jeffrey Haas
- <mailto:jhaas@pfrc.org>
-
- Editor: Alexander Clemm
- <mailto:alex@cisco.com>
-
- Editor: Jan Medved
- <mailto:jmedved@cisco.com>
-
- Editor: Robert Varga
- <mailto:rovarga@cisco.com>
-
- Editor: Tony Tkacik
- <mailto:ttkacik@cisco.com>
-
- Editor: Nitin Bahadur
- <mailto:nitin_bahadur@yahoo.com>
-
- Editor: Hariharan Ananthakrishnan
- <mailto:hari@packetdesign.com>";
-
- description
- "This module defines a common base model for a collection
- of nodes in a network. Node definitions are further used
- in network topologies and inventories.
-
- Copyright (c) 2015 IETF Trust and the persons identified as
- authors of the code. All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, is permitted pursuant to, and subject
- to the license terms contained in, the Simplified BSD License
- set forth in Section 4.c of the IETF Trust's Legal Provisions
- Relating to IETF Documents
- (http://trustee.ietf.org/license-info).
-
- This version of this YANG module is part of
- draft-ietf-i2rs-yang-network-topo-02;
- see the RFC itself for full legal notices.
-
- NOTE TO RFC EDITOR: Please replace above reference to
- draft-ietf-i2rs-yang-network-topo-02 with RFC
- number when published (i.e. RFC xxxx).";
-
- revision 2015-12-08 {
- description
- "Initial revision.
- NOTE TO RFC EDITOR: Please replace the following reference
- to draft-ietf-i2rs-yang-network-topo-02 with
- RFC number when published (i.e. RFC xxxx).";
- reference
- "draft-ietf-i2rs-yang-network-topo-02";
- }
-
- typedef node-id {
- type string;
- description
- "Identifier for a node.";
- }
-
- typedef network-id {
- type string;
- description
- "Identifier for a network.";
- }
- grouping network-ref {
- description
- "Contains the information necessary to reference a network,
- for example an underlay network.";
- leaf network-ref {
- type leafref {
- path "/nd:networks/nd:network/nd:network-id";
- require-instance false;
- }
- description
- "Used to reference a network, for example an underlay
- network.";
- }
- }
-
- grouping node-ref {
- description
- "Contains the information necessary to reference a node.";
- leaf node-ref {
- type leafref {
- path "/nd:networks/nd:network[nd:network-id=current()/../"+
- "network-ref]/nd:node/nd:node-id";
- require-instance false;
- }
- description
- "Used to reference a node.
- Nodes are identified relative to the network they are
- contained in.";
- }
- uses network-ref;
- }
-
- container networks {
- description
- "Serves as top-level container for a list of networks.";
- list network {
- key "network-id";
- description
- "Describes a network.
- A network typically contains an inventory of nodes,
- topological information (augmented through
- network-topology model), as well as layering
- information.";
- container network-types {
- description
- "Serves as an augmentation target.
- The network type is indicated through corresponding
- presence containers augmented into this container.";
- }
- leaf network-id {
- type network-id;
- description
- "Identifies a network.";
- }
- list supporting-network {
- key "network-ref";
- description
- "An underlay network, used to represent layered network
- topologies.";
- leaf network-ref {
- type leafref {
- path "/networks/network/network-id";
- require-instance false;
- }
- description
- "References the underlay network.";
- }
- }
- list node {
- key "node-id";
- description
- "The inventory of nodes of this network.";
- leaf node-id {
- type node-id;
- description
- "Identifies a node uniquely within the containing
- network.";
- }
- list supporting-node {
- key "network-ref node-ref";
- description
- "Represents another node, in an underlay network, that
- this node is supported by. Used to represent layering
- structure.";
- leaf network-ref {
- type leafref {
- path "../../../supporting-network/network-ref";
- require-instance false;
- }
- description
- "References the underlay network that the
- underlay node is part of.";
- }
- leaf node-ref {
- type leafref {
- path "/networks/network/node/node-id";
- require-instance false;
- }
- description
- "References the underlay node itself.";
- }
- }
- }
- }
- }
- container networks-state {
- config false;
- description
- "Serves as top-level container for a list of state information
- for networks";
- list network {
- key "network-ref";
- description
- "Data nodes representing operational data and state of
- networks.
- An instance is automatically created for every network
- in the corresponding list under the networks container.";
- uses network-ref;
- leaf server-provided {
- type boolean;
- description
- "Indicates whether the information concerning this
- particular network is populated by the server
- (server-provided true, the general case for network
- information discovered from the server),
- or whether it is configured by a client
- (server-provided true, possible e.g. for
- service overlays managed through a controller).";
- }
- }
- }
- }
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafreflinking/SelfResolutionWhenLeafrefIsInDeepTreeAndLeafIsInModuleWithReferredTypeUnion.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafreflinking/SelfResolutionWhenLeafrefIsInDeepTreeAndLeafIsInModuleWithReferredTypeUnion.yang
deleted file mode 100644
index edf6bfa..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafreflinking/SelfResolutionWhenLeafrefIsInDeepTreeAndLeafIsInModuleWithReferredTypeUnion.yang
+++ /dev/null
@@ -1,28 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "define";
- leaf define {
- type string;
- }
- container standard {
- container present {
- leaf name {
- type leafref {
- path "/invalid-interval";
- }
- }
- }
- }
- }
- leaf invalid-interval {
- type union {
- type int32;
- type enumeration {
- enum "unbounded";
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafrefreferingtoleaflist/SelfResolutionWhenLeafrefReferToContainerLeafList.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafrefreferingtoleaflist/SelfResolutionWhenLeafrefReferToContainerLeafList.yang
deleted file mode 100644
index ec9a6d3..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafrefreferingtoleaflist/SelfResolutionWhenLeafrefReferToContainerLeafList.yang
+++ /dev/null
@@ -1,19 +0,0 @@
-module ietf-network {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-network";
- prefix nd;
- container networks {
- description
- "Serves as top-level container for a list of networks.";
- leaf network-id {
- type uint8;
- description
- "Identifies a network.";
- }
- }
- leaf-list network-ref {
- type leafref {
- path "/networks/network-id";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafreftoderivedtype/SelfResolutionWhenLeafrefReferToAnotherDerivedType.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafreftoderivedtype/SelfResolutionWhenLeafrefReferToAnotherDerivedType.yang
deleted file mode 100644
index eb2668e..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafreftoderivedtype/SelfResolutionWhenLeafrefReferToAnotherDerivedType.yang
+++ /dev/null
@@ -1,22 +0,0 @@
-module ietf-network {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-network";
- prefix nd;
- container networks {
- description
- "Serves as top-level container for a list of networks.";
- leaf network-id {
- type status;
- description
- "Identifies a network.";
- }
- }
- typedef status {
- type uint8;
- }
- leaf network-ref {
- type leafref {
- path "/networks/network-id";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafreftoinputinrpc/SelfResolutionWhenLeafrefInModuleReferToLeafListInInputOfRpc.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafreftoinputinrpc/SelfResolutionWhenLeafrefInModuleReferToLeafListInInputOfRpc.yang
deleted file mode 100644
index 917c434..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafreftoinputinrpc/SelfResolutionWhenLeafrefInModuleReferToLeafListInInputOfRpc.yang
+++ /dev/null
@@ -1,23 +0,0 @@
-module ietf-network {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-network";
- prefix nd;
- rpc networks {
- description
- "Serves as top-level container for a list of networks.";
- input {
- leaf-list network-id {
- type uint8;
- description
- "Identifies a network.";
- }
- }
- output {
- }
- }
- leaf-list network-ref {
- type leafref {
- path "/networks/input/network-id";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafreftoleafref/SelfResolutionWhenLeafrefReferToAnotherLeafref.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafreftoleafref/SelfResolutionWhenLeafrefReferToAnotherLeafref.yang
deleted file mode 100644
index 26ccd1f..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafreftoleafref/SelfResolutionWhenLeafrefReferToAnotherLeafref.yang
+++ /dev/null
@@ -1,26 +0,0 @@
-module ietf-network {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-network";
- prefix nd;
- container networks {
- description
- "Serves as top-level container for a list of networks.";
- leaf network-id {
- type leafref {
- path "/status/current";
- }
- description
- "Identifies a network.";
- }
- }
- container status {
- leaf current {
- type uint8;
- }
- }
- leaf network-ref {
- type leafref {
- path "/networks/network-id";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafreftoleafrefwithtypedef/SelfResolutionWhenLeafrefInTypedefIsInDeepTreeAndLeafListIsInModuleWithReferredTypeEnumeration.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafreftoleafrefwithtypedef/SelfResolutionWhenLeafrefInTypedefIsInDeepTreeAndLeafListIsInModuleWithReferredTypeEnumeration.yang
deleted file mode 100644
index b61be6a..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafreftoleafrefwithtypedef/SelfResolutionWhenLeafrefInTypedefIsInDeepTreeAndLeafListIsInModuleWithReferredTypeEnumeration.yang
+++ /dev/null
@@ -1,33 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "define";
- leaf define {
- type string;
- }
- container standard {
- typedef node {
- type leafref {
- path "/invalid-interval";
- }
- }
- container present {
- typedef name {
- type node;
- }
- leaf interval {
- type name;
- }
- }
- }
- }
- leaf-list invalid-interval {
- type enumeration {
- enum 10m;
- enum 100m;
- enum auto;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafreftomultileafref/SelfResolutionWhenLeafrefReferToMultipleLeafref.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafreftomultileafref/SelfResolutionWhenLeafrefReferToMultipleLeafref.yang
deleted file mode 100644
index fd75d32..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafreftomultileafref/SelfResolutionWhenLeafrefReferToMultipleLeafref.yang
+++ /dev/null
@@ -1,50 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "define";
- leaf define {
- type string;
- }
- container standard {
- container present {
- leaf-list name {
- type leafref {
- path "/transmitter/send";
- }
- }
- }
- }
- }
- container reference {
- list found {
- key "define";
- leaf define {
- type string;
- }
- container reciever {
- leaf remove {
- type leafref {
- path "/valid/standard/present/name";
- }
- }
- }
- }
- }
- list transmitter {
- key "send";
- leaf send {
- type leafref {
- path "/invalid-interval";
- }
- }
- }
- leaf-list invalid-interval {
- type enumeration {
- enum 10m;
- enum 100m;
- enum auto;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafreftomultitypedef/SelfResolutionWhenLeafrefReferToMultipleTypedef.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafreftomultitypedef/SelfResolutionWhenLeafrefReferToMultipleTypedef.yang
deleted file mode 100644
index 4b286d2..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafreftomultitypedef/SelfResolutionWhenLeafrefReferToMultipleTypedef.yang
+++ /dev/null
@@ -1,43 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "define";
- leaf define {
- type string;
- }
- container standard {
- container present {
- leaf-list name {
- type transmitter;
- }
- }
- }
- }
- container reference {
- list found {
- key "define";
- leaf define {
- type string;
- }
- container reciever {
- leaf remove {
- type leafref {
- path "/valid/standard/present/name";
- }
- }
- }
- }
- }
- typedef transmitter {
- type invalid-interval;
- }
- typedef invalid-interval {
- type enumeration {
- enum 10m;
- enum 100m;
- enum auto;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafreftorpcinputleaflist/SelfResolutionWhenLeafrefInTypedefModuleReferToLeafListInInputOfRpc.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafreftorpcinputleaflist/SelfResolutionWhenLeafrefInTypedefModuleReferToLeafListInInputOfRpc.yang
deleted file mode 100644
index 59e7a98..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafreftorpcinputleaflist/SelfResolutionWhenLeafrefInTypedefModuleReferToLeafListInInputOfRpc.yang
+++ /dev/null
@@ -1,26 +0,0 @@
-module ietf-network {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-network";
- prefix nd;
- rpc networks {
- description
- "Serves as top-level container for a list of networks.";
- input {
- leaf-list network-id {
- type network-ref;
- description
- "Identifies a network.";
- }
- leaf id {
- type uint8;
- }
- }
- output {
- }
- }
- typedef network-ref {
- type leafref {
- path "/networks/input/id";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafreftotypedefwithleafref/SelfResolutionWhenLeafrefReferToDerivedTypeReferringToLeafWithLeafref.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafreftotypedefwithleafref/SelfResolutionWhenLeafrefReferToDerivedTypeReferringToLeafWithLeafref.yang
deleted file mode 100644
index 1bf423d..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafreftotypedefwithleafref/SelfResolutionWhenLeafrefReferToDerivedTypeReferringToLeafWithLeafref.yang
+++ /dev/null
@@ -1,45 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "define";
- leaf define {
- type string;
- }
- container standard {
- container present {
- leaf-list name {
- type transmitter;
- }
- }
- }
- }
- container reference {
- list found {
- key "define";
- leaf define {
- type string;
- }
- container reciever {
- leaf remove {
- type leafref {
- path "/valid/standard/present/name";
- }
- }
- }
- }
- }
- typedef transmitter {
- type leafref {
- path "/invalid-interval";
- }
- }
- leaf invalid-interval {
- type enumeration {
- enum 10m;
- enum 100m;
- enum auto;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafrefundernodeingrouping/ietf-network.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafrefundernodeingrouping/ietf-network.yang
deleted file mode 100644
index 3db511e..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafrefundernodeingrouping/ietf-network.yang
+++ /dev/null
@@ -1,95 +0,0 @@
-module ietf-network {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-network";
- prefix nd;
-
- organization
- "IETF I2RS (Interface to the Routing System) Working Group";
- grouping node-ref {
- description
- "Contains the information necessary to reference a node.";
- container node-from-grouping {
- leaf node-ref {
- type leafref {
- path "/networks/network/node/node-id";
- require-instance false;
- }
- }
- }
- }
- container networks {
- description
- "Serves as top-level container for a list of networks.";
- list network {
- key "network-id";
- description
- "Describes a network.
- A network typically contains an inventory of nodes,
- topological information (augmented through
- network-topology model), as well as layering
- information.";
- container network-types {
- description
- "Serves as an augmentation target.
- The network type is indicated through corresponding
- presence containers augmented into this container.";
- }
- leaf network-id {
- type string;
- description
- "Identifies a network.";
- }
- list supporting-network {
- key "network-ref";
- description
- "An underlay network, used to represent layered network
- topologies.";
- leaf network-ref {
- type leafref {
- path "/networks/network/network-id";
- require-instance false;
- }
- description
- "References the underlay network.";
- }
- }
- list node {
- key "node-id";
- description
- "The inventory of nodes of this network.";
- leaf node-id {
- type uint8;
- description
- "Identifies a node uniquely within the containing
- network.";
- }
- list supporting-node {
- key "network-ref node-ref";
- description
- "Represents another node, in an underlay network, that
- this node is supported by. Used to represent layering
- structure.";
- leaf network-ref {
- type leafref {
- path "../../../supporting-network/network-ref";
- require-instance false;
- }
- description
- "References the underlay network that the
- underlay node is part of.";
- }
- leaf node-ref {
- type leafref {
- path "/networks/network/node/node-id";
- require-instance false;
- }
- description
- "References the underlay node itself.";
- }
- }
- }
- }
- uses node-ref;
- }
-
-}
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafrefwithrefleafderived/SelfResolutionWhenLeafrefIsInDeepTreeAndLeafListIsInModuleWithReferredTypeEnumeration.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafrefwithrefleafderived/SelfResolutionWhenLeafrefIsInDeepTreeAndLeafListIsInModuleWithReferredTypeEnumeration.yang
deleted file mode 100644
index a3e0f29..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafrefwithrefleafderived/SelfResolutionWhenLeafrefIsInDeepTreeAndLeafListIsInModuleWithReferredTypeEnumeration.yang
+++ /dev/null
@@ -1,27 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "define";
- leaf define {
- type string;
- }
- container standard {
- container present {
- leaf-list name {
- type leafref {
- path "/invalid-interval";
- }
- }
- }
- }
- }
- leaf-list invalid-interval {
- type enumeration {
- enum 10m;
- enum 100m;
- enum auto;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafrefwithrpc/SelfResolutionWhenLeafrefInModuleReferToLeafInInputOfRpc.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafrefwithrpc/SelfResolutionWhenLeafrefInModuleReferToLeafInInputOfRpc.yang
deleted file mode 100644
index 3dce93e..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafrefwithrpc/SelfResolutionWhenLeafrefInModuleReferToLeafInInputOfRpc.yang
+++ /dev/null
@@ -1,23 +0,0 @@
-module SelfResolutionWhenLeafrefInModuleReferToLeafInInputOfRpc {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-network";
- prefix nd;
- rpc networks {
- description
- "Serves as top-level container for a list of networks.";
- input {
- leaf network-id {
- type uint8;
- description
- "Identifies a network.";
- }
- }
- output {
- }
- }
- leaf network-ref {
- type leafref {
- path "/networks/input/network-id";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafrefwithrpcandgrouping/SelfResolutionWhenLeafrefInModuleReferToGroupingWithInputInRpc.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafrefwithrpcandgrouping/SelfResolutionWhenLeafrefInModuleReferToGroupingWithInputInRpc.yang
deleted file mode 100644
index e8debbd..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/leafrefwithrpcandgrouping/SelfResolutionWhenLeafrefInModuleReferToGroupingWithInputInRpc.yang
+++ /dev/null
@@ -1,28 +0,0 @@
-module SelfResolutionWhenLeafrefInModuleReferToGroupingWithInputInRpc {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-network";
- prefix nd;
- rpc networks {
- description
- "Serves as top-level container for a list of networks.";
- grouping input {
- leaf network-id {
- type string;
- description
- "Identifies a network.";
- }
- }
- input {
- leaf network-id {
- type uint8;
- description
- "Identifies a network.";
- }
- }
- }
- leaf network-ref {
- type leafref {
- path "/networks/input/network-id";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/relativepath/invalidnode/SelfResolutionWhenLeafrefInModuleReferToInvalidNodeRelPath.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/relativepath/invalidnode/SelfResolutionWhenLeafrefInModuleReferToInvalidNodeRelPath.yang
deleted file mode 100644
index 9681d76..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/relativepath/invalidnode/SelfResolutionWhenLeafrefInModuleReferToInvalidNodeRelPath.yang
+++ /dev/null
@@ -1,19 +0,0 @@
-module ietf-network {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-network";
- prefix nd;
- container networks {
- description
- "Serves as top-level container for a list of networks.";
- leaf network-id {
- type uint8;
- description
- "Identifies a network.";
- }
- }
- leaf network-ref {
- type leafref {
- path "../define/network-id";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/relativepath/invalidrelativeancestoraccess/SelfResolutionWhenLeafrefInModuleReferToInvalidRootNodeRelPath.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/relativepath/invalidrelativeancestoraccess/SelfResolutionWhenLeafrefInModuleReferToInvalidRootNodeRelPath.yang
deleted file mode 100644
index 7e3d216..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/relativepath/invalidrelativeancestoraccess/SelfResolutionWhenLeafrefInModuleReferToInvalidRootNodeRelPath.yang
+++ /dev/null
@@ -1,19 +0,0 @@
-module ietf-network {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-network";
- prefix nd;
- container networks {
- description
- "Serves as top-level container for a list of networks.";
- leaf network-id {
- type uint8;
- description
- "Identifies a network.";
- }
- }
- leaf network-ref {
- type leafref {
- path "../../../define/network-id";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/relativepath/leafrefintypedef/SelfResolutionWhenLeafrefInTypedefReferToContainerRelPath.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/relativepath/leafrefintypedef/SelfResolutionWhenLeafrefInTypedefReferToContainerRelPath.yang
deleted file mode 100644
index 93d8e94..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/relativepath/leafrefintypedef/SelfResolutionWhenLeafrefInTypedefReferToContainerRelPath.yang
+++ /dev/null
@@ -1,22 +0,0 @@
-module ietf-network {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-network";
- prefix nd;
- container networks {
- description
- "Serves as top-level container for a list of networks.";
- leaf network-id {
- type network-ref;
- description
- "Identifies a network.";
- }
- leaf id {
- type uint8;
- }
- }
- typedef network-ref {
- type leafref {
- path "../id";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/relativepath/leafreftoinputwithgroupinginrpc/SelfResolutionWhenLeafrefInModuleReferToGroupingWithInputInRpcRelPath.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/relativepath/leafreftoinputwithgroupinginrpc/SelfResolutionWhenLeafrefInModuleReferToGroupingWithInputInRpcRelPath.yang
deleted file mode 100644
index 477832d..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/relativepath/leafreftoinputwithgroupinginrpc/SelfResolutionWhenLeafrefInModuleReferToGroupingWithInputInRpcRelPath.yang
+++ /dev/null
@@ -1,28 +0,0 @@
-module ietf-network {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-network";
- prefix nd;
- rpc networks {
- description
- "Serves as top-level container for a list of networks.";
- grouping input {
- leaf network-id {
- type string;
- description
- "Identifies a network.";
- }
- }
- input {
- leaf network-id {
- type uint8;
- description
- "Identifies a network.";
- }
- }
- }
- leaf network-ref {
- type leafref {
- path "../networks/input/network-id";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/relativepath/leafreftomultileafref/SelfResolutionWhenLeafrefReferToMultipleLeafrefRelPath.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/relativepath/leafreftomultileafref/SelfResolutionWhenLeafrefReferToMultipleLeafrefRelPath.yang
deleted file mode 100644
index 890bbaa..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/relativepath/leafreftomultileafref/SelfResolutionWhenLeafrefReferToMultipleLeafrefRelPath.yang
+++ /dev/null
@@ -1,50 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "define";
- leaf define {
- type string;
- }
- container standard {
- container present {
- leaf-list name {
- type leafref {
- path "../../../../transmitter/send";
- }
- }
- }
- }
- }
- container reference {
- list found {
- key "define";
- leaf define {
- type string;
- }
- container reciever {
- leaf remove {
- type leafref {
- path "../../../../valid/standard/present/name";
- }
- }
- }
- }
- }
- list transmitter {
- key "send";
- leaf send {
- type leafref {
- path "../../invalid-interval";
- }
- }
- }
- leaf-list invalid-interval {
- type enumeration {
- enum 10m;
- enum 100m;
- enum auto;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/relativepath/leafreftotypedef/SelfResolutionWhenLeafrefReferToDerivedTypeReferringToLeafWithLeafrefRelType.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/relativepath/leafreftotypedef/SelfResolutionWhenLeafrefReferToDerivedTypeReferringToLeafWithLeafrefRelType.yang
deleted file mode 100644
index 5570f38..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/relativepath/leafreftotypedef/SelfResolutionWhenLeafrefReferToDerivedTypeReferringToLeafWithLeafrefRelType.yang
+++ /dev/null
@@ -1,45 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- list valid {
- key "define";
- leaf define {
- type string;
- }
- container standard {
- container present {
- leaf-list name {
- type transmitter;
- }
- }
- }
- }
- container reference {
- list found {
- key "define";
- leaf define {
- type string;
- }
- container reciever {
- leaf remove {
- type leafref {
- path "../../../../valid/standard/present/name";
- }
- }
- }
- }
- }
- typedef transmitter {
- type leafref {
- path "../../../../invalid-interval";
- }
- }
- leaf invalid-interval {
- type enumeration {
- enum 10m;
- enum 100m;
- enum auto;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/relativepath/pathlistener/PathListener.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/relativepath/pathlistener/PathListener.yang
deleted file mode 100644
index c4dae28..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/relativepath/pathlistener/PathListener.yang
+++ /dev/null
@@ -1,31 +0,0 @@
-module PathListener {
- namespace "test";
- prefix test;
- list interface {
- key "name";
- leaf name {
- type string;
- }
- leaf admin-status {
- type string;
- }
- list address {
- key "ip";
- leaf ip {
- type string;
- }
- }
- }
- container default-address {
- leaf ifname {
- type leafref {
- path "../../test:interface/test:name";
- }
- }
- leaf status {
- type leafref {
- path "/test:interface[name = current()/../ifname]/test:admin-status";
- }
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/relativepath/simpleleafref/SelfResolutionWhenLeafrefReferToContainerLeafRelPath.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/relativepath/simpleleafref/SelfResolutionWhenLeafrefReferToContainerLeafRelPath.yang
deleted file mode 100644
index 05ef0d2..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/relativepath/simpleleafref/SelfResolutionWhenLeafrefReferToContainerLeafRelPath.yang
+++ /dev/null
@@ -1,19 +0,0 @@
-module ietf-network {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-network";
- prefix nd;
- container networks {
- description
- "Serves as top-level container for a list of networks.";
- leaf network-id {
- type uint8;
- description
- "Identifies a network.";
- }
- }
- leaf network-ref {
- type leafref {
- path "../networks/network-id";
- }
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/simpleleafref/SelfResolutionWhenLeafrefReferToContainerLeaf.yang b/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/simpleleafref/SelfResolutionWhenLeafrefReferToContainerLeaf.yang
deleted file mode 100644
index 375cace..0000000
--- a/utils/yangutils/plugin/src/test/resources/leafreflinker/intrafile/simpleleafref/SelfResolutionWhenLeafrefReferToContainerLeaf.yang
+++ /dev/null
@@ -1,19 +0,0 @@
-module SelfResolutionWhenLeafrefReferToContainerLeaf {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-network";
- prefix nd;
- container networks {
- description
- "Serves as top-level container for a list of networks.";
- leaf network-id {
- type uint8;
- description
- "Identifies a network.";
- }
- }
- leaf network-ref {
- type leafref {
- path "/networks/network-id";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/manager/MultiChild/module.yang b/utils/yangutils/plugin/src/test/resources/manager/MultiChild/module.yang
deleted file mode 100644
index 1c4637c..0000000
--- a/utils/yangutils/plugin/src/test/resources/manager/MultiChild/module.yang
+++ /dev/null
@@ -1,18 +0,0 @@
-module test5 {
- namespace "test5:test";
- prefix test ;
-
- revision "2016-07-04" {
- description "Initial revision.";
- }
- typedef typedef1 {
- type int32;
- }
- typedef typedef2 {
- type int32;
- }
- typedef typedef3 {
- type int32;
- }
-
-}
diff --git a/utils/yangutils/plugin/src/test/resources/manager/MultiChild/submodule.yang b/utils/yangutils/plugin/src/test/resources/manager/MultiChild/submodule.yang
deleted file mode 100644
index 92d7c21..0000000
--- a/utils/yangutils/plugin/src/test/resources/manager/MultiChild/submodule.yang
+++ /dev/null
@@ -1,26 +0,0 @@
-submodule test6 {
-
- belongs-to "test5" {
- prefix "test";
- }
-
- revision "2016-07-04" {
- description "Initial revision.";
- }
- grouping grouping1 {
- leaf leaf1 {
- type int32;
- }
- }
- grouping grouping2 {
- leaf leaf1 {
- type int32;
- }
- }
-
- grouping grouping3 {
- leaf leaf1 {
- type int32;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/manager/MultiChild/test.yang b/utils/yangutils/plugin/src/test/resources/manager/MultiChild/test.yang
deleted file mode 100644
index 036d78a..0000000
--- a/utils/yangutils/plugin/src/test/resources/manager/MultiChild/test.yang
+++ /dev/null
@@ -1,19 +0,0 @@
-module test7 {
- namespace "test5:test";
- prefix test ;
-
- revision "2016-07-04" {
- description "Initial revision.";
- }
-
- grouping grouping1 {
- leaf leaf1 {
- type int32;
- }
- }
-
- typedef typedef3 {
- type int32;
- }
-
-}
diff --git a/utils/yangutils/plugin/src/test/resources/manager/MultiChild/test2.yang b/utils/yangutils/plugin/src/test/resources/manager/MultiChild/test2.yang
deleted file mode 100644
index b252c23..0000000
--- a/utils/yangutils/plugin/src/test/resources/manager/MultiChild/test2.yang
+++ /dev/null
@@ -1,22 +0,0 @@
-module test8 {
- namespace "test8:test";
- prefix test ;
-
- revision "2016-07-04" {
- description "Initial revision.";
- }
-
- grouping grouping1 {
- leaf leaf1 {
- type int32;
- }
- }
-
- typedef typedef3 {
- type int32;
- }
-
- container container2 {
- }
-
-}
diff --git a/utils/yangutils/plugin/src/test/resources/manager/singleChild/module.yang b/utils/yangutils/plugin/src/test/resources/manager/singleChild/module.yang
deleted file mode 100644
index 5fb8a9b..0000000
--- a/utils/yangutils/plugin/src/test/resources/manager/singleChild/module.yang
+++ /dev/null
@@ -1,12 +0,0 @@
-module test5 {
- namespace "test5:test";
- prefix test ;
-
- revision "2016-07-04" {
- description "Initial revision.";
- }
- typedef typedef1 {
- type int32;
- }
-
-}
diff --git a/utils/yangutils/plugin/src/test/resources/manager/singleChild/submodule.yang b/utils/yangutils/plugin/src/test/resources/manager/singleChild/submodule.yang
deleted file mode 100644
index 541b7dd..0000000
--- a/utils/yangutils/plugin/src/test/resources/manager/singleChild/submodule.yang
+++ /dev/null
@@ -1,15 +0,0 @@
-submodule test6 {
-
- belongs-to "test5" {
- prefix "test";
- }
-
- revision "2016-07-04" {
- description "Initial revision.";
- }
- grouping grouping1 {
- leaf leaf1 {
- type int32;
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/manager/singleChild/test.yang b/utils/yangutils/plugin/src/test/resources/manager/singleChild/test.yang
deleted file mode 100644
index 483e00e..0000000
--- a/utils/yangutils/plugin/src/test/resources/manager/singleChild/test.yang
+++ /dev/null
@@ -1,12 +0,0 @@
-module test7 {
- namespace "test5:test";
- prefix test ;
-
- revision "2016-07-04" {
- description "Initial revision.";
- }
-
- container cont1 {
- }
-
-}
diff --git a/utils/yangutils/plugin/src/test/resources/processTypeDef.yang b/utils/yangutils/plugin/src/test/resources/processTypeDef.yang
deleted file mode 100644
index 2875752..0000000
--- a/utils/yangutils/plugin/src/test/resources/processTypeDef.yang
+++ /dev/null
@@ -1,11 +0,0 @@
-module Test {
- yang-version 1;
- namespace http://huawei.com;
- prefix Ant;
- typedef hello {
- type String;
- }
- leaf invalid-interval {
- type hello;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/typedefTranslator/wihtout/Onos_Yang_1.yang b/utils/yangutils/plugin/src/test/resources/typedefTranslator/wihtout/Onos_Yang_1.yang
deleted file mode 100644
index 56fbacf..0000000
--- a/utils/yangutils/plugin/src/test/resources/typedefTranslator/wihtout/Onos_Yang_1.yang
+++ /dev/null
@@ -1,489 +0,0 @@
-module ietf-yang-types {
-
- yang-version 1;
-
- namespace
- "urn:ietf:params:xml:ns:yang:ietf-yang-types";
-
- prefix yang;
-
- organization
- "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
-
- contact
- "WG Web: <http://tools.ietf.org/wg/netmod/>
- WG List: <mailto:netmod@ietf.org>
-
- WG Chair: David Kessens
- <mailto:david.kessens@nsn.com>
-
- WG Chair: Juergen Schoenwaelder
- <mailto:j.schoenwaelder@jacobs-university.de>
-
- Editor: Juergen Schoenwaelder
- <mailto:j.schoenwaelder@jacobs-university.de>";
-
- description
- "This module contains a collection of generally useful derived
- YANG data types.
-
- Copyright (c) 2013 IETF Trust and the persons identified as
- authors of the code. All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, is permitted pursuant to, and subject
- to the license terms contained in, the Simplified BSD License
- set forth in Section 4.c of the IETF Trust's Legal Provisions
- Relating to IETF Documents
- (http://trustee.ietf.org/license-info).
-
- This version of this YANG module is part of RFC 6991; see
- the RFC itself for full legal notices.";
-
- revision "2013-07-15" {
- description
- "This revision adds the following new data types:
- - yang-identifier
- - hex-string
- - uuid
- - dotted-quad";
- reference
- "RFC 6991: Common YANG Data Types";
-
- }
-
- revision "2010-09-24" {
- description "Initial revision.";
- reference
- "RFC 6021: Common YANG Data Types";
-
- }
-
-
- typedef counter32 {
- type uint32;
- description
- "The counter32 type represents a non-negative integer
- that monotonically increases until it reaches a
- maximum value of 2^32-1 (4294967295 decimal), when it
- wraps around and starts increasing again from zero.
-
- Counters have no defined 'initial' value, and thus, a
- single value of a counter has (in general) no information
- content. Discontinuities in the monotonically increasing
- value normally occur at re-initialization of the
- management system, and at other times as specified in the
- description of a schema node using this type. If such
- other times can occur, for example, the creation of
- a schema node of type counter32 at times other than
- re-initialization, then a corresponding schema node
- should be defined, with an appropriate type, to indicate
- the last discontinuity.
-
- The counter32 type should not be used for configuration
- schema nodes. A default statement SHOULD NOT be used in
- combination with the type counter32.
-
- In the value set and its semantics, this type is equivalent
- to the Counter32 type of the SMIv2.";
- reference
- "RFC 2578: Structure of Management Information Version 2
- (SMIv2)";
-
- }
-
- typedef zero-based-counter32 {
- type counter32;
- default "0";
- description
- "The zero-based-counter32 type represents a counter32
- that has the defined 'initial' value zero.
-
- A schema node of this type will be set to zero (0) on creation
- and will thereafter increase monotonically until it reaches
- a maximum value of 2^32-1 (4294967295 decimal), when it
- wraps around and starts increasing again from zero.
-
- Provided that an application discovers a new schema node
- of this type within the minimum time to wrap, it can use the
- 'initial' value as a delta. It is important for a management
- station to be aware of this minimum time and the actual time
- between polls, and to discard data if the actual time is too
- long or there is no defined minimum time.
-
- In the value set and its semantics, this type is equivalent
- to the ZeroBasedCounter32 textual convention of the SMIv2.";
- reference
- "RFC 4502: Remote Network Monitoring Management Information
- Base Version 2";
-
- }
-
- typedef counter64 {
- type uint64;
- description
- "The counter64 type represents a non-negative integer
- that monotonically increases until it reaches a
- maximum value of 2^64-1 (18446744073709551615 decimal),
- when it wraps around and starts increasing again from zero.
-
- Counters have no defined 'initial' value, and thus, a
- single value of a counter has (in general) no information
- content. Discontinuities in the monotonically increasing
- value normally occur at re-initialization of the
- management system, and at other times as specified in the
- description of a schema node using this type. If such
- other times can occur, for example, the creation of
- a schema node of type counter64 at times other than
- re-initialization, then a corresponding schema node
- should be defined, with an appropriate type, to indicate
- the last discontinuity.
-
- The counter64 type should not be used for configuration
- schema nodes. A default statement SHOULD NOT be used in
- combination with the type counter64.
-
- In the value set and its semantics, this type is equivalent
- to the Counter64 type of the SMIv2.";
- reference
- "RFC 2578: Structure of Management Information Version 2
- (SMIv2)";
-
- }
-
- typedef zero-based-counter64 {
- type counter64;
- default "0";
- description
- "The zero-based-counter64 type represents a counter64 that
- has the defined 'initial' value zero.
-
-
-
-
- A schema node of this type will be set to zero (0) on creation
- and will thereafter increase monotonically until it reaches
- a maximum value of 2^64-1 (18446744073709551615 decimal),
- when it wraps around and starts increasing again from zero.
-
- Provided that an application discovers a new schema node
- of this type within the minimum time to wrap, it can use the
- 'initial' value as a delta. It is important for a management
- station to be aware of this minimum time and the actual time
- between polls, and to discard data if the actual time is too
- long or there is no defined minimum time.
-
- In the value set and its semantics, this type is equivalent
- to the ZeroBasedCounter64 textual convention of the SMIv2.";
- reference
- "RFC 2856: Textual Conventions for Additional High Capacity
- Data Types";
-
- }
-
- typedef gauge32 {
- type uint32;
- description
- "The gauge32 type represents a non-negative integer, which
- may increase or decrease, but shall never exceed a maximum
- value, nor fall below a minimum value. The maximum value
- cannot be greater than 2^32-1 (4294967295 decimal), and
- the minimum value cannot be smaller than 0. The value of
- a gauge32 has its maximum value whenever the information
- being modeled is greater than or equal to its maximum
- value, and has its minimum value whenever the information
- being modeled is smaller than or equal to its minimum value.
- If the information being modeled subsequently decreases
- below (increases above) the maximum (minimum) value, the
- gauge32 also decreases (increases).
-
- In the value set and its semantics, this type is equivalent
- to the Gauge32 type of the SMIv2.";
- reference
- "RFC 2578: Structure of Management Information Version 2
- (SMIv2)";
-
- }
-
- typedef gauge64 {
- type uint64;
- description
- "The gauge64 type represents a non-negative integer, which
- may increase or decrease, but shall never exceed a maximum
- value, nor fall below a minimum value. The maximum value
- cannot be greater than 2^64-1 (18446744073709551615), and
- the minimum value cannot be smaller than 0. The value of
- a gauge64 has its maximum value whenever the information
- being modeled is greater than or equal to its maximum
- value, and has its minimum value whenever the information
- being modeled is smaller than or equal to its minimum value.
- If the information being modeled subsequently decreases
- below (increases above) the maximum (minimum) value, the
- gauge64 also decreases (increases).
-
- In the value set and its semantics, this type is equivalent
- to the CounterBasedGauge64 SMIv2 textual convention defined
- in RFC 2856";
- reference
- "RFC 2856: Textual Conventions for Additional High Capacity
- Data Types";
-
- }
-
- typedef object-identifier {
- type string {
- pattern
- '(([0-1](\.[1-3]?[0-9]))|(2\.(0|([1-9]\d*))))(\.(0|([1-9]\d*)))*';
- }
- description
- "The object-identifier type represents administratively
- assigned names in a registration-hierarchical-name tree.
-
- Values of this type are denoted as a sequence of numerical
- non-negative sub-identifier values. Each sub-identifier
- value MUST NOT exceed 2^32-1 (4294967295). Sub-identifiers
- are separated by single dots and without any intermediate
- whitespace.
-
- The ASN.1 standard restricts the value space of the first
- sub-identifier to 0, 1, or 2. Furthermore, the value space
- of the second sub-identifier is restricted to the range
- 0 to 39 if the first sub-identifier is 0 or 1. Finally,
- the ASN.1 standard requires that an object identifier
- has always at least two sub-identifiers. The pattern
- captures these restrictions.
-
- Although the number of sub-identifiers is not limited,
- module designers should realize that there may be
- implementations that stick with the SMIv2 limit of 128
- sub-identifiers.
-
- This type is a superset of the SMIv2 OBJECT IDENTIFIER type
- since it is not restricted to 128 sub-identifiers. Hence,
- this type SHOULD NOT be used to represent the SMIv2 OBJECT
- IDENTIFIER type; the object-identifier-128 type SHOULD be
- used instead.";
- reference
- "ISO9834-1: Information technology -- Open Systems
- Interconnection -- Procedures for the operation of OSI
- Registration Authorities: General procedures and top
- arcs of the ASN.1 Object Identifier tree";
-
- }
-
- typedef object-identifier-128 {
- type object-identifier {
- pattern '\d*(\.\d*){1,127}';
- }
- description
- "This type represents object-identifiers restricted to 128
- sub-identifiers.
-
- In the value set and its semantics, this type is equivalent
- to the OBJECT IDENTIFIER type of the SMIv2.";
- reference
- "RFC 2578: Structure of Management Information Version 2
- (SMIv2)";
-
- }
-
- typedef yang-identifier {
- type string {
- length "1..max";
- pattern '[a-zA-Z_][a-zA-Z0-9\-_.]*';
- pattern
- '.|..|[^xX].*|.[^mM].*|..[^lL].*';
- }
- description
- "A YANG identifier string as defined by the 'identifier'
- rule in Section 12 of RFC 6020. An identifier must
- start with an alphabetic character or an underscore
- followed by an arbitrary sequence of alphabetic or
- numeric characters, underscores, hyphens, or dots.
-
- A YANG identifier MUST NOT start with any possible
- combination of the lowercase or uppercase character
- sequence 'xml'.";
- reference
- "RFC 6020: YANG - A Data Modeling Language for the Network
- Configuration Protocol (NETCONF)";
-
- }
-
- typedef date-and-time {
- type string {
- pattern
- '\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[\+\-]\d{2}:\d{2})';
- }
- description
- "The date-and-time type is a profile of the ISO 8601
- standard for representation of dates and times using the
- Gregorian calendar. The profile is defined by the
- date-time production in Section 5.6 of RFC 3339.
-
- The date-and-time type is compatible with the dateTime XML
- schema type with the following notable exceptions:
-
- (a) The date-and-time type does not allow negative years.
-
- (b) The date-and-time time-offset -00:00 indicates an unknown
- time zone (see RFC 3339) while -00:00 and +00:00 and Z
- all represent the same time zone in dateTime.
-
- (c) The canonical format (see below) of data-and-time values
- differs from the canonical format used by the dateTime XML
- schema type, which requires all times to be in UTC using
- the time-offset 'Z'.
-
- This type is not equivalent to the DateAndTime textual
- convention of the SMIv2 since RFC 3339 uses a different
- separator between full-date and full-time and provides
- higher resolution of time-secfrac.
-
- The canonical format for date-and-time values with a known time
- zone uses a numeric time zone offset that is calculated using
- the device's configured known offset to UTC time. A change of
- the device's offset to UTC time will cause date-and-time values
- to change accordingly. Such changes might happen periodically
- in case a server follows automatically daylight saving time
- (DST) time zone offset changes. The canonical format for
- date-and-time values with an unknown time zone (usually
- referring to the notion of local time) uses the time-offset
- -00:00.";
- reference
- "RFC 3339: Date and Time on the Internet: Timestamps
- RFC 2579: Textual Conventions for SMIv2
- XSD-TYPES: XML Schema Part 2: Datatypes Second Edition";
-
- }
-
- typedef timeticks {
- type uint32;
- description
- "The timeticks type represents a non-negative integer that
- represents the time, modulo 2^32 (4294967296 decimal), in
- hundredths of a second between two epochs. When a schema
- node is defined that uses this type, the description of
- the schema node identifies both of the reference epochs.
-
- In the value set and its semantics, this type is equivalent
- to the TimeTicks type of the SMIv2.";
- reference
- "RFC 2578: Structure of Management Information Version 2
- (SMIv2)";
-
- }
-
- typedef timestamp {
- type timeticks;
- description
- "The timestamp type represents the value of an associated
- timeticks schema node at which a specific occurrence
- happened. The specific occurrence must be defined in the
- description of any schema node defined using this type. When
- the specific occurrence occurred prior to the last time the
- associated timeticks attribute was zero, then the timestamp
- value is zero. Note that this requires all timestamp values
- to be reset to zero when the value of the associated timeticks
- attribute reaches 497+ days and wraps around to zero.
-
- The associated timeticks schema node must be specified
- in the description of any schema node using this type.
-
- In the value set and its semantics, this type is equivalent
- to the TimeStamp textual convention of the SMIv2.";
- reference
- "RFC 2579: Textual Conventions for SMIv2";
-
- }
-
- typedef phys-address {
- type string {
- pattern
- '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?';
- }
- description
- "Represents media- or physical-level addresses represented
- as a sequence octets, each octet represented by two hexadecimal
- numbers. Octets are separated by colons. The canonical
- representation uses lowercase characters.
-
- In the value set and its semantics, this type is equivalent
- to the PhysAddress textual convention of the SMIv2.";
- reference
- "RFC 2579: Textual Conventions for SMIv2";
-
- }
-
- typedef mac-address {
- type string {
- pattern
- '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}';
- }
- description
- "The mac-address type represents an IEEE 802 MAC address.
- The canonical representation uses lowercase characters.
-
- In the value set and its semantics, this type is equivalent
- to the MacAddress textual convention of the SMIv2.";
- reference
- "IEEE 802: IEEE Standard for Local and Metropolitan Area
- Networks: Overview and Architecture
- RFC 2579: Textual Conventions for SMIv2";
-
- }
-
- typedef xpath1.0 {
- type string;
- description
- "This type represents an XPATH 1.0 expression.
-
- When a schema node is defined that uses this type, the
- description of the schema node MUST specify the XPath
- context in which the XPath expression is evaluated.";
- reference
- "XPATH: XML Path Language (XPath) Version 1.0";
-
- }
-
- typedef hex-string {
- type string {
- pattern
- '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?';
- }
- description
- "A hexadecimal string with octets represented as hex digits
- separated by colons. The canonical representation uses
- lowercase characters.";
- }
-
- typedef uuid {
- type string {
- pattern
- '[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}';
- }
- description
- "A Universally Unique IDentifier in the string representation
- defined in RFC 4122. The canonical representation uses
- lowercase characters.
-
- The following is an example of a UUID in string representation:
- f81d4fae-7dec-11d0-a765-00a0c91e6bf6
- ";
- reference
- "RFC 4122: A Universally Unique IDentifier (UUID) URN
- Namespace";
-
- }
-
- typedef dotted-quad {
- type string {
- pattern
- '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])';
- }
- description
- "An unsigned 32-bit number expressed in the dotted-quad
- notation, i.e., four octets written as decimal numbers
- and separated with the '.' (full stop) character.";
- }
- }
diff --git a/utils/yangutils/plugin/src/test/resources/typedefTranslator/with/Onos_Yang_1.yang b/utils/yangutils/plugin/src/test/resources/typedefTranslator/with/Onos_Yang_1.yang
deleted file mode 100644
index c09e372..0000000
--- a/utils/yangutils/plugin/src/test/resources/typedefTranslator/with/Onos_Yang_1.yang
+++ /dev/null
@@ -1,201 +0,0 @@
-module typedef {
-
- yang-version "1";
- namespace "http://rob.sh/yang/test/list";
- prefix "foo";
-
- import remote { prefix defn; }
-
- organization "BugReports Inc";
- contact "A bug reporter";
-
- description
- "A test module";
- revision 2014-01-01 {
- description "april-fools";
- reference "fooled-you";
- }
-
- typedef derived-string-type {
- type string;
- }
-
- typedef restricted-integer-type {
- type uint16 {
- range 0..64;
- }
- }
-
- typedef bgp-session-direction {
- type enumeration {
- enum INBOUND;
- enum OUTBOUND;
- }
- }
-
- typedef new-string-type {
- type string;
- default "defaultValue";
- }
-
- typedef restricted-inherit {
- type string {
- pattern "^a.*";
- }
- }
-
- typedef restricted-int-inherit {
- type int8 {
- range 0..100;
- }
- }
-
- typedef parent-union {
- type union {
- type string {
- pattern "a.*";
- }
- type string {
- pattern "b.*";
- }
- }
- }
-
- typedef child-union {
- type union {
- type parent-union;
- type string {
- pattern "z.*";
- }
- }
- }
-
- typedef union-included {
- type union {
- type string {
- pattern "a.*";
- }
- type string {
- pattern "b.*";
- }
- }
- }
-
- identity identity_base;
- identity IDONE {
- base "identity_base";
- }
-
- identity IDTWO {
- base "identity_base";
- }
-
- typedef identity_one {
- type identityref {
- base identity_base;
- }
- }
-
- typedef referenced-leaf {
- type leafref {
- path "/container/target";
- require-instance false;
- }
- }
-
- grouping scoped-typedef {
- typedef scoped-type {
- type string {
- pattern "a.*";
- }
- }
-
- leaf scoped-leaf {
- type scoped-type;
- }
- }
-
- container container {
- description
- "A container";
-
- leaf-list target {
- type string;
- description
- "A target leaf for leafref checks";
- }
-
- leaf string {
- type derived-string-type;
- }
-
- leaf integer {
- type restricted-integer-type;
- }
-
- leaf stringdefault {
- type derived-string-type;
- default "aDefaultValue";
- }
-
- leaf integerdefault {
- type restricted-integer-type;
- default 10;
- }
-
- leaf new-string {
- type new-string-type;
- }
-
- leaf remote-new-type {
- type defn:remote-definition;
- }
-
- leaf session-dir {
- type bgp-session-direction;
- }
-
- leaf remote-local-type {
- type defn:remote-local-definition;
- }
-
- leaf inheritance {
- type restricted-inherit {
- pattern ".*k";
- }
- }
-
- leaf int-inheritance {
- type restricted-int-inherit {
- range 2..5;
- }
- }
-
- leaf-list stacked-union {
- type child-union;
- }
-
- leaf include-of-include-definition {
- type defn:hybrid-definition;
- }
-
- leaf identity-one-typedef {
- type identity_one;
- }
-
- leaf union-with-union {
- type union {
- type union-included;
- type string {
- pattern "q.*";
- }
- }
- }
-
- leaf reference {
- type referenced-leaf;
- }
-
- uses scoped-typedef;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/typedefTranslator/with/remote.yang b/utils/yangutils/plugin/src/test/resources/typedefTranslator/with/remote.yang
deleted file mode 100644
index 409f04f..0000000
--- a/utils/yangutils/plugin/src/test/resources/typedefTranslator/with/remote.yang
+++ /dev/null
@@ -1,33 +0,0 @@
-module remote {
- yang-version "1";
- namespace "http://rob.sh/yang/test/typedef/remote";
- prefix "remote";
-
- import second-remote { prefix sr; }
-
- organization "BugReports Inc";
- contact "A bug reporter";
-
- description
- "A test module";
- revision 2014-01-01 {
- description "april-fools";
- reference "fooled-you";
- }
-
- typedef remote-definition {
- type string;
- }
-
- typedef remote-local-definition {
- type local-definition;
- }
-
- typedef local-definition {
- type string;
- }
-
- typedef hybrid-definition {
- type sr:second-remote-definition;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/typedefTranslator/with/second-remote.yang b/utils/yangutils/plugin/src/test/resources/typedefTranslator/with/second-remote.yang
deleted file mode 100644
index c106d89..0000000
--- a/utils/yangutils/plugin/src/test/resources/typedefTranslator/with/second-remote.yang
+++ /dev/null
@@ -1,21 +0,0 @@
-module second-remote {
- yang-version "1";
- namespace "http://rob.sh/yang/test/typedef/second-remote";
- prefix "second-remote";
-
- organization "BugReports Inc";
- contact "A bug reporter";
-
- description
- "A test module";
- revision 2014-01-01 {
- description "april-fools";
- reference "fooled-you";
- }
-
- typedef second-remote-definition {
- type string {
- pattern "z.*";
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/unionTranslator/intuint/test.yang b/utils/yangutils/plugin/src/test/resources/unionTranslator/intuint/test.yang
deleted file mode 100644
index 6cba197..0000000
--- a/utils/yangutils/plugin/src/test/resources/unionTranslator/intuint/test.yang
+++ /dev/null
@@ -1,23 +0,0 @@
-module test {
- namespace "test:test";
- prefix test ;
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- leaf leaf1 {
- type union {
- type int32;
- type uint16;
- }
- }
-
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/unionTranslator/intuintstring/test.yang b/utils/yangutils/plugin/src/test/resources/unionTranslator/intuintstring/test.yang
deleted file mode 100644
index c806017..0000000
--- a/utils/yangutils/plugin/src/test/resources/unionTranslator/intuintstring/test.yang
+++ /dev/null
@@ -1,24 +0,0 @@
-module test {
- namespace "test:test";
- prefix test ;
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- leaf leaf1 {
- type union {
- type int32;
- type string;
- type uint16;
- }
- }
-
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/unionTranslator/intuintstring/test2.yang b/utils/yangutils/plugin/src/test/resources/unionTranslator/intuintstring/test2.yang
deleted file mode 100644
index 63b791c..0000000
--- a/utils/yangutils/plugin/src/test/resources/unionTranslator/intuintstring/test2.yang
+++ /dev/null
@@ -1,24 +0,0 @@
-module test2 {
- namespace "test:test";
- prefix test ;
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- leaf leaf1 {
- type union {
- type int64;
- type string;
- type uint16;
- }
- }
-
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/unionTranslator/intuintulonglong/test.yang b/utils/yangutils/plugin/src/test/resources/unionTranslator/intuintulonglong/test.yang
deleted file mode 100644
index b4737e7..0000000
--- a/utils/yangutils/plugin/src/test/resources/unionTranslator/intuintulonglong/test.yang
+++ /dev/null
@@ -1,25 +0,0 @@
-module test {
- namespace "test:test";
- prefix test ;
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- leaf leaf1 {
- type union {
- type int32;
- type uint16;
- type uint32;
- type int64;
- }
- }
-
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/unionTranslator/intuintulonglongstring/test.yang b/utils/yangutils/plugin/src/test/resources/unionTranslator/intuintulonglongstring/test.yang
deleted file mode 100644
index a50b5ef..0000000
--- a/utils/yangutils/plugin/src/test/resources/unionTranslator/intuintulonglongstring/test.yang
+++ /dev/null
@@ -1,26 +0,0 @@
-module test {
- namespace "test:test";
- prefix test ;
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- leaf leaf1 {
- type union {
- type string;
- type int32;
- type uint16;
- type uint32;
- type int64;
- }
- }
-
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/unionTranslator/longulong/test.yang b/utils/yangutils/plugin/src/test/resources/unionTranslator/longulong/test.yang
deleted file mode 100644
index a555043..0000000
--- a/utils/yangutils/plugin/src/test/resources/unionTranslator/longulong/test.yang
+++ /dev/null
@@ -1,23 +0,0 @@
-module test {
- namespace "test:test";
- prefix test ;
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- leaf leaf1 {
- type union {
- type int64;
- type uint32;
- }
- }
-
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/unionTranslator/uintint/test.yang b/utils/yangutils/plugin/src/test/resources/unionTranslator/uintint/test.yang
deleted file mode 100644
index d7a590a..0000000
--- a/utils/yangutils/plugin/src/test/resources/unionTranslator/uintint/test.yang
+++ /dev/null
@@ -1,23 +0,0 @@
-module test {
- namespace "test:test";
- prefix test ;
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- leaf leaf1 {
- type union {
- type uint16;
- type int32;
- }
- }
-
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/unionTranslator/ulonglong/test.yang b/utils/yangutils/plugin/src/test/resources/unionTranslator/ulonglong/test.yang
deleted file mode 100644
index 22f6e97..0000000
--- a/utils/yangutils/plugin/src/test/resources/unionTranslator/ulonglong/test.yang
+++ /dev/null
@@ -1,23 +0,0 @@
-module test {
- namespace "test:test";
- prefix test ;
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- leaf leaf1 {
- type union {
- type uint32;
- type int64;
- }
- }
-
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/usesInContainer/GroupingError.yang b/utils/yangutils/plugin/src/test/resources/usesInContainer/GroupingError.yang
deleted file mode 100644
index 8c7c01d..0000000
--- a/utils/yangutils/plugin/src/test/resources/usesInContainer/GroupingError.yang
+++ /dev/null
@@ -1,64 +0,0 @@
-
-module ietf-sd-onos-service-types {
-
- namespace "urn:ietf:params:xml:ns:yang:ietf-sd-onos-service-types";
- prefix service-types ;
-
- grouping qos-if-car {
- description "qos parameter." ;
- list qos-if-car {
- key "direction";
- description "cars qos policy." ;
- leaf direction {
- type enumeration {
- enum inbound{
- value 0 ;
- description "inbound." ;
- }
- enum outbound {
- value 1 ;
- description "outbound." ;
- }
- }
- description "qos for interface car" ;
- }
-}
-}
-
- container qos-policy {
- description "The qos policy of the vpn service." ;
- container qos-if-cars {
- description "qos policy if car." ;
- list qos-if-car {
- key "direction";
- uses qos-if-car;
- description "List of qos parameters." ;
- }
- }
- }
-
- rpc close-l3vpn {
- description "Close l3vpn." ;
- input {
- leaf l3vpn-id {
- type string;
- description "vpn id." ;
- }
- container ac-status {
- description "Access status of the vpn." ;
- list acs{
- key "id";
- description "Access information." ;
- leaf id {
- type string;
- description "Access id." ;
- }
- leaf admin-status {
- type string;
- description "Administration status." ;
- }
- }
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/usesInsideChildOfGrouping/ietf-network.yang b/utils/yangutils/plugin/src/test/resources/usesInsideChildOfGrouping/ietf-network.yang
deleted file mode 100644
index 8fb2bc0..0000000
--- a/utils/yangutils/plugin/src/test/resources/usesInsideChildOfGrouping/ietf-network.yang
+++ /dev/null
@@ -1,28 +0,0 @@
-module ietf-network {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-network";
- prefix nd;
-
- revision 2015-12-08 {
- description
- "Initial revision.
- NOTE TO RFC EDITOR: Please replace the following reference
- to draft-ietf-i2rs-yang-network-topo-02 with
- RFC number when published (i.e. RFC xxxx).";
- }
-
- container networks {
- list network {
- key "network-id";
- leaf network-id {
- type string;
- }
- list node {
- key "node-id";
- leaf node-id {
- type string;
- }
- }
- }
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/usesInsideChildOfGrouping/ietf-te-topology.yang b/utils/yangutils/plugin/src/test/resources/usesInsideChildOfGrouping/ietf-te-topology.yang
deleted file mode 100644
index f1776fb..0000000
--- a/utils/yangutils/plugin/src/test/resources/usesInsideChildOfGrouping/ietf-te-topology.yang
+++ /dev/null
@@ -1,60 +0,0 @@
-module ietf-te-topology {
- yang-version 1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-te-topology";
-
- prefix "tet";
-
- import ietf-network {
- prefix "nw";
- }
-
- revision "2016-03-17" {
- description "Initial revision";
- }
-
- grouping te-node-augment {
- container te {
- presence "TE support.";
-
- leaf te-node-id {
- type string;
- mandatory true;
- }
-
- container config {
- uses te-node-config;
- } // config
- } // te
- } // te-node-augment
-
- grouping te-node-config {
- leaf-list te-node-template {
- if-feature template;
- type string;
- }
- uses te-node-config-attributes;
- } // te-node-config
-
- grouping te-node-config-attributes {
- container te-node-attributes {
- leaf admin-status {
- type string;
- }
- uses te-node-connectivity-matrix;
- } // te-node-attributes
- } // te-node-config-attributes
-
- grouping te-node-connectivity-matrix {
- list connectivity-matrix {
- key "id";
- leaf id {
- type uint32;
- description "Identifies the connectivity-matrix entry.";
- }
- }
- } // te-node-connectivity-matrix
-
- augment "/nw:networks/nw:network/nw:node" {
- uses te-node-augment;
- }
-}
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/submodule/test.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/submodule/test.yang
deleted file mode 100644
index dbff7e8..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/submodule/test.yang
+++ /dev/null
@@ -1,31 +0,0 @@
-module test {
- namespace "xpath:intra:single";
- prefix test ;
-
- include test1;
- include test2;
- include test4;
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- augment /cont5/cont6 {
- leaf a {
- type int32;
- }
- }
-
- augment /cont3/cont4/cont8 {
- leaf a {
- type int32;
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/submodule/test1.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/submodule/test1.yang
deleted file mode 100644
index 23161d4..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/submodule/test1.yang
+++ /dev/null
@@ -1,47 +0,0 @@
-submodule test1 {
-
- belongs-to test {
- prefix test;
- }
-
- include test4;
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- container cont1 {
- leaf leaf1 {
- type int32;
- }
- container cont2 {
- leaf leaf2 {
- type int32;
- }
- }
- }
-
- augment /cont1/cont2 {
- container cont4 {
- leaf leaf1 {
- type int32;
- }
- }
- }
-
- augment /cont3/cont4 {
- container cont8 {
- leaf leaf8 {
- type int32;
- }
- }
- }
-
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/submodule/test2.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/submodule/test2.yang
deleted file mode 100644
index 26640ee..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/submodule/test2.yang
+++ /dev/null
@@ -1,36 +0,0 @@
-submodule test2{
- belongs-to test {
- prefix test;
- }
-
- include test1;
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- container cont5 {
- leaf leaf5 {
- type int32;
- }
- container cont6 {
- leaf leaf6 {
- type int32;
- }
- }
- }
-
- augment /cont1/cont2/cont4 {
- container cont10 {
- leaf leaf10 {
- type int32;
- }
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/submodule/test4.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/submodule/test4.yang
deleted file mode 100644
index fcbf522..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/submodule/test4.yang
+++ /dev/null
@@ -1,28 +0,0 @@
-submodule test4 {
-
- belongs-to test {
- prefix test;
- }
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- container cont3 {
- leaf leaf3 {
- type int32;
- }
- container cont4 {
- leaf leaf4 {
- type int32;
- }
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/uses/test.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/uses/test.yang
deleted file mode 100644
index b326024..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/uses/test.yang
+++ /dev/null
@@ -1,23 +0,0 @@
-module test {
- namespace "xpath:intra:single";
- prefix test ;
-
- include test2;
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- augment /cont5/cont6/cont3/cont4 {
- leaf a {
- type int32;
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/uses/test1.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/uses/test1.yang
deleted file mode 100644
index bd75dba..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/uses/test1.yang
+++ /dev/null
@@ -1,37 +0,0 @@
-submodule test1 {
-
- belongs-to test {
- prefix test;
- }
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- container cont1 {
- leaf leaf1 {
- type int32;
- }
- container cont2 {
- leaf leaf2 {
- type int32;
- }
- }
- }
-
- augment /cont1/cont2 {
- container cont4 {
- leaf leaf1 {
- type int32;
- }
- }
- }
-
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/uses/test2.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/uses/test2.yang
deleted file mode 100644
index e42101e..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/uses/test2.yang
+++ /dev/null
@@ -1,64 +0,0 @@
-submodule test2{
- belongs-to test {
- prefix test;
- }
-
- include test3;
- include test1;
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- grouping group2 {
- container cont11 {
- }
- }
-
- container cont5 {
- leaf leaf5 {
- type int32;
- }
- container cont6 {
- leaf leaf6 {
- type int32;
- }
- uses group1;
- }
- }
-
- container ethernet {
- leaf leaf10 {
- type string;
- }
- }
-
-
- augment /ethernet {
- uses group2;
- }
-
- augment /cont1/cont2/cont4 {
- container cont10 {
- leaf leaf10 {
- type int32;
- }
-
- }
- }
-
- augment /group1/cont3/cont4 {
- container cont8 {
- leaf leaf8 {
- type int32;
- }
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/uses/test4.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/uses/test4.yang
deleted file mode 100644
index b45bb7d..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/Case/uses/test4.yang
+++ /dev/null
@@ -1,30 +0,0 @@
-submodule test3 {
-
- belongs-to test {
- prefix test;
- }
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- grouping group1 {
- container cont3 {
- leaf leaf3 {
- type int32;
- }
- container cont4 {
- leaf leaf4 {
- type int32;
- }
- }
- }
- }
-
-}
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMulti/test.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMulti/test.yang
deleted file mode 100644
index 772f792..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMulti/test.yang
+++ /dev/null
@@ -1,25 +0,0 @@
-module test {
- namespace "xpath:inter:single";
- prefix test ;
-
- import test1{
- prefix test1;
- }
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- augment /test1:cont1/test1:cont2 {
- leaf a {
- type int32;
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMulti/test1.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMulti/test1.yang
deleted file mode 100644
index 9c1cdb0..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMulti/test1.yang
+++ /dev/null
@@ -1,26 +0,0 @@
-module test1 {
- namespace "xpath:inter:single";
- prefix test1 ;
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- container cont1 {
- leaf leaf1 {
- type int32;
- }
- container cont2 {
- leaf leaf1 {
- type int32;
- }
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiAugment/test.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiAugment/test.yang
deleted file mode 100644
index 640a15a..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiAugment/test.yang
+++ /dev/null
@@ -1,25 +0,0 @@
-module test {
- namespace "xpath:inter:single";
- prefix test ;
-
- import test1{
- prefix test1;
- }
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- augment /test1:cont1/test1:cont2/test1:cont2 {
- leaf a {
- type int32;
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiAugment/test1.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiAugment/test1.yang
deleted file mode 100644
index c9fbeab..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiAugment/test1.yang
+++ /dev/null
@@ -1,34 +0,0 @@
-module test1 {
- namespace "xpath:inter:single";
- prefix test1 ;
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- container cont1 {
- leaf leaf1 {
- type int32;
- }
- }
-
- augment /cont1 {
- container cont2 {
- leaf leaf1 {
- type int32;
- }
- container cont2 {
- leaf leaf1 {
- type int32;
- }
- }
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test.yang
deleted file mode 100644
index 53ed780..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test.yang
+++ /dev/null
@@ -1,29 +0,0 @@
-module test {
- namespace "xpath:inter:single";
- prefix test ;
-
- import test1{
- prefix test1;
- }
-
- import test2{
- prefix test2;
- }
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- augment /test2:cont1/test2:cont2/test1:cont2 {
- leaf a {
- type int32;
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test1.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test1.yang
deleted file mode 100644
index 9ae5e24..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test1.yang
+++ /dev/null
@@ -1,51 +0,0 @@
-module test1 {
- namespace "xpath:inter:single";
- prefix test1 ;
-
- import test2{
- prefix test2;
- }
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
-
- container cont1 {
- leaf leaf1 {
- type int32;
- }
- }
-
- augment /cont1 {
- container cont2 {
- leaf leaf1 {
- type int32;
- }
- container cont2 {
- leaf leaf1 {
- type int32;
- }
- }
- }
- }
-
- augment /test2:cont1/test2:cont2 {
- leaf a {
- type int32;
- }
-
- container cont2 {
- leaf leaf1 {
- type int32;
- }
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test2.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test2.yang
deleted file mode 100644
index f20ac7d..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test2.yang
+++ /dev/null
@@ -1,26 +0,0 @@
-module test2 {
- namespace "xpath:inter:multi";
- prefix test2 ;
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- container cont1 {
- leaf leaf1 {
- type int32;
- }
- container cont2 {
- leaf leaf1 {
- type int32;
- }
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test.yang
deleted file mode 100644
index adb4800..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test.yang
+++ /dev/null
@@ -1,29 +0,0 @@
-module test {
- namespace "xpath:inter:single";
- prefix test ;
-
- import test1{
- prefix test1;
- }
-
- import test2{
- prefix test2;
- }
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- augment /test2:cont1/test2:cont2/test2:cont3/test1:cont2 {
- leaf leaf8 {
- type int32;
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test1.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test1.yang
deleted file mode 100644
index 0957e15..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test1.yang
+++ /dev/null
@@ -1,51 +0,0 @@
-module test1 {
- namespace "xpath:inter:single";
- prefix test1 ;
-
- import test2{
- prefix test2;
- }
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
-
- container cont1 {
- leaf leaf1 {
- type int32;
- }
- }
-
- augment /cont1 {
- container cont2 {
- leaf leaf1 {
- type int32;
- }
- container cont2 {
- leaf leaf3 {
- type int32;
- }
- }
- }
- }
-
- augment /test2:cont1/test2:cont2/test2:cont3 {
- leaf leaf2 {
- type int32;
- }
-
- container cont2 {
- leaf leaf4 {
- type int32;
- }
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test2.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test2.yang
deleted file mode 100644
index 0eeb46d..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test2.yang
+++ /dev/null
@@ -1,34 +0,0 @@
-module test2 {
- namespace "xpath:inter:multi";
- prefix test2 ;
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- container cont1 {
- leaf leaf5 {
- type int32;
- }
- container cont2 {
- leaf leaf6 {
- type int32;
- }
- }
- }
-
- augment /cont1/cont2 {
- container cont3 {
- leaf leaf7 {
- type string;
- }
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test.yang
deleted file mode 100644
index 40b2386..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test.yang
+++ /dev/null
@@ -1,33 +0,0 @@
-module test {
- namespace "xpath:intra:single";
- prefix test ;
-
- import test2 {
- prefix test2;
- }
-
- include test1;
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- augment /test2:cont1/test2:cont2/cont2 {
- leaf a {
- type int32;
- }
- }
-
- augment /cont2/cont3/cont4 {
- leaf a {
- type int32;
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test1.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test1.yang
deleted file mode 100644
index a19ba356..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test1.yang
+++ /dev/null
@@ -1,50 +0,0 @@
-submodule test1 {
-
- belongs-to test {
- prefix test;
- }
-
- import test2 {
- prefix test2;
- }
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- container cont2 {
- leaf leaf1 {
- type int32;
- }
- container cont3 {
- leaf leaf1 {
- type int32;
- }
- }
- }
-
- augment /cont2/cont3 {
- container cont4 {
- leaf leaf1 {
- type int32;
- }
- }
- }
-
- augment /test2:cont1/test2:cont2 {
- leaf a {
- type int32;
- }
- container cont2 {
- leaf leaf1 {
- type int32;
- }
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test2.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test2.yang
deleted file mode 100644
index f20ac7d..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test2.yang
+++ /dev/null
@@ -1,26 +0,0 @@
-module test2 {
- namespace "xpath:inter:multi";
- prefix test2 ;
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- container cont1 {
- leaf leaf1 {
- type int32;
- }
- container cont2 {
- leaf leaf1 {
- type int32;
- }
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiUses/test.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiUses/test.yang
deleted file mode 100644
index 01aa34e..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiUses/test.yang
+++ /dev/null
@@ -1,32 +0,0 @@
-module test {
- namespace "xpath:intra:single";
- prefix test ;
-
- import test2 {
- prefix test2;
- }
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- container cont2 {
- leaf a {
- type int32;
- }
- uses test2:group1;
- }
-
- augment /cont2/cont1/cont2 {
- leaf a {
- type int32;
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiUses/test2.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiUses/test2.yang
deleted file mode 100644
index 298d443..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterMultiUses/test2.yang
+++ /dev/null
@@ -1,28 +0,0 @@
-module test2 {
- namespace "xpath:inter:multi";
- prefix test2 ;
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- grouping group1 {
- container cont1 {
- leaf leaf1 {
- type int32;
- }
- container cont2 {
- leaf leaf1 {
- type int32;
- }
- }
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingle/test.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingle/test.yang
deleted file mode 100644
index 102ec39..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingle/test.yang
+++ /dev/null
@@ -1,25 +0,0 @@
-module test {
- namespace "xpath:inter:single";
- prefix test ;
-
- import test1{
- prefix test1;
- }
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- augment /test1:cont1 {
- leaf a {
- type int32;
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingle/test1.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingle/test1.yang
deleted file mode 100644
index 243ddfe..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingle/test1.yang
+++ /dev/null
@@ -1,21 +0,0 @@
-module test1 {
- namespace "xpath:inter:single";
- prefix test1 ;
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- container cont1 {
- leaf leaf1 {
- type int32;
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleAugment/test.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleAugment/test.yang
deleted file mode 100644
index 772f792..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleAugment/test.yang
+++ /dev/null
@@ -1,25 +0,0 @@
-module test {
- namespace "xpath:inter:single";
- prefix test ;
-
- import test1{
- prefix test1;
- }
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- augment /test1:cont1/test1:cont2 {
- leaf a {
- type int32;
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleAugment/test1.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleAugment/test1.yang
deleted file mode 100644
index b9c5e32..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleAugment/test1.yang
+++ /dev/null
@@ -1,29 +0,0 @@
-module test1 {
- namespace "xpath:inter:single";
- prefix test1 ;
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- container cont1 {
- leaf leaf1 {
- type int32;
- }
- }
-
- augment /cont1 {
- container cont2 {
- leaf leaf1 {
- type int32;
- }
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test.yang
deleted file mode 100644
index a8340ab..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test.yang
+++ /dev/null
@@ -1,27 +0,0 @@
-module test {
- namespace "xpath:intra:single";
- prefix test ;
-
- import test2 {
- prefix test2;
- }
-
- include test1;
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- augment /test2:cont1/test2:cont2/cont2 {
- leaf a {
- type int32;
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test1.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test1.yang
deleted file mode 100644
index ebc8750..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test1.yang
+++ /dev/null
@@ -1,31 +0,0 @@
-submodule test1 {
-
- belongs-to test {
- prefix test;
- }
-
- import test2 {
- prefix test2;
- }
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- augment /test2:cont1/test2:cont2 {
- leaf a {
- type int32;
- }
- container cont2 {
- leaf leaf1 {
- type int32;
- }
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test2.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test2.yang
deleted file mode 100644
index f20ac7d..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test2.yang
+++ /dev/null
@@ -1,26 +0,0 @@
-module test2 {
- namespace "xpath:inter:multi";
- prefix test2 ;
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- container cont1 {
- leaf leaf1 {
- type int32;
- }
- container cont2 {
- leaf leaf1 {
- type int32;
- }
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test.yang
deleted file mode 100644
index 15a6fab..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test.yang
+++ /dev/null
@@ -1,34 +0,0 @@
-module test {
- namespace "xpath:intra:single";
- prefix test ;
-
- import test2 {
- prefix test2;
- }
-
- include test1;
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- augment /test2:cont1/test2:cont2/cont2 {
- leaf leaf {
- type int32;
- }
- uses group1;
- }
-
- augment /test2:cont1/test2:cont2/cont2/cont1/cont2 {
- leaf leaf1 {
- type int32;
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test1.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test1.yang
deleted file mode 100644
index e7fbc31..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test1.yang
+++ /dev/null
@@ -1,42 +0,0 @@
-submodule test1 {
-
- belongs-to test {
- prefix test;
- }
-
- import test2 {
- prefix test2;
- }
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
-
- grouping group1 {
- container cont1 {
- container cont2 {
- leaf leaf2 {
- type string;
- }
- }
- }
- }
-
- augment /test2:cont1/test2:cont2 {
- leaf leaf3 {
- type int32;
- }
- container cont2 {
- leaf leaf1 {
- type int32;
- }
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test2.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test2.yang
deleted file mode 100644
index 2905f9a..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test2.yang
+++ /dev/null
@@ -1,26 +0,0 @@
-module test2 {
- namespace "xpath:inter:multi";
- prefix test2 ;
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- container cont1 {
- leaf leaf4 {
- type int32;
- }
- container cont2 {
- leaf leaf5 {
- type int32;
- }
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraMulti/test.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraMulti/test.yang
deleted file mode 100644
index 77d61b9..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraMulti/test.yang
+++ /dev/null
@@ -1,37 +0,0 @@
-module test {
- namespace "xpath:intra:multi";
- prefix test ;
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- container cont1 {
- leaf leaf1 {
- type int32;
- }
- container cont2 {
- leaf leaf2 {
- type int32;
- }
- container cont3 {
- leaf leaf3 {
- type int32;
- }
- }
- }
- }
-
- augment /cont1/cont2/cont3 {
- leaf a {
- type int32;
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraMultiAugment/test.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraMultiAugment/test.yang
deleted file mode 100644
index b53012c..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraMultiAugment/test.yang
+++ /dev/null
@@ -1,54 +0,0 @@
-module test {
- namespace "xpath:intra:multi";
- prefix test ;
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- container cont1 {
- leaf leaf1 {
- type int32;
- }
- container cont2 {
- leaf leaf2 {
- type int32;
- }
- container cont3 {
- leaf leaf3 {
- type int32;
- }
- }
- }
- }
-
- augment /cont1/cont2/cont3 {
- leaf a {
- type int32;
- }
- container cont4 {
- leaf leaf2 {
- type int32;
- }
- }
- }
-
- augment /cont1/cont2/cont3/cont4 {
- leaf a {
- type int32;
- }
-
- container cont5 {
- leaf leaf1 {
- type int32;
- }
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraMultiSubModule/test.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraMultiSubModule/test.yang
deleted file mode 100644
index b5d1c8d..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraMultiSubModule/test.yang
+++ /dev/null
@@ -1,28 +0,0 @@
-module test {
- namespace "xpath:intra:multi";
- prefix test ;
-
- include test1;
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- container cont1 {
- leaf leaf1 {
- type int32;
- }
- }
-
- augment /cont2/cont3 {
- leaf a {
- type int32;
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraMultiSubModule/test1.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraMultiSubModule/test1.yang
deleted file mode 100644
index faf672e..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraMultiSubModule/test1.yang
+++ /dev/null
@@ -1,28 +0,0 @@
-submodule test1 {
-
- belongs-to "test" {
- prefix "test";
- }
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- container cont2 {
- leaf leaf1 {
- type int32;
- }
- container cont3 {
- leaf leaf3 {
- type int32;
- }
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraMultiUses/test.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraMultiUses/test.yang
deleted file mode 100644
index 6d7473d..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraMultiUses/test.yang
+++ /dev/null
@@ -1,38 +0,0 @@
-module test {
- namespace "xpath:intra:single";
- prefix test ;
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- grouping group1 {
- container cont1 {
- leaf leaf1 {
- type int32;
- }
- container cont3 {
- leaf leaf1 {
- type int32;
- }
- }
- }
- }
-
- container cont2 {
- uses group1;
- }
-
- augment /cont2/cont1/cont3 {
- leaf a {
- type int32;
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraSingle/test.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraSingle/test.yang
deleted file mode 100644
index 95d9c2b..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraSingle/test.yang
+++ /dev/null
@@ -1,27 +0,0 @@
-module test {
- namespace "xpath:intra:single";
- prefix test ;
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- container cont1 {
- leaf leaf1 {
- type int32;
- }
- }
-
- augment /cont1 {
- leaf a {
- type int32;
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraSingleAugment/test.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraSingleAugment/test.yang
deleted file mode 100644
index 2925dcf..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraSingleAugment/test.yang
+++ /dev/null
@@ -1,39 +0,0 @@
-module test {
- namespace "xpath:intra:single";
- prefix test ;
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- container cont1 {
- leaf leaf1 {
- type int32;
- }
- }
-
- augment /cont1 {
- leaf a {
- type int32;
- }
-
- container cont2 {
- leaf leaf1 {
- type int32;
- }
- }
- }
-
- augment /cont1/cont2 {
- leaf a {
- type int32;
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraSingleSubModule/test.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraSingleSubModule/test.yang
deleted file mode 100644
index 77401da..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraSingleSubModule/test.yang
+++ /dev/null
@@ -1,28 +0,0 @@
-module test {
- namespace "xpath:intra:single";
- prefix test ;
-
- include test1;
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- container cont1 {
- leaf leaf1 {
- type int32;
- }
- }
-
- augment /cont2 {
- leaf a {
- type int32;
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraSingleSubModule/test1.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraSingleSubModule/test1.yang
deleted file mode 100644
index 47d4c5c..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraSingleSubModule/test1.yang
+++ /dev/null
@@ -1,23 +0,0 @@
-submodule test1 {
-
- belongs-to test {
- prefix test;
- }
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- container cont2 {
- leaf leaf1 {
- type int32;
- }
- }
-}
-
diff --git a/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraSingleUses/test.yang b/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraSingleUses/test.yang
deleted file mode 100644
index 3074db7..0000000
--- a/utils/yangutils/plugin/src/test/resources/xPathLinker/IntraFile/IntraSingleUses/test.yang
+++ /dev/null
@@ -1,33 +0,0 @@
-module test {
- namespace "xpath:intra:single";
- prefix test ;
-
- organization "";
- contact "";
-
- description
- "Defines basic service types for L3VPN service.";
-
- revision "2015-12-16" {
- reference "";
- }
-
- grouping group1 {
- container cont1 {
- leaf leaf1 {
- type int32;
- }
- }
- }
-
- container cont2 {
- uses group1;
- }
-
- augment /cont2/cont1 {
- leaf a {
- type int32;
- }
- }
-}
-
diff --git a/utils/yangutils/pom.xml b/utils/yangutils/pom.xml
deleted file mode 100644
index 44d8da5..0000000
--- a/utils/yangutils/pom.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<!--
- ~ 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.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.onosproject</groupId>
- <artifactId>onlab-utils</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>onos-yangutils</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- <name>onos-yang-utils</name>
- <packaging>pom</packaging>
-
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
-
- <modules>
- <module>datamodel</module>
- <module>plugin</module>
- </modules>
-</project>