Remove syntaxcheck from vnspacemanager. 19/31119/1
authorZhang Yali <zhangyali369@huawei.com>
Thu, 10 Dec 2015 07:35:03 +0000 (15:35 +0800)
committerZhang Yali <zhangyali369@huawei.com>
Thu, 10 Dec 2015 07:35:03 +0000 (15:35 +0800)
Change-Id: Ib9b003f8070e2ec10fd9367cc41753c2c1459a6b
Signed-off-by: Zhang Yali <zhangyali369@huawei.com>
nemo-impl/src/main/java/org/opendaylight/nemo/user/vnspacemanager/syntaxcheck/ConnectionDefinitionCheck.java [deleted file]
nemo-impl/src/main/java/org/opendaylight/nemo/user/vnspacemanager/syntaxcheck/FlowDefinitionCheck.java [deleted file]
nemo-impl/src/main/java/org/opendaylight/nemo/user/vnspacemanager/syntaxcheck/NodeDefinitionCheck.java [deleted file]
nemo-impl/src/main/java/org/opendaylight/nemo/user/vnspacemanager/syntaxcheck/OperationDefinitionCheck.java [deleted file]
nemo-impl/src/main/java/org/opendaylight/nemo/user/vnspacemanager/syntaxcheck/ResultDefinitionCheck.java [deleted file]

diff --git a/nemo-impl/src/main/java/org/opendaylight/nemo/user/vnspacemanager/syntaxcheck/ConnectionDefinitionCheck.java b/nemo-impl/src/main/java/org/opendaylight/nemo/user/vnspacemanager/syntaxcheck/ConnectionDefinitionCheck.java
deleted file mode 100644 (file)
index 6af91fe..0000000
+++ /dev/null
@@ -1,192 +0,0 @@
-/*\r
- * Copyright (c) 2015 Huawei, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.nemo.user.vnspacemanager.syntaxcheck;\r
-\r
-import java.util.List;\r
-\r
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;\r
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.user.intent.objects.Connection;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.object.rev151010.ConnectionDefinitions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.object.rev151010.connection.definitions.ConnectionDefinition;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.object.rev151010.connection.instance.Property;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.object.rev151010.property.definitions.PropertyDefinition;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.object.rev151010.property.instance.PropertyValues;\r
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-import com.google.common.base.Optional;\r
-import com.google.common.util.concurrent.FutureCallback;\r
-import com.google.common.util.concurrent.Futures;\r
-import com.google.common.util.concurrent.ListenableFuture;\r
-\r
-/**\r
- * Created by z00293636 on 2015/9/2.\r
- */\r
-public class ConnectionDefinitionCheck {\r
-\r
-    private DataBroker dataBroker;\r
-    private List<ConnectionDefinition> connectionDefinitionList;\r
-    private static final Logger LOG = LoggerFactory.getLogger(ConnectionDefinitionCheck.class);\r
-\r
-    public ConnectionDefinitionCheck(DataBroker dataBroker)\r
-    {\r
-        this.dataBroker = dataBroker;\r
-        connectionDefinitionList = null;\r
-    }\r
-\r
-    public String CheckConnectionDefinition(Connection connection)\r
-    {\r
-        fetchConnectionDefinitionList();\r
-        boolean ConnectionHasDefined = false;\r
-        String errorInfo = null;\r
-\r
-        if (connectionDefinitionList != null)\r
-        {\r
-            for (ConnectionDefinition connectionDefinition : connectionDefinitionList)\r
-            {\r
-                if (connectionDefinition.getConnectionType().equals(connection.getConnectionType()))\r
-                {\r
-                    ConnectionHasDefined = true;\r
-                    List<Property> connectionProperties = connection.getProperty();\r
-                    List<PropertyDefinition> propertyDefinitions = connectionDefinition.getPropertyDefinition();\r
-\r
-                    if (connectionProperties != null && propertyDefinitions ==null)\r
-                    {\r
-                        errorInfo = "There are no properties for this type of connection.";\r
-                        break;\r
-                    }\r
-                    else if (connectionProperties != null && propertyDefinitions != null)\r
-                    {\r
-                        errorInfo = CheckProperty(connection.getProperty(), connectionDefinition.getPropertyDefinition());\r
-                        if (errorInfo != null)\r
-                        {\r
-                            break;\r
-                        }\r
-                    }\r
-\r
-                }\r
-            }\r
-        }\r
-\r
-        if (!ConnectionHasDefined)\r
-        {\r
-            return "This type of connection has not been defined.";\r
-        }\r
-        return errorInfo;\r
-    }\r
-\r
-    private String CheckProperty(List<Property> connectionProperty, List<PropertyDefinition> propertyDefinitionList )\r
-    {\r
-        String errorInfo = null;\r
-        for (Property property : connectionProperty)\r
-        {\r
-            Boolean properyHasDefine = false;\r
-            if (errorInfo != null)\r
-            {\r
-                break;\r
-            }\r
-            else\r
-            {\r
-                for (PropertyDefinition propertyDefinition : propertyDefinitionList)\r
-                {\r
-                    if (property.getPropertyName().equals(propertyDefinition.getPropertyName()))\r
-                    {\r
-                        properyHasDefine = true;\r
-                        PropertyValues propertyValues = property.getPropertyValues();\r
-                        PropertyDefinition.PropertyValueType propertyValueType = propertyDefinition.getPropertyValueType();\r
-\r
-                        if (propertyValues != null && propertyValueType != null)\r
-                        {\r
-                            if (propertyDefinition.getIsReadOnly()!=null)\r
-                            {\r
-                                if (propertyDefinition.getIsRequired().getIntValue() == 1)\r
-                                {\r
-                                    errorInfo = "The property value type of" + property.getPropertyName().toString() + "is read only.";\r
-                                    break;\r
-                                }\r
-                            }\r
-                            else\r
-                            {\r
-                                if (propertyValueType.getIntValue() == 0 && !(propertyValues.getIntValue() == null && propertyValues.getStringValue() != null && propertyValues.getRangeValue() == null)) {\r
-                                    errorInfo = "The property value type of" + property.getPropertyName().toString() + " should be string.";\r
-                                    break;\r
-                                }\r
-                                if (propertyValueType.getIntValue() == 1 && !(propertyValues.getIntValue() != null && propertyValues.getStringValue() == null && propertyValues.getRangeValue() == null)) {\r
-                                    errorInfo = "The property value type of" + property.getPropertyName().toString() + " should be integer.";\r
-                                    break;\r
-                                }\r
-                                if (propertyValueType.getIntValue() == 2 && !(propertyValues.getIntValue() == null && propertyValues.getStringValue() == null && propertyValues.getRangeValue() != null)) {\r
-                                    errorInfo = "The property value type of" + property.getPropertyName().toString() + " should be range.";\r
-                                    break;\r
-                                }\r
-                            }\r
-                        }\r
-                        }\r
-                }\r
-                if (!properyHasDefine) {\r
-                    errorInfo = "This type of property" + property.getPropertyName().toString() + " has not been defined.";\r
-                }\r
-            }\r
-         }\r
-\r
-        if (errorInfo == null)\r
-        {\r
-            Boolean requiredProperty = false;\r
-            for (PropertyDefinition propertyDefinition : propertyDefinitionList)\r
-            {\r
-                if (propertyDefinition.getIsRequired()!=null)\r
-                {\r
-                    if (propertyDefinition.getIsRequired().getIntValue() == 0)\r
-                    {\r
-                        for (Property property : connectionProperty)\r
-                        {\r
-                            if (property.getPropertyName().equals(propertyDefinition.getPropertyName()))\r
-                            {\r
-                                requiredProperty = true;\r
-                            }\r
-                        }\r
-                        if (!requiredProperty)\r
-                        {\r
-                            errorInfo = "The required property" + propertyDefinition.getPropertyName().toString() + "is not included in the intent.";\r
-                        }\r
-                    }\r
-                }\r
-            }\r
-        }\r
-        return errorInfo;\r
-    }\r
-\r
-    private void fetchConnectionDefinitionList()\r
-    {\r
-        InstanceIdentifier<ConnectionDefinitions> connectiondefinitionId = InstanceIdentifier.builder(ConnectionDefinitions.class).build();\r
-        ListenableFuture<Optional<ConnectionDefinitions>> connectiondefinitionFuture = dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, connectiondefinitionId);\r
-        Futures.addCallback(connectiondefinitionFuture, new FutureCallback<Optional<ConnectionDefinitions>>() {\r
-            @Override\r
-            public void onSuccess(Optional<ConnectionDefinitions> result) {\r
-                setConnectionDefinitionList(result.get().getConnectionDefinition());\r
-                return;\r
-            }\r
-\r
-            @Override\r
-            public void onFailure(Throwable t) {\r
-                LOG.error("Can not read connection definition information.", t);\r
-\r
-                return;\r
-            }\r
-        });\r
-        return;\r
-    }\r
-\r
-    private void setConnectionDefinitionList(List<ConnectionDefinition> connectionDefinitionList)\r
-    {\r
-        this.connectionDefinitionList = connectionDefinitionList;\r
-    }\r
-\r
-}\r
diff --git a/nemo-impl/src/main/java/org/opendaylight/nemo/user/vnspacemanager/syntaxcheck/FlowDefinitionCheck.java b/nemo-impl/src/main/java/org/opendaylight/nemo/user/vnspacemanager/syntaxcheck/FlowDefinitionCheck.java
deleted file mode 100644 (file)
index bd74197..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-/*\r
- * Copyright (c) 2015 Huawei, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.nemo.user.vnspacemanager.syntaxcheck;\r
-\r
-import java.util.List;\r
-\r
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;\r
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.user.intent.objects.Flow;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.object.rev151010.MatchItemDefinitions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.object.rev151010.flow.instance.MatchItem;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.object.rev151010.match.item.definitions.MatchItemDefinition;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.object.rev151010.match.item.instance.MatchItemValue;\r
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-import com.google.common.base.Optional;\r
-import com.google.common.util.concurrent.FutureCallback;\r
-import com.google.common.util.concurrent.Futures;\r
-import com.google.common.util.concurrent.ListenableFuture;\r
-\r
-/**\r
- * Created by z00293636 on 2015/9/2.\r
- */\r
-public class FlowDefinitionCheck {\r
-\r
-    private DataBroker dataBroker;\r
-    private List<MatchItemDefinition> matchItemDefinitionList;\r
-    private static final Logger LOG = LoggerFactory.getLogger(FlowDefinitionCheck.class);\r
-\r
-    public FlowDefinitionCheck(DataBroker dataBroker)\r
-    {\r
-        this.dataBroker = dataBroker;\r
-        matchItemDefinitionList = null;\r
-    }\r
-\r
-    public String CheckDefinition(Flow flow)\r
-    {\r
-        String errorInfo = null;\r
-        fetchMatchItemDefinitions();\r
-        Boolean matchHasDefined = false;\r
-        if (flow.getMatchItem() != null)\r
-        {\r
-            if (matchItemDefinitionList != null )\r
-            {\r
-                for (MatchItem matchItem : flow.getMatchItem())\r
-                {\r
-                    for (MatchItemDefinition matchItemDefinition : matchItemDefinitionList)\r
-                    {\r
-                        if (matchItem.getMatchItemName().equals(matchItemDefinition.getMatchItemName()))\r
-                        {\r
-                            matchHasDefined = true;\r
-                            MatchItemValue matchItemValue = matchItem.getMatchItemValue();\r
-                            MatchItemDefinition.MatchItemValueType matchItemValueType = matchItemDefinition.getMatchItemValueType();\r
-\r
-                            if (matchItemValue != null && matchItemValueType != null)\r
-                            {\r
-                                if (matchItemValueType.getIntValue()==0 && !(matchItemValue.getIntValue()==null&&matchItemValue.getStringValue()!=null&&matchItemValue.getRangeValue()==null))\r
-                                {\r
-                                    errorInfo = "The match item value type for" +matchItem.getMatchItemName().toString()+"should be string.";\r
-                                    break;\r
-                                }\r
-\r
-                                if (matchItemValueType.getIntValue()==1 && !(matchItemValue.getIntValue()!=null&&matchItemValue.getStringValue()==null&&matchItemValue.getRangeValue()==null))\r
-                                {\r
-                                    errorInfo = "The match item value type for" + matchItem.getMatchItemName().toString()+"should be integer.";\r
-                                    break;\r
-                                }\r
-\r
-                                if (matchItemValueType.getIntValue()==2 && !(matchItemValue.getIntValue()==null&&matchItemValue.getStringValue()==null&&matchItemValue.getRangeValue()!=null))\r
-                                {\r
-                                    errorInfo = "The match item value type for" + matchItem.getMatchItemName().toString()+"should be range.";\r
-                                    break;\r
-                                }\r
-                            }\r
-                        }\r
-                    }\r
-                }\r
-        }\r
-            if (!matchHasDefined)\r
-            {\r
-                errorInfo = "The match item has not been defined.";\r
-            }\r
-    }\r
-        return errorInfo;\r
-    }\r
-\r
-    private void fetchMatchItemDefinitions()\r
-    {\r
-        InstanceIdentifier<MatchItemDefinitions> matchitemdefinitionId = InstanceIdentifier.builder(MatchItemDefinitions.class).build();\r
-        ListenableFuture<Optional<MatchItemDefinitions>> matchitemdefinitionFuture = dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, matchitemdefinitionId);\r
-        Futures.addCallback(matchitemdefinitionFuture, new FutureCallback<Optional<MatchItemDefinitions>>() {\r
-            @Override\r
-            public void onSuccess(Optional<MatchItemDefinitions> result) {\r
-               setMatchItemDefinitionList( result.get().getMatchItemDefinition());\r
-                return;\r
-            }\r
-\r
-            @Override\r
-            public void onFailure(Throwable t) {\r
-                LOG.error("Can not read match item definition information.", t);\r
-\r
-                return;\r
-            }\r
-        });\r
-        return ;\r
-    }\r
-\r
-    private void setMatchItemDefinitionList(List<MatchItemDefinition> matchItemDefinitionList)\r
-    {\r
-        this.matchItemDefinitionList = matchItemDefinitionList;\r
-    }\r
-}\r
diff --git a/nemo-impl/src/main/java/org/opendaylight/nemo/user/vnspacemanager/syntaxcheck/NodeDefinitionCheck.java b/nemo-impl/src/main/java/org/opendaylight/nemo/user/vnspacemanager/syntaxcheck/NodeDefinitionCheck.java
deleted file mode 100644 (file)
index 198df00..0000000
+++ /dev/null
@@ -1,195 +0,0 @@
-/*\r
- * Copyright (c) 2015 Huawei, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.nemo.user.vnspacemanager.syntaxcheck;\r
-\r
-import java.util.List;\r
-\r
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;\r
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.user.intent.objects.Node;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.object.rev151010.NodeDefinitions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.object.rev151010.node.definitions.NodeDefinition;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.object.rev151010.node.instance.Property;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.object.rev151010.property.definitions.PropertyDefinition;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.object.rev151010.property.instance.PropertyValues;\r
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-import com.google.common.base.Optional;\r
-import com.google.common.util.concurrent.FutureCallback;\r
-import com.google.common.util.concurrent.Futures;\r
-import com.google.common.util.concurrent.ListenableFuture;\r
-\r
-/**\r
- * Created by z00293636 on 2015/9/2.\r
- */\r
-public class NodeDefinitionCheck {\r
-\r
-    private DataBroker dataBroker;\r
-    private List<NodeDefinition> nodeDefinitionList;\r
-    private static final Logger LOG = LoggerFactory.getLogger(NodeDefinitionCheck.class);\r
-\r
-    public NodeDefinitionCheck(DataBroker dataBroker)\r
-    {\r
-        this.dataBroker = dataBroker;\r
-        nodeDefinitionList = null;\r
-    }\r
-\r
-    public String CheckNodeDefinition(Node node)\r
-    {\r
-        String errorInfo = null;\r
-        Boolean NodeHasDefined = false;\r
-\r
-        fetchNodeDefinitions();\r
-        if (nodeDefinitionList != null)\r
-        {\r
-            for (NodeDefinition nodeDefinition : nodeDefinitionList)\r
-            {\r
-                if (nodeDefinition.getNodeType().equals(node.getNodeType()))\r
-                {\r
-                    NodeHasDefined = true;\r
-                    List<Property> nodeProperties = node.getProperty();\r
-                    List<PropertyDefinition> nodePropertyDefinitions = nodeDefinition.getPropertyDefinition();\r
-\r
-                    if (nodeProperties != null && nodePropertyDefinitions == null)\r
-                    {\r
-                        errorInfo = "This type of node has no properties.";\r
-                        break;\r
-                    }\r
-                    else if (nodeProperties != null && nodePropertyDefinitions != null)\r
-                    {\r
-                        errorInfo = checkProperty(nodeProperties, nodeDefinition.getPropertyDefinition());\r
-                        if (errorInfo != null)\r
-                        {\r
-                            break;\r
-                        }\r
-                    }\r
-                }\r
-            }\r
-        }\r
-\r
-        if (!NodeHasDefined)\r
-        {\r
-            errorInfo = "This type of Node has not been defined.";\r
-        }\r
-        return errorInfo;\r
-    }\r
-\r
-    private String checkProperty(List<Property> nodeProperties, List<PropertyDefinition> nodePropertyDefinitions)\r
-    {\r
-        Boolean propertyHasDefine = false;\r
-        String errorInfo = null;\r
-\r
-        for (Property property : nodeProperties)\r
-        {\r
-            if (errorInfo != null)\r
-            {\r
-                break;\r
-            }\r
-            else\r
-            {\r
-                for (PropertyDefinition propertydefinition : nodePropertyDefinitions)\r
-                {\r
-                    if (property.getPropertyName().equals(propertydefinition.getPropertyName()))\r
-                    {\r
-                        propertyHasDefine = true;\r
-                        PropertyValues propertyValues = property.getPropertyValues();\r
-                        PropertyDefinition.PropertyValueType propertyValueType = propertydefinition.getPropertyValueType();\r
-\r
-                        if (propertyValues != null && propertyValueType != null)\r
-                        {\r
-                            if (propertydefinition.getIsReadOnly()!=null)\r
-                            {\r
-                                if (propertydefinition.getIsRequired().getIntValue() == 1)\r
-                                {\r
-                                    errorInfo = "The property"+ property.getPropertyName().toString()+" is readonly, can not be written.";\r
-                                    break;\r
-                                }\r
-                            }\r
-                            else if (propertyValueType.getIntValue() == 0 && !(propertyValues.getIntValue() == null && propertyValues.getStringValue() != null && propertyValues.getRangeValue() == null))\r
-                            {\r
-                                errorInfo =  "The property value type"+property.getPropertyName().toString()+" should be string";\r
-                                break;\r
-                            }\r
-                            else if (propertyValueType.getIntValue() == 1 && !(propertyValues.getIntValue() != null && propertyValues.getStringValue() == null && propertyValues.getRangeValue() == null))\r
-                            {\r
-                                errorInfo =  "The property value type"+property.getPropertyName().toString()+" should be integer";\r
-                                break;\r
-                            }\r
-                            else if (propertyValueType.getIntValue() == 2 && !(propertyValues.getIntValue() == null && propertyValues.getStringValue() == null && propertyValues.getRangeValue() != null))\r
-                            {\r
-                                errorInfo =  "The property value type"+property.getPropertyName().toString()+" should be range";\r
-                                break;\r
-                            }\r
-                        }\r
-                    }\r
-                  }\r
-\r
-                if (!propertyHasDefine)\r
-                {\r
-                    errorInfo = "The property"+property.getPropertyName().toString()+"has not been defined.";\r
-                }\r
-            }\r
-        }\r
-\r
-        if (errorInfo == null)\r
-        {\r
-            Boolean requiredProperty = false;\r
-            for (PropertyDefinition propertyDefinition : nodePropertyDefinitions)\r
-            {\r
-                if (propertyDefinition.getIsRequired()!=null)\r
-                {\r
-                    if (propertyDefinition.getIsRequired().getIntValue() ==0)\r
-                    {\r
-                       for (Property property: nodeProperties)\r
-                       {\r
-                           if (property.getPropertyName().equals(propertyDefinition.getPropertyName()))\r
-                           {\r
-                                requiredProperty = true;\r
-                           }\r
-                       }\r
-                        if (!requiredProperty)\r
-                        {\r
-                            errorInfo = "The required property "+ propertyDefinition.getPropertyName().toString() + "is not included in the intent.";\r
-                            break;\r
-                        }\r
-                    }\r
-                }\r
-            }\r
-        }\r
-        return errorInfo;\r
-    }\r
-\r
-    private void fetchNodeDefinitions()\r
-    {\r
-        InstanceIdentifier<NodeDefinitions> nodedefinitionId = InstanceIdentifier.builder(NodeDefinitions.class).build();\r
-        ListenableFuture<Optional<NodeDefinitions>> nodedefinitionFuture = dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, nodedefinitionId);\r
-        Futures.addCallback(nodedefinitionFuture, new FutureCallback<Optional<NodeDefinitions>>() {\r
-            @Override\r
-            public void onSuccess(Optional<NodeDefinitions> result)\r
-            {\r
-                setNodeDefinitionList(result.get().getNodeDefinition());\r
-                return;\r
-            }\r
-\r
-            @Override\r
-            public void onFailure(Throwable t)\r
-            {\r
-                LOG.error("Can not read node definitions information.", t);\r
-                return;\r
-            }\r
-        });\r
-        return ;\r
-    }\r
-\r
-    private void setNodeDefinitionList(List<NodeDefinition> nodeDefinitionsList)\r
-    {\r
-        this.nodeDefinitionList = nodeDefinitionsList;\r
-    }\r
-}\r
diff --git a/nemo-impl/src/main/java/org/opendaylight/nemo/user/vnspacemanager/syntaxcheck/OperationDefinitionCheck.java b/nemo-impl/src/main/java/org/opendaylight/nemo/user/vnspacemanager/syntaxcheck/OperationDefinitionCheck.java
deleted file mode 100644 (file)
index f0abf44..0000000
+++ /dev/null
@@ -1,244 +0,0 @@
-/*\r
- * Copyright (c) 2015 Huawei, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.nemo.user.vnspacemanager.syntaxcheck;\r
-\r
-import java.util.List;\r
-\r
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;\r
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.user.intent.operations.Operation;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.operation.rev151010.ActionDefinitions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.operation.rev151010.ConditionParameterDefinitions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.operation.rev151010.action.definitions.ActionDefinition;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.operation.rev151010.action.instance.ParameterValues;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.operation.rev151010.condition.instance.ConditionSegment;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.operation.rev151010.condition.instance.condition.segment.ConditionParameterTargetValue;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.operation.rev151010.condition.parameter.definitions.ConditionParameterDefinition;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.operation.rev151010.condition.parameter.definitions.condition.parameter.definition.ParameterMatchPatterns;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.operation.rev151010.operation.instance.Action;\r
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-import com.google.common.base.Optional;\r
-import com.google.common.util.concurrent.FutureCallback;\r
-import com.google.common.util.concurrent.Futures;\r
-import com.google.common.util.concurrent.ListenableFuture;\r
-\r
-/**\r
- * Created by z00293636 on 2015/9/2.\r
- */\r
-public class OperationDefinitionCheck {\r
-\r
-    private DataBroker dataBroker;\r
-    private List<ActionDefinition> actionDefinitionList;\r
-    private List<ConditionParameterDefinition> conditionParameterDefinitionList;\r
-    private static final Logger LOG = LoggerFactory.getLogger(OperationDefinitionCheck.class);\r
-    public OperationDefinitionCheck(DataBroker dataBroker)\r
-    {\r
-        this.dataBroker = dataBroker;\r
-        actionDefinitionList = null;\r
-        conditionParameterDefinitionList = null;\r
-    }\r
-\r
-    public String CheckDefinition(Operation operation)\r
-    {\r
-        fetchActionDefinitions();\r
-        fetchConditionParaDefinitions();\r
-        String errorInfo = null;\r
-\r
-        if (operation.getAction() != null )\r
-        {\r
-           errorInfo = checkAction(operation);\r
-        }\r
-        if (errorInfo == null && operation.getConditionSegment() != null)\r
-        {\r
-            errorInfo = checkCondition(operation);\r
-        }\r
-        return errorInfo;\r
-    }\r
-\r
-    private String checkAction(Operation operation)\r
-    {\r
-        String errorInfo = null;\r
-        Boolean actionHasDefine = false;\r
-\r
-        if ( actionDefinitionList == null)\r
-        {\r
-            errorInfo = "There are no actions has been defined in the data store.";\r
-        }\r
-        else {\r
-            for (Action action : operation.getAction()) {\r
-                for (ActionDefinition actionDefinition : actionDefinitionList) {\r
-                    if (actionDefinition.getActionName().equals(action.getActionName())) {\r
-                        actionHasDefine = true;\r
-\r
-                        ParameterValues parameterValues = action.getParameterValues();\r
-                        ActionDefinition.ParameterValueType parameterValueType = actionDefinition.getParameterValueType();\r
-\r
-                        if (parameterValues != null && parameterValueType != null)\r
-                        {\r
-                            if (parameterValueType.getIntValue() == 0 && !(parameterValues.getIntValue() == null && parameterValues.getStringValue() != null && parameterValues.getRangeValue() == null)) {\r
-                                errorInfo = "The value type of" + action.getActionName().toString() + "should be string.";\r
-                                break;\r
-                            }\r
-                            if (parameterValueType.getIntValue() == 1 && !(parameterValues.getIntValue() != null && parameterValues.getStringValue() == null && parameterValues.getRangeValue() == null)) {\r
-                                errorInfo = "The value type of" + action.getActionName().toString() + "should be integer.";\r
-                                break;\r
-                            }\r
-                            if (parameterValueType.getIntValue() == 2 && !(parameterValues.getIntValue() == null && parameterValues.getStringValue() == null && parameterValues.getRangeValue() != null)) {\r
-                                errorInfo = "The value type of" + action.getActionName().toString() + "should be range.";\r
-                                break;\r
-                            }\r
-                        }\r
-                    }\r
-\r
-                }\r
-            }\r
-            if (!actionHasDefine) {\r
-                errorInfo = "The action type has not been defined.";\r
-            }\r
-        }\r
-        return errorInfo;\r
-    }\r
-\r
-    private String checkCondition(Operation operation)\r
-    {\r
-        String errorInfo = null;\r
-        Boolean conditionHasDefined = false;\r
-\r
-        if (conditionParameterDefinitionList != null)\r
-        {\r
-            if (operation.getConditionSegment() != null)\r
-            {\r
-                for (ConditionSegment conditionSegment :operation.getConditionSegment())\r
-                {\r
-                    for (ConditionParameterDefinition conditionParameterDefinition : conditionParameterDefinitionList)\r
-                    {\r
-                        if (conditionParameterDefinition.getParameterName().getValue().equals(conditionSegment.getConditionParameterName().getValue()))\r
-                        {\r
-                            conditionHasDefined = true;\r
-                            if (conditionSegment.getConditionParameterMatchPattern() != null)\r
-                            {\r
-                                if (conditionParameterDefinition.getParameterMatchPatterns() != null)\r
-                                {\r
-                                    List<ParameterMatchPatterns.ParameterMatchPattern> conditionParameterMatchPatterns = conditionParameterDefinition.getParameterMatchPatterns().getParameterMatchPattern();\r
-                                    if (conditionParameterMatchPatterns != null)\r
-                                    {\r
-                                        Boolean matchpatternexist = false;\r
-                                        for (ParameterMatchPatterns.ParameterMatchPattern parameterMatchPattern : conditionParameterMatchPatterns)\r
-                                        {\r
-                                            if (parameterMatchPattern.getIntValue() == conditionSegment.getConditionParameterMatchPattern().getIntValue())\r
-                                            {\r
-                                                matchpatternexist = true;\r
-                                                break;\r
-                                            }\r
-                                        }\r
-                                        if (!matchpatternexist)\r
-                                        {\r
-                                            errorInfo = "The match pattern has not defined in the condition.";\r
-                                        }\r
-                                    }\r
-                                    else\r
-                                    {\r
-                                        errorInfo = "There are no match pattern in match pattrn list.";\r
-                                        break;\r
-                                    }\r
-                                }\r
-                                else\r
-                                {\r
-                                    errorInfo = "No match patterns have been defined in data store.";\r
-                                    break;\r
-                                }\r
-                            }\r
-                            if (conditionSegment.getConditionParameterTargetValue() != null)\r
-                            {\r
-                                if (conditionParameterDefinition.getParameterValueType() != null)\r
-                                {\r
-                                    ConditionParameterTargetValue conditionParameterTargetValue = conditionSegment.getConditionParameterTargetValue();\r
-                                    ConditionParameterDefinition.ParameterValueType  parameterValueType = conditionParameterDefinition.getParameterValueType();\r
-\r
-                                    if (parameterValueType.getIntValue() == 0 && !(conditionParameterTargetValue.getIntValue() == null && conditionParameterTargetValue.getStringValue() != null && conditionParameterTargetValue.getRangeValue() == null)) {\r
-                                        errorInfo = "The value type of" + conditionSegment.getConditionParameterName().toString() + "should be string.";\r
-                                        break;\r
-                                    }\r
-                                    if (parameterValueType.getIntValue() == 1 && !(conditionParameterTargetValue.getIntValue() != null && conditionParameterTargetValue.getStringValue() == null && conditionParameterTargetValue.getRangeValue() == null)) {\r
-                                        errorInfo = "The value type of" + conditionSegment.getConditionParameterName().toString() + "should be integer.";\r
-                                        break;\r
-                                    }\r
-                                    if (parameterValueType.getIntValue() == 2 && !(conditionParameterTargetValue.getIntValue() == null && conditionParameterTargetValue.getStringValue() == null && conditionParameterTargetValue.getRangeValue() != null)) {\r
-                                        errorInfo = "The value type of" + conditionSegment.getConditionParameterName().toString() + "should be range.";\r
-                                        break;\r
-                                    }\r
-\r
-                                }\r
-                            }\r
-                        }\r
-                    }\r
-                }\r
-            }\r
-        }\r
-\r
-        if (!conditionHasDefined)\r
-        {\r
-            errorInfo = "This condition has not been defined in data store.";\r
-        }\r
-        return errorInfo;\r
-    }\r
-\r
-    private void fetchActionDefinitions()\r
-    {\r
-        InstanceIdentifier<ActionDefinitions> actiondefinitionId = InstanceIdentifier.builder(ActionDefinitions.class).build();\r
-        ListenableFuture<Optional<ActionDefinitions>> actiondefinitionFuture = dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, actiondefinitionId);\r
-        Futures.addCallback(actiondefinitionFuture, new FutureCallback<Optional<ActionDefinitions>>() {\r
-            @Override\r
-            public void onSuccess(Optional<ActionDefinitions> result) {\r
-                setActionDefinitionList( result.get().getActionDefinition());\r
-                return;\r
-            }\r
-\r
-            @Override\r
-            public void onFailure(Throwable t) {\r
-                LOG.error("Can not read action definition information.", t);\r
-\r
-                return;\r
-            }\r
-        });\r
-        return ;\r
-    }\r
-\r
-    private void fetchConditionParaDefinitions()\r
-    {\r
-        InstanceIdentifier<ConditionParameterDefinitions> conditionparadefinitionId = InstanceIdentifier.builder(ConditionParameterDefinitions.class).build();\r
-        ListenableFuture<Optional<ConditionParameterDefinitions>> conditionparadefinitionFuture = dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, conditionparadefinitionId);\r
-        Futures.addCallback(conditionparadefinitionFuture, new FutureCallback<Optional<ConditionParameterDefinitions>>() {\r
-            @Override\r
-            public void onSuccess(Optional<ConditionParameterDefinitions> result) {\r
-                setConditionParameterDefinitionList( result.get().getConditionParameterDefinition());\r
-                return;\r
-            }\r
-\r
-            @Override\r
-            public void onFailure(Throwable t) {\r
-                LOG.error("Can not read condition parameter definition information.", t);\r
-                return;\r
-            }\r
-        });\r
-        return ;\r
-    }\r
-\r
-    private void setActionDefinitionList(List<ActionDefinition> actionDefinitionList)\r
-    {\r
-        this.actionDefinitionList = actionDefinitionList;\r
-    }\r
-\r
-    private void setConditionParameterDefinitionList(List<ConditionParameterDefinition> conditionParameterDefinitionList)\r
-    {\r
-        this.conditionParameterDefinitionList = conditionParameterDefinitionList;\r
-    }\r
-}\r
diff --git a/nemo-impl/src/main/java/org/opendaylight/nemo/user/vnspacemanager/syntaxcheck/ResultDefinitionCheck.java b/nemo-impl/src/main/java/org/opendaylight/nemo/user/vnspacemanager/syntaxcheck/ResultDefinitionCheck.java
deleted file mode 100644 (file)
index 9249304..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*\r
- * Copyright (c) 2015 Huawei, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.nemo.user.vnspacemanager.syntaxcheck;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.user.intent.Results;\r
-\r
-/**\r
- * Created by z00293636 on 2015/9/2.\r
- */\r
-public class ResultDefinitionCheck {\r
-\r
-    public String CheckDefinition(Results results)\r
-    {\r
-        return null;\r
-    }\r
-}\r