diff options
author | Dan Timoney <dtimoney@att.com> | 2017-10-02 15:48:23 -0400 |
---|---|---|
committer | Dan Timoney <dtimoney@att.com> | 2017-10-02 15:48:23 -0400 |
commit | 2a7f6affcecfcd2a7f9db3731884699f1bacff1c (patch) | |
tree | 01deb47b62eb1144f6993cddf258bcb0baa0143d | |
parent | bbf0e9ff14d10f46235d4282dce5b9c560f26321 (diff) |
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 <dtimoney@att.com>
26 files changed, 3066 insertions, 130 deletions
diff --git a/sli/model/pom.xml b/sli/model/pom.xml new file mode 100755 index 000000000..18b56f46b --- /dev/null +++ b/sli/model/pom.xml @@ -0,0 +1,82 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>sli</artifactId> + <groupId>org.onap.ccsdk.sli.core</groupId> + <version>0.1.2-SNAPSHOT</version> + </parent> + <artifactId>sli-model</artifactId> + <packaging>bundle</packaging> + <name>SLI - Model</name> + <build> + + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Import-Package>*</Import-Package> + </instructions> + </configuration> + </plugin> + <plugin> + <groupId>org.opendaylight.yangtools</groupId> + <artifactId>yang-maven-plugin</artifactId> + <version>${odl.yangtools.yang.maven.plugin.version}</version> + <dependencies> + <dependency> + <groupId>org.opendaylight.mdsal</groupId> + <artifactId>maven-sal-api-gen-plugin</artifactId> + <version>${odl.sal.api.gen.plugin.version}</version> + <type>jar</type> + </dependency> + </dependencies> + <executions> + <execution> + <goals> + <goal>generate-sources</goal> + </goals> + <configuration> + <yangFilesRootDir>${yang.file.directory}</yangFilesRootDir> + <codeGenerators> + <generator> + <!-- + <codeGeneratorClass>org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl</codeGeneratorClass> + --> + <codeGeneratorClass>org.opendaylight.mdsal.binding.maven.api.gen.plugin.CodeGeneratorImpl</codeGeneratorClass> + <outputBaseDir>${salGeneratorPath}</outputBaseDir> + </generator> + </codeGenerators> + <inspectDependencies>true</inspectDependencies> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + <dependencies> + <dependency> + <groupId>org.opendaylight.mdsal</groupId> + <artifactId>yang-binding</artifactId> + <version>${odl.mdsal.yang.binding.version}</version> + </dependency> + <dependency> + <groupId>org.opendaylight.yangtools</groupId> + <artifactId>yang-common</artifactId> + <version>${odl.yangtools.version}</version> + </dependency> + <dependency> + <groupId>org.opendaylight.mdsal.model</groupId> + <artifactId>ietf-inet-types</artifactId> + <version>${odl.ietf-inet-types.version}</version> + </dependency> + <dependency> + <groupId>org.opendaylight.mdsal.model</groupId> + <artifactId>ietf-yang-types</artifactId> + <version>${odl.ietf-yang-types.version}</version> + </dependency> + </dependencies> +</project> 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 000000000..5195da540 --- /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 000000000..e1cdacc54 --- /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<YangModuleInfo> importedModules; + + public static YangModuleInfo getInstance() { + return INSTANCE; + } + + private $YangModuleInfoImpl() { + Set<YangModuleInfo> 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<YangModuleInfo> 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 000000000..4045483ec --- /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; + +/** + * <p>This class represents the following YANG schema fragment defined in module <b>SLI-API</b> + * <pre> + * 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; + * } + * } + * </pre> + * The schema path to identify an instance is + * <i>SLI-API/execute-graph/input</i> + * + * <p>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<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput> +{ + + + public enum Mode { + Sync(0, "sync"), + + Async(1, "async") + ; + + + java.lang.String name; + int value; + private static final java.util.Map<java.lang.Integer, Mode> VALUE_MAP; + + static { + final com.google.common.collect.ImmutableMap.Builder<java.lang.Integer, Mode> 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 <code>java.lang.String</code> <code>moduleName</code>, or <code>null</code> if not present + */ + java.lang.String getModuleName(); + + /** + * @return <code>java.lang.String</code> <code>rpcName</code>, or <code>null</code> if not present + */ + java.lang.String getRpcName(); + + /** + * @return <code>org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput.Mode</code> <code>mode</code>, or <code>null</code> if not present + */ + Mode getMode(); + + /** + * @return <code>java.util.List</code> <code>sliParameter</code>, or <code>null</code> if not present + */ + List<SliParameter> 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 000000000..9f28ef27b --- /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<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput> { + + private Mode _mode; + private java.lang.String _moduleName; + private java.lang.String _rpcName; + private List<SliParameter> _sliParameter; + + Map<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput>> 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<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput>) 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<SliParameter> getSliParameter() { + return _sliParameter; + } + + @SuppressWarnings("unchecked") + public <E extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput>> E getAugmentation(java.lang.Class<E> 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<SliParameter> value) { + this._sliParameter = value; + return this; + } + + public ExecuteGraphInputBuilder addAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput> 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<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput>> 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<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput> 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> _sliParameter; + + private Map<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput>> 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<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput>> e = base.augmentation.entrySet().iterator().next(); + this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput>>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<SliParameter> getSliParameter() { + return _sliParameter; + } + + @SuppressWarnings("unchecked") + @Override + public <E extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput>> E getAugmentation(java.lang.Class<E> 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<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput>> 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 000000000..08321c079 --- /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; + +/** + * <p>This class represents the following YANG schema fragment defined in module <b>SLI-API</b> + * <pre> + * 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; + * } + * </pre> + * The schema path to identify an instance is + * <i>SLI-API/execute-graph/output</i> + * + * <p>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<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphOutput> +{ + + + + 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 000000000..7b613bb41 --- /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<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphOutput> { + + private java.lang.String _ackFinalIndicator; + private java.lang.String _contextMemoryJson; + private java.lang.String _responseCode; + private java.lang.String _responseMessage; + + Map<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphOutput>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphOutput>> 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<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphOutput> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphOutput>) 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: + * <ul> + * <li>org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ResponseFields</li> + * </ul> + * + * @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 extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphOutput>> E getAugmentation(java.lang.Class<E> 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<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphOutput>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphOutput> 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<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphOutput>> 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<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphOutput> 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<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphOutput>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphOutput>> 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<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphOutput>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphOutput>> e = base.augmentation.entrySet().iterator().next(); + this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphOutput>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphOutput>>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 extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphOutput>> E getAugmentation(java.lang.Class<E> 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<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphOutput>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphOutput>> 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 000000000..b0dd3b1be --- /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; + +/** + * <p>This class represents the following YANG schema fragment defined in module <b>SLI-API</b> + * <pre> + * 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; + * } + * </pre> + * The schema path to identify an instance is + * <i>SLI-API/healthcheck/output</i> + * + * <p>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<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckOutput> +{ + + + + 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 000000000..de7840321 --- /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<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckOutput> { + + private java.lang.String _ackFinalIndicator; + private java.lang.String _contextMemoryJson; + private java.lang.String _responseCode; + private java.lang.String _responseMessage; + + Map<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckOutput>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckOutput>> 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<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckOutput> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckOutput>) 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: + * <ul> + * <li>org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ResponseFields</li> + * </ul> + * + * @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 extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckOutput>> E getAugmentation(java.lang.Class<E> 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<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckOutput>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckOutput> 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<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckOutput>> 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<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckOutput> 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<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckOutput>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckOutput>> 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<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckOutput>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckOutput>> e = base.augmentation.entrySet().iterator().next(); + this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckOutput>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckOutput>>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 extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckOutput>> E getAugmentation(java.lang.Class<E> 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<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckOutput>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckOutput>> 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 000000000..e2d610b6b --- /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 + * + * <p>This class represents the following YANG schema fragment defined in module <b>SLI-API</b> + * <pre> + * grouping parameter-setting { + * leaf parameter-name { + * type string; + * } + * leaf int-value { + * type int32; + * } + * leaf string-value { + * type string; + * } + * leaf boolean-value { + * type boolean; + * } + * } + * </pre> + * The schema path to identify an instance is + * <i>SLI-API/parameter-setting</i> + * + */ +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 <code>java.lang.String</code> <code>parameterName</code>, or <code>null</code> if not present + */ + java.lang.String getParameterName(); + + /** + * @return <code>java.lang.Integer</code> <code>intValue</code>, or <code>null</code> if not present + */ + java.lang.Integer getIntValue(); + + /** + * @return <code>java.lang.String</code> <code>stringValue</code>, or <code>null</code> if not present + */ + java.lang.String getStringValue(); + + /** + * @return <code>java.lang.Boolean</code> <code>booleanValue</code>, or <code>null</code> 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 000000000..440beea03 --- /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; + +/** + * <p>This class represents the following YANG schema fragment defined in module <b>SLI-API</b> + * <pre> + * 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; + * } + * } + * </pre> + * The schema path to identify an instance is + * <i>SLI-API/response-fields</i> + * + */ +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 <code>java.lang.String</code> <code>responseCode</code>, or <code>null</code> if not present + */ + java.lang.String getResponseCode(); + + /** + * @return <code>java.lang.String</code> <code>ackFinalIndicator</code>, or <code>null</code> if not present + */ + java.lang.String getAckFinalIndicator(); + + /** + * @return <code>java.lang.String</code> <code>responseMessage</code>, or <code>null</code> if not present + */ + java.lang.String getResponseMessage(); + + /** + * @return <code>java.lang.String</code> <code>contextMemoryJson</code>, or <code>null</code> 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 000000000..1917b475c --- /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 + * + * <p>This class represents the following YANG schema fragment defined in module <b>SLI-API</b> + * <pre> + * 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; + * } + * } + * } + * } + * </pre> + * + */ +public interface SLIAPIData + extends + DataRoot +{ + + + + + /** + * Test results + * + * + * + * @return <code>org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults</code> <code>testResults</code>, or <code>null</code> 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 000000000..3ad03f6fd --- /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 <b>SLI-API</b> + * <pre> + * 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; + * } + * } + * } + * </pre> + * + */ +public interface SLIAPIService + extends + RpcService +{ + + + + + Future<RpcResult<HealthcheckOutput>> healthcheck(); + + /** + * Method to add a new parameter. + * + */ + Future<RpcResult<ExecuteGraphOutput>> 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 000000000..a1723d730 --- /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 + * + * <p>This class represents the following YANG schema fragment defined in module <b>SLI-API</b> + * <pre> + * container test-results { + * list test-result { + * key "test-identifier" + * leaf test-identifier { + * type string; + * } + * leaf-list results { + * type string; + * } + * } + * } + * </pre> + * The schema path to identify an instance is + * <i>SLI-API/test-results</i> + * + * <p>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<SLIAPIData>, + Augmentable<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults> +{ + + + + 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 <code>java.util.List</code> <code>testResult</code>, or <code>null</code> if not present + */ + List<TestResult> 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 000000000..36da730ed --- /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<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults> { + + private List<TestResult> _testResult; + + Map<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults>> 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<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults>) base; + if (!casted.augmentations().isEmpty()) { + this.augmentation = new HashMap<>(casted.augmentations()); + } + } + } + + + public List<TestResult> getTestResult() { + return _testResult; + } + + @SuppressWarnings("unchecked") + public <E extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults>> E getAugmentation(java.lang.Class<E> augmentationType) { + if (augmentationType == null) { + throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!"); + } + return (E) augmentation.get(augmentationType); + } + + + public TestResultsBuilder setTestResult(final List<TestResult> value) { + this._testResult = value; + return this; + } + + public TestResultsBuilder addAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults> 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<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults>> 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<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults> getImplementedInterface() { + return org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults.class; + } + + private final List<TestResult> _testResult; + + private Map<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults>> 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<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults>> e = base.augmentation.entrySet().iterator().next(); + this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults>>singletonMap(e.getKey(), e.getValue()); + break; + default : + this.augmentation = new HashMap<>(base.augmentation); + } + } + + @Override + public List<TestResult> getTestResult() { + return _testResult; + } + + @SuppressWarnings("unchecked") + @Override + public <E extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults>> E getAugmentation(java.lang.Class<E> 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<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults>> 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 000000000..e1cac53c5 --- /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; + +/** + * <p>This class represents the following YANG schema fragment defined in module <b>SLI-API</b> + * <pre> + * 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; + * } + * </pre> + * The schema path to identify an instance is + * <i>SLI-API/execute-graph/input/sli-parameter</i> + * + * <p>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<ExecuteGraphInput>, + Augmentable<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter>, + ParameterSetting, + Identifiable<SliParameterKey> +{ + + + + 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 <code>org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameterKey</code> <code>key</code>, or <code>null</code> 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 000000000..f28eb1a8b --- /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<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter> { + + private java.lang.Integer _intValue; + private SliParameterKey _key; + private java.lang.String _parameterName; + private java.lang.String _stringValue; + private java.lang.Boolean _booleanValue; + + Map<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter>> 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<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter>) 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: + * <ul> + * <li>org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ParameterSetting</li> + * </ul> + * + * @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 extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter>> E getAugmentation(java.lang.Class<E> 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<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter> 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<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter>> 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<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter> 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<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter>> 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<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter>> e = base.augmentation.entrySet().iterator().next(); + this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter>>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 extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter>> E getAugmentation(java.lang.Class<E> 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<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter>> 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 000000000..6c19a877b --- /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<SliParameter> { + 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 000000000..d12faa445 --- /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; + +/** + * <p>This class represents the following YANG schema fragment defined in module <b>SLI-API</b> + * <pre> + * list test-result { + * key "test-identifier" + * leaf test-identifier { + * type string; + * } + * leaf-list results { + * type string; + * } + * } + * </pre> + * The schema path to identify an instance is + * <i>SLI-API/test-results/test-result</i> + * + * <p>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<TestResults>, + Augmentable<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult>, + Identifiable<TestResultKey> +{ + + + + 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 <code>java.lang.String</code> <code>testIdentifier</code>, or <code>null</code> if not present + */ + java.lang.String getTestIdentifier(); + + /** + * @return <code>java.util.List</code> <code>results</code>, or <code>null</code> if not present + */ + List<java.lang.String> getResults(); + + /** + * Returns Primary Key of Yang List Type + * + * + * + * @return <code>org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResultKey</code> <code>key</code>, or <code>null</code> 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 000000000..51e437222 --- /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<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult> { + + private TestResultKey _key; + private List<java.lang.String> _results; + private java.lang.String _testIdentifier; + + Map<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult>> 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<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult>) base; + if (!casted.augmentations().isEmpty()) { + this.augmentation = new HashMap<>(casted.augmentations()); + } + } + } + + + public TestResultKey getKey() { + return _key; + } + + public List<java.lang.String> getResults() { + return _results; + } + + public java.lang.String getTestIdentifier() { + return _testIdentifier; + } + + @SuppressWarnings("unchecked") + public <E extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult>> E getAugmentation(java.lang.Class<E> 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<java.lang.String> 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<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult> 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<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult>> 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<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult> 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<java.lang.String> _results; + private final java.lang.String _testIdentifier; + + private Map<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult>> 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<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult>> e = base.augmentation.entrySet().iterator().next(); + this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult>>singletonMap(e.getKey(), e.getValue()); + break; + default : + this.augmentation = new HashMap<>(base.augmentation); + } + } + + @Override + public TestResultKey getKey() { + return _key; + } + + @Override + public List<java.lang.String> getResults() { + return _results; + } + + @Override + public java.lang.String getTestIdentifier() { + return _testIdentifier; + } + + @SuppressWarnings("unchecked") + @Override + public <E extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult>> E getAugmentation(java.lang.Class<E> 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<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult>> 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 000000000..d867ca23b --- /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<TestResult> { + 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 000000000..8deb8a10f --- /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 7257e9ee4..de882159d 100755 --- a/sli/pom.xml +++ b/sli/pom.xml @@ -2,64 +2,65 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <parent> - <groupId>org.onap.ccsdk.sli.core</groupId> - <artifactId>ccsdk-sli-core</artifactId> - <version>0.1.2-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - <packaging>pom</packaging> - <groupId>org.onap.ccsdk.sli.core</groupId> - <artifactId>sli</artifactId> + <parent> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>ccsdk-sli-core</artifactId> + <version>0.1.2-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <packaging>pom</packaging> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli</artifactId> - <dependencyManagement> + <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.onap.ccsdk.sli.core</groupId> - <artifactId>sli-features</artifactId> - <classifier>features</classifier> - <type>xml</type> - <version>${project.version}</version> - </dependency> + <dependencies> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-features</artifactId> + <classifier>features</classifier> + <type>xml</type> + <version>${project.version}</version> + </dependency> - <dependency> - <groupId>org.onap.ccsdk.sli.core</groupId> - <artifactId>sli-common</artifactId> - <version>${project.version}</version> - </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-common</artifactId> + <version>${project.version}</version> + </dependency> - <dependency> - <groupId>org.onap.ccsdk.sli.core</groupId> - <artifactId>sli-provider</artifactId> - <version>${project.version}</version> - </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-provider</artifactId> + <version>${project.version}</version> + </dependency> - <dependency> - <groupId>org.onap.ccsdk.sli.core</groupId> - <artifactId>sli-recording</artifactId> - <version>${project.version}</version> - </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-recording</artifactId> + <version>${project.version}</version> + </dependency> - </dependencies> + </dependencies> - </dependencyManagement> + </dependencyManagement> - <name>Service Logic Interpreter</name> - <description>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. </description> + <name>Service Logic Interpreter</name> + <description>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. </description> - <modules> - <module>common</module> - <module>provider</module> - <module>recording</module> - <module>features</module> - <module>installer</module> - </modules> - <organization> - <name>ONAP</name> - </organization> - <version>0.1.2-SNAPSHOT</version> + <modules> + <module>model</module> + <module>common</module> + <module>provider</module> + <module>recording</module> + <module>features</module> + <module>installer</module> + </modules> + <organization> + <name>ONAP</name> + </organization> + <version>0.1.2-SNAPSHOT</version> </project> diff --git a/sli/provider/pom.xml b/sli/provider/pom.xml index 51db628c7..7514c74e4 100755 --- a/sli/provider/pom.xml +++ b/sli/provider/pom.xml @@ -28,6 +28,12 @@ </dependency> <dependency> <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-model</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> <artifactId>sli-common</artifactId> <version>${project.version}</version> <scope>compile</scope> 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 3e8c57b01..5ba0eb968 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<SliParameter> params = new LinkedList<SliParameter>(); + + 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<Object, Object> 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 dca6b54c6..000000000 --- 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<VpnSvc> 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. -} |