diff --git a/csarvalidation/src/main/java/org/onap/validation/yaml/model/YamlDocument.java b/csarvalidation/src/main/java/org/onap/validation/yaml/model/YamlDocument.java
index 5ed4690..7f80d1c 100644
--- a/csarvalidation/src/main/java/org/onap/validation/yaml/model/YamlDocument.java
+++ b/csarvalidation/src/main/java/org/onap/validation/yaml/model/YamlDocument.java
@@ -23,13 +23,35 @@
 
     private final Map<String, ?> yaml;
 
-    public YamlDocument(Map<String, ?> yaml) {
+    YamlDocument(Map<String, ?> yaml) {
         this.yaml = yaml;
     }
 
     public Map<String, ?> getYaml() {
         return yaml;
     }
+
+    public boolean containsKey(String key) {
+        return yaml.containsKey(key);
+    }
+
+    public String getValue(String key) {
+        return yaml.get(key).toString();
+    }
+
+    public YamlParametersList getListOfValues(String key)
+        throws YamlParameterListFactory.YamlParameterListParsingException {
+        return new YamlParameterListFactory().createYamlParameterList(
+            yaml.get(key)
+        );
+    }
+
+    public YamlDocument getSubStructure(String name)
+        throws YamlDocumentFactory.YamlDocumentParsingException {
+        return new YamlDocumentFactory().createYamlDocument(
+            yaml.get(name)
+        );
+    }
 }
 
 
diff --git a/csarvalidation/src/main/java/org/onap/validation/yaml/model/YamlDocumentFactory.java b/csarvalidation/src/main/java/org/onap/validation/yaml/model/YamlDocumentFactory.java
index 8e571a9..1cda34b 100644
--- a/csarvalidation/src/main/java/org/onap/validation/yaml/model/YamlDocumentFactory.java
+++ b/csarvalidation/src/main/java/org/onap/validation/yaml/model/YamlDocumentFactory.java
@@ -17,21 +17,30 @@
 
 package org.onap.validation.yaml.model;
 
+import java.util.HashMap;
 import java.util.Map;
 
 public class YamlDocumentFactory {
 
     public YamlDocument createYamlDocument(Object yaml) throws YamlDocumentParsingException {
         try {
-            Map<String, ?> parsedYaml = (Map<String, ?>) yaml;
+            Map<String, Object> parsedYaml = transformMap((Map) yaml);
             return new YamlDocument(parsedYaml);
         } catch (ClassCastException e) {
             throw new YamlDocumentParsingException(
-                String.format("Fail to parse given objects: %s as yaml",yaml), e
+                String.format("Fail to parse given objects: %s as yaml document.", yaml), e
             );
         }
     }
 
+    private Map<String, Object> transformMap(Map<?, ?> yaml) {
+        Map<String, Object> parsedYaml = new HashMap<>();
+        for (Map.Entry entry: yaml.entrySet()) {
+            parsedYaml.put(entry.getKey().toString(), entry.getValue());
+        }
+        return parsedYaml;
+    }
+
     public static class YamlDocumentParsingException extends Exception {
 
         YamlDocumentParsingException(String message, Throwable throwable) {
diff --git a/csarvalidation/src/main/java/org/onap/validation/yaml/model/YamlParameterListFactory.java b/csarvalidation/src/main/java/org/onap/validation/yaml/model/YamlParameterListFactory.java
new file mode 100644
index 0000000..b85ec7c
--- /dev/null
+++ b/csarvalidation/src/main/java/org/onap/validation/yaml/model/YamlParameterListFactory.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2020 Nokia
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.onap.validation.yaml.model;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class YamlParameterListFactory {
+
+    public YamlParametersList createEmptyYamlParameterList() {
+        return new YamlParametersList(Collections.emptyList());
+    }
+
+    public YamlParametersList createYamlParameterList(Object yaml)
+        throws YamlParameterListParsingException {
+        try {
+            return parseYamlToListOfPossibleValues(yaml);
+        } catch (ClassCastException e) {
+            throw new YamlParameterListParsingException(
+                String.format("Fail to parse given objects: %s as list.",yaml), e
+            );
+        }
+    }
+
+    private YamlParametersList parseYamlToListOfPossibleValues(Object yaml) {
+        List<String> parametersList = new ArrayList<>();
+        if( yaml instanceof List) {
+            for (Object element : (List) yaml) {
+                parametersList.add(element.toString());
+            }
+        } else {
+            parametersList.add(yaml.toString());
+        }
+        return new YamlParametersList(parametersList);
+    }
+
+
+    public static class YamlParameterListParsingException extends Exception {
+
+        YamlParameterListParsingException(String message, Throwable throwable) {
+            super(message, throwable);
+        }
+    }
+
+}
diff --git a/csarvalidation/src/main/java/org/onap/validation/yaml/model/YamlParametersList.java b/csarvalidation/src/main/java/org/onap/validation/yaml/model/YamlParametersList.java
new file mode 100644
index 0000000..2b93c74
--- /dev/null
+++ b/csarvalidation/src/main/java/org/onap/validation/yaml/model/YamlParametersList.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2020 Nokia
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.onap.validation.yaml.model;
+
+import java.util.List;
+
+public class YamlParametersList {
+
+    private final List<String> parameters;
+
+    YamlParametersList(List<String> parameters) {
+        this.parameters = parameters;
+    }
+
+    public List<String> getParameters() {
+        return parameters;
+    }
+
+}
diff --git a/csarvalidation/src/test/java/org/onap/validation/yaml/model/YamlDocumentFactoryTest.java b/csarvalidation/src/test/java/org/onap/validation/yaml/model/YamlDocumentFactoryTest.java
new file mode 100644
index 0000000..469b39f
--- /dev/null
+++ b/csarvalidation/src/test/java/org/onap/validation/yaml/model/YamlDocumentFactoryTest.java
@@ -0,0 +1,155 @@
+/*
+ * Copyright 2020 Nokia
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.onap.validation.yaml.model;
+
+import org.assertj.core.util.Lists;
+import org.junit.Test;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.onap.validation.yaml.model.YamlDocumentFactory.YamlDocumentParsingException;
+import static org.onap.validation.yaml.model.YamlParameterListFactory.YamlParameterListParsingException;
+
+public class YamlDocumentFactoryTest {
+
+    @Test
+    public void shouldTurnMapOfUnknownKeyTypeToMapWithStringKeysAndBeAbleToReturnStringifyValues()
+        throws YamlDocumentParsingException {
+        // given
+        Map<Object, Object> inputMap = new HashMap<>();
+        List<String> testList = Lists.list("element1", "element11");
+        Map<Object, Object> testEmptyMap = Collections.emptyMap();
+
+        inputMap.put("test", testList);
+        inputMap.put(345, "element2");
+        inputMap.put("test2", "element3");
+        inputMap.put(2.67, testEmptyMap);
+
+        // when
+        YamlDocument document = new YamlDocumentFactory().createYamlDocument(inputMap);
+
+        // then
+        assertThat(document).isNotNull();
+        assertThat(document.getYaml()).containsKeys("test", "345", "test2", "2.67");
+
+        assertThat(document.getYaml().get("test")).isEqualTo(testList);
+        assertThat(document.getValue("test")).isEqualTo("[element1, element11]");
+
+        assertThat(document.getValue("345")).isEqualTo("element2");
+        assertThat(document.getValue("test2")).isEqualTo("element3");
+
+        assertThat(document.getYaml().get("2.67")).isEqualTo(testEmptyMap);
+        assertThat(document.getValue("2.67")).isEqualTo("{}");
+    }
+
+    @Test
+    public void shouldTurnMapOfUnknownKeyTypeToMapWithStringKeysAndBeAbleToExtractSubStructure()
+        throws YamlDocumentParsingException {
+        // given
+        Map<Object, Object> inputMap = new HashMap<>();
+        Map<Object, Object> subStructureMap = new HashMap<>();
+
+        inputMap.put("test", "element1");
+        inputMap.put("structure", subStructureMap);
+
+        subStructureMap.put("subTest1", "subElement1");
+        subStructureMap.put("subTest2", "subElement2");
+
+        // when
+        YamlDocument document = new YamlDocumentFactory().createYamlDocument(inputMap);
+
+        // then
+        assertThat(document).isNotNull();
+        assertThat(document.getYaml()).containsKeys("test", "structure");
+        assertThat(document.getValue("test")).isEqualTo("element1");
+
+        assertThat(document.getSubStructure("structure")).isNotNull();
+        assertThat(document.getSubStructure("structure").getValue("subTest1")).isEqualTo("subElement1");
+        assertThat(document.getSubStructure("structure").getValue("subTest2")).isEqualTo("subElement2");
+    }
+
+    @Test
+    public void shouldTurnMapOfUnknownKeyTypeToMapWithStringKeysAndBeAbleToExtractParametersList()
+        throws YamlDocumentParsingException, YamlParameterListParsingException {
+        // given
+        Map<Object, Object> inputMap = new HashMap<>();
+        List<String> parametersList = new LinkedList<>();
+
+        inputMap.put("test", "element1");
+        inputMap.put("parameters", parametersList);
+
+        parametersList.add("parameter1");
+        parametersList.add("parameter2");
+
+        // when
+        YamlDocument document = new YamlDocumentFactory().createYamlDocument(inputMap);
+
+        // then
+        assertThat(document).isNotNull();
+        assertThat(document.getYaml()).containsKeys("test", "parameters");
+        assertThat(document.getValue("test")).isEqualTo("element1");
+
+        assertThat(document.getListOfValues("parameters")).isNotNull();
+        assertThat(document.getListOfValues("parameters").getParameters()).contains("parameter1","parameter2");
+    }
+
+    @Test
+    public void shouldThrowExceptionIfGetSubStructureIsCalledOnList()
+        throws YamlDocumentParsingException {
+        // given
+        Map<Object, Object> inputMap = new HashMap<>();
+        List<String> testList = Lists.list("element1", "element2");
+
+        inputMap.put("test", testList);
+
+        YamlDocument document = new YamlDocumentFactory().createYamlDocument(inputMap);
+
+        // when then
+        assertThatThrownBy(() ->
+            document.getSubStructure("test")
+        ).isInstanceOf(YamlDocumentParsingException.class)
+            .hasMessageContaining(
+                String.format("Fail to parse given objects: %s as yaml document", testList)
+            );
+    }
+
+    @Test
+    public void shouldThrowExceptionIfGetSubStructureIsCalledOnString()
+        throws YamlDocumentParsingException {
+        // given
+        Map<Object, Object> inputMap = new HashMap<>();
+
+        inputMap.put("test", "testElement");
+
+        YamlDocument document = new YamlDocumentFactory().createYamlDocument(inputMap);
+
+        // when then
+        assertThatThrownBy(() ->
+            document.getSubStructure("test")
+        ).isInstanceOf(YamlDocumentParsingException.class)
+            .hasMessageContaining(
+                String.format("Fail to parse given objects: %s as yaml document.", "testElement")
+            );
+    }
+}
diff --git a/csarvalidation/src/test/java/org/onap/validation/yaml/model/YamlParameterListFactoryTest.java b/csarvalidation/src/test/java/org/onap/validation/yaml/model/YamlParameterListFactoryTest.java
new file mode 100644
index 0000000..1f370cb
--- /dev/null
+++ b/csarvalidation/src/test/java/org/onap/validation/yaml/model/YamlParameterListFactoryTest.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2020 Nokia
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.onap.validation.yaml.model;
+
+import org.assertj.core.util.Lists;
+import org.junit.Test;
+
+import java.util.List;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class YamlParameterListFactoryTest {
+
+    @Test
+    public void shouldCreateEmptyParametersList() {
+        // when
+        YamlParametersList parametersList = new YamlParameterListFactory().createEmptyYamlParameterList();
+
+        // then
+        assertThat(parametersList).isNotNull();
+        assertThat(parametersList.getParameters()).isEmpty();
+    }
+
+    @Test
+    public void shouldCreateParametersListContainingStringsFromListContainingSimpleTypes()
+        throws YamlParameterListFactory.YamlParameterListParsingException {
+        // given
+        List<Object> testList = Lists.list("test1",3,23.45,'a',"test2");
+
+        // when
+        YamlParametersList parametersList = new YamlParameterListFactory().createYamlParameterList(testList);
+
+        // then
+        assertThat(parametersList).isNotNull();
+        assertThat(parametersList.getParameters()).hasSize(5);
+        assertThat(parametersList.getParameters()).contains("test1","test2","3","23.45","a");
+    }
+
+    @Test
+    public void shouldCreateParametersListContainingStringsFromListContainingVariousTypes()
+        throws YamlParameterListFactory.YamlParameterListParsingException {
+        // given
+        List<Object> testList = Lists.list("test1",3,Lists.list(2,3,4),"test2");
+
+        // when
+        YamlParametersList parametersList = new YamlParameterListFactory().createYamlParameterList(testList);
+
+        // then
+        assertThat(parametersList).isNotNull();
+        assertThat(parametersList.getParameters()).hasSize(4);
+        assertThat(parametersList.getParameters()).contains("test1","test2","3","[2, 3, 4]");
+    }
+
+    @Test
+    public void shouldCreateListWithOneStringWhenGivenObjectIsNotList()
+        throws YamlParameterListFactory.YamlParameterListParsingException {
+        // given
+        Object testObject = "test";
+
+        // when
+        YamlParametersList parametersList = new YamlParameterListFactory().createYamlParameterList(testObject);
+
+        // then
+        assertThat(parametersList).isNotNull();
+        assertThat(parametersList.getParameters()).hasSize(1);
+        assertThat(parametersList.getParameters()).contains("test");
+    }
+
+}
