From 2a7f6affcecfcd2a7f9db3731884699f1bacff1c Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Mon, 2 Oct 2017 15:48:23 -0400 Subject: Add test cases for MdsalHelper Add test cases for MdsalHelper methods toBuilder() and toProperties(). This requires a Yang model, so added a copy of sliapi/model to sli, since could not use sliapi directly otherwise would create circular dependency (since sliapi depends on sli). Change-Id: I4824afe250f93428c73dbeec9f4a4c36ee4f76e6 Issue-ID: CCSDK-106 Signed-off-by: Dan Timoney --- sli/model/pom.xml | 82 +++++ .../rev161110/$YangModelBindingProvider.java | 8 + .../core/sliapi/rev161110/$YangModuleInfoImpl.java | 82 +++++ .../core/sliapi/rev161110/ExecuteGraphInput.java | 128 ++++++++ .../sliapi/rev161110/ExecuteGraphInputBuilder.java | 287 +++++++++++++++++ .../core/sliapi/rev161110/ExecuteGraphOutput.java | 46 +++ .../rev161110/ExecuteGraphOutputBuilder.java | 315 ++++++++++++++++++ .../core/sliapi/rev161110/HealthcheckOutput.java | 46 +++ .../sliapi/rev161110/HealthcheckOutputBuilder.java | 315 ++++++++++++++++++ .../core/sliapi/rev161110/ParameterSetting.java | 64 ++++ .../sli/core/sliapi/rev161110/ResponseFields.java | 58 ++++ .../sli/core/sliapi/rev161110/SLIAPIData.java | 147 +++++++++ .../sli/core/sliapi/rev161110/SLIAPIService.java | 93 ++++++ .../sli/core/sliapi/rev161110/TestResults.java | 49 +++ .../core/sliapi/rev161110/TestResultsBuilder.java | 202 ++++++++++++ .../execute/graph/input/SliParameter.java | 60 ++++ .../execute/graph/input/SliParameterBuilder.java | 357 +++++++++++++++++++++ .../execute/graph/input/SliParameterKey.java | 75 +++++ .../sliapi/rev161110/test/results/TestResult.java | 62 ++++ .../rev161110/test/results/TestResultBuilder.java | 271 ++++++++++++++++ .../rev161110/test/results/TestResultKey.java | 75 +++++ sli/model/src/main/yang/sliapi.yang | 111 +++++++ sli/pom.xml | 97 +++--- sli/provider/pom.xml | 6 + .../sli/core/sli/provider/MdsalHelperTest.java | 81 ++++- .../core/sli/provider/TestMdsalHelperUtils.java | 79 ----- 26 files changed, 3066 insertions(+), 130 deletions(-) create mode 100755 sli/model/pom.xml create mode 100644 sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/$YangModelBindingProvider.java create mode 100644 sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/$YangModuleInfoImpl.java create mode 100644 sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/ExecuteGraphInput.java create mode 100644 sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/ExecuteGraphInputBuilder.java create mode 100644 sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/ExecuteGraphOutput.java create mode 100644 sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/ExecuteGraphOutputBuilder.java create mode 100644 sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/HealthcheckOutput.java create mode 100644 sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/HealthcheckOutputBuilder.java create mode 100644 sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/ParameterSetting.java create mode 100644 sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/ResponseFields.java create mode 100644 sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/SLIAPIData.java create mode 100644 sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/SLIAPIService.java create mode 100644 sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/TestResults.java create mode 100644 sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/TestResultsBuilder.java create mode 100644 sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/execute/graph/input/SliParameter.java create mode 100644 sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/execute/graph/input/SliParameterBuilder.java create mode 100644 sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/execute/graph/input/SliParameterKey.java create mode 100644 sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/test/results/TestResult.java create mode 100644 sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/test/results/TestResultBuilder.java create mode 100644 sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/test/results/TestResultKey.java create mode 100755 sli/model/src/main/yang/sliapi.yang delete mode 100644 sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/TestMdsalHelperUtils.java diff --git a/sli/model/pom.xml b/sli/model/pom.xml new file mode 100755 index 00000000..18b56f46 --- /dev/null +++ b/sli/model/pom.xml @@ -0,0 +1,82 @@ + + + 4.0.0 + + sli + org.onap.ccsdk.sli.core + 0.1.2-SNAPSHOT + + sli-model + bundle + SLI - Model + + + + + org.apache.felix + maven-bundle-plugin + true + + + * + + + + + org.opendaylight.yangtools + yang-maven-plugin + ${odl.yangtools.yang.maven.plugin.version} + + + org.opendaylight.mdsal + maven-sal-api-gen-plugin + ${odl.sal.api.gen.plugin.version} + jar + + + + + + generate-sources + + + ${yang.file.directory} + + + + org.opendaylight.mdsal.binding.maven.api.gen.plugin.CodeGeneratorImpl + ${salGeneratorPath} + + + true + + + + + + + + + org.opendaylight.mdsal + yang-binding + ${odl.mdsal.yang.binding.version} + + + org.opendaylight.yangtools + yang-common + ${odl.yangtools.version} + + + org.opendaylight.mdsal.model + ietf-inet-types + ${odl.ietf-inet-types.version} + + + org.opendaylight.mdsal.model + ietf-yang-types + ${odl.ietf-yang-types.version} + + + diff --git a/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/$YangModelBindingProvider.java b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/$YangModelBindingProvider.java new file mode 100644 index 00000000..5195da54 --- /dev/null +++ b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/$YangModelBindingProvider.java @@ -0,0 +1,8 @@ +package org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110; + +public final class $YangModelBindingProvider implements org.opendaylight.yangtools.yang.binding.YangModelBindingProvider { + @Override + public org.opendaylight.yangtools.yang.binding.YangModuleInfo getModuleInfo() { + return $YangModuleInfoImpl.getInstance(); + } +} diff --git a/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/$YangModuleInfoImpl.java b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/$YangModuleInfoImpl.java new file mode 100644 index 00000000..e1cdacc5 --- /dev/null +++ b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/$YangModuleInfoImpl.java @@ -0,0 +1,82 @@ +package org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110 ; +import org.opendaylight.yangtools.yang.binding.YangModuleInfo; +import java.util.Set; +import java.util.HashSet; +import com.google.common.collect.ImmutableSet; +import java.io.InputStream; +import java.io.IOException; +public final class $YangModuleInfoImpl implements YangModuleInfo { + + private static final YangModuleInfo INSTANCE = new $YangModuleInfoImpl(); + + private final java.lang.String name = "SLI-API"; + private final java.lang.String namespace = "org:onap:ccsdk:sli:core:sliapi"; + private final java.lang.String revision = "2016-11-10"; + private final java.lang.String resourcePath = "/META-INF/yang/sliapi.yang"; + + private final Set importedModules; + + public static YangModuleInfo getInstance() { + return INSTANCE; + } + + private $YangModuleInfoImpl() { + Set set = new HashSet<>(); + set.add(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.$YangModuleInfoImpl.getInstance()); + importedModules = ImmutableSet.copyOf(set); + + InputStream stream = $YangModuleInfoImpl.class.getResourceAsStream(resourcePath); + if (stream == null) { + throw new IllegalStateException("Resource '" + resourcePath + "' is missing"); + } + try { + stream.close(); + } catch (IOException e) { + // Resource leak, but there is nothing we can do + } + } + + @Override + public java.lang.String getName() { + return name; + } + + @Override + public java.lang.String getRevision() { + return revision; + } + + @Override + public java.lang.String getNamespace() { + return namespace; + } + + @Override + public InputStream getModuleSourceStream() throws IOException { + InputStream stream = $YangModuleInfoImpl.class.getResourceAsStream(resourcePath); + if (stream == null) { + throw new IOException("Resource " + resourcePath + " is missing"); + } + return stream; + } + + @Override + public Set getImportedModules() { + return importedModules; + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder(this.getClass().getCanonicalName()); + sb.append("["); + sb.append("name = " + name); + sb.append(", namespace = " + namespace); + sb.append(", revision = " + revision); + sb.append(", resourcePath = " + resourcePath); + sb.append(", imports = " + importedModules); + sb.append("]"); + return sb.toString(); + } + + +} diff --git a/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/ExecuteGraphInput.java b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/ExecuteGraphInput.java new file mode 100644 index 00000000..4045483e --- /dev/null +++ b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/ExecuteGraphInput.java @@ -0,0 +1,128 @@ +package org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; +import java.util.List; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter; +import org.opendaylight.yangtools.yang.binding.Augmentable; + +/** + *

This class represents the following YANG schema fragment defined in module SLI-API + *

+ * container input {
+ *     leaf module-name {
+ *         type string;
+ *     }
+ *     leaf rpc-name {
+ *         type string;
+ *     }
+ *     leaf mode {
+ *         type enumeration;
+ *     }
+ *     list sli-parameter {
+ *         key "parameter-name"
+ *         leaf parameter-name {
+ *             type string;
+ *         }
+ *         leaf int-value {
+ *             type int32;
+ *         }
+ *         leaf string-value {
+ *             type string;
+ *         }
+ *         leaf boolean-value {
+ *             type boolean;
+ *         }
+ *         uses parameter-setting;
+ *     }
+ * }
+ * 
+ * The schema path to identify an instance is + * SLI-API/execute-graph/input + * + *

To create instances of this class use {@link org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInputBuilder}. + * @see org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInputBuilder + * + */ +public interface ExecuteGraphInput + extends + DataObject, + Augmentable +{ + + + public enum Mode { + Sync(0, "sync"), + + Async(1, "async") + ; + + + java.lang.String name; + int value; + private static final java.util.Map VALUE_MAP; + + static { + final com.google.common.collect.ImmutableMap.Builder b = com.google.common.collect.ImmutableMap.builder(); + for (Mode enumItem : Mode.values()) + { + b.put(enumItem.value, enumItem); + } + + VALUE_MAP = b.build(); + } + + private Mode(int value, java.lang.String name) { + this.value = value; + this.name = name; + } + + /** + * Returns the name of the enumeration item as it is specified in the input yang. + * + * @return the name of the enumeration item as it is specified in the input yang + */ + public java.lang.String getName() { + return name; + } + + /** + * @return integer value + */ + public int getIntValue() { + return value; + } + + /** + * @param valueArg + * @return corresponding Mode item + */ + public static Mode forValue(int valueArg) { + return VALUE_MAP.get(valueArg); + } + } + + public static final QName QNAME = org.opendaylight.yangtools.yang.common.QName.create("org:onap:ccsdk:sli:core:sliapi", + "2016-11-10", "input").intern(); + + /** + * @return java.lang.String moduleName, or null if not present + */ + java.lang.String getModuleName(); + + /** + * @return java.lang.String rpcName, or null if not present + */ + java.lang.String getRpcName(); + + /** + * @return org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput.Mode mode, or null if not present + */ + Mode getMode(); + + /** + * @return java.util.List sliParameter, or null if not present + */ + List getSliParameter(); + +} + diff --git a/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/ExecuteGraphInputBuilder.java b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/ExecuteGraphInputBuilder.java new file mode 100644 index 00000000..9f28ef27 --- /dev/null +++ b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/ExecuteGraphInputBuilder.java @@ -0,0 +1,287 @@ +package org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.DataObject; +import java.util.HashMap; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput.Mode; +import java.util.Objects; +import java.util.List; +import java.util.Collections; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter; +import java.util.Map; + +/** + * Class that builds {@link org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput} instances. + * + * @see org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput + * + */ +public class ExecuteGraphInputBuilder implements Builder { + + private Mode _mode; + private java.lang.String _moduleName; + private java.lang.String _rpcName; + private List _sliParameter; + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ExecuteGraphInputBuilder() { + } + + public ExecuteGraphInputBuilder(ExecuteGraphInput base) { + this._mode = base.getMode(); + this._moduleName = base.getModuleName(); + this._rpcName = base.getRpcName(); + this._sliParameter = base.getSliParameter(); + if (base instanceof ExecuteGraphInputImpl) { + ExecuteGraphInputImpl impl = (ExecuteGraphInputImpl) base; + if (!impl.augmentation.isEmpty()) { + this.augmentation = new HashMap<>(impl.augmentation); + } + } else if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + AugmentationHolder casted =(AugmentationHolder) base; + if (!casted.augmentations().isEmpty()) { + this.augmentation = new HashMap<>(casted.augmentations()); + } + } + } + + + public Mode getMode() { + return _mode; + } + + public java.lang.String getModuleName() { + return _moduleName; + } + + public java.lang.String getRpcName() { + return _rpcName; + } + + public List getSliParameter() { + return _sliParameter; + } + + @SuppressWarnings("unchecked") + public > E getAugmentation(java.lang.Class augmentationType) { + if (augmentationType == null) { + throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!"); + } + return (E) augmentation.get(augmentationType); + } + + + public ExecuteGraphInputBuilder setMode(final Mode value) { + this._mode = value; + return this; + } + + + public ExecuteGraphInputBuilder setModuleName(final java.lang.String value) { + this._moduleName = value; + return this; + } + + + public ExecuteGraphInputBuilder setRpcName(final java.lang.String value) { + this._rpcName = value; + return this; + } + + + public ExecuteGraphInputBuilder setSliParameter(final List value) { + this._sliParameter = value; + return this; + } + + public ExecuteGraphInputBuilder addAugmentation(java.lang.Class> augmentationType, Augmentation augmentation) { + if (augmentation == null) { + return removeAugmentation(augmentationType); + } + + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentation); + return this; + } + + public ExecuteGraphInputBuilder removeAugmentation(java.lang.Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + @Override + public ExecuteGraphInput build() { + return new ExecuteGraphInputImpl(this); + } + + private static final class ExecuteGraphInputImpl implements ExecuteGraphInput { + + @Override + public java.lang.Class getImplementedInterface() { + return org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput.class; + } + + private final Mode _mode; + private final java.lang.String _moduleName; + private final java.lang.String _rpcName; + private final List _sliParameter; + + private Map>, Augmentation> augmentation = Collections.emptyMap(); + + private ExecuteGraphInputImpl(ExecuteGraphInputBuilder base) { + this._mode = base.getMode(); + this._moduleName = base.getModuleName(); + this._rpcName = base.getRpcName(); + this._sliParameter = base.getSliParameter(); + switch (base.augmentation.size()) { + case 0: + this.augmentation = Collections.emptyMap(); + break; + case 1: + final Map.Entry>, Augmentation> e = base.augmentation.entrySet().iterator().next(); + this.augmentation = Collections.>, Augmentation>singletonMap(e.getKey(), e.getValue()); + break; + default : + this.augmentation = new HashMap<>(base.augmentation); + } + } + + @Override + public Mode getMode() { + return _mode; + } + + @Override + public java.lang.String getModuleName() { + return _moduleName; + } + + @Override + public java.lang.String getRpcName() { + return _rpcName; + } + + @Override + public List getSliParameter() { + return _sliParameter; + } + + @SuppressWarnings("unchecked") + @Override + public > E getAugmentation(java.lang.Class augmentationType) { + if (augmentationType == null) { + throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!"); + } + return (E) augmentation.get(augmentationType); + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_mode); + result = prime * result + Objects.hashCode(_moduleName); + result = prime * result + Objects.hashCode(_rpcName); + result = prime * result + Objects.hashCode(_sliParameter); + result = prime * result + Objects.hashCode(augmentation); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput.class.equals(((DataObject)obj).getImplementedInterface())) { + return false; + } + org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput other = (org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput)obj; + if (!Objects.equals(_mode, other.getMode())) { + return false; + } + if (!Objects.equals(_moduleName, other.getModuleName())) { + return false; + } + if (!Objects.equals(_rpcName, other.getRpcName())) { + return false; + } + if (!Objects.equals(_sliParameter, other.getSliParameter())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ExecuteGraphInputImpl otherImpl = (ExecuteGraphInputImpl) obj; + if (!Objects.equals(augmentation, otherImpl.augmentation)) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentation.entrySet()) { + if (!e.getValue().equals(other.getAugmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public java.lang.String toString() { + java.lang.String name = "ExecuteGraphInput ["; + java.lang.StringBuilder builder = new java.lang.StringBuilder (name); + if (_mode != null) { + builder.append("_mode="); + builder.append(_mode); + builder.append(", "); + } + if (_moduleName != null) { + builder.append("_moduleName="); + builder.append(_moduleName); + builder.append(", "); + } + if (_rpcName != null) { + builder.append("_rpcName="); + builder.append(_rpcName); + builder.append(", "); + } + if (_sliParameter != null) { + builder.append("_sliParameter="); + builder.append(_sliParameter); + } + final int builderLength = builder.length(); + final int builderAdditionalLength = builder.substring(name.length(), builderLength).length(); + if (builderAdditionalLength > 2 && !builder.substring(builderLength - 2, builderLength).equals(", ")) { + builder.append(", "); + } + builder.append("augmentation="); + builder.append(augmentation.values()); + return builder.append(']').toString(); + } + } + +} diff --git a/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/ExecuteGraphOutput.java b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/ExecuteGraphOutput.java new file mode 100644 index 00000000..08321c07 --- /dev/null +++ b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/ExecuteGraphOutput.java @@ -0,0 +1,46 @@ +package org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.binding.Augmentable; + +/** + *

This class represents the following YANG schema fragment defined in module SLI-API + *

+ * container output {
+ *     leaf response-code {
+ *         type string;
+ *     }
+ *     leaf ack-final-indicator {
+ *         type string;
+ *     }
+ *     leaf response-message {
+ *         type string;
+ *     }
+ *     leaf context-memory-json {
+ *         type string;
+ *     }
+ *     uses response-fields;
+ * }
+ * 
+ * The schema path to identify an instance is + * SLI-API/execute-graph/output + * + *

To create instances of this class use {@link org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphOutputBuilder}. + * @see org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphOutputBuilder + * + */ +public interface ExecuteGraphOutput + extends + ResponseFields, + DataObject, + Augmentable +{ + + + + public static final QName QNAME = org.opendaylight.yangtools.yang.common.QName.create("org:onap:ccsdk:sli:core:sliapi", + "2016-11-10", "output").intern(); + + +} + diff --git a/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/ExecuteGraphOutputBuilder.java b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/ExecuteGraphOutputBuilder.java new file mode 100644 index 00000000..7b613bb4 --- /dev/null +++ b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/ExecuteGraphOutputBuilder.java @@ -0,0 +1,315 @@ +package org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.DataObject; +import java.util.HashMap; +import org.opendaylight.yangtools.concepts.Builder; +import java.util.Objects; +import java.util.Collections; +import java.util.Map; + +/** + * Class that builds {@link org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphOutput} instances. + * + * @see org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphOutput + * + */ +public class ExecuteGraphOutputBuilder implements Builder { + + private java.lang.String _ackFinalIndicator; + private java.lang.String _contextMemoryJson; + private java.lang.String _responseCode; + private java.lang.String _responseMessage; + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ExecuteGraphOutputBuilder() { + } + public ExecuteGraphOutputBuilder(org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ResponseFields arg) { + this._responseCode = arg.getResponseCode(); + this._ackFinalIndicator = arg.getAckFinalIndicator(); + this._responseMessage = arg.getResponseMessage(); + this._contextMemoryJson = arg.getContextMemoryJson(); + } + + public ExecuteGraphOutputBuilder(ExecuteGraphOutput base) { + this._ackFinalIndicator = base.getAckFinalIndicator(); + this._contextMemoryJson = base.getContextMemoryJson(); + this._responseCode = base.getResponseCode(); + this._responseMessage = base.getResponseMessage(); + if (base instanceof ExecuteGraphOutputImpl) { + ExecuteGraphOutputImpl impl = (ExecuteGraphOutputImpl) base; + if (!impl.augmentation.isEmpty()) { + this.augmentation = new HashMap<>(impl.augmentation); + } + } else if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + AugmentationHolder casted =(AugmentationHolder) base; + if (!casted.augmentations().isEmpty()) { + this.augmentation = new HashMap<>(casted.augmentations()); + } + } + } + + /** + *Set fields from given grouping argument. Valid argument is instance of one of following types: + *

    + *
  • org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ResponseFields
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ResponseFields) { + this._responseCode = ((org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ResponseFields)arg).getResponseCode(); + this._ackFinalIndicator = ((org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ResponseFields)arg).getAckFinalIndicator(); + this._responseMessage = ((org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ResponseFields)arg).getResponseMessage(); + this._contextMemoryJson = ((org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ResponseFields)arg).getContextMemoryJson(); + isValidArg = true; + } + if (!isValidArg) { + throw new IllegalArgumentException( + "expected one of: [org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ResponseFields] \n" + + "but was: " + arg + ); + } + } + + public java.lang.String getAckFinalIndicator() { + return _ackFinalIndicator; + } + + public java.lang.String getContextMemoryJson() { + return _contextMemoryJson; + } + + public java.lang.String getResponseCode() { + return _responseCode; + } + + public java.lang.String getResponseMessage() { + return _responseMessage; + } + + @SuppressWarnings("unchecked") + public > E getAugmentation(java.lang.Class augmentationType) { + if (augmentationType == null) { + throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!"); + } + return (E) augmentation.get(augmentationType); + } + + + public ExecuteGraphOutputBuilder setAckFinalIndicator(final java.lang.String value) { + this._ackFinalIndicator = value; + return this; + } + + + public ExecuteGraphOutputBuilder setContextMemoryJson(final java.lang.String value) { + this._contextMemoryJson = value; + return this; + } + + + public ExecuteGraphOutputBuilder setResponseCode(final java.lang.String value) { + this._responseCode = value; + return this; + } + + + public ExecuteGraphOutputBuilder setResponseMessage(final java.lang.String value) { + this._responseMessage = value; + return this; + } + + public ExecuteGraphOutputBuilder addAugmentation(java.lang.Class> augmentationType, Augmentation augmentation) { + if (augmentation == null) { + return removeAugmentation(augmentationType); + } + + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentation); + return this; + } + + public ExecuteGraphOutputBuilder removeAugmentation(java.lang.Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + @Override + public ExecuteGraphOutput build() { + return new ExecuteGraphOutputImpl(this); + } + + private static final class ExecuteGraphOutputImpl implements ExecuteGraphOutput { + + @Override + public java.lang.Class getImplementedInterface() { + return org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphOutput.class; + } + + private final java.lang.String _ackFinalIndicator; + private final java.lang.String _contextMemoryJson; + private final java.lang.String _responseCode; + private final java.lang.String _responseMessage; + + private Map>, Augmentation> augmentation = Collections.emptyMap(); + + private ExecuteGraphOutputImpl(ExecuteGraphOutputBuilder base) { + this._ackFinalIndicator = base.getAckFinalIndicator(); + this._contextMemoryJson = base.getContextMemoryJson(); + this._responseCode = base.getResponseCode(); + this._responseMessage = base.getResponseMessage(); + switch (base.augmentation.size()) { + case 0: + this.augmentation = Collections.emptyMap(); + break; + case 1: + final Map.Entry>, Augmentation> e = base.augmentation.entrySet().iterator().next(); + this.augmentation = Collections.>, Augmentation>singletonMap(e.getKey(), e.getValue()); + break; + default : + this.augmentation = new HashMap<>(base.augmentation); + } + } + + @Override + public java.lang.String getAckFinalIndicator() { + return _ackFinalIndicator; + } + + @Override + public java.lang.String getContextMemoryJson() { + return _contextMemoryJson; + } + + @Override + public java.lang.String getResponseCode() { + return _responseCode; + } + + @Override + public java.lang.String getResponseMessage() { + return _responseMessage; + } + + @SuppressWarnings("unchecked") + @Override + public > E getAugmentation(java.lang.Class augmentationType) { + if (augmentationType == null) { + throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!"); + } + return (E) augmentation.get(augmentationType); + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_ackFinalIndicator); + result = prime * result + Objects.hashCode(_contextMemoryJson); + result = prime * result + Objects.hashCode(_responseCode); + result = prime * result + Objects.hashCode(_responseMessage); + result = prime * result + Objects.hashCode(augmentation); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphOutput.class.equals(((DataObject)obj).getImplementedInterface())) { + return false; + } + org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphOutput other = (org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphOutput)obj; + if (!Objects.equals(_ackFinalIndicator, other.getAckFinalIndicator())) { + return false; + } + if (!Objects.equals(_contextMemoryJson, other.getContextMemoryJson())) { + return false; + } + if (!Objects.equals(_responseCode, other.getResponseCode())) { + return false; + } + if (!Objects.equals(_responseMessage, other.getResponseMessage())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ExecuteGraphOutputImpl otherImpl = (ExecuteGraphOutputImpl) obj; + if (!Objects.equals(augmentation, otherImpl.augmentation)) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentation.entrySet()) { + if (!e.getValue().equals(other.getAugmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public java.lang.String toString() { + java.lang.String name = "ExecuteGraphOutput ["; + java.lang.StringBuilder builder = new java.lang.StringBuilder (name); + if (_ackFinalIndicator != null) { + builder.append("_ackFinalIndicator="); + builder.append(_ackFinalIndicator); + builder.append(", "); + } + if (_contextMemoryJson != null) { + builder.append("_contextMemoryJson="); + builder.append(_contextMemoryJson); + builder.append(", "); + } + if (_responseCode != null) { + builder.append("_responseCode="); + builder.append(_responseCode); + builder.append(", "); + } + if (_responseMessage != null) { + builder.append("_responseMessage="); + builder.append(_responseMessage); + } + final int builderLength = builder.length(); + final int builderAdditionalLength = builder.substring(name.length(), builderLength).length(); + if (builderAdditionalLength > 2 && !builder.substring(builderLength - 2, builderLength).equals(", ")) { + builder.append(", "); + } + builder.append("augmentation="); + builder.append(augmentation.values()); + return builder.append(']').toString(); + } + } + +} diff --git a/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/HealthcheckOutput.java b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/HealthcheckOutput.java new file mode 100644 index 00000000..b0dd3b1b --- /dev/null +++ b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/HealthcheckOutput.java @@ -0,0 +1,46 @@ +package org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.binding.Augmentable; + +/** + *

This class represents the following YANG schema fragment defined in module SLI-API + *

+ * container output {
+ *     leaf response-code {
+ *         type string;
+ *     }
+ *     leaf ack-final-indicator {
+ *         type string;
+ *     }
+ *     leaf response-message {
+ *         type string;
+ *     }
+ *     leaf context-memory-json {
+ *         type string;
+ *     }
+ *     uses response-fields;
+ * }
+ * 
+ * The schema path to identify an instance is + * SLI-API/healthcheck/output + * + *

To create instances of this class use {@link org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckOutputBuilder}. + * @see org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckOutputBuilder + * + */ +public interface HealthcheckOutput + extends + ResponseFields, + DataObject, + Augmentable +{ + + + + public static final QName QNAME = org.opendaylight.yangtools.yang.common.QName.create("org:onap:ccsdk:sli:core:sliapi", + "2016-11-10", "output").intern(); + + +} + diff --git a/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/HealthcheckOutputBuilder.java b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/HealthcheckOutputBuilder.java new file mode 100644 index 00000000..de784032 --- /dev/null +++ b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/HealthcheckOutputBuilder.java @@ -0,0 +1,315 @@ +package org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.DataObject; +import java.util.HashMap; +import org.opendaylight.yangtools.concepts.Builder; +import java.util.Objects; +import java.util.Collections; +import java.util.Map; + +/** + * Class that builds {@link org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckOutput} instances. + * + * @see org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckOutput + * + */ +public class HealthcheckOutputBuilder implements Builder { + + private java.lang.String _ackFinalIndicator; + private java.lang.String _contextMemoryJson; + private java.lang.String _responseCode; + private java.lang.String _responseMessage; + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public HealthcheckOutputBuilder() { + } + public HealthcheckOutputBuilder(org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ResponseFields arg) { + this._responseCode = arg.getResponseCode(); + this._ackFinalIndicator = arg.getAckFinalIndicator(); + this._responseMessage = arg.getResponseMessage(); + this._contextMemoryJson = arg.getContextMemoryJson(); + } + + public HealthcheckOutputBuilder(HealthcheckOutput base) { + this._ackFinalIndicator = base.getAckFinalIndicator(); + this._contextMemoryJson = base.getContextMemoryJson(); + this._responseCode = base.getResponseCode(); + this._responseMessage = base.getResponseMessage(); + if (base instanceof HealthcheckOutputImpl) { + HealthcheckOutputImpl impl = (HealthcheckOutputImpl) base; + if (!impl.augmentation.isEmpty()) { + this.augmentation = new HashMap<>(impl.augmentation); + } + } else if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + AugmentationHolder casted =(AugmentationHolder) base; + if (!casted.augmentations().isEmpty()) { + this.augmentation = new HashMap<>(casted.augmentations()); + } + } + } + + /** + *Set fields from given grouping argument. Valid argument is instance of one of following types: + *

    + *
  • org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ResponseFields
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ResponseFields) { + this._responseCode = ((org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ResponseFields)arg).getResponseCode(); + this._ackFinalIndicator = ((org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ResponseFields)arg).getAckFinalIndicator(); + this._responseMessage = ((org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ResponseFields)arg).getResponseMessage(); + this._contextMemoryJson = ((org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ResponseFields)arg).getContextMemoryJson(); + isValidArg = true; + } + if (!isValidArg) { + throw new IllegalArgumentException( + "expected one of: [org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ResponseFields] \n" + + "but was: " + arg + ); + } + } + + public java.lang.String getAckFinalIndicator() { + return _ackFinalIndicator; + } + + public java.lang.String getContextMemoryJson() { + return _contextMemoryJson; + } + + public java.lang.String getResponseCode() { + return _responseCode; + } + + public java.lang.String getResponseMessage() { + return _responseMessage; + } + + @SuppressWarnings("unchecked") + public > E getAugmentation(java.lang.Class augmentationType) { + if (augmentationType == null) { + throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!"); + } + return (E) augmentation.get(augmentationType); + } + + + public HealthcheckOutputBuilder setAckFinalIndicator(final java.lang.String value) { + this._ackFinalIndicator = value; + return this; + } + + + public HealthcheckOutputBuilder setContextMemoryJson(final java.lang.String value) { + this._contextMemoryJson = value; + return this; + } + + + public HealthcheckOutputBuilder setResponseCode(final java.lang.String value) { + this._responseCode = value; + return this; + } + + + public HealthcheckOutputBuilder setResponseMessage(final java.lang.String value) { + this._responseMessage = value; + return this; + } + + public HealthcheckOutputBuilder addAugmentation(java.lang.Class> augmentationType, Augmentation augmentation) { + if (augmentation == null) { + return removeAugmentation(augmentationType); + } + + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentation); + return this; + } + + public HealthcheckOutputBuilder removeAugmentation(java.lang.Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + @Override + public HealthcheckOutput build() { + return new HealthcheckOutputImpl(this); + } + + private static final class HealthcheckOutputImpl implements HealthcheckOutput { + + @Override + public java.lang.Class getImplementedInterface() { + return org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckOutput.class; + } + + private final java.lang.String _ackFinalIndicator; + private final java.lang.String _contextMemoryJson; + private final java.lang.String _responseCode; + private final java.lang.String _responseMessage; + + private Map>, Augmentation> augmentation = Collections.emptyMap(); + + private HealthcheckOutputImpl(HealthcheckOutputBuilder base) { + this._ackFinalIndicator = base.getAckFinalIndicator(); + this._contextMemoryJson = base.getContextMemoryJson(); + this._responseCode = base.getResponseCode(); + this._responseMessage = base.getResponseMessage(); + switch (base.augmentation.size()) { + case 0: + this.augmentation = Collections.emptyMap(); + break; + case 1: + final Map.Entry>, Augmentation> e = base.augmentation.entrySet().iterator().next(); + this.augmentation = Collections.>, Augmentation>singletonMap(e.getKey(), e.getValue()); + break; + default : + this.augmentation = new HashMap<>(base.augmentation); + } + } + + @Override + public java.lang.String getAckFinalIndicator() { + return _ackFinalIndicator; + } + + @Override + public java.lang.String getContextMemoryJson() { + return _contextMemoryJson; + } + + @Override + public java.lang.String getResponseCode() { + return _responseCode; + } + + @Override + public java.lang.String getResponseMessage() { + return _responseMessage; + } + + @SuppressWarnings("unchecked") + @Override + public > E getAugmentation(java.lang.Class augmentationType) { + if (augmentationType == null) { + throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!"); + } + return (E) augmentation.get(augmentationType); + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_ackFinalIndicator); + result = prime * result + Objects.hashCode(_contextMemoryJson); + result = prime * result + Objects.hashCode(_responseCode); + result = prime * result + Objects.hashCode(_responseMessage); + result = prime * result + Objects.hashCode(augmentation); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckOutput.class.equals(((DataObject)obj).getImplementedInterface())) { + return false; + } + org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckOutput other = (org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckOutput)obj; + if (!Objects.equals(_ackFinalIndicator, other.getAckFinalIndicator())) { + return false; + } + if (!Objects.equals(_contextMemoryJson, other.getContextMemoryJson())) { + return false; + } + if (!Objects.equals(_responseCode, other.getResponseCode())) { + return false; + } + if (!Objects.equals(_responseMessage, other.getResponseMessage())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + HealthcheckOutputImpl otherImpl = (HealthcheckOutputImpl) obj; + if (!Objects.equals(augmentation, otherImpl.augmentation)) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentation.entrySet()) { + if (!e.getValue().equals(other.getAugmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public java.lang.String toString() { + java.lang.String name = "HealthcheckOutput ["; + java.lang.StringBuilder builder = new java.lang.StringBuilder (name); + if (_ackFinalIndicator != null) { + builder.append("_ackFinalIndicator="); + builder.append(_ackFinalIndicator); + builder.append(", "); + } + if (_contextMemoryJson != null) { + builder.append("_contextMemoryJson="); + builder.append(_contextMemoryJson); + builder.append(", "); + } + if (_responseCode != null) { + builder.append("_responseCode="); + builder.append(_responseCode); + builder.append(", "); + } + if (_responseMessage != null) { + builder.append("_responseMessage="); + builder.append(_responseMessage); + } + final int builderLength = builder.length(); + final int builderAdditionalLength = builder.substring(name.length(), builderLength).length(); + if (builderAdditionalLength > 2 && !builder.substring(builderLength - 2, builderLength).equals(", ")) { + builder.append(", "); + } + builder.append("augmentation="); + builder.append(augmentation.values()); + return builder.append(']').toString(); + } + } + +} diff --git a/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/ParameterSetting.java b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/ParameterSetting.java new file mode 100644 index 00000000..e2d610b6 --- /dev/null +++ b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/ParameterSetting.java @@ -0,0 +1,64 @@ +package org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Parameter setting + * + *

This class represents the following YANG schema fragment defined in module SLI-API + *

+ * grouping parameter-setting {
+ *     leaf parameter-name {
+ *         type string;
+ *     }
+ *     leaf int-value {
+ *         type int32;
+ *     }
+ *     leaf string-value {
+ *         type string;
+ *     }
+ *     leaf boolean-value {
+ *         type boolean;
+ *     }
+ * }
+ * 
+ * The schema path to identify an instance is + * SLI-API/parameter-setting + * + */ +public interface ParameterSetting + extends + DataObject +{ + + + + public static final QName QNAME = org.opendaylight.yangtools.yang.common.QName.create("org:onap:ccsdk:sli:core:sliapi", + "2016-11-10", "parameter-setting").intern(); + + /** + * Parameter name + * + * + * + * @return java.lang.String parameterName, or null if not present + */ + java.lang.String getParameterName(); + + /** + * @return java.lang.Integer intValue, or null if not present + */ + java.lang.Integer getIntValue(); + + /** + * @return java.lang.String stringValue, or null if not present + */ + java.lang.String getStringValue(); + + /** + * @return java.lang.Boolean booleanValue, or null if not present + */ + java.lang.Boolean isBooleanValue(); + +} + diff --git a/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/ResponseFields.java b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/ResponseFields.java new file mode 100644 index 00000000..440beea0 --- /dev/null +++ b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/ResponseFields.java @@ -0,0 +1,58 @@ +package org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + *

This class represents the following YANG schema fragment defined in module SLI-API + *

+ * grouping response-fields {
+ *     leaf response-code {
+ *         type string;
+ *     }
+ *     leaf ack-final-indicator {
+ *         type string;
+ *     }
+ *     leaf response-message {
+ *         type string;
+ *     }
+ *     leaf context-memory-json {
+ *         type string;
+ *     }
+ * }
+ * 
+ * The schema path to identify an instance is + * SLI-API/response-fields + * + */ +public interface ResponseFields + extends + DataObject +{ + + + + public static final QName QNAME = org.opendaylight.yangtools.yang.common.QName.create("org:onap:ccsdk:sli:core:sliapi", + "2016-11-10", "response-fields").intern(); + + /** + * @return java.lang.String responseCode, or null if not present + */ + java.lang.String getResponseCode(); + + /** + * @return java.lang.String ackFinalIndicator, or null if not present + */ + java.lang.String getAckFinalIndicator(); + + /** + * @return java.lang.String responseMessage, or null if not present + */ + java.lang.String getResponseMessage(); + + /** + * @return java.lang.String contextMemoryJson, or null if not present + */ + java.lang.String getContextMemoryJson(); + +} + diff --git a/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/SLIAPIData.java b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/SLIAPIData.java new file mode 100644 index 00000000..1917b475 --- /dev/null +++ b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/SLIAPIData.java @@ -0,0 +1,147 @@ +package org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110; +import org.opendaylight.yangtools.yang.binding.DataRoot; + +/** + * Defines API to service logic interpreter + * + *

This class represents the following YANG schema fragment defined in module SLI-API + *

+ * module SLI-API {
+ *     yang-version 1;
+ *     namespace "org:onap:ccsdk:sli:core:sliapi";
+ *     prefix "sample";
+ *
+ *     import ietf-inet-types { prefix "inet"; }
+ *     revision 2016-11-10 {
+ *         description "Defines API to service logic interpreter
+ *         ";
+ *     }
+ *
+ *     container test-results {
+ *         list test-result {
+ *             key "test-identifier"
+ *             leaf test-identifier {
+ *                 type string;
+ *             }
+ *             leaf-list results {
+ *                 type string;
+ *             }
+ *         }
+ *     }
+ *
+ *     grouping response-fields {
+ *         leaf response-code {
+ *             type string;
+ *         }
+ *         leaf ack-final-indicator {
+ *             type string;
+ *         }
+ *         leaf response-message {
+ *             type string;
+ *         }
+ *         leaf context-memory-json {
+ *             type string;
+ *         }
+ *     }
+ *     grouping parameter-setting {
+ *         leaf parameter-name {
+ *             type string;
+ *         }
+ *         leaf int-value {
+ *             type int32;
+ *         }
+ *         leaf string-value {
+ *             type string;
+ *         }
+ *         leaf boolean-value {
+ *             type boolean;
+ *         }
+ *     }
+ *
+ *     rpc healthcheck {
+ *         input {
+ *         }
+ *         
+ *         output {
+ *             leaf response-code {
+ *                 type string;
+ *             }
+ *             leaf ack-final-indicator {
+ *                 type string;
+ *             }
+ *             leaf response-message {
+ *                 type string;
+ *             }
+ *             leaf context-memory-json {
+ *                 type string;
+ *             }
+ *         }
+ *     }
+ *     rpc execute-graph {
+ *         " Method to add a new parameter.";
+ *         input {
+ *             leaf module-name {
+ *                 type string;
+ *             }
+ *             leaf rpc-name {
+ *                 type string;
+ *             }
+ *             leaf mode {
+ *                 type enumeration;
+ *             }
+ *             list sli-parameter {
+ *                 key "parameter-name"
+ *                 leaf parameter-name {
+ *                     type string;
+ *                 }
+ *                 leaf int-value {
+ *                     type int32;
+ *                 }
+ *                 leaf string-value {
+ *                     type string;
+ *                 }
+ *                 leaf boolean-value {
+ *                     type boolean;
+ *                 }
+ *                 uses parameter-setting;
+ *             }
+ *         }
+ *         
+ *         output {
+ *             leaf response-code {
+ *                 type string;
+ *             }
+ *             leaf ack-final-indicator {
+ *                 type string;
+ *             }
+ *             leaf response-message {
+ *                 type string;
+ *             }
+ *             leaf context-memory-json {
+ *                 type string;
+ *             }
+ *         }
+ *     }
+ * }
+ * 
+ * + */ +public interface SLIAPIData + extends + DataRoot +{ + + + + + /** + * Test results + * + * + * + * @return org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults testResults, or null if not present + */ + TestResults getTestResults(); + +} + diff --git a/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/SLIAPIService.java b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/SLIAPIService.java new file mode 100644 index 00000000..3ad03f6f --- /dev/null +++ b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/SLIAPIService.java @@ -0,0 +1,93 @@ +package org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110; +import org.opendaylight.yangtools.yang.binding.RpcService; +import org.opendaylight.yangtools.yang.common.RpcResult; +import java.util.concurrent.Future; + +/** + * Interface for implementing the following YANG RPCs defined in module SLI-API + *
+ * rpc healthcheck {
+ *     input {
+ *     }
+ *     
+ *     output {
+ *         leaf response-code {
+ *             type string;
+ *         }
+ *         leaf ack-final-indicator {
+ *             type string;
+ *         }
+ *         leaf response-message {
+ *             type string;
+ *         }
+ *         leaf context-memory-json {
+ *             type string;
+ *         }
+ *     }
+ * }
+ * rpc execute-graph {
+ *     " Method to add a new parameter.";
+ *     input {
+ *         leaf module-name {
+ *             type string;
+ *         }
+ *         leaf rpc-name {
+ *             type string;
+ *         }
+ *         leaf mode {
+ *             type enumeration;
+ *         }
+ *         list sli-parameter {
+ *             key "parameter-name"
+ *             leaf parameter-name {
+ *                 type string;
+ *             }
+ *             leaf int-value {
+ *                 type int32;
+ *             }
+ *             leaf string-value {
+ *                 type string;
+ *             }
+ *             leaf boolean-value {
+ *                 type boolean;
+ *             }
+ *             uses parameter-setting;
+ *         }
+ *     }
+ *     
+ *     output {
+ *         leaf response-code {
+ *             type string;
+ *         }
+ *         leaf ack-final-indicator {
+ *             type string;
+ *         }
+ *         leaf response-message {
+ *             type string;
+ *         }
+ *         leaf context-memory-json {
+ *             type string;
+ *         }
+ *     }
+ * }
+ * 
+ * + */ +public interface SLIAPIService + extends + RpcService +{ + + + + + Future> healthcheck(); + + /** + * Method to add a new parameter. + * + */ + Future> executeGraph(ExecuteGraphInput input); + +} + diff --git a/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/TestResults.java b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/TestResults.java new file mode 100644 index 00000000..a1723d73 --- /dev/null +++ b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/TestResults.java @@ -0,0 +1,49 @@ +package org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.common.QName; +import java.util.List; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult; +import org.opendaylight.yangtools.yang.binding.Augmentable; + +/** + * Test results + * + *

This class represents the following YANG schema fragment defined in module SLI-API + *

+ * container test-results {
+ *     list test-result {
+ *         key "test-identifier"
+ *         leaf test-identifier {
+ *             type string;
+ *         }
+ *         leaf-list results {
+ *             type string;
+ *         }
+ *     }
+ * }
+ * 
+ * The schema path to identify an instance is + * SLI-API/test-results + * + *

To create instances of this class use {@link org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResultsBuilder}. + * @see org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResultsBuilder + * + */ +public interface TestResults + extends + ChildOf, + Augmentable +{ + + + + public static final QName QNAME = org.opendaylight.yangtools.yang.common.QName.create("org:onap:ccsdk:sli:core:sliapi", + "2016-11-10", "test-results").intern(); + + /** + * @return java.util.List testResult, or null if not present + */ + List getTestResult(); + +} + diff --git a/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/TestResultsBuilder.java b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/TestResultsBuilder.java new file mode 100644 index 00000000..36da730e --- /dev/null +++ b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/TestResultsBuilder.java @@ -0,0 +1,202 @@ +package org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.DataObject; +import java.util.HashMap; +import org.opendaylight.yangtools.concepts.Builder; +import java.util.Objects; +import java.util.List; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult; +import java.util.Collections; +import java.util.Map; + +/** + * Class that builds {@link org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults} instances. + * + * @see org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults + * + */ +public class TestResultsBuilder implements Builder { + + private List _testResult; + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public TestResultsBuilder() { + } + + public TestResultsBuilder(TestResults base) { + this._testResult = base.getTestResult(); + if (base instanceof TestResultsImpl) { + TestResultsImpl impl = (TestResultsImpl) base; + if (!impl.augmentation.isEmpty()) { + this.augmentation = new HashMap<>(impl.augmentation); + } + } else if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + AugmentationHolder casted =(AugmentationHolder) base; + if (!casted.augmentations().isEmpty()) { + this.augmentation = new HashMap<>(casted.augmentations()); + } + } + } + + + public List getTestResult() { + return _testResult; + } + + @SuppressWarnings("unchecked") + public > E getAugmentation(java.lang.Class augmentationType) { + if (augmentationType == null) { + throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!"); + } + return (E) augmentation.get(augmentationType); + } + + + public TestResultsBuilder setTestResult(final List value) { + this._testResult = value; + return this; + } + + public TestResultsBuilder addAugmentation(java.lang.Class> augmentationType, Augmentation augmentation) { + if (augmentation == null) { + return removeAugmentation(augmentationType); + } + + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentation); + return this; + } + + public TestResultsBuilder removeAugmentation(java.lang.Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + @Override + public TestResults build() { + return new TestResultsImpl(this); + } + + private static final class TestResultsImpl implements TestResults { + + @Override + public java.lang.Class getImplementedInterface() { + return org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults.class; + } + + private final List _testResult; + + private Map>, Augmentation> augmentation = Collections.emptyMap(); + + private TestResultsImpl(TestResultsBuilder base) { + this._testResult = base.getTestResult(); + switch (base.augmentation.size()) { + case 0: + this.augmentation = Collections.emptyMap(); + break; + case 1: + final Map.Entry>, Augmentation> e = base.augmentation.entrySet().iterator().next(); + this.augmentation = Collections.>, Augmentation>singletonMap(e.getKey(), e.getValue()); + break; + default : + this.augmentation = new HashMap<>(base.augmentation); + } + } + + @Override + public List getTestResult() { + return _testResult; + } + + @SuppressWarnings("unchecked") + @Override + public > E getAugmentation(java.lang.Class augmentationType) { + if (augmentationType == null) { + throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!"); + } + return (E) augmentation.get(augmentationType); + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_testResult); + result = prime * result + Objects.hashCode(augmentation); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults.class.equals(((DataObject)obj).getImplementedInterface())) { + return false; + } + org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults other = (org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults)obj; + if (!Objects.equals(_testResult, other.getTestResult())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + TestResultsImpl otherImpl = (TestResultsImpl) obj; + if (!Objects.equals(augmentation, otherImpl.augmentation)) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentation.entrySet()) { + if (!e.getValue().equals(other.getAugmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public java.lang.String toString() { + java.lang.String name = "TestResults ["; + java.lang.StringBuilder builder = new java.lang.StringBuilder (name); + if (_testResult != null) { + builder.append("_testResult="); + builder.append(_testResult); + } + final int builderLength = builder.length(); + final int builderAdditionalLength = builder.substring(name.length(), builderLength).length(); + if (builderAdditionalLength > 2 && !builder.substring(builderLength - 2, builderLength).equals(", ")) { + builder.append(", "); + } + builder.append("augmentation="); + builder.append(augmentation.values()); + return builder.append(']').toString(); + } + } + +} diff --git a/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/execute/graph/input/SliParameter.java b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/execute/graph/input/SliParameter.java new file mode 100644 index 00000000..e1cac53c --- /dev/null +++ b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/execute/graph/input/SliParameter.java @@ -0,0 +1,60 @@ +package org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ParameterSetting; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput; +import org.opendaylight.yangtools.yang.binding.Identifiable; + +/** + *

This class represents the following YANG schema fragment defined in module SLI-API + *

+ * list sli-parameter {
+ *     key "parameter-name"
+ *     leaf parameter-name {
+ *         type string;
+ *     }
+ *     leaf int-value {
+ *         type int32;
+ *     }
+ *     leaf string-value {
+ *         type string;
+ *     }
+ *     leaf boolean-value {
+ *         type boolean;
+ *     }
+ *     uses parameter-setting;
+ * }
+ * 
+ * The schema path to identify an instance is + * SLI-API/execute-graph/input/sli-parameter + * + *

To create instances of this class use {@link org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameterBuilder}. + * @see org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameterBuilder + * @see org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameterKey + * + */ +public interface SliParameter + extends + ChildOf, + Augmentable, + ParameterSetting, + Identifiable +{ + + + + public static final QName QNAME = org.opendaylight.yangtools.yang.common.QName.create("org:onap:ccsdk:sli:core:sliapi", + "2016-11-10", "sli-parameter").intern(); + + /** + * Returns Primary Key of Yang List Type + * + * + * + * @return org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameterKey key, or null if not present + */ + SliParameterKey getKey(); + +} + diff --git a/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/execute/graph/input/SliParameterBuilder.java b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/execute/graph/input/SliParameterBuilder.java new file mode 100644 index 00000000..f28eb1a8 --- /dev/null +++ b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/execute/graph/input/SliParameterBuilder.java @@ -0,0 +1,357 @@ +package org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.DataObject; +import java.util.HashMap; +import org.opendaylight.yangtools.concepts.Builder; +import java.util.Objects; +import java.util.Collections; +import java.util.Map; + +/** + * Class that builds {@link org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter} instances. + * + * @see org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter + * + */ +public class SliParameterBuilder implements Builder { + + private java.lang.Integer _intValue; + private SliParameterKey _key; + private java.lang.String _parameterName; + private java.lang.String _stringValue; + private java.lang.Boolean _booleanValue; + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public SliParameterBuilder() { + } + public SliParameterBuilder(org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ParameterSetting arg) { + this._parameterName = arg.getParameterName(); + this._intValue = arg.getIntValue(); + this._stringValue = arg.getStringValue(); + this._booleanValue = arg.isBooleanValue(); + } + + public SliParameterBuilder(SliParameter base) { + if (base.getKey() == null) { + this._key = new SliParameterKey( + base.getParameterName() + ); + this._parameterName = base.getParameterName(); + } else { + this._key = base.getKey(); + this._parameterName = _key.getParameterName(); + } + this._intValue = base.getIntValue(); + this._stringValue = base.getStringValue(); + this._booleanValue = base.isBooleanValue(); + if (base instanceof SliParameterImpl) { + SliParameterImpl impl = (SliParameterImpl) base; + if (!impl.augmentation.isEmpty()) { + this.augmentation = new HashMap<>(impl.augmentation); + } + } else if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + AugmentationHolder casted =(AugmentationHolder) base; + if (!casted.augmentations().isEmpty()) { + this.augmentation = new HashMap<>(casted.augmentations()); + } + } + } + + /** + *Set fields from given grouping argument. Valid argument is instance of one of following types: + *

    + *
  • org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ParameterSetting
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ParameterSetting) { + this._parameterName = ((org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ParameterSetting)arg).getParameterName(); + this._intValue = ((org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ParameterSetting)arg).getIntValue(); + this._stringValue = ((org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ParameterSetting)arg).getStringValue(); + this._booleanValue = ((org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ParameterSetting)arg).isBooleanValue(); + isValidArg = true; + } + if (!isValidArg) { + throw new IllegalArgumentException( + "expected one of: [org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ParameterSetting] \n" + + "but was: " + arg + ); + } + } + + public java.lang.Integer getIntValue() { + return _intValue; + } + + public SliParameterKey getKey() { + return _key; + } + + public java.lang.String getParameterName() { + return _parameterName; + } + + public java.lang.String getStringValue() { + return _stringValue; + } + + public java.lang.Boolean isBooleanValue() { + return _booleanValue; + } + + @SuppressWarnings("unchecked") + public > E getAugmentation(java.lang.Class augmentationType) { + if (augmentationType == null) { + throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!"); + } + return (E) augmentation.get(augmentationType); + } + + + public SliParameterBuilder setIntValue(final java.lang.Integer value) { + this._intValue = value; + return this; + } + + + public SliParameterBuilder setKey(final SliParameterKey value) { + this._key = value; + return this; + } + + + public SliParameterBuilder setParameterName(final java.lang.String value) { + this._parameterName = value; + return this; + } + + + public SliParameterBuilder setStringValue(final java.lang.String value) { + this._stringValue = value; + return this; + } + + + public SliParameterBuilder setBooleanValue(final java.lang.Boolean value) { + this._booleanValue = value; + return this; + } + + public SliParameterBuilder addAugmentation(java.lang.Class> augmentationType, Augmentation augmentation) { + if (augmentation == null) { + return removeAugmentation(augmentationType); + } + + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentation); + return this; + } + + public SliParameterBuilder removeAugmentation(java.lang.Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + @Override + public SliParameter build() { + return new SliParameterImpl(this); + } + + private static final class SliParameterImpl implements SliParameter { + + @Override + public java.lang.Class getImplementedInterface() { + return org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter.class; + } + + private final java.lang.Integer _intValue; + private final SliParameterKey _key; + private final java.lang.String _parameterName; + private final java.lang.String _stringValue; + private final java.lang.Boolean _booleanValue; + + private Map>, Augmentation> augmentation = Collections.emptyMap(); + + private SliParameterImpl(SliParameterBuilder base) { + if (base.getKey() == null) { + this._key = new SliParameterKey( + base.getParameterName() + ); + this._parameterName = base.getParameterName(); + } else { + this._key = base.getKey(); + this._parameterName = _key.getParameterName(); + } + this._intValue = base.getIntValue(); + this._stringValue = base.getStringValue(); + this._booleanValue = base.isBooleanValue(); + switch (base.augmentation.size()) { + case 0: + this.augmentation = Collections.emptyMap(); + break; + case 1: + final Map.Entry>, Augmentation> e = base.augmentation.entrySet().iterator().next(); + this.augmentation = Collections.>, Augmentation>singletonMap(e.getKey(), e.getValue()); + break; + default : + this.augmentation = new HashMap<>(base.augmentation); + } + } + + @Override + public java.lang.Integer getIntValue() { + return _intValue; + } + + @Override + public SliParameterKey getKey() { + return _key; + } + + @Override + public java.lang.String getParameterName() { + return _parameterName; + } + + @Override + public java.lang.String getStringValue() { + return _stringValue; + } + + @Override + public java.lang.Boolean isBooleanValue() { + return _booleanValue; + } + + @SuppressWarnings("unchecked") + @Override + public > E getAugmentation(java.lang.Class augmentationType) { + if (augmentationType == null) { + throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!"); + } + return (E) augmentation.get(augmentationType); + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_intValue); + result = prime * result + Objects.hashCode(_key); + result = prime * result + Objects.hashCode(_parameterName); + result = prime * result + Objects.hashCode(_stringValue); + result = prime * result + Objects.hashCode(_booleanValue); + result = prime * result + Objects.hashCode(augmentation); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter.class.equals(((DataObject)obj).getImplementedInterface())) { + return false; + } + org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter other = (org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter)obj; + if (!Objects.equals(_intValue, other.getIntValue())) { + return false; + } + if (!Objects.equals(_key, other.getKey())) { + return false; + } + if (!Objects.equals(_parameterName, other.getParameterName())) { + return false; + } + if (!Objects.equals(_stringValue, other.getStringValue())) { + return false; + } + if (!Objects.equals(_booleanValue, other.isBooleanValue())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + SliParameterImpl otherImpl = (SliParameterImpl) obj; + if (!Objects.equals(augmentation, otherImpl.augmentation)) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentation.entrySet()) { + if (!e.getValue().equals(other.getAugmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public java.lang.String toString() { + java.lang.String name = "SliParameter ["; + java.lang.StringBuilder builder = new java.lang.StringBuilder (name); + if (_intValue != null) { + builder.append("_intValue="); + builder.append(_intValue); + builder.append(", "); + } + if (_key != null) { + builder.append("_key="); + builder.append(_key); + builder.append(", "); + } + if (_parameterName != null) { + builder.append("_parameterName="); + builder.append(_parameterName); + builder.append(", "); + } + if (_stringValue != null) { + builder.append("_stringValue="); + builder.append(_stringValue); + builder.append(", "); + } + if (_booleanValue != null) { + builder.append("_booleanValue="); + builder.append(_booleanValue); + } + final int builderLength = builder.length(); + final int builderAdditionalLength = builder.substring(name.length(), builderLength).length(); + if (builderAdditionalLength > 2 && !builder.substring(builderLength - 2, builderLength).equals(", ")) { + builder.append(", "); + } + builder.append("augmentation="); + builder.append(augmentation.values()); + return builder.append(']').toString(); + } + } + +} diff --git a/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/execute/graph/input/SliParameterKey.java b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/execute/graph/input/SliParameterKey.java new file mode 100644 index 00000000..6c19a877 --- /dev/null +++ b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/execute/graph/input/SliParameterKey.java @@ -0,0 +1,75 @@ +package org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input; +import org.opendaylight.yangtools.yang.binding.Identifier; +import java.util.Objects; + +public class SliParameterKey + implements Identifier { + private static final long serialVersionUID = 8929025111457627032L; + private final java.lang.String _parameterName; + + + public SliParameterKey(java.lang.String _parameterName) { + + + this._parameterName = _parameterName; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public SliParameterKey(SliParameterKey source) { + this._parameterName = source._parameterName; + } + + + public java.lang.String getParameterName() { + return _parameterName; + } + + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_parameterName); + return result; + } + + @Override + public boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + SliParameterKey other = (SliParameterKey) obj; + if (!Objects.equals(_parameterName, other._parameterName)) { + return false; + } + return true; + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder builder = new java.lang.StringBuilder(org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameterKey.class.getSimpleName()).append(" ["); + boolean first = true; + + if (_parameterName != null) { + if (first) { + first = false; + } else { + builder.append(", "); + } + builder.append("_parameterName="); + builder.append(_parameterName); + } + return builder.append(']').toString(); + } +} + diff --git a/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/test/results/TestResult.java b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/test/results/TestResult.java new file mode 100644 index 00000000..d12faa44 --- /dev/null +++ b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/test/results/TestResult.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults; +import java.util.List; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.Identifiable; + +/** + *

This class represents the following YANG schema fragment defined in module SLI-API + *

+ * list test-result {
+ *     key "test-identifier"
+ *     leaf test-identifier {
+ *         type string;
+ *     }
+ *     leaf-list results {
+ *         type string;
+ *     }
+ * }
+ * 
+ * The schema path to identify an instance is + * SLI-API/test-results/test-result + * + *

To create instances of this class use {@link org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResultBuilder}. + * @see org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResultBuilder + * @see org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResultKey + * + */ +public interface TestResult + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final QName QNAME = org.opendaylight.yangtools.yang.common.QName.create("org:onap:ccsdk:sli:core:sliapi", + "2016-11-10", "test-result").intern(); + + /** + * @return java.lang.String testIdentifier, or null if not present + */ + java.lang.String getTestIdentifier(); + + /** + * @return java.util.List results, or null if not present + */ + List getResults(); + + /** + * Returns Primary Key of Yang List Type + * + * + * + * @return org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResultKey key, or null if not present + */ + TestResultKey getKey(); + +} + diff --git a/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/test/results/TestResultBuilder.java b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/test/results/TestResultBuilder.java new file mode 100644 index 00000000..51e43722 --- /dev/null +++ b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/test/results/TestResultBuilder.java @@ -0,0 +1,271 @@ +package org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.DataObject; +import java.util.HashMap; +import org.opendaylight.yangtools.concepts.Builder; +import java.util.Objects; +import java.util.List; +import java.util.Collections; +import java.util.Map; + +/** + * Class that builds {@link org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult} instances. + * + * @see org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult + * + */ +public class TestResultBuilder implements Builder { + + private TestResultKey _key; + private List _results; + private java.lang.String _testIdentifier; + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public TestResultBuilder() { + } + + public TestResultBuilder(TestResult base) { + if (base.getKey() == null) { + this._key = new TestResultKey( + base.getTestIdentifier() + ); + this._testIdentifier = base.getTestIdentifier(); + } else { + this._key = base.getKey(); + this._testIdentifier = _key.getTestIdentifier(); + } + this._results = base.getResults(); + if (base instanceof TestResultImpl) { + TestResultImpl impl = (TestResultImpl) base; + if (!impl.augmentation.isEmpty()) { + this.augmentation = new HashMap<>(impl.augmentation); + } + } else if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + AugmentationHolder casted =(AugmentationHolder) base; + if (!casted.augmentations().isEmpty()) { + this.augmentation = new HashMap<>(casted.augmentations()); + } + } + } + + + public TestResultKey getKey() { + return _key; + } + + public List getResults() { + return _results; + } + + public java.lang.String getTestIdentifier() { + return _testIdentifier; + } + + @SuppressWarnings("unchecked") + public > E getAugmentation(java.lang.Class augmentationType) { + if (augmentationType == null) { + throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!"); + } + return (E) augmentation.get(augmentationType); + } + + + public TestResultBuilder setKey(final TestResultKey value) { + this._key = value; + return this; + } + + + public TestResultBuilder setResults(final List value) { + this._results = value; + return this; + } + + + public TestResultBuilder setTestIdentifier(final java.lang.String value) { + this._testIdentifier = value; + return this; + } + + public TestResultBuilder addAugmentation(java.lang.Class> augmentationType, Augmentation augmentation) { + if (augmentation == null) { + return removeAugmentation(augmentationType); + } + + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentation); + return this; + } + + public TestResultBuilder removeAugmentation(java.lang.Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + @Override + public TestResult build() { + return new TestResultImpl(this); + } + + private static final class TestResultImpl implements TestResult { + + @Override + public java.lang.Class getImplementedInterface() { + return org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult.class; + } + + private final TestResultKey _key; + private final List _results; + private final java.lang.String _testIdentifier; + + private Map>, Augmentation> augmentation = Collections.emptyMap(); + + private TestResultImpl(TestResultBuilder base) { + if (base.getKey() == null) { + this._key = new TestResultKey( + base.getTestIdentifier() + ); + this._testIdentifier = base.getTestIdentifier(); + } else { + this._key = base.getKey(); + this._testIdentifier = _key.getTestIdentifier(); + } + this._results = base.getResults(); + switch (base.augmentation.size()) { + case 0: + this.augmentation = Collections.emptyMap(); + break; + case 1: + final Map.Entry>, Augmentation> e = base.augmentation.entrySet().iterator().next(); + this.augmentation = Collections.>, Augmentation>singletonMap(e.getKey(), e.getValue()); + break; + default : + this.augmentation = new HashMap<>(base.augmentation); + } + } + + @Override + public TestResultKey getKey() { + return _key; + } + + @Override + public List getResults() { + return _results; + } + + @Override + public java.lang.String getTestIdentifier() { + return _testIdentifier; + } + + @SuppressWarnings("unchecked") + @Override + public > E getAugmentation(java.lang.Class augmentationType) { + if (augmentationType == null) { + throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!"); + } + return (E) augmentation.get(augmentationType); + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_key); + result = prime * result + Objects.hashCode(_results); + result = prime * result + Objects.hashCode(_testIdentifier); + result = prime * result + Objects.hashCode(augmentation); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult.class.equals(((DataObject)obj).getImplementedInterface())) { + return false; + } + org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult other = (org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult)obj; + if (!Objects.equals(_key, other.getKey())) { + return false; + } + if (!Objects.equals(_results, other.getResults())) { + return false; + } + if (!Objects.equals(_testIdentifier, other.getTestIdentifier())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + TestResultImpl otherImpl = (TestResultImpl) obj; + if (!Objects.equals(augmentation, otherImpl.augmentation)) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentation.entrySet()) { + if (!e.getValue().equals(other.getAugmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public java.lang.String toString() { + java.lang.String name = "TestResult ["; + java.lang.StringBuilder builder = new java.lang.StringBuilder (name); + if (_key != null) { + builder.append("_key="); + builder.append(_key); + builder.append(", "); + } + if (_results != null) { + builder.append("_results="); + builder.append(_results); + builder.append(", "); + } + if (_testIdentifier != null) { + builder.append("_testIdentifier="); + builder.append(_testIdentifier); + } + final int builderLength = builder.length(); + final int builderAdditionalLength = builder.substring(name.length(), builderLength).length(); + if (builderAdditionalLength > 2 && !builder.substring(builderLength - 2, builderLength).equals(", ")) { + builder.append(", "); + } + builder.append("augmentation="); + builder.append(augmentation.values()); + return builder.append(']').toString(); + } + } + +} diff --git a/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/test/results/TestResultKey.java b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/test/results/TestResultKey.java new file mode 100644 index 00000000..d867ca23 --- /dev/null +++ b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/test/results/TestResultKey.java @@ -0,0 +1,75 @@ +package org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results; +import org.opendaylight.yangtools.yang.binding.Identifier; +import java.util.Objects; + +public class TestResultKey + implements Identifier { + private static final long serialVersionUID = 3857649555637491806L; + private final java.lang.String _testIdentifier; + + + public TestResultKey(java.lang.String _testIdentifier) { + + + this._testIdentifier = _testIdentifier; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public TestResultKey(TestResultKey source) { + this._testIdentifier = source._testIdentifier; + } + + + public java.lang.String getTestIdentifier() { + return _testIdentifier; + } + + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_testIdentifier); + return result; + } + + @Override + public boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + TestResultKey other = (TestResultKey) obj; + if (!Objects.equals(_testIdentifier, other._testIdentifier)) { + return false; + } + return true; + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder builder = new java.lang.StringBuilder(org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResultKey.class.getSimpleName()).append(" ["); + boolean first = true; + + if (_testIdentifier != null) { + if (first) { + first = false; + } else { + builder.append(", "); + } + builder.append("_testIdentifier="); + builder.append(_testIdentifier); + } + return builder.append(']').toString(); + } +} + diff --git a/sli/model/src/main/yang/sliapi.yang b/sli/model/src/main/yang/sliapi.yang new file mode 100755 index 00000000..8deb8a10 --- /dev/null +++ b/sli/model/src/main/yang/sliapi.yang @@ -0,0 +1,111 @@ +module SLI-API { + + yang-version 1; + + namespace "org:onap:ccsdk:sli:core:sliapi"; + + prefix sample; + + import ietf-inet-types { prefix "inet"; revision-date 2010-09-24; } + + organization "ONAP"; + + contact + "Dan Timoney"; + + description + "Defines API to service logic interpreter"; + + revision "2016-11-10" { + description + "REST API to Service Logic Interpreter"; + } + + grouping parameter-setting { + description + "Parameter setting"; + + leaf parameter-name { + type string; + description "Parameter name"; + } + + leaf int-value { + type int32; + } + leaf string-value { + type string; + } + leaf boolean-value { + type boolean; + } + } + + grouping response-fields { + leaf response-code { + type string; + } + leaf ack-final-indicator { + type string; + } + leaf response-message { + type string; + } + leaf context-memory-json { + type string; + } + } + + container test-results { + description "Test results"; + + list test-result { + key "test-identifier"; + + leaf test-identifier { + type string; + } + + leaf-list results { + type string; + } + } + } + + rpc execute-graph { + description " Method to add a new parameter."; + input { + + leaf module-name { + type string; + } + + leaf rpc-name { + type string; + } + + leaf mode { + type enumeration { + enum sync; + enum async; + } + } + + list sli-parameter { + key "parameter-name"; + uses parameter-setting; + } + } + + output { + uses response-fields; + } + } + + rpc healthcheck { + output { + uses response-fields; + } + } + +} diff --git a/sli/pom.xml b/sli/pom.xml index 7257e9ee..de882159 100755 --- a/sli/pom.xml +++ b/sli/pom.xml @@ -2,64 +2,65 @@ - - org.onap.ccsdk.sli.core - ccsdk-sli-core - 0.1.2-SNAPSHOT - - 4.0.0 - pom - org.onap.ccsdk.sli.core - sli + + org.onap.ccsdk.sli.core + ccsdk-sli-core + 0.1.2-SNAPSHOT + + 4.0.0 + pom + org.onap.ccsdk.sli.core + sli - + - - - org.onap.ccsdk.sli.core - sli-features - features - xml - ${project.version} - + + + org.onap.ccsdk.sli.core + sli-features + features + xml + ${project.version} + - - org.onap.ccsdk.sli.core - sli-common - ${project.version} - + + org.onap.ccsdk.sli.core + sli-common + ${project.version} + - - org.onap.ccsdk.sli.core - sli-provider - ${project.version} - + + org.onap.ccsdk.sli.core + sli-provider + ${project.version} + - - org.onap.ccsdk.sli.core - sli-recording - ${project.version} - + + org.onap.ccsdk.sli.core + sli-recording + ${project.version} + - + - + - Service Logic Interpreter - The Service Logic Interpreter (SLI) allows service planners to design the flow of logic within the SDN controller in an XML format, without a need for custom Java code. + Service Logic Interpreter + The Service Logic Interpreter (SLI) allows service planners to design the flow of logic within the SDN controller in an XML format, without a need for custom Java code. - - common - provider - recording - features - installer - - - ONAP - - 0.1.2-SNAPSHOT + + model + common + provider + recording + features + installer + + + ONAP + + 0.1.2-SNAPSHOT diff --git a/sli/provider/pom.xml b/sli/provider/pom.xml index 51db628c..7514c74e 100755 --- a/sli/provider/pom.xml +++ b/sli/provider/pom.xml @@ -26,6 +26,12 @@ 2.2.3 test + + org.onap.ccsdk.sli.core + sli-model + ${project.version} + test + org.onap.ccsdk.sli.core sli-common diff --git a/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelperTest.java b/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelperTest.java index 3e8c57b0..5ba0eb96 100644 --- a/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelperTest.java +++ b/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelperTest.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,10 +21,26 @@ package org.onap.ccsdk.sli.core.sli.provider; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Properties; + +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput.Mode; +import org.onap.ccsdk.sli.core.sli.SvcLogicGraph; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameterBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import junit.framework.TestCase; -public class MdsalHelperTest extends TestCase { +public class MdsalHelperTest extends TestCase { + private static final Logger LOG = LoggerFactory + .getLogger(MdsalHelperTest.class); public static final String pathToSdnPropertiesFile = "./src/test/resources/l3sdn.properties"; public void testSdnProperties() { @@ -40,4 +56,63 @@ public class MdsalHelperTest extends TestCase { assertNotSame("synccomplete", MdsalHelperTesterUtil.mapEnumeratedValue("request-status", "Synccomplete")); } + public void testToProperties() { + + ExecuteGraphInputBuilder execBuilder = new ExecuteGraphInputBuilder(); + SliParameterBuilder parmBuilder = new SliParameterBuilder(); + List params = new LinkedList(); + + parmBuilder.setParameterName("boolean-parm"); + parmBuilder.setBooleanValue(Boolean.TRUE); + params.add(parmBuilder.build()); + + parmBuilder.setParameterName("int-parm"); + parmBuilder.setIntValue(1); + params.add(parmBuilder.build()); + + parmBuilder.setParameterName("str-parm"); + parmBuilder.setStringValue("hello"); + params.add(parmBuilder.build()); + + + execBuilder.setMode(Mode.Sync); + execBuilder.setModuleName("my-module"); + execBuilder.setRpcName("do-it-now"); + execBuilder.setSliParameter(params); + + + Properties props = new Properties(); + + MdsalHelperTesterUtil.toProperties(props, execBuilder); + + LOG.info("Converted to properties"); + for (Map.Entry e : props.entrySet()) { + LOG.info(e.getKey().toString() + " = "+e.getValue().toString()); + + } + + + } + + public void testToBuilder() { + + Properties props = new Properties(); + + props.setProperty("execute-graph-input.mode", "Sync"); + props.setProperty("execute-graph-input.module", "my-module"); + props.setProperty("execute-graph-input.rpc", "do-it-now"); + props.setProperty("execute-graph-input.sli-parameter[0].parameter-name", "bool-parm"); + props.setProperty("execute-graph-input.sli-parameter[0].boolean-value", "true"); + props.setProperty("execute-graph-input,sli-parameter[1].parameter-name", "int-param"); + props.setProperty("execute-graph-input.sli-parameter[1].int-value", "1"); + props.setProperty("execute-graph-input.sli-parameter[2].parameter-name", "str-param"); + props.setProperty("execute-graph-input.sli-parameter[2].str-value", "hello"); + + ExecuteGraphInputBuilder execBuilder = new ExecuteGraphInputBuilder(); + + MdsalHelperTesterUtil.toBuilder(props, execBuilder); + + + + } } diff --git a/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/TestMdsalHelperUtils.java b/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/TestMdsalHelperUtils.java deleted file mode 100644 index dca6b54c..00000000 --- a/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/TestMdsalHelperUtils.java +++ /dev/null @@ -1,79 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.ccsdk.sli.core.sli.provider; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; - -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; -import org.junit.Test; -import org.onap.ccsdk.sli.core.sli.SvcLogicContext; -import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.part.rev170921.L3vpnSvcBuilder; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.part.rev170921.SvcId; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.part.rev170921.l3vpn.svc.VpnServicesBuilder; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.part.rev170921.l3vpn.svc.vpn.services.VpnSvc; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.part.rev170921.l3vpn.svc.vpn.services.VpnSvcBuilder; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.part.rev170921.l3vpn.svc.vpn.services.VpnSvcKey; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class TestMdsalHelperUtils { - - private static final Logger log = LoggerFactory.getLogger(TestMdsalHelperUtils.class); - - @Test - public void testL3vpnSvcToBuilder() throws SvcLogicException { - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("l3vpn-svc.vpn-services.vpn-svc[0].vpn-id", "1"); - - L3vpnSvcBuilder svcBuilder = new L3vpnSvcBuilder(); - - MdsalHelper.toBuilder(ctx.toProperties(), "", svcBuilder); - - assertThat(svcBuilder.getVpnServices().getVpnSvc().get(0).getKey().getVpnId().getValue(), is("1")); - log.info(svcBuilder.toString()); - } - - @Test - public void testL3vpnSvcToProperties() throws SvcLogicException { - VpnSvcBuilder vpnSvcBuilder = new VpnSvcBuilder(); - vpnSvcBuilder.setKey(new VpnSvcKey(new SvcId("1"))); - List vpnSvcList = new ArrayList<>(); - vpnSvcList.add(vpnSvcBuilder.build()); - VpnServicesBuilder vpnServicesBuilder = new VpnServicesBuilder(); - vpnServicesBuilder.setVpnSvc(vpnSvcList); - L3vpnSvcBuilder l3vpnSvcBuilder = new L3vpnSvcBuilder(); - l3vpnSvcBuilder.setVpnServices(vpnServicesBuilder.build()); - - Properties properties = new Properties(); - - MdsalHelper.toProperties(properties, "", l3vpnSvcBuilder.build()); - - assertThat(properties.getProperty("l3vpn-svc.vpn-services.vpn-svc[0].vpn-id"), is("1")); - log.info(properties.toString()); - } - - // TODO add more detailed testcases. -} -- cgit 1.2.3-korg